mirror of https://github.com/m2049r/xmrwallet.git
net colour in toolbar
This commit is contained in:
parent
8ff8be6f60
commit
ea7c7d2fdb
|
@ -27,7 +27,6 @@ import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -213,6 +212,15 @@ public class LoginActivity extends AppCompatActivity
|
||||||
public void setSubtitle(String subtitle) {
|
public void setSubtitle(String subtitle) {
|
||||||
toolbar.setSubtitle(subtitle);
|
toolbar.setSubtitle(subtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTestNet(boolean testnet) {
|
||||||
|
if (testnet) {
|
||||||
|
toolbar.setBackgroundResource(R.color.colorPrimaryDark);
|
||||||
|
} else {
|
||||||
|
toolbar.setBackgroundResource(R.color.moneroOrange);
|
||||||
|
}
|
||||||
|
}
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,8 @@ public class LoginFragment extends Fragment {
|
||||||
|
|
||||||
void setSubtitle(String subtitle);
|
void setSubtitle(String subtitle);
|
||||||
|
|
||||||
|
void setTestNet(boolean testnet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -160,6 +162,7 @@ public class LoginFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
boolean mainnet = ((ToggleButton) v).isChecked(); // current state
|
boolean mainnet = ((ToggleButton) v).isChecked(); // current state
|
||||||
|
activityCallback.setTestNet(!mainnet);
|
||||||
savePrefs(true); // use previous state as we just clicked it
|
savePrefs(true); // use previous state as we just clicked it
|
||||||
if (mainnet) {
|
if (mainnet) {
|
||||||
setDaemon(daemonMainNet);
|
setDaemon(daemonMainNet);
|
||||||
|
@ -282,6 +285,8 @@ public class LoginFragment extends Fragment {
|
||||||
|
|
||||||
void setMainNet(boolean mainnet) {
|
void setMainNet(boolean mainnet) {
|
||||||
tbMainNet.setChecked(mainnet);
|
tbMainNet.setChecked(mainnet);
|
||||||
|
activityCallback.setTestNet(!mainnet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDaemon() {
|
String getDaemon() {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import android.widget.Toast;
|
||||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
|
import com.m2049r.xmrwallet.model.WalletManager;
|
||||||
import com.m2049r.xmrwallet.service.WalletService;
|
import com.m2049r.xmrwallet.service.WalletService;
|
||||||
import com.m2049r.xmrwallet.util.TxData;
|
import com.m2049r.xmrwallet.util.TxData;
|
||||||
|
|
||||||
|
@ -140,6 +141,12 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
toolbar.setTitle(R.string.app_name);
|
toolbar.setTitle(R.string.app_name);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
boolean testnet = WalletManager.getInstance().isTestNet();
|
||||||
|
if (testnet) {
|
||||||
|
toolbar.setBackgroundResource(R.color.colorPrimaryDark);
|
||||||
|
} else {
|
||||||
|
toolbar.setBackgroundResource(R.color.moneroOrange);
|
||||||
|
}
|
||||||
|
|
||||||
Fragment walletFragment = new WalletFragment();
|
Fragment walletFragment = new WalletFragment();
|
||||||
getFragmentManager().beginTransaction()
|
getFragmentManager().beginTransaction()
|
||||||
|
|
Loading…
Reference in New Issue