From cfb3c2300340fa7893e433578de53db069c44fb0 Mon Sep 17 00:00:00 2001 From: m2049r <30435443+m2049r@users.noreply.github.com> Date: Sat, 4 Nov 2017 15:31:34 +0100 Subject: [PATCH] hide receive button before wallet is loaded (#115) --- app/build.gradle | 4 ++-- .../java/com/m2049r/xmrwallet/WalletActivity.java | 10 ++++++++++ .../java/com/m2049r/xmrwallet/WalletFragment.java | 15 +++++++++++++++ app/src/main/res/layout/fragment_wallet.xml | 6 +++--- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3441bb25..ef9782f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.m2049r.xmrwallet" minSdkVersion 21 targetSdkVersion 25 - versionCode 38 - versionName "1.1.7" + versionCode 39 + versionName "1.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index f88718e7..9de73470 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -447,6 +447,16 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment. } else { haveWallet = true; invalidateOptionsMenu(); + + final WalletFragment walletFragment = (WalletFragment) + getSupportFragmentManager().findFragmentById(R.id.fragment_container); + runOnUiThread(new Runnable() { + public void run() { + if (walletFragment != null) { + walletFragment.onLoaded(); + } + } + }); } } diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java index ffa34e5e..30f1c720 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java @@ -244,6 +244,20 @@ public class WalletFragment extends Fragment } } + boolean walletLoaded = false; + + public void onLoaded() { + walletLoaded = true; + showReceive(); + } + + private void showReceive() { + if (walletLoaded) { + bReceive.setVisibility(View.VISIBLE); + bReceive.setEnabled(true); + } + } + public void setProgressText(final String text) { tvProgress.setText(text); } @@ -373,5 +387,6 @@ public class WalletFragment extends Fragment Log.d(TAG, "onResume()"); activityCallback.setTitle(walletTitle, walletSubtitle); activityCallback.setToolbarButton(Toolbar.BUTTON_CLOSE); + showReceive(); } } diff --git a/app/src/main/res/layout/fragment_wallet.xml b/app/src/main/res/layout/fragment_wallet.xml index ec33304b..509317eb 100644 --- a/app/src/main/res/layout/fragment_wallet.xml +++ b/app/src/main/res/layout/fragment_wallet.xml @@ -137,11 +137,11 @@ android:layout_margin="8dp" android:layout_weight="1" android:drawableStart="@drawable/ic_hand" - android:enabled="true" + android:enabled="false" android:paddingEnd="16dp" android:paddingStart="16dp" android:text="@string/label_wallet_receive" - android:visibility="visible" /> + android:visibility="invisible" />