Bugfixes (#82)

* cache getAddress()

* savedInstanceState handling

* v0.8.0.2
This commit is contained in:
m2049r 2017-09-23 14:16:30 +02:00 committed by GitHub
parent be236cce1b
commit cc46dc06c4
4 changed files with 17 additions and 12 deletions

View File

@ -8,8 +8,8 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 25
versionCode 14
versionName "0.8.0.1"
versionCode 15
versionName "0.8.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {

View File

@ -75,13 +75,13 @@ public class LoginActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
setContentView(R.layout.login_activity);
if (savedInstanceState != null) {
return;
// we don't store anything ourselves
}
setContentView(R.layout.login_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

View File

@ -150,14 +150,16 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(R.layout.wallet_activity);
if (savedInstanceState != null) {
return;
// we don't store anything ourselves
}
setContentView(R.layout.wallet_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(R.string.app_name);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.app_name);
boolean testnet = WalletManager.getInstance().isTestNet();
if (testnet) {
toolbar.setBackgroundResource(R.color.colorPrimaryDark);

View File

@ -36,6 +36,7 @@ public class Wallet {
Wallet(long handle) {
this.handle = handle;
getAddress(); // cache address for later
}
public enum Status {
@ -50,8 +51,6 @@ public class Wallet {
ConnectionStatus_WrongVersion
}
//public native long createWalletListenerJ();
public native String getSeed();
public native String getSeedLanguage();
@ -68,11 +67,15 @@ public class Wallet {
public native boolean setPassword(String password);
private String address = null;
public String getAddress() {
String address = getAddressJ();
if (address == null) {
address = getAddressJ();
}
if (!Wallet.isAddressValid(address, WalletManager.getInstance().isTestNet())) {
// just die!
throw new IllegalStateException("Wallet returned invalid address!");
throw new IllegalStateException("Wallet returned invalid address: " + address);
}
return address;
}