mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix education in PasswordActivity
This commit is contained in:
@@ -78,6 +78,7 @@ class PasswordActivity : StylishActivity() {
|
||||
// Views
|
||||
private var toolbar: Toolbar? = null
|
||||
|
||||
private var containerView: View? = null
|
||||
private var filenameView: TextView? = null
|
||||
private var passwordView: EditText? = null
|
||||
private var keyFileView: EditText? = null
|
||||
@@ -115,6 +116,7 @@ class PasswordActivity : StylishActivity() {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
|
||||
containerView = findViewById(R.id.container)
|
||||
confirmButtonView = findViewById(R.id.pass_ok)
|
||||
filenameView = findViewById(R.id.filename)
|
||||
passwordView = findViewById(R.id.password)
|
||||
@@ -565,6 +567,9 @@ class PasswordActivity : StylishActivity() {
|
||||
})
|
||||
}
|
||||
|
||||
// To fix multiple view education
|
||||
private var performedEductionInProgress = false
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
val inflater = menuInflater
|
||||
// Read menu
|
||||
@@ -580,17 +585,21 @@ class PasswordActivity : StylishActivity() {
|
||||
|
||||
super.onCreateOptionsMenu(menu)
|
||||
|
||||
// Show education views
|
||||
Handler().post { performedNextEducation(PasswordActivityEducation(this), menu) }
|
||||
if (!performedEductionInProgress) {
|
||||
performedEductionInProgress = true
|
||||
// Show education views
|
||||
Handler().post { performedNextEducation(PasswordActivityEducation(this), menu) }
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun performedNextEducation(passwordActivityEducation: PasswordActivityEducation,
|
||||
menu: Menu) {
|
||||
val unlockEducationPerformed = toolbar != null
|
||||
val educationContainerView = containerView
|
||||
val unlockEducationPerformed = educationContainerView != null
|
||||
&& passwordActivityEducation.checkAndPerformedUnlockEducation(
|
||||
toolbar!!,
|
||||
educationContainerView,
|
||||
{
|
||||
performedNextEducation(passwordActivityEducation, menu)
|
||||
},
|
||||
@@ -598,11 +607,11 @@ class PasswordActivity : StylishActivity() {
|
||||
performedNextEducation(passwordActivityEducation, menu)
|
||||
})
|
||||
if (!unlockEducationPerformed) {
|
||||
|
||||
val readOnlyEducationPerformed = toolbar != null
|
||||
&& toolbar!!.findViewById<View>(R.id.menu_open_file_read_mode_key) != null
|
||||
val educationToolbar = toolbar
|
||||
val readOnlyEducationPerformed =
|
||||
educationToolbar?.findViewById<View>(R.id.menu_open_file_read_mode_key) != null
|
||||
&& passwordActivityEducation.checkAndPerformedReadOnlyEducation(
|
||||
toolbar!!.findViewById(R.id.menu_open_file_read_mode_key),
|
||||
educationToolbar.findViewById(R.id.menu_open_file_read_mode_key),
|
||||
{
|
||||
onOptionsItemSelected(menu.findItem(R.id.menu_open_file_read_mode_key))
|
||||
performedNextEducation(passwordActivityEducation, menu)
|
||||
|
||||
@@ -33,11 +33,10 @@ open class Education(val activity: Activity) {
|
||||
return doEducation
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define if educations screens are enabled
|
||||
*/
|
||||
fun isEducationScreensEnabled(): Boolean {
|
||||
private fun isEducationScreensEnabled(): Boolean {
|
||||
return isEducationScreensEnabled(activity)
|
||||
}
|
||||
|
||||
@@ -47,7 +46,7 @@ open class Education(val activity: Activity) {
|
||||
* @param context The context to retrieve the key string in XML
|
||||
* @param educationKeys Keys to save as boolean 'true'
|
||||
*/
|
||||
fun saveEducationPreference(context: Context, vararg educationKeys: Int) {
|
||||
private fun saveEducationPreference(context: Context, vararg educationKeys: Int) {
|
||||
val sharedPreferences = getEducationSharedPreferences(context)
|
||||
val editor = sharedPreferences.edit()
|
||||
for (key in educationKeys) {
|
||||
|
||||
@@ -18,7 +18,6 @@ class PasswordActivityEducation(activity: Activity)
|
||||
TapTarget.forView(educationView,
|
||||
activity.getString(R.string.education_unlock_title),
|
||||
activity.getString(R.string.education_unlock_summary))
|
||||
.dimColor(R.color.green)
|
||||
.icon(ContextCompat.getDrawable(activity, R.mipmap.ic_launcher_round))
|
||||
.textColorInt(Color.WHITE)
|
||||
.tintTarget(false)
|
||||
|
||||
Reference in New Issue
Block a user