From ea7c7d2fdbf1db1f3809ce0c3f1895d32bd843d8 Mon Sep 17 00:00:00 2001 From: m2049r <30435443+m2049r@users.noreply.github.com> Date: Mon, 28 Aug 2017 23:46:18 +0200 Subject: [PATCH] net colour in toolbar --- .../main/java/com/m2049r/xmrwallet/LoginActivity.java | 10 +++++++++- .../main/java/com/m2049r/xmrwallet/LoginFragment.java | 5 +++++ .../main/java/com/m2049r/xmrwallet/WalletActivity.java | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index c4a94a8..996d351 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -27,7 +27,6 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Bundle; import android.support.annotation.NonNull; -import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; @@ -213,6 +212,15 @@ public class LoginActivity extends AppCompatActivity public void setSubtitle(String subtitle) { toolbar.setSubtitle(subtitle); } + + @Override + public void setTestNet(boolean testnet) { + if (testnet) { + toolbar.setBackgroundResource(R.color.colorPrimaryDark); + } else { + toolbar.setBackgroundResource(R.color.moneroOrange); + } + } //////////////////////////////////////// //////////////////////////////////////// diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java index 0cb557d..fdbe0f4 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginFragment.java @@ -92,6 +92,8 @@ public class LoginFragment extends Fragment { void setSubtitle(String subtitle); + void setTestNet(boolean testnet); + } @Override @@ -160,6 +162,7 @@ public class LoginFragment extends Fragment { @Override public void onClick(View v) { boolean mainnet = ((ToggleButton) v).isChecked(); // current state + activityCallback.setTestNet(!mainnet); savePrefs(true); // use previous state as we just clicked it if (mainnet) { setDaemon(daemonMainNet); @@ -282,6 +285,8 @@ public class LoginFragment extends Fragment { void setMainNet(boolean mainnet) { tbMainNet.setChecked(mainnet); + activityCallback.setTestNet(!mainnet); + } String getDaemon() { diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index 9d3e7f6..a3a1aab 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -37,6 +37,7 @@ import android.widget.Toast; import com.m2049r.xmrwallet.model.PendingTransaction; import com.m2049r.xmrwallet.model.TransactionInfo; import com.m2049r.xmrwallet.model.Wallet; +import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.service.WalletService; import com.m2049r.xmrwallet.util.TxData; @@ -140,6 +141,12 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment. toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(R.string.app_name); setSupportActionBar(toolbar); + boolean testnet = WalletManager.getInstance().isTestNet(); + if (testnet) { + toolbar.setBackgroundResource(R.color.colorPrimaryDark); + } else { + toolbar.setBackgroundResource(R.color.moneroOrange); + } Fragment walletFragment = new WalletFragment(); getFragmentManager().beginTransaction()