mirror of
https://github.com/RfidResearchGroup/RFIDtools.git
synced 2026-05-12 11:19:59 -07:00
Translate.
This commit is contained in:
@@ -9,7 +9,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
@@ -63,7 +62,7 @@ import cn.dxl.common.util.ViewUtil;
|
||||
|
||||
/**
|
||||
* @author DXL
|
||||
* 提供变色龙的界面支持!
|
||||
* Chameleon View!
|
||||
*/
|
||||
public class ChameleonGUIActivity
|
||||
extends BaseActivity
|
||||
@@ -306,9 +305,7 @@ public class ChameleonGUIActivity
|
||||
util.resetDevice(new ResultCallback<String, String>() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
//隐藏对话框后进行重启!
|
||||
dialog.dismiss();
|
||||
//成功后进行APP重启!
|
||||
RestartUtils.restartAPP(context, 1000, () -> true);
|
||||
}
|
||||
|
||||
@@ -414,7 +411,7 @@ public class ChameleonGUIActivity
|
||||
@Override
|
||||
public void onInt(int i) {
|
||||
if (i == -1) {
|
||||
showToast("请求获得容量占用字节数失败!");
|
||||
showToast(getString(R.string.tips_size_get_failed));
|
||||
} else {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@@ -457,12 +454,12 @@ public class ChameleonGUIActivity
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String[] sizeList = {"MF_1K卡", "MF_4K卡", "MF_UL卡"};
|
||||
String[] sizeList = {"MF_1K", "MF_4K", "MF_UL"};
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle("选择下载容量")
|
||||
.setTitle(R.string.tips_download_size_select)
|
||||
.setCancelable(false)
|
||||
.setSingleChoiceItems(sizeList, 0, null)
|
||||
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
which = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
|
||||
@@ -478,7 +475,6 @@ public class ChameleonGUIActivity
|
||||
size = 320;
|
||||
break;
|
||||
}
|
||||
Log.d(LOG_TAG, "当前选择的容量: " + size);
|
||||
downloadFinallly(size);
|
||||
}
|
||||
}).show();
|
||||
@@ -496,15 +492,14 @@ public class ChameleonGUIActivity
|
||||
}
|
||||
|
||||
private void downloadFinallly(int size) {
|
||||
showToast("开始下载到本地dump文件夹!");
|
||||
//开始执行下载,下载到本地!
|
||||
Communication com = ExecutorImpl.getInstance().getCom();
|
||||
File file = new File(Paths.DUMP_DIRECTORY + "/" + "变色龙.bin");
|
||||
File file = new File(Paths.DUMP_DIRECTORY + "/" + "Chameleon.bin");
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
boolean b = file.createNewFile();
|
||||
if (!b) {
|
||||
showToast("文件创建失败!");
|
||||
showToast(getString(R.string.failed));
|
||||
dismissProgressDialog();
|
||||
return;
|
||||
}
|
||||
@@ -521,9 +516,9 @@ public class ChameleonGUIActivity
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024 * 64);
|
||||
boolean b = modem.recv(bos);
|
||||
if (b) {
|
||||
showToast("下载成功!");
|
||||
showToast(getString(R.string.successful));
|
||||
} else {
|
||||
showToast("下载失败!");
|
||||
showToast(getString(R.string.failed));
|
||||
}
|
||||
byte[] result = Arrays.copyOfRange(bos.toByteArray(), 0, size);
|
||||
FileUtils.writeBytes(result, file, false);
|
||||
|
||||
+5
-7
@@ -1,8 +1,10 @@
|
||||
package cn.rrg.rdv.activities.tools;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
@@ -73,13 +75,9 @@ public class ChameleonSoltAliasesActivity
|
||||
DiskKVUtil.update2Disk(Properties.k_chameleon_aliases_status, String.valueOf(isChecked), setFile);
|
||||
//更新全局参数!
|
||||
Properties.v_chameleon_aliases_status = isChecked;
|
||||
if (isChecked)
|
||||
ToastUtil.show(context, "启用成功", false);
|
||||
else
|
||||
ToastUtil.show(context, "禁用成功", false);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
ToastUtil.show(context, "启用失败", false);
|
||||
ToastUtil.show(context, getString(R.string.failed), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -101,10 +99,10 @@ public class ChameleonSoltAliasesActivity
|
||||
DiskKVUtil.update2Disk(Properties.k_chameleon_aliases, aliases, setFile);
|
||||
//更新到内存中!
|
||||
Properties.v_chameleon_aliases = aliases;
|
||||
ToastUtil.show(context, "保存成功!", false);
|
||||
ToastUtil.show(context, getString(R.string.successful), false);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
ToastUtil.show(context, "保存失败!", false);
|
||||
ToastUtil.show(context, getString(R.string.failed), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,7 +25,9 @@ import cn.dxl.common.util.AppUtil;
|
||||
import cn.dxl.mifare.StdMifareImpl;
|
||||
import cn.rrg.devices.PN53X;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.chameleon.ChameleonGUIActivity;
|
||||
import cn.rrg.rdv.activities.connect.Acr122uHkUsbConnectActivity;
|
||||
import cn.rrg.rdv.activities.connect.ChameleonUsb2UartConnectActivity;
|
||||
import cn.rrg.rdv.activities.connect.PN532UartConnectActivity;
|
||||
import cn.rrg.rdv.activities.connect.PN53XUsbBulkTransferActivity;
|
||||
import cn.rrg.rdv.activities.connect.Proxmark3Rdv4RRGConnectActivity;
|
||||
@@ -180,9 +182,7 @@ public class AppMainDevicesFragment extends BaseFragment {
|
||||
);
|
||||
}
|
||||
});
|
||||
// TODO
|
||||
// The Chameleon have some problem, So we temporarily close the entrance.
|
||||
/*deviceItems.add(new DeviceInfoBean("ChameleonMini RevE", R.drawable.chameleon_rdv2) {
|
||||
deviceItems.add(new DeviceInfoBean("ChameleonMini RevE", R.drawable.chameleon_rdv2) {
|
||||
@Override
|
||||
public void onClick() {
|
||||
deviceInfoBean = this;
|
||||
@@ -191,7 +191,7 @@ public class AppMainDevicesFragment extends BaseFragment {
|
||||
ChameleonGUIActivity.class
|
||||
);
|
||||
}
|
||||
});*/
|
||||
});
|
||||
deviceItems.add(new DeviceInfoBean(PN53X.NAME.PN532, R.drawable.pn532core) {
|
||||
@Override
|
||||
public void onClick() {
|
||||
|
||||
@@ -25,7 +25,6 @@ public abstract class AbsUsb2UartModel extends AbstractDeviceModel<String, UsbMa
|
||||
return new DevCallback<String>() {
|
||||
@Override
|
||||
public void onAttach(String dev) {
|
||||
//添加设备进列表中!
|
||||
DevBean devBean = new DevBean(dev, "00:00:00:00:00:00");
|
||||
addDev2List(devBean);
|
||||
attachDispatcher(devBean);
|
||||
@@ -34,9 +33,7 @@ public abstract class AbsUsb2UartModel extends AbstractDeviceModel<String, UsbMa
|
||||
@Override
|
||||
public void onDetach(String dev) {
|
||||
DevBean devBean = new DevBean(dev, "00:00:00:00:00:00");
|
||||
//再自己移除!
|
||||
Commons.removeDevByList(devBean, devAttachList);
|
||||
//如果设置了接口实现则需要通知接口移除
|
||||
detachDispatcher(devBean);
|
||||
}
|
||||
};
|
||||
@@ -49,7 +46,7 @@ public abstract class AbsUsb2UartModel extends AbstractDeviceModel<String, UsbMa
|
||||
if (manager != null)
|
||||
if (manager.getDeviceList().size() > 0) {
|
||||
AppUtil.getInstance().getApp().sendBroadcast(new Intent(UsbSerialControl.ACTION_BROADCAST));
|
||||
} else Log.d(TAG, "startDiscovery: 找不到任何一个USB设备!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,14 +58,11 @@ public abstract class AbsUsb2UartModel extends AbstractDeviceModel<String, UsbMa
|
||||
@Override
|
||||
public void connect(String address, ConnectCallback callback) {
|
||||
if (mDI == null) {
|
||||
Log.d(TAG, "驱动为空!");
|
||||
callback.onConnectFail();
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "开始连接Rdv4 Usb!");
|
||||
if (Commons.isUsbDevice(address)) {
|
||||
boolean ret = mDI.connect(address);
|
||||
Log.d(TAG, "连接完成: " + ret);
|
||||
if (ret) {
|
||||
callback.onConnectSucces();
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package cn.rrg.rdv.models;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.iobridges.com.DeviceChecker;
|
||||
|
||||
import cn.rrg.chameleon.defined.IChameleonExecutor;
|
||||
@@ -20,18 +18,13 @@ public class ChameleonUsb2UartModel extends AbsUsb2UartModel {
|
||||
|
||||
@Override
|
||||
public void connect(String address, ConnectCallback callback) {
|
||||
// 我们不需要进行Com类的初始化,因为变色龙是纯JAVA编程实现通讯的!
|
||||
// super.connect(address, callback);
|
||||
if (mDI == null) {
|
||||
Log.d(TAG, "驱动为空!");
|
||||
callback.onConnectFail();
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "开始连接Chameleon Usb!");
|
||||
// TODO USB直接连接地址即可!
|
||||
if (Commons.isUsbDevice(address)) {
|
||||
boolean ret = mDI.connect(address);
|
||||
Log.d(TAG, "连接完成: " + ret);
|
||||
if (ret) {
|
||||
callback.onConnectSucces();
|
||||
} else {
|
||||
@@ -42,17 +35,12 @@ public class ChameleonUsb2UartModel extends AbsUsb2UartModel {
|
||||
|
||||
@Override
|
||||
public void init(InitNfcCallback callback) {
|
||||
Log.d(TAG, "调用了初始化!");
|
||||
//TODO 最终是在这里实现的NFC设备的通信初始化和设备唤醒!
|
||||
if (isConnected()) {
|
||||
Log.d(TAG, "该驱动已经链接初始化成功,将使用该驱动进行初始化设备!");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//直接连接,有需要时可重写!
|
||||
IChameleonExecutor executor = ChameleonExecutor.get();
|
||||
if (executor.initExecutor(mDI)) {
|
||||
// 初始化代理持有!
|
||||
ExecutorImpl.setExecutor(executor);
|
||||
callback.onInitSuccess();
|
||||
} else {
|
||||
@@ -60,8 +48,6 @@ public class ChameleonUsb2UartModel extends AbsUsb2UartModel {
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Log.d(TAG, "该驱动未链接,将禁用该驱动在接下来的初始化设备任务!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
android:background="@color/md_grey_50"
|
||||
android:orientation="vertical">
|
||||
|
||||
<cn.dxl.common.widget.StatusBarHeightView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swUseAliases"
|
||||
android:layout_width="match_parent"
|
||||
@@ -12,7 +16,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="使用卡槽别名"
|
||||
android:text="@string/title_use_slot_alias"
|
||||
android:textColor="@color/md_blue_600"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -47,7 +51,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -71,7 +75,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -95,7 +99,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -119,7 +123,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -143,7 +147,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -167,7 +171,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -191,7 +195,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -215,7 +219,7 @@
|
||||
android:background="@color/md_white_1000"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="编辑框"
|
||||
android:text="..."
|
||||
android:textColor="@color/md_grey_600" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -227,7 +231,7 @@
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:text="保存"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:text="发送"
|
||||
android:text="@string/send"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -37,7 +37,7 @@
|
||||
android:background="@color/md_blue_600"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="原生CMD控制台"
|
||||
android:text="@string/console"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -312,5 +312,11 @@
|
||||
<string name="tips_opensource_welcome">Welcome join our open source.</string>
|
||||
<string name="tips_power">Power by Proxgrind\nDistributed by RFID Research Group (RRG)</string>
|
||||
<string name="unknown">unknown</string>
|
||||
<string name="tips_download_size_select">Select download capacity</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="tips_size_get_failed">Request to get the number of bytes occupied by capacity failed!</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="console">Console</string>
|
||||
<string name="title_use_slot_alias">Use slot alias</string>
|
||||
|
||||
</resources>
|
||||
@@ -317,6 +317,12 @@
|
||||
<string name="title_open_source">开源计划</string>
|
||||
<string name="tips_opensource_welcome">欢迎加入我们的开源计划。</string>
|
||||
<string name="tips_power">由Proxgrind强力驱动\n由RFID Research Group (RRG)管理发布</string>
|
||||
<string name="unknown">unknown</string>
|
||||
<string name="unknown">未知</string>
|
||||
<string name="tips_download_size_select">选择下载容量</string>
|
||||
<string name="confirm">确认</string>
|
||||
<string name="tips_size_get_failed">请求获得容量占用字节数失败!</string>
|
||||
<string name="send">发送</string>
|
||||
<string name="console">控制台</string>
|
||||
<string name="title_use_slot_alias">使用卡槽别名</string>
|
||||
|
||||
</resources>
|
||||
@@ -311,5 +311,11 @@
|
||||
<string name="tips_opensource_welcome">Welcome join our open source.</string>
|
||||
<string name="tips_power">Power by Proxgrind\nDistributed by RFID Research Group (RRG)</string>
|
||||
<string name="unknown">unknown</string>
|
||||
<string name="tips_download_size_select">Select download capacity</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="tips_size_get_failed">Request to get the number of bytes occupied by capacity failed!</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="console">Console</string>
|
||||
<string name="title_use_slot_alias">Use slot alias</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user