mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Add validate entry education
This commit is contained in:
@@ -137,7 +137,8 @@ open class Education(val activity: Activity) {
|
||||
R.string.education_password_generator_key,
|
||||
R.string.education_entry_new_field_key,
|
||||
R.string.education_add_attachment_key,
|
||||
R.string.education_setup_OTP_key)
|
||||
R.string.education_setup_OTP_key,
|
||||
R.string.education_validate_entry_key)
|
||||
|
||||
fun putPropertiesInEducationPreferences(context: Context,
|
||||
editor: SharedPreferences.Editor,
|
||||
@@ -159,6 +160,7 @@ open class Education(val activity: Activity) {
|
||||
context.getString(R.string.education_entry_new_field_key) -> editor.putBoolean(name, value.toBoolean())
|
||||
context.getString(R.string.education_add_attachment_key) -> editor.putBoolean(name, value.toBoolean())
|
||||
context.getString(R.string.education_setup_OTP_key) -> editor.putBoolean(name, value.toBoolean())
|
||||
context.getString(R.string.education_validate_entry_key) -> editor.putBoolean(name, value.toBoolean())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,18 +326,6 @@ open class Education(val activity: Activity) {
|
||||
context.resources.getBoolean(R.bool.education_password_generator_default))
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the explanatory view of the validate entry has already been displayed.
|
||||
*
|
||||
* @param context The context to open the SharedPreferences
|
||||
* @return boolean value of education_validate_entry_key key
|
||||
*/
|
||||
fun isEducationValidateEntryPerformed(context: Context): Boolean {
|
||||
val prefs = getEducationSharedPreferences(context)
|
||||
return prefs.getBoolean(context.getString(R.string.education_validate_entry_key),
|
||||
context.resources.getBoolean(R.bool.education_validate_entry_default))
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the explanatory view of the new fields button in an entry has already been displayed.
|
||||
*
|
||||
@@ -372,6 +362,18 @@ open class Education(val activity: Activity) {
|
||||
context.resources.getBoolean(R.bool.education_setup_OTP_default))
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the explanatory view of the validate entry has already been displayed.
|
||||
*
|
||||
* @param context The context to open the SharedPreferences
|
||||
* @return boolean value of education_validate_entry_key key
|
||||
*/
|
||||
fun isEducationValidateEntryPerformed(context: Context): Boolean {
|
||||
val prefs = getEducationSharedPreferences(context)
|
||||
return prefs.getBoolean(context.getString(R.string.education_validate_entry_key),
|
||||
context.resources.getBoolean(R.bool.education_validate_entry_default))
|
||||
}
|
||||
|
||||
fun setEducationScreenReclickedPerformed(context: Context) {
|
||||
getEducationSharedPreferences(context)
|
||||
.edit()
|
||||
|
||||
@@ -59,37 +59,6 @@ class EntryEditActivityEducation(activity: Activity)
|
||||
R.string.education_password_generator_key)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and display learning views
|
||||
* Displays the explanation for the entry validation
|
||||
*/
|
||||
fun checkAndPerformedValidateEntryEducation(educationView: View,
|
||||
onEducationViewClick: ((TapTargetView?) -> Unit)? = null,
|
||||
onOuterViewClick: ((TapTargetView?) -> Unit)? = null): Boolean {
|
||||
return checkAndPerformedEducation(isEducationValidateEntryPerformed(activity),
|
||||
TapTarget.forView(educationView,
|
||||
activity.getString(R.string.education_validate_entry_title),
|
||||
activity.getString(R.string.education_validate_entry_summary))
|
||||
.outerCircleColorInt(getCircleColor())
|
||||
.outerCircleAlpha(getCircleAlpha())
|
||||
.textColorInt(getTextColor())
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
object : TapTargetView.Listener() {
|
||||
override fun onTargetClick(view: TapTargetView) {
|
||||
super.onTargetClick(view)
|
||||
onEducationViewClick?.invoke(view)
|
||||
}
|
||||
|
||||
override fun onOuterCircleClick(view: TapTargetView?) {
|
||||
super.onOuterCircleClick(view)
|
||||
view?.dismiss(false)
|
||||
onOuterViewClick?.invoke(view)
|
||||
}
|
||||
},
|
||||
R.string.education_validate_entry_key)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and display learning views
|
||||
* Displays the explanation to create a new field
|
||||
@@ -182,4 +151,35 @@ class EntryEditActivityEducation(activity: Activity)
|
||||
},
|
||||
R.string.education_setup_OTP_key)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and display learning views
|
||||
* Displays the explanation for the entry validation
|
||||
*/
|
||||
fun checkAndPerformedValidateEntryEducation(educationView: View,
|
||||
onEducationViewClick: ((TapTargetView?) -> Unit)? = null,
|
||||
onOuterViewClick: ((TapTargetView?) -> Unit)? = null): Boolean {
|
||||
return checkAndPerformedEducation(isEducationValidateEntryPerformed(activity),
|
||||
TapTarget.forView(educationView,
|
||||
activity.getString(R.string.education_validate_entry_title),
|
||||
activity.getString(R.string.education_validate_entry_summary))
|
||||
.outerCircleColorInt(getCircleColor())
|
||||
.outerCircleAlpha(getCircleAlpha())
|
||||
.textColorInt(getTextColor())
|
||||
.tintTarget(false)
|
||||
.cancelable(true),
|
||||
object : TapTargetView.Listener() {
|
||||
override fun onTargetClick(view: TapTargetView) {
|
||||
super.onTargetClick(view)
|
||||
onEducationViewClick?.invoke(view)
|
||||
}
|
||||
|
||||
override fun onOuterCircleClick(view: TapTargetView?) {
|
||||
super.onOuterCircleClick(view)
|
||||
view?.dismiss(false)
|
||||
onOuterViewClick?.invoke(view)
|
||||
}
|
||||
},
|
||||
R.string.education_validate_entry_key)
|
||||
}
|
||||
}
|
||||
@@ -345,14 +345,14 @@
|
||||
<bool name="education_entry_edit_default" translatable="false">false</bool>
|
||||
<string name="education_password_generator_key" translatable="false">education_password_generator_key</string>
|
||||
<bool name="education_password_generator_default" translatable="false">false</bool>
|
||||
<string name="education_validate_entry_key" translatable="false">education_validate_entry_key</string>
|
||||
<bool name="education_validate_entry_default" translatable="false">false</bool>
|
||||
<string name="education_entry_new_field_key" translatable="false">education_entry_new_field_key</string>
|
||||
<bool name="education_entry_new_field_default" translatable="false">false</bool>
|
||||
<string name="education_add_attachment_key" translatable="false">education_add_attachment_key</string>
|
||||
<bool name="education_add_attachment_default" translatable="false">false</bool>
|
||||
<string name="education_setup_OTP_key" translatable="false">education_setup_OTP_key</string>
|
||||
<bool name="education_setup_OTP_default" translatable="false">false</bool>
|
||||
<string name="education_validate_entry_key" translatable="false">education_validate_entry_key</string>
|
||||
<bool name="education_validate_entry_default" translatable="false">false</bool>
|
||||
<string name="education_screen_reclicked_key" translatable="false">education_screen_reclicked_key</string>
|
||||
<bool name="education_screen_reclicked_default" translatable="false">false</bool>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user