diff options
author | zeapo <mohamed@zenadi.com> | 2017-11-03 15:03:44 +0100 |
---|---|---|
committer | zeapo <mohamed@zenadi.com> | 2017-11-03 15:03:44 +0100 |
commit | 7337be52140848985f428c44a2627ae23c19028f (patch) | |
tree | f7931efdfa3b3e1c766d68528be425cb6fe9a4ac | |
parent | ae3924673245f0d40d41ec313f2146c0f3943ef0 (diff) |
replace the onclick by a listener
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 20 | ||||
-rw-r--r-- | app/src/main/res/layout/encrypt_layout.xml | 1 |
2 files changed, 9 insertions, 12 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt index 8ba418d1..db2acfac 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -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) diff --git a/app/src/main/res/layout/encrypt_layout.xml b/app/src/main/res/layout/encrypt_layout.xml index 29fde529..383c563e 100644 --- a/app/src/main/res/layout/encrypt_layout.xml +++ b/app/src/main/res/layout/encrypt_layout.xml @@ -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 |