Lockscreen

This commit is contained in:
J0J0XMR 2024-03-22 18:56:23 -04:00
parent c90c4494f0
commit 932de3ba9d
5 changed files with 41 additions and 3 deletions

View File

@ -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

View File

@ -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();
}

View File

@ -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();

View File

@ -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"

View File

@ -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>