Update first run dialog

This commit is contained in:
Jakob Nixdorf 2018-01-11 13:14:40 +01:00
parent a2f8a95552
commit 0c0fb0f2c7
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
4 changed files with 103 additions and 65 deletions

View file

@ -106,15 +106,32 @@ public class MainActivity extends BaseActivity
private void showFirstTimeWarning() {
ViewGroup container = findViewById(R.id.main_content);
View msgView = getLayoutInflater().inflate(R.layout.dialog_security_backup, container, false);
View msgView = getLayoutInflater().inflate(R.layout.dialog_database_encryption, container, false);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.dialog_title_security_backup)
builder.setTitle(R.string.dialog_title_encryption)
.setView(msgView)
.setPositiveButton(R.string.button_warned, new DialogInterface.OnClickListener() {
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
settings.setFirstTimeWarningShown(true);
updateEncryption(null);
}
})
.setNegativeButton(R.string.button_settings, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
settings.setFirstTimeWarningShown(true);
Intent settingsIntent = new Intent(getBaseContext(), SettingsActivity.class);
startActivityForResult(settingsIntent, Constants.INTENT_MAIN_SETTINGS);
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
settings.setFirstTimeWarningShown(true);
updateEncryption(null);
}
})
.create()
@ -316,15 +333,9 @@ public class MainActivity extends BaseActivity
authenticate(R.string.auth_msg_authenticate);
}
} else {
if (encryptionType == EncryptionType.KEYSTORE) {
if (settings.getFirstTimeWarningShown()) {
if (adapter.getEncryptionKey() == null) {
adapter.setEncryptionKey(KeyStoreHelper.loadEncryptionKeyFromKeyStore(this, false));
}
populateAdapter();
} else if (encryptionType == EncryptionType.PASSWORD) {
if (adapter.getEncryptionKey() == null) {
authenticate(R.string.auth_msg_authenticate);
updateEncryption(null);
} else {
populateAdapter();
}

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin_small">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="@dimen/activity_margin_medium"
android:layout_marginEnd="@dimen/activity_margin_medium">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_first" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:text="@string/dialog_title_security_keystore"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_keystore" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:text="@string/dialog_title_security_password"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_password" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_default" />
</LinearLayout>
</ScrollView>

View file

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin_small"
android:paddingStart="@dimen/activity_margin_medium"
android:paddingEnd="@dimen/activity_margin_medium">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_backup_desc" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_backup_3rd_party" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:text="@string/dialog_msg_security_backup_warning" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_margin_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/dialog_msg_security_backup_one_time" />
</LinearLayout>

View file

@ -7,7 +7,7 @@
<string name="button_scan_qr">Scan QR-Code</string>
<string name="button_save">Save</string>
<string name="button_new_tag">New tag</string>
<string name="button_warned">You have been warned!</string>
<string name="button_settings">Settings</string>
<string name="button_all_tags">All tags</string>
<string name="button_no_tags">No tags</string>
@ -63,26 +63,32 @@
<string name="dialog_title_manual_entry">Enter details</string>
<string name="dialog_title_remove">Remove</string>
<string name="dialog_title_rename">Rename</string>
<string name="dialog_title_security_backup">Security and Backups</string>
<string name="dialog_title_last_used">Last used</string>
<string name="dialog_title_keystore_error">KeyStore error</string>
<string name="dialog_title_encryption">Database encryption</string>
<string name="dialog_msg_auth">Please enter your device credentials to start andOTP.</string>
<string name="dialog_msg_confirm_delete">Are you sure you want do remove the account \"%1$s\"?</string>
<string name="dialog_msg_security_backup_desc">To keep your account information secure this app
only stores it encrypted. Part of the encryption key used for this is stored in the Android
KeyStore system. The advantage of this approach is that the key is kept separate from the
apps data and can be backed by hardware cryptography (if your device supports this).
</string>
<string name="dialog_msg_security_backup_3rd_party">As a drawback this makes backups of the apps
data a little bit more difficult. If you use 3rd party apps (like Titanium Backup) you only
backup the data files, not the encryption key and as a result such backups become useless.
</string>
<string name="dialog_msg_security_backup_warning">Please only use the internal backup functions
provided by the app to backup your accounts! Anything else WILL lead to data loss.
</string>
<string name="dialog_msg_security_backup_one_time">This message will not be shown again.</string>
<string name="dialog_title_security_keystore">1. Android KeyStore</string>
<string name="dialog_title_security_password">2. Password / PIN</string>
<string name="dialog_msg_security_first">To ensure the security of your accounts this app
only stores them in encrypted data files using one of the following two methods:</string>
<string name="dialog_msg_security_keystore">The KeyStore is a system component of Android for
securely storing cryptographic keys. The advantage of this approach is that the keys are
stored separated from the data files and can be backed by hardware cryptography (if the
hardware supports it). However as the keys are not stored with the apps data this method
prevents external backup solutions (like Titanium) from working. If you choose this method
you will have to rely on the internal backup functions provided by andOTP.</string>
<string name="dialog_msg_security_password">This method will encrypt your data with a key
generated from a password or PIN. The main advantage here is that this will work with
external backup solutions (like Titanium). However you will have to enter your credentials
every time you start andOTP.</string>
<string name="dialog_msg_security_default">By default the Android KeyStore will be used, however
this is known to cause problems on certain custom ROMs (and a few stock ones as well). You
can change the encryption in the Settings by clicking on the button below.</string>
<string name="dialog_msg_last_used">In order for andOTP to recognize which token was used last
you have to have \"tap to reveal\" enabled or use the copy button.\n\nThis message will not
be shown again.</string>