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" />