fix: Add validate entry education

This commit is contained in:
J-Jamet committed 2023-07-28 13:06:48 +02:00
1 parent b913913bf1
commit 3a79f94698
3 files changed
+48 -46

No files matched your search

@@ -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)
}
}