diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java index c2278cd9..ef680ff2 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateReviewFragment.java @@ -79,12 +79,14 @@ public class GenerateReviewFragment extends Fragment { Bundle args = getArguments(); String path = args.getString("path"); String password = args.getString("password"); - String type = args.getString("type"); + this.type = args.getString("type"); new AsyncShow().executeOnExecutor(MoneroThreadPoolExecutor.MONERO_THREAD_POOL_EXECUTOR, - path, password, type); + path, password); return view; } + String type; + private void acceptWallet() { String name = tvWalletName.getText().toString(); String password = tvWalletPassword.getText().toString(); @@ -93,7 +95,6 @@ public class GenerateReviewFragment extends Fragment { } private class AsyncShow extends AsyncTask { - String type; String password; String name; @@ -106,10 +107,9 @@ public class GenerateReviewFragment extends Fragment { @Override protected Boolean doInBackground(String... params) { - if (params.length != 3) return false; + if (params.length != 2) return false; String walletPath = params[0]; password = params[1]; - type = params[2]; Wallet wallet; boolean closeWallet; @@ -195,4 +195,8 @@ public class GenerateReviewFragment extends Fragment { public void hideProgress() { pbProgress.setVisibility(View.INVISIBLE); } + + boolean backOk() { + return !type.equals(GenerateReviewFragment.VIEW_TYPE_ACCEPT); + } } diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index 68ff954b..616f9f7f 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -905,4 +905,16 @@ public class LoginActivity extends AppCompatActivity outChannel.close(); } } + + @Override + public void onBackPressed() { + Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment_container); + if (f instanceof GenerateReviewFragment) { + if (((GenerateReviewFragment) f).backOk()) { + super.onBackPressed(); + } + } else { + super.onBackPressed(); + } + } }