diff --git a/app/build.gradle b/app/build.gradle index 4f54d5cd..0adc0fcd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,6 +25,9 @@ android { lintOptions { abortOnError false } + dataBinding { + enabled = true + } } ext { @@ -41,6 +44,7 @@ dependencies { compile "com.android.support:recyclerview-v7:$supportLibVersion" compile "com.android.support.constraint:constraint-layout:1.0.2" compile "com.github.aakira:expandable-layout:1.6.0" + compile "com.heinrichreimersoftware:material-intro:1.6.2" compile "com.journeyapps:zxing-android-embedded:3.5.0" compile "com.vanniktech:vntnumberpickerpreference:1.0.0" compile "de.psdev.licensesdialog:licensesdialog:1.8.3" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 671fceda..32edd74a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -35,6 +35,10 @@ android:name=".Activities.BackupActivity" android:parentActivityName=".Activities.MainActivity" android:theme="@style/AppTheme.NoActionBar" /> + selectionMapping; + + public EncryptionFragment() { + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View root = inflater.inflate(R.layout.component_intro_encryption, container, false); + + selection = root.findViewById(R.id.introEncryptionSelection); + desc = root.findViewById(R.id.introEncryptionDesc); + + final String[] encValues = getResources().getStringArray(R.array.settings_values_encryption); + + selectionMapping = new SparseArray<>(); + for (int i = 0; i < encValues.length; i++) + selectionMapping.put(i, Constants.EncryptionType.valueOf(encValues[i].toUpperCase())); + + selection.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int i, long l) { + Constants.EncryptionType encryptionType = selectionMapping.get(i); + + if (encryptionType == Constants.EncryptionType.PASSWORD) + desc.setText(R.string.intro_slide2_desc_password); + else if (encryptionType == Constants.EncryptionType.KEYSTORE) + desc.setText(R.string.intro_slide2_desc_keystore); + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + } + }); + + return root; + } + + private Constants.EncryptionType getSelectedEncryption() { + return selectionMapping.get(selection.getSelectedItemPosition()); + } + } +} diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Constants.java b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Constants.java index 8d5b142b..5c818cad 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Constants.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Constants.java @@ -52,6 +52,7 @@ public class Constants { public final static int INTENT_MAIN_AUTHENTICATE = 100; public final static int INTENT_MAIN_SETTINGS = 101; public final static int INTENT_MAIN_BACKUP = 102; + public final static int INTENT_MAIN_INTRO = 103; public final static int INTENT_BACKUP_OPEN_DOCUMENT_PLAIN = 200; public final static int INTENT_BACKUP_SAVE_DOCUMENT_PLAIN = 201; diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java index 7b8f47dc..6d4d6285 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/Settings.java @@ -290,6 +290,10 @@ public class Settings { return EncryptionType.valueOf(encType.toUpperCase()); } + public void setEncryption(EncryptionType encryptionType) { + setEncryption(encryptionType.name().toLowerCase()); + } + public void setEncryption(String encryption) { setString(R.string.settings_key_encryption, encryption); } diff --git a/app/src/main/res/layout/component_intro_encryption.xml b/app/src/main/res/layout/component_intro_encryption.xml new file mode 100644 index 00000000..d6e31066 --- /dev/null +++ b/app/src/main/res/layout/component_intro_encryption.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings_intro.xml b/app/src/main/res/values/strings_intro.xml new file mode 100644 index 00000000..e017c2bc --- /dev/null +++ b/app/src/main/res/values/strings_intro.xml @@ -0,0 +1,21 @@ + + + Welcome to andOTP + This wizard will guide you through the initial setup. + + To ensure the security of your accounts andOTP only stores them + in encrypted data files. Here you can choose which method of encryption will be used: + The KeyStore is a system component of Android for + securely storing cryptographic keys. The advantage of this method is that the keys are + stored separated from the data files and can be backed by hardware cryptography (if your + device 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. + \n\nWarning: The KeyStore is known to cause problems on some custom ROMs (and a few + stock ones as well). If you don\'t mind entering a password / PIN every time you start + andOTP it is highly recommended to use the password-based encryption. + 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. + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4b0df518..5528006d 100644 --- a/build.gradle +++ b/build.gradle @@ -18,9 +18,8 @@ buildscript { allprojects { repositories { jcenter() - maven { - url "https://maven.google.com" - } + maven { url "https://maven.google.com" } + maven { url "https://jitpack.io" } } }