replace the onclick by a listener

This commit is contained in:
zeapo 2017-11-03 15:03:44 +01:00
parent ae39246732
commit 7337be5214
2 changed files with 9 additions and 12 deletions

View file

@ -77,10 +77,16 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
}
"ENCRYPT" -> {
setContentView(R.layout.encrypt_layout)
generate_password?.setOnClickListener {
pwgenDialogFragment().show(fragmentManager, "generator")
}
title = getString(R.string.new_password_title)
crypto_password_category.text = getRelativePath(fullPath, repoPath)
}
}
}
override fun onDestroy() {
@ -117,17 +123,6 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
return true
}
fun handleClick(view: View) {
when (view.id) {
R.id.generate_password -> {
val df = pwgenDialogFragment()
df.show(fragmentManager, "generator")
Log.wtf(TAG, "This should not happen.... PgpHandler.java#handleClick(View) default reached.")
}
else -> Log.wtf(TAG, "This should not happen.... PgpHandler.java#handleClick(View) default reached.")
}// should not happen
}
/**
* Shows a simple toast message
*/
@ -318,6 +313,9 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
*/
private fun editPassword() {
setContentView(R.layout.encrypt_layout)
generate_password?.setOnClickListener {
pwgenDialogFragment().show(fragmentManager, "generator")
}
title = getString(R.string.edit_password_title)

View file

@ -68,7 +68,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:onClick="handleClick"
android:text="@string/pwd_generate_button" />
<TextView