Show extra content even if password is not copied to clipboard. Add toggle to preferences as well.
This commit is contained in:
parent
8e6ab25572
commit
6ce31056c9
4 changed files with 17 additions and 6 deletions
|
@ -485,15 +485,18 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) {
|
if (requestCode == REQUEST_CODE_DECRYPT_AND_VERIFY && os != null) {
|
||||||
try {
|
try {
|
||||||
if (returnToCiphertextField) {
|
if (returnToCiphertextField) {
|
||||||
boolean showPassword = settings.getBoolean("show_password", true);
|
final boolean showPassword = settings.getBoolean("show_password", true);
|
||||||
|
final boolean showExtraContent = settings.getBoolean("show_extra_content", true);
|
||||||
findViewById(R.id.crypto_container).setVisibility(View.VISIBLE);
|
findViewById(R.id.crypto_container).setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
Typeface monoTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf");
|
Typeface monoTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodepro.ttf");
|
||||||
final String[] passContent = os.toString("UTF-8").split("\n");
|
final String[] passContent = os.toString("UTF-8").split("\n", 2);
|
||||||
|
final String decodedPassword = passContent[0];
|
||||||
|
final String extraContent = passContent.length > 1 ? passContent[1] : "";
|
||||||
textViewPassword
|
textViewPassword
|
||||||
.setTypeface(monoTypeface);
|
.setTypeface(monoTypeface);
|
||||||
textViewPassword
|
textViewPassword
|
||||||
.setText(passContent[0]);
|
.setText(decodedPassword);
|
||||||
|
|
||||||
Button toggleVisibilityButton = (Button) findViewById(R.id.crypto_password_toggle_show);
|
Button toggleVisibilityButton = (Button) findViewById(R.id.crypto_password_toggle_show);
|
||||||
toggleVisibilityButton.setVisibility(showPassword?View.GONE:View.VISIBLE);
|
toggleVisibilityButton.setVisibility(showPassword?View.GONE:View.VISIBLE);
|
||||||
|
@ -501,13 +504,12 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
textViewPassword
|
textViewPassword
|
||||||
.setText(passContent[0]);
|
.setText(decodedPassword);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
decodedPassword = passContent[0];
|
|
||||||
|
|
||||||
String extraContent = os.toString("UTF-8").replaceFirst(".*\n", "");
|
|
||||||
if (extraContent.length() != 0) {
|
if (extraContent.length() != 0) {
|
||||||
|
findViewById(R.id.crypto_extra_show_layout).setVisibility(showExtraContent ? View.VISIBLE : View.GONE);
|
||||||
((TextView) findViewById(R.id.crypto_extra_show))
|
((TextView) findViewById(R.id.crypto_extra_show))
|
||||||
.setTypeface(monoTypeface);
|
.setTypeface(monoTypeface);
|
||||||
((TextView) findViewById(R.id.crypto_extra_show))
|
((TextView) findViewById(R.id.crypto_extra_show))
|
||||||
|
|
|
@ -171,6 +171,8 @@
|
||||||
<string name="refresh_list">Aktualisieren</string>
|
<string name="refresh_list">Aktualisieren</string>
|
||||||
<string name="show_password_pref_title">Zeige das Password</string>
|
<string name="show_password_pref_title">Zeige das Password</string>
|
||||||
<string name="show_password_pref_summary">Soll das entschlüsselte Passwort sichtbar sein? Dies deaktiviert nicht das Kopieren.</string>
|
<string name="show_password_pref_summary">Soll das entschlüsselte Passwort sichtbar sein? Dies deaktiviert nicht das Kopieren.</string>
|
||||||
|
<string name="show_extra_content_pref_title">Zeige weiteren Inhalt</string>
|
||||||
|
<string name="show_extra_content_pref_summary">Soll weiterer Inhalt sichtbar sein?</string>
|
||||||
<string name="toast_password_copied">Passwort befindet sich zum Einfügen in der Zwischenablage</string>
|
<string name="toast_password_copied">Passwort befindet sich zum Einfügen in der Zwischenablage</string>
|
||||||
<string name="pwd_generate_button">Generieren</string>
|
<string name="pwd_generate_button">Generieren</string>
|
||||||
<string name="category_string">"Kategorie: "</string>
|
<string name="category_string">"Kategorie: "</string>
|
||||||
|
|
|
@ -179,6 +179,8 @@
|
||||||
<string name="git_push">Push to remote</string>
|
<string name="git_push">Push to remote</string>
|
||||||
<string name="show_password_pref_title">Show the password</string>
|
<string name="show_password_pref_title">Show the password</string>
|
||||||
<string name="show_password_pref_summary">Control the visibility of the passwords once decrypted, this does not disable the password copy</string>
|
<string name="show_password_pref_summary">Control the visibility of the passwords once decrypted, this does not disable the password copy</string>
|
||||||
|
<string name="show_extra_content_pref_title">Show extra content</string>
|
||||||
|
<string name="show_extra_content_pref_summary">Control the visibility of the extra content once decrypted</string>
|
||||||
<string name="toast_password_copied">Password copied into the clipboard</string>
|
<string name="toast_password_copied">Password copied into the clipboard</string>
|
||||||
<string name="pwd_generate_button">Generate</string>
|
<string name="pwd_generate_button">Generate</string>
|
||||||
<string name="category_string">"Category: "</string>
|
<string name="category_string">"Category: "</string>
|
||||||
|
|
|
@ -52,6 +52,11 @@
|
||||||
android:title="@string/show_password_pref_title"
|
android:title="@string/show_password_pref_title"
|
||||||
android:summary="@string/show_password_pref_summary"
|
android:summary="@string/show_password_pref_summary"
|
||||||
android:key="show_password" />
|
android:key="show_password" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:title="@string/show_extra_content_pref_title"
|
||||||
|
android:summary="@string/show_extra_content_pref_summary"
|
||||||
|
android:key="show_extra_content" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:dialogTitle="@string/pref_copy_dialog_title"
|
android:dialogTitle="@string/pref_copy_dialog_title"
|
||||||
|
|
Loading…
Reference in a new issue