diff --git a/app/build.gradle b/app/build.gradle
index 096a72b..4254f8e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@ android {
applicationId "io.xdag.xdagwallet"
minSdkVersion min_version
targetSdkVersion target_version
- versionCode 30
- versionName "0.3.0"
+ versionCode 31
+ versionName "0.3.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
diff --git a/app/src/main/java/io/xdag/xdagwallet/activity/UsageActivity.java b/app/src/main/java/io/xdag/xdagwallet/activity/UsageActivity.java
index 4258b78..bcca744 100644
--- a/app/src/main/java/io/xdag/xdagwallet/activity/UsageActivity.java
+++ b/app/src/main/java/io/xdag/xdagwallet/activity/UsageActivity.java
@@ -9,11 +9,15 @@
import butterknife.BindView;
import butterknife.OnClick;
import com.scottyab.rootbeer.RootBeer;
+import com.yanzhenjie.permission.AndPermission;
+import com.yanzhenjie.permission.Permission;
+
import io.reactivex.disposables.Disposable;
import io.xdag.common.Common;
import io.xdag.common.base.ToolbarActivity;
import io.xdag.common.tool.ActivityStack;
import io.xdag.common.tool.ToolbarMode;
+import io.xdag.common.util.DeviceUtils;
import io.xdag.common.util.TextStyleUtil;
import io.xdag.xdagwallet.MainActivity;
import io.xdag.xdagwallet.R;
@@ -21,6 +25,7 @@
import io.xdag.xdagwallet.net.HttpRequest;
import io.xdag.xdagwallet.util.AlertUtil;
import io.xdag.xdagwallet.util.RxUtil;
+import io.xdag.xdagwallet.wrapper.XdagHandlerWrapper;
/**
* created by ssyijiu on 2018/7/22
@@ -40,6 +45,8 @@ public class UsageActivity extends ToolbarActivity
View mRootRemindLayout;
CheckBox mCbRootRemind;
+ AlertDialog.Builder mBuilder;
+
@Override
protected int getLayoutResId() {
@@ -54,13 +61,12 @@ protected void initView(View rootView, Bundle savedInstanceState) {
.append(getString(R.string.use_explain_1))
.append(getString(R.string.use_explain_2))
.append(getString(R.string.use_explain_3))
- .setForegroundColor(Common.getColor(R.color.RED))
.append(getString(R.string.use_explain_4))
.append(getString(R.string.use_explain_5))
- .setForegroundColor(Common.getColor(R.color.RED))
.appendLine()
.append(getString(R.string.use_explain_6))
- .append(getString(R.string.use_explain_7))
+ .append(getString(R.string.network_upgrade_0_6_1))
+ .setForegroundColor(Common.getColor(R.color.RED))
.create()
);
@@ -68,6 +74,12 @@ protected void initView(View rootView, Bundle savedInstanceState) {
mCbNoShow.setOnCheckedChangeListener(this);
mRootRemindLayout = View.inflate(mContext, R.layout.dialog_item_checkbox, null);
mCbRootRemind = mRootRemindLayout.findViewById(R.id.dialog_cb);
+
+ mBuilder = new AlertDialog.Builder(mContext)
+ .setTitle(R.string.warning)
+ .setMessage(R.string.cover_explain)
+ .setPositiveButton(R.string.cover, (dialog, which) -> backupWallet())
+ .setNegativeButton(R.string.cancel, null);
}
@@ -109,6 +121,20 @@ protected void initView(View rootView, Bundle savedInstanceState) {
}
+ @OnClick(R.id.explain_btn_backup)
+ void explain_btn_backup() {
+ if (DeviceUtils.afterQ()) {
+ checkBackup();
+ } else {
+ AndPermission.with(mContext)
+ .runtime()
+ .permission(Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE)
+ .onGranted(data -> checkBackup())
+ .onDenied(strings -> AlertUtil.show(mContext, getString(R.string.no_file_access_permission)))
+ .start();
+ }
+ }
+
@OnClick(R.id.explain_btn_start)
void explain_btn_start() {
if (!Config.isUserBackup()) {
@@ -128,6 +154,22 @@ void explain_btn_pool() {
}
+ private void checkBackup() {
+ if (XdagHandlerWrapper.hasBackup()) {
+ mBuilder.create().show();
+ } else {
+ backupWallet();
+ }
+ }
+
+ private void backupWallet() {
+ if (XdagHandlerWrapper.getInstance(this).backupWallet()) {
+ AlertUtil.show(mContext, R.string.success_backup_xdag_wallet);
+ } else {
+ AlertUtil.show(mContext, R.string.error_backup_xdag_wallet);
+ }
+ }
+
public static boolean isNotDisplay() {
return Config.isUserBackup() && Config.isNotDisplayUsage();
}
diff --git a/app/src/main/java/io/xdag/xdagwallet/wrapper/XdagHandlerWrapper.java b/app/src/main/java/io/xdag/xdagwallet/wrapper/XdagHandlerWrapper.java
index b03dbe8..265b318 100644
--- a/app/src/main/java/io/xdag/xdagwallet/wrapper/XdagHandlerWrapper.java
+++ b/app/src/main/java/io/xdag/xdagwallet/wrapper/XdagHandlerWrapper.java
@@ -59,9 +59,9 @@ public class XdagHandlerWrapper {
private static XdagHandlerWrapper sInstance = null;
- public static XdagHandlerWrapper getInstance(MainActivity activity) {
+ public static XdagHandlerWrapper getInstance(Activity activity) {
synchronized (XdagHandlerWrapper.class) {
- if (sInstance == null) {
+ if (sInstance == null || activity.isDestroyed() || activity.isFinishing()) {
synchronized (XdagHandlerWrapper.class) {
sInstance = new XdagHandlerWrapper(activity);
}
@@ -72,7 +72,7 @@ public static XdagHandlerWrapper getInstance(MainActivity activity) {
}
- private XdagHandlerWrapper(MainActivity activity) {
+ private XdagHandlerWrapper(Activity activity) {
mActivity = activity;
HandlerThread handlerThread = new HandlerThread("XdagProcessThread");
handlerThread.start();
diff --git a/app/src/main/res/layout/activity_use_explain.xml b/app/src/main/res/layout/activity_use_explain.xml
index 4430bd0..aad65bf 100644
--- a/app/src/main/res/layout/activity_use_explain.xml
+++ b/app/src/main/res/layout/activity_use_explain.xml
@@ -18,13 +18,22 @@
android:lineSpacingExtra="@dimen/space_8"
tools:text="说明文字"/>
+
+
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index bc0699c..bab49bd 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -105,6 +105,7 @@
任何卸载应用、删除数据的行为都将造成钱包文件丢失,且无法找回,请您在进行这些操作前务必备份您的钱包。\n
为保证钱包事物的连续性,目前的版本应用内的很多弹框都不可取消,请您见谅。\n
我们在后续版本中将改善这个问题。
+ XDAG 0.6.1 主网升级后,该安卓钱包将不再支持转账操作,请务必将钱包备份文件导出到电脑钱包使用。\n钱包备份路径:Documents/xdag_backup.zip
XDAG 因为其独特的设计,\n
目前不支持私钥、助记词等方式备份和恢复钱包。\n
您只能通过以下钱包文件来备份和恢复您的钱包:\n
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3878494..907c028 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -113,6 +113,7 @@
Uninstalling or deleting data will cause loss of wallet, and NO WAY TO RECOVER. Please backup your wallet first.\n
To ensure transactions, popups are not cancelable.\n
We will improve this in later releases.
+ After the XDAG 0.6.1 mainnet upgrade, this Android wallet will no longer support transfer operations. Please make sure to export the wallet backup file to your computer wallet for use.\nWallet backup path: Documents/xdag_backup.zip
Due to special data structure of XDAG, \n
XDAG wallet doesn\'t support backup or restore through private key or mnemonic code currently.\n
You can only backup and restore your wallet by files in xdag folder.\n