Added option to disable auto lock

This commit is contained in:
M66B 2021-10-16 07:50:13 +02:00
parent 4878d97344
commit a0a97a69ba
8 changed files with 52 additions and 3 deletions

View File

@ -4,6 +4,12 @@
### [Banji](https://en.wikipedia.org/wiki/Banji)
### Next version
* Added option to disable lock on screen off for biometric authentication
* Small improvements and minor bug fixes
* Updated translations
### 1.1764
* Added support for latin and roman numbered lists (view only)

View File

@ -4,6 +4,12 @@
### [Banji](https://en.wikipedia.org/wiki/Banji)
### Next version
* Added option to disable lock on screen off for biometric authentication
* Small improvements and minor bug fixes
* Updated translations
### 1.1764
* Added support for latin and roman numbered lists (view only)

View File

@ -281,7 +281,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean biometrics = prefs.getBoolean("biometrics", false);
String pin = prefs.getString("pin", null);
if (biometrics || !TextUtils.isEmpty(pin)) {
boolean autolock = prefs.getBoolean("autolock", true);
if (autolock && (biometrics || !TextUtils.isEmpty(pin))) {
Helper.clearAuthentication(this);
finish();
}

View File

@ -701,7 +701,10 @@ public class ApplicationEx extends Application
public void onReceive(Context context, Intent intent) {
Log.i("Received " + intent);
Log.logExtras(intent);
Helper.clearAuthentication(ApplicationEx.this);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean autolock = prefs.getBoolean("autolock", true);
if (autolock)
Helper.clearAuthentication(ApplicationEx.this);
}
};

View File

@ -70,6 +70,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private Button btnPin;
private Button btnBiometrics;
private Spinner spBiometricsTimeout;
private SwitchCompat swAutoLock;
private SwitchCompat swClientId;
private TextView tvClientId;
private SwitchCompat swDisplayHidden;
@ -93,7 +94,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
"confirm_links", "check_links_dbl", "browse_links",
"confirm_images", "html_always_images", "confirm_html",
"disable_tracking", "hide_timezone",
"pin", "biometrics", "biometrics_timeout",
"pin", "biometrics", "biometrics_timeout", "autolock",
"client_id", "display_hidden", "incognito_keyboard", "secure",
"generic_ua", "safe_browsing",
"disconnect_auto_update", "disconnect_links", "disconnect_images"
@ -120,6 +121,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
btnPin = view.findViewById(R.id.btnPin);
btnBiometrics = view.findViewById(R.id.btnBiometrics);
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
swAutoLock = view.findViewById(R.id.swAutoLock);
swClientId = view.findViewById(R.id.swClientId);
tvClientId = view.findViewById(R.id.tvClientId);
swDisplayHidden = view.findViewById(R.id.swDisplayHidden);
@ -255,6 +257,13 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
});
swAutoLock.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("autolock", checked).apply();
}
});
swClientId.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -445,6 +454,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
break;
}
swAutoLock.setChecked(prefs.getBoolean("autolock", true));
swClientId.setChecked(prefs.getBoolean("client_id", true));
swDisplayHidden.setChecked(prefs.getBoolean("display_hidden", false));
swIncognitoKeyboard.setChecked(prefs.getBoolean("incognito_keyboard", false));

View File

@ -249,6 +249,7 @@
android:id="@+id/tvBiometricsTimeout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_biometrics_timeout"
@ -262,10 +263,24 @@
android:id="@+id/spBiometricsTimeout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:entries="@array/biometricsTimeoutNames"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBiometricsTimeout" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoLock"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_autolock"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spBiometricsTimeout"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View File

@ -593,6 +593,7 @@
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string>
<string name="title_advanced_pin">PIN</string>
<string name="title_advanced_biometrics_timeout">Biometric authentication timeout</string>
<string name="title_advanced_autolock">Lock on screen off</string>
<string name="title_advanced_generic_user_agent">Use generic browser user agent</string>
<string name="title_advanced_safe_browsing" translatable="false">Google Safe browsing (Android 8+)</string>
<string name="title_advanced_disconnect_blacklist" translatable="false">Disconnect\'s tracker protection lists</string>

View File

@ -4,6 +4,12 @@
### [Banji](https://en.wikipedia.org/wiki/Banji)
### Next version
* Added option to disable lock on screen off for biometric authentication
* Small improvements and minor bug fixes
* Updated translations
### 1.1764
* Added support for latin and roman numbered lists (view only)