mirror of https://github.com/m2049r/xmrwallet.git
Lockscreen
This commit is contained in:
parent
c90c4494f0
commit
932de3ba9d
|
@ -17,6 +17,7 @@
|
|||
#include <inttypes.h>
|
||||
#include "monerujo.h"
|
||||
#include "wallet2_api.h"
|
||||
#include <cassert>
|
||||
|
||||
//TODO explicit casting jlong, jint, jboolean to avoid warnings
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||
private String uri = null;
|
||||
|
||||
private long streetMode = 0;
|
||||
private boolean isLockMode = false;
|
||||
|
||||
@Override
|
||||
public void onPasswordChanged(String newPassword) {
|
||||
|
@ -310,11 +311,27 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||
} else {
|
||||
onEnableStreetMode();
|
||||
}
|
||||
} else if (itemId == R.id.action_lockmode) {
|
||||
if (isStreetMode()) { // disable streetmode
|
||||
isLockMode = false;
|
||||
onDisableStreetMode();
|
||||
} else {
|
||||
onEnableLockMode();
|
||||
}
|
||||
} else
|
||||
return super.onOptionsItemSelected(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLockMode() { return isLockMode; }
|
||||
|
||||
private void onEnableLockMode() {
|
||||
isLockMode = true;
|
||||
enableStreetMode(true);
|
||||
updateStreetMode();
|
||||
}
|
||||
|
||||
private void updateStreetMode() {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
|
|
@ -219,12 +219,21 @@ public class WalletFragment extends Fragment
|
|||
String balance = amountToString(amountA);
|
||||
tvBalance.setText(balance);
|
||||
final boolean streetMode = activityCallback.isStreetMode();
|
||||
if (!streetMode) {
|
||||
llBalance.setVisibility(View.VISIBLE);
|
||||
final boolean lockMode = activityCallback.isLockMode();
|
||||
if (lockMode) {
|
||||
llBalance.setVisibility(View.INVISIBLE);
|
||||
tvStreetView.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
txlist.setVisibility(View.INVISIBLE);
|
||||
} else if (streetMode) {
|
||||
llBalance.setVisibility(View.INVISIBLE);
|
||||
tvStreetView.setVisibility(View.VISIBLE);
|
||||
if(txlist != null)
|
||||
txlist.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
llBalance.setVisibility(View.VISIBLE);
|
||||
tvStreetView.setVisibility(View.INVISIBLE);
|
||||
if(txlist != null)
|
||||
txlist.setVisibility(View.VISIBLE);
|
||||
}
|
||||
setStreetModeBackground(streetMode);
|
||||
}
|
||||
|
@ -493,6 +502,8 @@ public class WalletFragment extends Fragment
|
|||
|
||||
boolean isStreetMode();
|
||||
|
||||
boolean isLockMode();
|
||||
|
||||
long getStreetModeHeight();
|
||||
|
||||
boolean isWatchOnly();
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_lockmode"
|
||||
android:checkable="true"
|
||||
android:icon="@drawable/ic_lock_24dp"
|
||||
android:orderInCategory="90"
|
||||
android:title="@string/menu_lockmode"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_streetmode"
|
||||
android:checkable="true"
|
||||
|
|
|
@ -498,4 +498,5 @@
|
|||
<string name="pocketchange_create_title">Create Change</string>
|
||||
|
||||
<string name="label_apply">APPLY</string>
|
||||
<string name="menu_lockmode">Lock Mode</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue