pin number limits
This commit is contained in:
@@ -93,6 +93,10 @@ public class AppLock {
|
||||
return context.getSharedPreferences(PREFS, 0).getString("pincode_time", "15");
|
||||
}
|
||||
|
||||
public static String getPinCodeLimits(Context context) {
|
||||
return context.getSharedPreferences(PREFS, 0).getString("pincode_limits", "4");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the user is enrolled in locking and the last successful unlock happened more than lastSuccessValidMs ago
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.guardanis.applock.pin;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.TextView;
|
||||
import com.guardanis.applock.AppLock;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -98,7 +99,7 @@ public class PINInputController implements TextView.OnEditorActionListener, Inpu
|
||||
|
||||
@Override
|
||||
public void onTextEntered(int count) {
|
||||
if (count == AndroidUtils.getResources().getInteger(AndroidUtils.getIdentifier("applock__input_pin_item_count", "integer"))) {
|
||||
if (count == Integer.parseInt(AppLock.getPinCodeLimits(AndroidUtils.getGlobalContext()))) {
|
||||
var inputView = this.inputView.get();
|
||||
InputEventListener eventListener = this.eventListener.get();
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.widget.TextView;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import com.guardanis.applock.AppLock;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class PINInputView extends LinearLayout implements TextWatcher {
|
||||
itemBackgroundPaint.setColor(ThemesUtils.getMutedAccentColor());
|
||||
|
||||
|
||||
inputViewsCount = getResources().getInteger(AndroidUtils.getIdentifier("applock__input_pin_item_count", "integer"));
|
||||
inputViewsCount = Integer.parseInt(AppLock.getPinCodeLimits(AndroidUtils.getGlobalContext()));
|
||||
|
||||
passwordCharacter = getResources().getString(AndroidUtils.getIdentifier("applock__password_char", "string"));
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ public abstract class AppLockViewController implements LifeCycleUtils.AppLockAct
|
||||
|
||||
this.pinInputView = new WeakReference((PINInputView) parent.findViewById(AndroidUtils.getIdentifier("pin__input_view", "id")));
|
||||
|
||||
int inputViewsCount = parent.getResources()
|
||||
.getInteger(AndroidUtils.getIdentifier("applock__input_pin_item_count", "integer"));
|
||||
int inputViewsCount = Integer.parseInt(AppLock.getPinCodeLimits(activity));
|
||||
|
||||
boolean passwordCharsEnabled = parent.getResources()
|
||||
.getBoolean(AndroidUtils.getIdentifier("applock__item_password_chars_enabled", "bool"));
|
||||
|
||||
@@ -41,6 +41,11 @@ public class PinFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(
|
||||
getPreferenceScreen(),
|
||||
"Тестовые функции, потом выпилим/переделаем"
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addEditTextValPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
@@ -52,5 +57,17 @@ public class PinFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
})
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addEditTextValPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Кол-во символов пин кода",
|
||||
AppLock.getPinCodeLimits(requireContext()),
|
||||
((preference, o) -> {
|
||||
AppLock.getInstance(requireContext()).getPreferences().edit().putString("pincode_limits", o).apply();
|
||||
AndroidUtils.sendToast("Сохранено");
|
||||
return true;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user