From 3a79f946984743b07f23a41bcba615746ac9b2ff Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 28 Jul 2023 13:06:48 +0200 Subject: [PATCH] fix: Add validate entry education --- .../kunzisoft/keepass/education/Education.kt | 28 +++++---- .../education/EntryEditActivityEducation.kt | 62 +++++++++---------- app/src/main/res/values/donottranslate.xml | 4 +- 3 files changed, 48 insertions(+), 46 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/education/Education.kt b/app/src/main/java/com/kunzisoft/keepass/education/Education.kt index a023fcd19..1bd0f9a14 100644 --- a/app/src/main/java/com/kunzisoft/keepass/education/Education.kt +++ b/app/src/main/java/com/kunzisoft/keepass/education/Education.kt @@ -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() diff --git a/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt b/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt index 28907b012..46de289b7 100644 --- a/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt +++ b/app/src/main/java/com/kunzisoft/keepass/education/EntryEditActivityEducation.kt @@ -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) + } } \ No newline at end of file diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 94b116773..1020b4075 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -345,14 +345,14 @@ false education_password_generator_key false - education_validate_entry_key - false education_entry_new_field_key false education_add_attachment_key false education_setup_OTP_key false + education_validate_entry_key + false education_screen_reclicked_key false