diff options
7 files changed, 44 insertions, 99 deletions
diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 4d1b572aa..92746d563 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -190,9 +190,6 @@ android { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - // Enable code coverage (Jacoco) - testCoverageEnabled true - applicationIdSuffix ".debug" // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. @@ -207,6 +204,13 @@ android { buildConfigField "String", "GITHUB_CLIENT_ID", "\"c942cd81844d94e7e41b\"" buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"f1dd17e70a0614abbd9310b00a310e23c6c8edff\"" } + + // Workaround for http://stackoverflow.com/questions/27909613/cannot-see-parameter-value-in-android-studio-when-breakpoint-is-in-first-line-of + debugWithTestCoverage.initWith(debug) + debugWithTestCoverage { + // Enable code coverage (Jacoco) + testCoverageEnabled true + } } productFlavors { @@ -285,12 +289,12 @@ android { } } -task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugUnitTest") { +task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugWithTestCoverageUnitTest") { group = "Reporting" description = "Generate Jacoco coverage reports" classDirectories = fileTree( - dir: "${buildDir}/intermediates/classes/debug", + dir: "${buildDir}/intermediates/classes/fdroid/debugWithTestCoverage", excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', @@ -302,8 +306,8 @@ task jacocoTestReport(type:JacocoReport, dependsOn: "testFdroidDebugUnitTest") { sourceDirectories = files("${buildDir.parent}/src/main/java") additionalSourceDirs = files([ - "${buildDir}/generated/source/buildConfig/debug", - "${buildDir}/generated/source/r/debug" + "${buildDir}/generated/source/buildConfig/fdroid/debugWithTestCoverage", + "${buildDir}/generated/source/r/fdroid/debugWithTestCoverage" ]) executionData = fileTree(dir: "${buildDir}/jacoco", include: "**/*.exec") diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java index 4fd327c8f..894ce7846 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SettingsActivity.java @@ -30,7 +30,6 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; @@ -211,9 +210,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity { return false; } }); - - initializePassphraseCacheSubs( - (CheckBoxPreference) findPreference(Constants.Pref.PASSPHRASE_CACHE_SUBS)); } } @@ -591,15 +587,4 @@ public class SettingsActivity extends AppCompatPreferenceActivity { || ExperimentalPrefsFragment.class.getName().equals(fragmentName) || super.isValidFragment(fragmentName); } - - private static void initializePassphraseCacheSubs(final CheckBoxPreference mPassphraseCacheSubs) { - mPassphraseCacheSubs.setChecked(sPreferences.getPassphraseCacheSubs()); - mPassphraseCacheSubs.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - public boolean onPreferenceChange(Preference preference, Object newValue) { - mPassphraseCacheSubs.setChecked((Boolean) newValue); - sPreferences.setPassphraseCacheSubs((Boolean) newValue); - return false; - } - }); - } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java index 2abd53f62..7ca2875ea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/Preferences.java @@ -107,12 +107,6 @@ public class Preferences { return mSharedPreferences.getBoolean(Pref.PASSPHRASE_CACHE_SUBS, false); } - public void setPassphraseCacheSubs(boolean value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Pref.PASSPHRASE_CACHE_SUBS, value); - editor.commit(); - } - public boolean getCachedConsolidate() { return mSharedPreferences.getBoolean(Pref.CACHED_CONSOLIDATE, false); } diff --git a/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml b/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml index ce97b7fd4..21bd4ba88 100644 --- a/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml +++ b/OpenKeychain/src/main/res/layout/backup_restore_fragment.xml @@ -10,12 +10,11 @@ android:orientation="vertical" android:paddingLeft="16dp" android:paddingRight="16dp" - android:paddingTop="24dp"> + android:paddingTop="16dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingBottom="8dip" android:text="@string/backup_text" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -36,8 +35,6 @@ android:drawableRight="@drawable/ic_save_grey_24dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="8dp" - android:paddingRight="8dp" android:text="@string/backup_all" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -56,8 +53,6 @@ android:drawableRight="@drawable/ic_save_grey_24dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="8dp" - android:paddingRight="8dp" android:text="@string/backup_public_keys" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -78,16 +73,9 @@ android:drawableRight="@drawable/ic_folder_grey_24dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" - android:paddingLeft="8dp" - android:paddingRight="8dp" android:text="@string/btn_decrypt_files" android:textAppearance="?android:attr/textAppearanceMedium" /> - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_marginBottom="8dp" - android:background="?android:attr/listDivider" /> </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml index 7bd919abc..55b3d6b51 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_decrypt_fragment.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView - xmlns:android="http://schemas.android.com/apk/res/android" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -8,33 +7,29 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="4dp" + android:orientation="vertical" android:paddingLeft="16dp" android:paddingRight="16dp" - android:orientation="vertical" - > + android:paddingTop="16dp"> <TextView style="@style/SectionHeader" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="16dp" android:text="@string/section_encrypt" /> <TextView android:id="@+id/encrypt_files" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" + style="?android:attr/borderlessButtonStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeight" android:clickable="true" - style="?android:attr/borderlessButtonStyle" - android:text="@string/btn_encrypt_files" - android:drawableRight="@drawable/ic_folder_grey_24dp" android:drawablePadding="8dp" - android:gravity="center_vertical" /> + android:drawableRight="@drawable/ic_folder_grey_24dp" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight" + android:text="@string/btn_encrypt_files" + android:textAppearance="?android:attr/textAppearanceMedium" /> <View android:layout_width="match_parent" @@ -43,23 +38,16 @@ <TextView android:id="@+id/encrypt_text" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" + style="?android:attr/borderlessButtonStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeight" android:clickable="true" - style="?android:attr/borderlessButtonStyle" - android:text="@string/btn_encrypt_text" - android:drawableRight="@drawable/ic_comment_text_grey600_24dp" android:drawablePadding="8dp" - android:gravity="center_vertical" /> - - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" /> + android:drawableRight="@drawable/ic_comment_text_grey600_24dp" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight" + android:text="@string/btn_encrypt_text" + android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView style="@style/SectionHeader" @@ -70,18 +58,16 @@ <TextView android:id="@+id/decrypt_files" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" + style="?android:attr/borderlessButtonStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeight" android:clickable="true" - style="?android:attr/borderlessButtonStyle" - android:text="@string/btn_decrypt_files" - android:drawableRight="@drawable/ic_folder_grey_24dp" android:drawablePadding="8dp" - android:gravity="center_vertical" /> + android:drawableRight="@drawable/ic_folder_grey_24dp" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight" + android:text="@string/btn_decrypt_files" + android:textAppearance="?android:attr/textAppearanceMedium" /> <View android:layout_width="match_parent" @@ -90,38 +76,31 @@ <LinearLayout android:id="@+id/decrypt_from_clipboard" + style="?android:attr/borderlessButtonStyle" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:clickable="true" - style="?android:attr/borderlessButtonStyle" android:orientation="horizontal" - android:paddingLeft="8dp" - android:paddingRight="0dp" tools:ignore="UseCompoundDrawables"> <TextView - android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_weight="1" android:layout_gravity="center_vertical" - android:text="@string/btn_decrypt_clipboard" /> + android:layout_weight="1" + android:text="@string/btn_decrypt_clipboard" + android:textAppearance="?android:attr/textAppearanceMedium" /> <ImageView android:id="@+id/clipboard_icon" android:layout_width="wrap_content" android:layout_height="match_parent" - android:padding="8dp" - android:src="@drawable/ic_content_paste_grey_24dp" - android:layout_gravity="center_vertical" /> + android:layout_gravity="center_vertical" + android:paddingLeft="8dp" + android:src="@drawable/ic_content_paste_grey_24dp" /> </LinearLayout> - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" - android:layout_marginBottom="8dp" /> </LinearLayout> </ScrollView> diff --git a/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml b/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml index 85d6a6bca..e1ab50d63 100644 --- a/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml +++ b/OpenKeychain/src/main/res/xml/cloud_search_preferences.xml @@ -5,17 +5,13 @@ android:key="search_keyserver_pref" android:summary="@string/pref_keyserver_summary" android:title="@string/pref_keyserver" /> - <PreferenceScreen android:dependency="search_keyserver_pref" android:key="keyServers" - android:persistent="false" android:title="@string/label_keyservers" /> - <SwitchPreference android:defaultValue="true" android:key="search_keybase_pref" android:summary="@string/pref_keybase_summary" android:title="@string/pref_keybase" /> - </PreferenceScreen>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/xml/passphrase_preferences.xml b/OpenKeychain/src/main/res/xml/passphrase_preferences.xml index 40500e53c..b9696492a 100644 --- a/OpenKeychain/src/main/res/xml/passphrase_preferences.xml +++ b/OpenKeychain/src/main/res/xml/passphrase_preferences.xml @@ -1,15 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen android:key="passphraseCacheTtls" - android:persistent="false" android:title="@string/label_passphrase_cache_ttl" /> - <CheckBoxPreference + <SwitchPreference + android:defaultValue="false" android:key="passphraseCacheSubs" - android:persistent="true" android:title="@string/label_passphrase_cache_subs" /> - <CheckBoxPreference + <SwitchPreference android:defaultValue="true" android:key="useNumKeypadForYubikeyPin" - android:persistent="true" android:title="@string/label_use_num_keypad_for_security_token_pin" /> </PreferenceScreen> |