summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt20
-rw-r--r--app/src/main/res/layout/decrypt_layout.xml13
-rw-r--r--app/src/main/res/values/strings.xml2
3 files changed, 33 insertions, 2 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 81a79d05..f6f0b9a8 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
@@ -271,11 +271,27 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
}
if (entry.hasExtraContent()) {
- crypto_extra_show_layout.visibility = if (showExtraContent) View.VISIBLE else View.GONE
-
crypto_extra_show.typeface = monoTypeface
crypto_extra_show.text = entry.extraContent
+ if (showExtraContent) {
+ crypto_extra_show_layout.visibility = View.VISIBLE
+ crypto_extra_toggle_show.visibility = View.GONE
+ crypto_extra_show.transformationMethod = null
+ } else {
+ crypto_extra_show_layout.visibility = View.GONE
+ crypto_extra_toggle_show.visibility = View.VISIBLE
+ crypto_extra_toggle_show.setOnCheckedChangeListener { _, _ ->
+ crypto_extra_show.text = entry.extraContent
+ }
+
+ crypto_extra_show.transformationMethod = object : PasswordTransformationMethod() {
+ override fun getTransformation(source: CharSequence, view: View): CharSequence {
+ return if (crypto_extra_toggle_show.isChecked) source else super.getTransformation(source, view)
+ }
+ }
+ }
+
if (entry.hasUsername()) {
crypto_username_show.visibility = View.VISIBLE
crypto_username_show_label.visibility = View.VISIBLE
diff --git a/app/src/main/res/layout/decrypt_layout.xml b/app/src/main/res/layout/decrypt_layout.xml
index 6f0d9d18..de3d0f03 100644
--- a/app/src/main/res/layout/decrypt_layout.xml
+++ b/app/src/main/res/layout/decrypt_layout.xml
@@ -228,6 +228,19 @@
android:textIsSelectable="true"
android:typeface="monospace" />
+ <ToggleButton
+ android:id="@+id/crypto_extra_toggle_show"
+ style="@style/Widget.AppCompat.Button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/crypto_extra_show"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentLeft="true"
+ android:checked="false"
+ android:paddingTop="8dp"
+ android:textOff="@string/show_extra"
+ android:textOn="@string/hide_extra" />
+
</RelativeLayout>
</LinearLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 52f631c1..bdb77193 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -215,6 +215,8 @@
<string name="no_repo_selected">No external repository selected</string>
<string name="send_plaintext_password_to">Send password as plaintext using…</string>
<string name="show_password">Show password</string>
+ <string name="show_extra">Show extra content</string>
+ <string name="hide_extra">Hide extra content</string>
<string name="repository_uri">Repository URI</string>
<string name="app_icon_hint">App icon</string>
<string name="folder_icon_hint">Folder icon</string>