mirror of
https://github.com/RfidResearchGroup/RFIDtools.git
synced 2026-05-12 11:19:59 -07:00
Some settings added.
This commit is contained in:
+39
-7
@@ -2,12 +2,17 @@ package cn.rrg.rdv.activities.tools;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.termux.app.TermuxActivity;
|
||||
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.main.BaseActivity;
|
||||
import cn.rrg.rdv.activities.main.PM3FlasherMainActivity;
|
||||
import cn.rrg.rdv.util.Commons;
|
||||
import cn.rrg.rdv.util.Proxmark3Installer;
|
||||
|
||||
@@ -15,16 +20,43 @@ public class Proxmark3NewTerminalInitActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_pm3_terminal_init);
|
||||
|
||||
if (Commons.isPM3ClientDecompressed()) {
|
||||
go();
|
||||
} else {
|
||||
Proxmark3Installer.installIfNeed(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
findViewById(R.id.btnFwFlash).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(activity, PM3FlasherMainActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnGoToTermux).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (Commons.isPM3ClientDecompressed()) {
|
||||
go();
|
||||
} else {
|
||||
Proxmark3Installer.installIfNeed(activity, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
go();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
CheckBox box = findViewById(R.id.ckBoxAutoGoTermux);
|
||||
box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Commons.setAutoGoToTermux(isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
// Must have init pm3 client and check auto go!
|
||||
if (Commons.getAutoGoToTermux() && Commons.isPM3ClientDecompressed()) {
|
||||
go();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,4 +15,6 @@ public class Properties {
|
||||
public static String k_app_language = "language";
|
||||
//Key files select history!
|
||||
public static String k_common_rw_keyfile_selected = "commonRWKeyFilesSelected";
|
||||
// Auto Goto Termux View
|
||||
public static String k_auto_goto_termux = "autoGotoTermuxView";
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.termux.app.TermuxActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.dxl.common.util.AppUtil;
|
||||
@@ -33,6 +31,7 @@ import cn.rrg.rdv.activities.connect.PN53XUsbBulkTransferActivity;
|
||||
import cn.rrg.rdv.activities.connect.Proxmark3Rdv4RRGConnectActivity;
|
||||
import cn.rrg.rdv.activities.main.GeneralNfcDeviceMain;
|
||||
import cn.rrg.rdv.activities.main.PN53XNfcMain;
|
||||
import cn.rrg.rdv.activities.tools.Proxmark3NewTerminalInitActivity;
|
||||
import cn.rrg.rdv.binder.BannerImageViewBinder;
|
||||
import cn.rrg.rdv.binder.DeviceInfoViewBinder;
|
||||
import cn.rrg.rdv.binder.TitleTextViewBinder;
|
||||
@@ -177,7 +176,7 @@ public class AppMainDevicesFragment extends BaseFragment {
|
||||
deviceInfoBean = this;
|
||||
connectOrGotoFunctionMain(
|
||||
Proxmark3Rdv4RRGConnectActivity.class,
|
||||
TermuxActivity.class
|
||||
Proxmark3NewTerminalInitActivity.class
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,11 @@ package cn.rrg.rdv.fragment.tools;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -63,7 +67,6 @@ public class MainSettingsFragment
|
||||
|
||||
initViews(view);
|
||||
initList();
|
||||
initActions(view.getContext());
|
||||
}
|
||||
|
||||
private void initViews(View v) {
|
||||
@@ -108,7 +111,7 @@ public class MainSettingsFragment
|
||||
}).show();
|
||||
}
|
||||
};
|
||||
languageItem.setSubTitle("Set the language of the app.");
|
||||
languageItem.setSubTitle(getString(R.string.title_set_language));
|
||||
languageItem.setMessage(languageTran());
|
||||
items.add(languageItem);
|
||||
|
||||
@@ -124,13 +127,36 @@ public class MainSettingsFragment
|
||||
pm3Res.setMessage(Commons.isPM3ResInitialled() ? getString(R.string.initialized) : getString(R.string.uninitialized));
|
||||
items.add(pm3Res);
|
||||
|
||||
items.add(new TitleBean(getString(R.string.other)));
|
||||
|
||||
ItemTextBean openSourceItem = new ItemTextBean(getString(R.string.title_open_source)) {
|
||||
@Override
|
||||
public void onClick(View view, int pos) {
|
||||
Uri uri = Uri.parse("https://github.com/RfidResearchGroup/RFIDtools");
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(intent);
|
||||
}
|
||||
};
|
||||
openSourceItem.setMessage(getString(R.string.go2));
|
||||
openSourceItem.setSubTitle(getString(R.string.tips_opensource_welcome));
|
||||
items.add(openSourceItem);
|
||||
|
||||
multiTypeAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void initActions(Context context) {
|
||||
|
||||
public static String getVersion(Context context) {
|
||||
if (context == null) return "unknown";
|
||||
try {
|
||||
PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
return pi.versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return context.getString(R.string.unknown);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String languageTran() {
|
||||
String currentLanguage = Commons.getLanguage();
|
||||
switch (currentLanguage) {
|
||||
|
||||
@@ -257,4 +257,14 @@ public class Commons {
|
||||
return new File(Paths.PM3_IMAGE_OS_FILE).exists() &&
|
||||
new File(Paths.PM3_IMAGE_BOOT_FILE).exists();
|
||||
}
|
||||
|
||||
public static void setAutoGoToTermux(boolean auto) {
|
||||
getPrivatePreferences().edit()
|
||||
.putBoolean(Properties.k_auto_goto_termux, auto)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static boolean getAutoGoToTermux() {
|
||||
return getPrivatePreferences().getBoolean(Properties.k_auto_goto_termux, false);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 252 KiB |
@@ -25,7 +25,7 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="center"
|
||||
android:text="Power by Proxgrind\nDistributed by RFID Research Group (RRG)"
|
||||
android:text="@string/tips_power"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<cn.dxl.common.widget.StatusBarHeightView
|
||||
android:id="@+id/sbh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="500dp"
|
||||
android:layout_below="@id/sbh"
|
||||
android:src="@drawable/termux_view_example" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/layout1"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tips_fw_client_version_same"
|
||||
android:textColor="@color/colorTextNormal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/tips_check_auto_go_termux"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:text="Client Update(Github)"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnFwFlash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:text="@string/title_flash_firmware_otg"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGoToTermux"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:background="@drawable/btn_selector_blue"
|
||||
android:padding="8dp"
|
||||
android:text="@string/title_go_termux"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/md_white_1000" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/ckBoxAutoGoTermux"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/auto_go" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -301,5 +301,16 @@
|
||||
<string name="title_select_bootrom">Select BootRom</string>
|
||||
<string name="select_fullimage">Select FullImage</string>
|
||||
<string name="tips_view_use_termux">Will use TERMUX implement UI</string>
|
||||
<string name="tips_fw_client_version_same">1. Your FW can\'t than for client version too low or high , you need go flash FW.</string>
|
||||
<string name="tips_check_auto_go_termux">2. Check \'Auto Go\', it will auto go to termux view.</string>
|
||||
<string name="auto_go">Auto Go</string>
|
||||
<string name="title_flash_firmware_otg">Flash Firmware(OTG)</string>
|
||||
<string name="title_go_termux">Go Termux</string>
|
||||
<string name="title_set_language">Set the language of the app.</string>
|
||||
<string name="other">Other</string>
|
||||
<string name="title_open_source">Open Source</string>
|
||||
<string name="tips_opensource_welcome">Welcome join we open source.</string>
|
||||
<string name="tips_power">Power by Proxgrind\nDistributed by RFID Research Group (RRG)</string>
|
||||
<string name="unknown">unknown</string>
|
||||
|
||||
</resources>
|
||||
@@ -307,5 +307,16 @@
|
||||
<string name="title_select_bootrom">选择引导器</string>
|
||||
<string name="select_fullimage">选择系统固件</string>
|
||||
<string name="tips_view_use_termux">将会使用TERMUX实现终端视图</string>
|
||||
<string name="tips_fw_client_version_same">1. 你的固件不能比客户端版本太低或太高,太高或者太低都需要去刷固件。</string>
|
||||
<string name="tips_check_auto_go_termux">2. 勾选 \'自动跳转\', 将自动转到TERMUX视图。</string>
|
||||
<string name="auto_go">自动跳转</string>
|
||||
<string name="title_flash_firmware_otg">刷写固件(OTG)</string>
|
||||
<string name="title_go_termux">跳转到Termux</string>
|
||||
<string name="title_set_language">设置APP使用的语言</string>
|
||||
<string name="other">其他</string>
|
||||
<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>
|
||||
|
||||
</resources>
|
||||
@@ -300,5 +300,16 @@
|
||||
<string name="title_select_bootrom">Select BootRom</string>
|
||||
<string name="select_fullimage">Select FullImage</string>
|
||||
<string name="tips_view_use_termux">Will use TERMUX implement UI</string>
|
||||
<string name="tips_fw_client_version_same">1. Your FW can\'t than for client version too low or high , you need go flash FW.</string>
|
||||
<string name="tips_check_auto_go_termux">2. Check \'Auto Go\', it will auto go to termux view.</string>
|
||||
<string name="auto_go">Auto Go</string>
|
||||
<string name="title_flash_firmware_otg">Flash Firmware(OTG)</string>
|
||||
<string name="title_go_termux">Go Termux</string>
|
||||
<string name="title_set_language">Set the language of the app.</string>
|
||||
<string name="other">Other</string>
|
||||
<string name="title_open_source">Open Source</string>
|
||||
<string name="tips_opensource_welcome">Welcome join we open source.</string>
|
||||
<string name="tips_power">Power by Proxgrind\nDistributed by RFID Research Group (RRG)</string>
|
||||
<string name="unknown">unknown</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user