From aaeb899fb63af1f755d88219e119bde2f62fb039 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 19 Apr 2020 14:09:55 +0530 Subject: PgpActivity: hide category view when there's no text Co-Authored-By: Fabian Henneke Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app') 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 be18472d..63e916d7 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -161,7 +161,6 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { title = getString(R.string.new_password_title) crypto_password_category.apply { - setText(getRelativePath(fullPath, repoPath)) // If the activity has been provided with suggested info or is meant to generate // a password, we allow the user to edit the path, otherwise we style the // EditText like a TextView. @@ -170,6 +169,12 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { } else { setBackgroundColor(getColor(android.R.color.transparent)) } + val path = getRelativePath(fullPath, repoPath) + // Keep empty path field visible if it is editable. + if (path.isEmpty() && !isEnabled) + visibility = View.GONE + else + setText(path) } suggestedName?.let { crypto_password_file_edit.setText(it) } // Allow the user to quickly switch between storing the username as the filename or -- cgit v1.2.3