Added option to disable auto lock

pull/206/head
M66B 4 years ago
parent 4878d97344
commit a0a97a69ba

@ -4,6 +4,12 @@
### [Banji](https://en.wikipedia.org/wiki/Banji) ### [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 ### 1.1764
* Added support for latin and roman numbered lists (view only) * Added support for latin and roman numbered lists (view only)

@ -4,6 +4,12 @@
### [Banji](https://en.wikipedia.org/wiki/Banji) ### [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 ### 1.1764
* Added support for latin and roman numbered lists (view only) * Added support for latin and roman numbered lists (view only)

@ -281,7 +281,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean biometrics = prefs.getBoolean("biometrics", false); boolean biometrics = prefs.getBoolean("biometrics", false);
String pin = prefs.getString("pin", null); 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); Helper.clearAuthentication(this);
finish(); finish();
} }

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

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

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

@ -593,6 +593,7 @@
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string> <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_pin">PIN</string>
<string name="title_advanced_biometrics_timeout">Biometric authentication timeout</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_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_safe_browsing" translatable="false">Google Safe browsing (Android 8+)</string>
<string name="title_advanced_disconnect_blacklist" translatable="false">Disconnect\'s tracker protection lists</string> <string name="title_advanced_disconnect_blacklist" translatable="false">Disconnect\'s tracker protection lists</string>

@ -4,6 +4,12 @@
### [Banji](https://en.wikipedia.org/wiki/Banji) ### [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 ### 1.1764
* Added support for latin and roman numbered lists (view only) * Added support for latin and roman numbered lists (view only)

Loading…
Cancel
Save