PgpActivity: hide category view when there's no text

Co-Authored-By: Fabian Henneke <fabian@henneke.me>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-04-19 14:09:55 +05:30
parent 17385892cb
commit aaeb899fb6
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -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