Merge branch 'thialfihar-feature/add-theme-setting'

This commit is contained in:
Dominik Schürmann
2015-07-25 15:55:30 +02:00
83 changed files with 575 additions and 322 deletions

View File

@@ -13,7 +13,7 @@ dependencies {
compile 'com.android.support:design:22.2.0' compile 'com.android.support:design:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0' compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.1.0' compile 'com.android.support:cardview-v7:22.1.0'
// Unit tests in the local JVM with Robolectric // Unit tests in the local JVM with Robolectric
// https://developer.android.com/training/testing/unit-testing/local-unit-tests.html // https://developer.android.com/training/testing/unit-testing/local-unit-tests.html
// http://robolectric.org/getting-started/ // http://robolectric.org/getting-started/
@@ -49,8 +49,8 @@ dependencies {
compile 'com.splitwise:tokenautocomplete:1.3.3@aar' compile 'com.splitwise:tokenautocomplete:1.3.3@aar'
compile 'se.emilsjolander:stickylistheaders:2.6.0' compile 'se.emilsjolander:stickylistheaders:2.6.0'
compile 'org.sufficientlysecure:html-textview:1.1' compile 'org.sufficientlysecure:html-textview:1.1'
compile 'com.mikepenz.materialdrawer:library:2.8.2@aar' compile 'com.mikepenz:materialdrawer:3.0.9@aar'
compile 'com.mikepenz.iconics:library:0.9.1@aar' compile 'com.mikepenz:iconics:1.0.2'
compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar' compile 'com.mikepenz.iconics:octicons-typeface:2.2.0@aar'
compile 'com.mikepenz.iconics:meteocons-typeface:1.1.1@aar' compile 'com.mikepenz.iconics:meteocons-typeface:1.1.1@aar'
compile 'com.mikepenz.iconics:community-material-typeface:1.0.0@aar' compile 'com.mikepenz.iconics:community-material-typeface:1.0.0@aar'
@@ -65,7 +65,7 @@ dependencies {
compile project(':extern:spongycastle:prov') compile project(':extern:spongycastle:prov')
compile project(':extern:minidns') compile project(':extern:minidns')
compile project(':extern:KeybaseLib:Lib') compile project(':extern:KeybaseLib:Lib')
compile project(':extern:safeslinger-exchange') compile project(':extern:safeslinger-exchange:safeslinger-exchange')
compile project(':extern:snackbar:lib') compile project(':extern:snackbar:lib')
} }
@@ -88,8 +88,8 @@ dependencyVerification {
'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb', 'com.splitwise:tokenautocomplete:20bee71cc59b3828eb000b684d46ddf738efd56b8fee453a509cd16fda42c8cb',
'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4', 'se.emilsjolander:stickylistheaders:8c05981ec5725be33f7cee5e68c13f3db49cd5c75f1aaeb04024920b1ef96ad4',
'org.sufficientlysecure:html-textview:ca24b1522be88378634093815ce9ff1b4920c72e7513a045a7846e14069ef988', 'org.sufficientlysecure:html-textview:ca24b1522be88378634093815ce9ff1b4920c72e7513a045a7846e14069ef988',
'com.mikepenz.materialdrawer:library:970317ed1a3cb96317f7b8d62ff592b3103eb46dfd68d9b244e7143623dc6d7a', 'com.mikepenz:materialdrawer:70c3efb3842461db41df6a918ea93969a7da21e63c092be838b153e5a47a17bf',
'com.mikepenz.iconics:library:4698a36ee4c2af765d0a85779c61474d755b90d66a59020105b6760a8a909e9e', 'com.mikepenz:iconics:c1a02203d8e0d638959463c00af3ab9096e0a7c1ad5928762eb10ef5ce8a63cd',
'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be', 'com.mikepenz.iconics:octicons-typeface:67ed7d456a9ce5f5307b85f955797bfb3dd674e2f6defb31c6b8bbe2ede290be',
'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b', 'com.mikepenz.iconics:meteocons-typeface:39a8a9e70cd8287cdb119af57a672a41dd09240dba6697f5a0dbda1ccc33298b',
'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f', 'com.mikepenz.iconics:community-material-typeface:f1c5afee5f0f10d66beb3ed0df977246a02a9c46de4e05d7c0264bcde53b6b7f',
@@ -130,12 +130,12 @@ android {
sourceCompatibility JavaVersion.VERSION_1_7 sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7
} }
buildTypes { buildTypes {
release { release {
minifyEnabled true minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\"" buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\""
@@ -145,13 +145,13 @@ android {
debug { debug {
applicationIdSuffix ".debug" applicationIdSuffix ".debug"
// Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE. // Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\"" buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\""
// Reference them in .xml files. // Reference them in .xml files.
resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account" resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account"
// Enable code coverage (Jacoco) // Enable code coverage (Jacoco)
testCoverageEnabled true testCoverageEnabled true
} }

View File

@@ -9,15 +9,15 @@
=============== ===============
- Last APG 1 version was 10900 (1.0.9 beta 00) - Last APG 1 version was 10900 (1.0.9 beta 00)
- Keychain starting with versionCode 20000! - Keychain starting with versionCode 20000!
Association of file types to Keychain Association of file types to Keychain
===================================== =====================================
General remarks about file ending conventions: General remarks about file ending conventions:
- *.gpg,*.pgp for binary files - *.gpg,*.pgp for binary files
- *.asc for ascii armored files The actual content can be anything. - *.asc for ascii armored files The actual content can be anything.
The file ending only shows if it is binary or ascii encoded. The file ending only shows if it is binary or ascii encoded.
Remarks about the ugly android:pathPattern: Remarks about the ugly android:pathPattern:
- We are matching all files with a specific file ending. - We are matching all files with a specific file ending.
This is done in an ugly way because of Android limitations. This is done in an ugly way because of Android limitations.
@@ -73,7 +73,7 @@
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/KeychainTheme"> android:theme="@style/LightTheme">
<activity <activity
android:name=".ui.MainActivity" android:name=".ui.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:configChanges="orientation|screenSize|keyboardHidden|keyboard"

View File

@@ -103,6 +103,13 @@ public final class Constants {
public static final String PROXY_HOST = "proxyHost"; public static final String PROXY_HOST = "proxyHost";
public static final String PROXY_PORT = "proxyPort"; public static final String PROXY_PORT = "proxyPort";
public static final String PROXY_TYPE = "proxyType"; public static final String PROXY_TYPE = "proxyType";
public static final String THEME = "theme";
public static final class Theme {
public static final String LIGHT = "light";
public static final String DARK = "dark";
public static final String DEFAULT = Constants.Pref.Theme.LIGHT;
}
} }
/** /**
@@ -116,7 +123,7 @@ public final class Constants {
public static final class Defaults { public static final class Defaults {
public static final String KEY_SERVERS = "hkps://hkps.pool.sks-keyservers.net, hkps://pgp.mit.edu"; public static final String KEY_SERVERS = "hkps://hkps.pool.sks-keyservers.net, hkps://pgp.mit.edu";
public static final int PREF_VERSION = 4; public static final int PREF_VERSION = 5;
} }
public static final class key { public static final class key {

View File

@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider; import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.ConsolidateDialogActivity; import org.sufficientlysecure.keychain.ui.ConsolidateDialogActivity;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.PRNGFixes; import org.sufficientlysecure.keychain.util.PRNGFixes;
import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.Preferences;
@@ -91,12 +92,12 @@ public class KeychainApplication extends Application {
} }
brandGlowEffect(getApplicationContext(), brandGlowEffect(getApplicationContext(),
getApplicationContext().getResources().getColor(R.color.primary)); FormattingUtils.getColorFromAttr(getApplicationContext(), R.attr.colorPrimary));
setupAccountAsNeeded(this); setupAccountAsNeeded(this);
// Update keyserver list as needed // Update keyserver list as needed
Preferences.getPreferences(this).updatePreferences(); Preferences.getPreferences(this).upgradePreferences();
TlsHelper.addStaticCA("pool.sks-keyservers.net", getAssets(), "sks-keyservers.netCA.cer"); TlsHelper.addStaticCA("pool.sks-keyservers.net", getAssets(), "sks-keyservers.netCA.cer");

View File

@@ -53,6 +53,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter; import org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter;
import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment; import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner; import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.Preferences;
@@ -154,7 +155,7 @@ public class CertifyKeyFragment
// make certify image gray, like action icons // make certify image gray, like action icons
ImageView vActionCertifyImage = ImageView vActionCertifyImage =
(ImageView) view.findViewById(R.id.certify_key_action_certify_image); (ImageView) view.findViewById(R.id.certify_key_action_certify_image);
vActionCertifyImage.setColorFilter(getResources().getColor(R.color.tertiary_text_light), vActionCertifyImage.setColorFilter(FormattingUtils.getColorFromAttr(getActivity(), R.attr.colorTertiaryText),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
View vCertifyButton = view.findViewById(R.id.certify_key_certify_button); View vCertifyButton = view.findViewById(R.id.certify_key_certify_button);

View File

@@ -49,6 +49,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder; import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import java.util.Date; import java.util.Date;
@@ -254,8 +255,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
final long[] masterKeyIds = getArguments().getLongArray(ARG_DELETE_MASTER_KEY_IDS); final long[] masterKeyIds = getArguments().getLongArray(ARG_DELETE_MASTER_KEY_IDS);
final boolean hasSecret = getArguments().getBoolean(ARG_HAS_SECRET); final boolean hasSecret = getArguments().getBoolean(ARG_HAS_SECRET);
ContextThemeWrapper theme = new ContextThemeWrapper(activity, ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity);
R.style.Theme_AppCompat_Light_Dialog);
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme); CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
@@ -351,10 +351,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
final String CHOICE_REVOKE = getString(R.string.del_rev_dialog_choice_rev_upload); final String CHOICE_REVOKE = getString(R.string.del_rev_dialog_choice_rev_upload);
final String CHOICE_DELETE = getString(R.string.del_rev_dialog_choice_delete); final String CHOICE_DELETE = getString(R.string.del_rev_dialog_choice_delete);
// if the dialog is displayed from the application class, design is missing ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity);
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light_Dialog);
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme); CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
builder.setTitle(getString(R.string.del_rev_dialog_title, builder.setTitle(getString(R.string.del_rev_dialog_title,

View File

@@ -78,6 +78,7 @@ public class HelpMarkdownFragment extends Fragment {
Log.e(Constants.TAG, "IOException", e); Log.e(Constants.TAG, "IOException", e);
} }
text.setBackgroundColor(getResources().getColor(android.R.color.white));
// no flickering when clicking textview for Android < 4 // no flickering when clicking textview for Android < 4
text.setTextColor(getResources().getColor(android.R.color.black)); text.setTextColor(getResources().getColor(android.R.color.black));

View File

@@ -68,6 +68,7 @@ import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter; import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style; import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.FabContainer; import org.sufficientlysecure.keychain.util.FabContainer;
@@ -675,8 +676,11 @@ public class KeyListFragment extends LoaderFragment
private HashMap<Integer, Boolean> mSelection = new HashMap<>(); private HashMap<Integer, Boolean> mSelection = new HashMap<>();
private Context mContext;
public KeyListAdapter(Context context, Cursor c, int flags) { public KeyListAdapter(Context context, Cursor c, int flags) {
super(context, c, flags); super(context, c, flags);
mContext = context;
} }
@Override @Override
@@ -705,9 +709,11 @@ public class KeyListFragment extends LoaderFragment
// let the adapter handle setting up the row views // let the adapter handle setting up the row views
View v = super.getView(position, convertView, parent); View v = super.getView(position, convertView, parent);
int colorEmphasis = FormattingUtils.getColorFromAttr(mContext, R.attr.colorEmphasis);
if (mSelection.get(position) != null) { if (mSelection.get(position) != null) {
// selected position color // selected position color
v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis)); v.setBackgroundColor(colorEmphasis);
} else { } else {
// default color // default color
v.setBackgroundColor(Color.TRANSPARENT); v.setBackgroundColor(Color.TRANSPARENT);

View File

@@ -43,6 +43,7 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogEntryParcel; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogEntryParcel;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogLevel; import org.sufficientlysecure.keychain.operations.results.OperationResult.LogLevel;
import org.sufficientlysecure.keychain.operations.results.OperationResult.SubLogEntryParcel; import org.sufficientlysecure.keychain.operations.results.OperationResult.SubLogEntryParcel;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.util.FileHelper; import org.sufficientlysecure.keychain.util.FileHelper;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
@@ -57,10 +58,12 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
OperationResult mResult; OperationResult mResult;
public static final String EXTRA_RESULT = "log"; public static final String EXTRA_RESULT = "log";
protected int mTextColor;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mTextColor = FormattingUtils.getColorFromAttr(getActivity(), R.attr.colorText);
setHasOptionsMenu(true); setHasOptionsMenu(true);
} }
@@ -357,13 +360,13 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
ih.mSecondText.setText(getResources().getString(subEntry.mType.getMsgId(), ih.mSecondText.setText(getResources().getString(subEntry.mType.getMsgId(),
subEntry.mParameters)); subEntry.mParameters));
} }
ih.mSecondText.setTextColor(subEntry.mType.mLevel == LogLevel.DEBUG ? Color.GRAY : Color.BLACK); ih.mSecondText.setTextColor(subEntry.mType.mLevel == LogLevel.DEBUG ? Color.GRAY : mTextColor);
switch (subEntry.mType.mLevel) { switch (subEntry.mType.mLevel) {
case DEBUG: ih.mSecondImg.setBackgroundColor(Color.GRAY); break; case DEBUG: ih.mSecondImg.setBackgroundColor(Color.GRAY); break;
case INFO: ih.mSecondImg.setBackgroundColor(Color.BLACK); break; case INFO: ih.mSecondImg.setBackgroundColor(mTextColor); break;
case WARN: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_orange_light)); break; case WARN: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_orange_light)); break;
case ERROR: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break; case ERROR: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break;
case START: ih.mSecondImg.setBackgroundColor(Color.BLACK); break; case START: ih.mSecondImg.setBackgroundColor(mTextColor); break;
case OK: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_green_light)); break; case OK: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_green_light)); break;
case CANCELLED: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break; case CANCELLED: ih.mSecondImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break;
} }
@@ -388,13 +391,13 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
entry.mParameters)); entry.mParameters));
} }
convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0); convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0);
ih.mText.setTextColor(entry.mType.mLevel == LogLevel.DEBUG ? Color.GRAY : Color.BLACK); ih.mText.setTextColor(entry.mType.mLevel == LogLevel.DEBUG ? Color.GRAY : mTextColor);
switch (entry.mType.mLevel) { switch (entry.mType.mLevel) {
case DEBUG: ih.mImg.setBackgroundColor(Color.GRAY); break; case DEBUG: ih.mImg.setBackgroundColor(Color.GRAY); break;
case INFO: ih.mImg.setBackgroundColor(Color.BLACK); break; case INFO: ih.mImg.setBackgroundColor(mTextColor); break;
case WARN: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_orange_light)); break; case WARN: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_orange_light)); break;
case ERROR: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break; case ERROR: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break;
case START: ih.mImg.setBackgroundColor(Color.BLACK); break; case START: ih.mImg.setBackgroundColor(mTextColor); break;
case OK: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_green_light)); break; case OK: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_green_light)); break;
case CANCELLED: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break; case CANCELLED: ih.mImg.setBackgroundColor(getResources().getColor(R.color.android_red_light)); break;
} }

View File

@@ -33,6 +33,7 @@ import com.mikepenz.community_material_typeface_library.CommunityMaterial;
import com.mikepenz.google_material_typeface_library.GoogleMaterial; import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.typeface.FontAwesome; import com.mikepenz.iconics.typeface.FontAwesome;
import com.mikepenz.materialdrawer.Drawer; import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
@@ -56,7 +57,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
public static final String EXTRA_SKIP_FIRST_TIME = "skip_first_time"; public static final String EXTRA_SKIP_FIRST_TIME = "skip_first_time";
public static final String EXTRA_INIT_FRAG = "init_frag"; public static final String EXTRA_INIT_FRAG = "init_frag";
public Drawer.Result mDrawerResult; public Drawer mDrawer;
private Toolbar mToolbar; private Toolbar mToolbar;
@Override @Override
@@ -68,7 +69,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
mToolbar.setTitle(R.string.app_name); mToolbar.setTitle(R.string.app_name);
setSupportActionBar(mToolbar); setSupportActionBar(mToolbar);
mDrawerResult = new Drawer() mDrawer = new DrawerBuilder()
.withActivity(this) .withActivity(this)
.withHeader(R.layout.main_drawer_header) .withHeader(R.layout.main_drawer_header)
.withToolbar(mToolbar) .withToolbar(mToolbar)
@@ -89,7 +90,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
) )
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { public boolean onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) {
if (drawerItem != null) { if (drawerItem != null) {
Intent intent = null; Intent intent = null;
switch(drawerItem.getIdentifier()) { switch(drawerItem.getIdentifier()) {
@@ -116,6 +117,8 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
MainActivity.this.startActivity(intent); MainActivity.this.startActivity(intent);
} }
} }
return false;
} }
}) })
.withSelectedItem(-1) .withSelectedItem(-1)
@@ -179,28 +182,28 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
private void onKeysSelected() { private void onKeysSelected() {
mToolbar.setTitle(R.string.app_name); mToolbar.setTitle(R.string.app_name);
mDrawerResult.setSelectionByIdentifier(ID_KEYS, false); mDrawer.setSelectionByIdentifier(ID_KEYS, false);
Fragment frag = new KeyListFragment(); Fragment frag = new KeyListFragment();
setFragment(frag, false); setFragment(frag, false);
} }
private void onEnDecryptSelected() { private void onEnDecryptSelected() {
mToolbar.setTitle(R.string.nav_encrypt_decrypt); mToolbar.setTitle(R.string.nav_encrypt_decrypt);
mDrawerResult.setSelectionByIdentifier(ID_ENCRYPT_DECRYPT, false); mDrawer.setSelectionByIdentifier(ID_ENCRYPT_DECRYPT, false);
Fragment frag = new EncryptDecryptOverviewFragment(); Fragment frag = new EncryptDecryptOverviewFragment();
setFragment(frag, true); setFragment(frag, true);
} }
private void onAppsSelected() { private void onAppsSelected() {
mToolbar.setTitle(R.string.nav_apps); mToolbar.setTitle(R.string.nav_apps);
mDrawerResult.setSelectionByIdentifier(ID_APPS, false); mDrawer.setSelectionByIdentifier(ID_APPS, false);
Fragment frag = new AppsListFragment(); Fragment frag = new AppsListFragment();
setFragment(frag, true); setFragment(frag, true);
} }
private void onBackupSelected() { private void onBackupSelected() {
mToolbar.setTitle(R.string.nav_backup); mToolbar.setTitle(R.string.nav_backup);
mDrawerResult.setSelectionByIdentifier(ID_APPS, false); mDrawer.setSelectionByIdentifier(ID_APPS, false);
Fragment frag = new BackupFragment(); Fragment frag = new BackupFragment();
setFragment(frag, true); setFragment(frag, true);
} }
@@ -208,15 +211,15 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
// add the values which need to be saved from the drawer to the bundle // add the values which need to be saved from the drawer to the bundle
outState = mDrawerResult.saveInstanceState(outState); outState = mDrawer.saveInstanceState(outState);
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// close the drawer first and if the drawer is closed do regular backstack handling // close the drawer first and if the drawer is closed do regular backstack handling
if (mDrawerResult != null && mDrawerResult.isDrawerOpen()) { if (mDrawer != null && mDrawer.isDrawerOpen()) {
mDrawerResult.closeDrawer(); mDrawer.closeDrawer();
} else { } else {
super.onBackPressed(); super.onBackPressed();
} }
@@ -255,16 +258,16 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
// make sure the selected icon is the one shown at this point // make sure the selected icon is the one shown at this point
if (frag instanceof KeyListFragment) { if (frag instanceof KeyListFragment) {
mToolbar.setTitle(R.string.app_name); mToolbar.setTitle(R.string.app_name);
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_KEYS), false); mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_KEYS), false);
} else if (frag instanceof EncryptDecryptOverviewFragment) { } else if (frag instanceof EncryptDecryptOverviewFragment) {
mToolbar.setTitle(R.string.nav_encrypt_decrypt); mToolbar.setTitle(R.string.nav_encrypt_decrypt);
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_ENCRYPT_DECRYPT), false); mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_ENCRYPT_DECRYPT), false);
} else if (frag instanceof AppsListFragment) { } else if (frag instanceof AppsListFragment) {
mToolbar.setTitle(R.string.nav_apps); mToolbar.setTitle(R.string.nav_apps);
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_APPS), false); mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_APPS), false);
} else if (frag instanceof BackupFragment) { } else if (frag instanceof BackupFragment) {
mToolbar.setTitle(R.string.nav_backup); mToolbar.setTitle(R.string.nav_backup);
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_BACKUP), false); mDrawer.setSelection(mDrawer.getPositionFromIdentifier(ID_BACKUP), false);
} }
} }

View File

@@ -59,6 +59,7 @@ import org.sufficientlysecure.keychain.service.PassphraseCacheService;
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel; import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder; import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Passphrase; import org.sufficientlysecure.keychain.util.Passphrase;
import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.Preferences;
@@ -196,10 +197,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity(); final Activity activity = getActivity();
// if the dialog is displayed from the application class, design is missing ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity);
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light_Dialog);
mSubKeyId = getArguments().getLong(EXTRA_SUBKEY_ID); mSubKeyId = getArguments().getLong(EXTRA_SUBKEY_ID);
mServiceIntent = getArguments().getParcelable(EXTRA_SERVICE_INTENT); mServiceIntent = getArguments().getParcelable(EXTRA_SERVICE_INTENT);

View File

@@ -29,6 +29,7 @@ import android.support.v4.app.FragmentActivity;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder; import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
public class RetryUploadDialogActivity extends FragmentActivity { public class RetryUploadDialogActivity extends FragmentActivity {
@@ -54,8 +55,7 @@ public class RetryUploadDialogActivity extends FragmentActivity {
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
ContextThemeWrapper theme = new ContextThemeWrapper(getActivity(), ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(getActivity());
R.style.Theme_AppCompat_Light_Dialog);
CustomAlertDialogBuilder dialogBuilder = new CustomAlertDialogBuilder(theme); CustomAlertDialogBuilder dialogBuilder = new CustomAlertDialogBuilder(theme);
dialogBuilder.setTitle(R.string.retry_up_dialog_title); dialogBuilder.setTitle(R.string.retry_up_dialog_title);

View File

@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.ImportKeyringParcel; import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
import org.sufficientlysecure.keychain.ui.base.BaseActivity; import org.sufficientlysecure.keychain.ui.base.BaseActivity;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper; import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableFileCache; import org.sufficientlysecure.keychain.util.ParcelableFileCache;
@@ -81,7 +82,7 @@ public class SafeSlingerActivity extends BaseActivity
}); });
ImageView buttonIcon = (ImageView) findViewById(R.id.safe_slinger_button_image); ImageView buttonIcon = (ImageView) findViewById(R.id.safe_slinger_button_image);
buttonIcon.setColorFilter(getResources().getColor(R.color.tertiary_text_light), buttonIcon.setColorFilter(FormattingUtils.getColorFromAttr(this, R.attr.colorTertiaryText),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
View button = findViewById(R.id.safe_slinger_button); View button = findViewById(R.id.safe_slinger_button);

View File

@@ -41,6 +41,7 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.AppCompatPreferenceActivity; import org.sufficientlysecure.keychain.compatibility.AppCompatPreferenceActivity;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.ui.widget.IntegerListPreference; import org.sufficientlysecure.keychain.ui.widget.IntegerListPreference;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.Preferences;
@@ -53,15 +54,20 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
public static final String ACTION_PREFS_CLOUD = "org.sufficientlysecure.keychain.ui.PREFS_CLOUD"; public static final String ACTION_PREFS_CLOUD = "org.sufficientlysecure.keychain.ui.PREFS_CLOUD";
public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV"; public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV";
public static final String ACTION_PREFS_PROXY = "org.sufficientlysecure.keychain.ui.PREFS_PROXY"; public static final String ACTION_PREFS_PROXY = "org.sufficientlysecure.keychain.ui.PREFS_PROXY";
public static final String ACTION_PREFS_GUI = "org.sufficientlysecure.keychain.ui.PREFS_GUI";
public static final int REQUEST_CODE_KEYSERVER_PREF = 0x00007005; public static final int REQUEST_CODE_KEYSERVER_PREF = 0x00007005;
private PreferenceScreen mKeyServerPreference = null; private PreferenceScreen mKeyServerPreference = null;
private static Preferences sPreferences; private static Preferences sPreferences;
private ThemeChanger mThemeChanger;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
sPreferences = Preferences.getPreferences(this); sPreferences = Preferences.getPreferences(this);
mThemeChanger = new ThemeChanger(this);
mThemeChanger.changeTheme();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setupToolbar(); setupToolbar();
@@ -106,6 +112,21 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
initializeUseNumKeypadForYubiKeyPin( initializeUseNumKeypadForYubiKeyPin(
(CheckBoxPreference) findPreference(Constants.Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN)); (CheckBoxPreference) findPreference(Constants.Pref.USE_NUMKEYPAD_FOR_YUBIKEY_PIN));
} else if (action != null && action.equals(ACTION_PREFS_GUI)) {
addPreferencesFromResource(R.xml.gui_preferences);
initializeTheme((ListPreference) findPreference(Constants.Pref.THEME));
}
}
@Override
protected void onResume() {
super.onResume();
if (mThemeChanger.changeTheme()) {
Intent intent = getIntent();
finish();
startActivity(intent);
} }
} }
@@ -425,14 +446,30 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
mUseTor.setEnabled(true); mUseTor.setEnabled(true);
} }
} }
} }
@TargetApi(Build.VERSION_CODES.KITKAT) /**
* This fragment shows gui preferences.
*/
public static class GuiPrefsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.gui_preferences);
initializeTheme((ListPreference) findPreference(Constants.Pref.THEME));
}
}
protected boolean isValidFragment(String fragmentName) { protected boolean isValidFragment(String fragmentName) {
return AdvancedPrefsFragment.class.getName().equals(fragmentName) return AdvancedPrefsFragment.class.getName().equals(fragmentName)
|| CloudSearchPrefsFragment.class.getName().equals(fragmentName) || CloudSearchPrefsFragment.class.getName().equals(fragmentName)
|| ProxyPrefsFragment.class.getName().equals(fragmentName) || ProxyPrefsFragment.class.getName().equals(fragmentName)
|| GuiPrefsFragment.class.getName().equals(fragmentName)
|| super.isValidFragment(fragmentName); || super.isValidFragment(fragmentName);
} }
@@ -461,6 +498,19 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}); });
} }
private static void initializeTheme(final ListPreference mTheme) {
mTheme.setValue(sPreferences.getTheme());
mTheme.setSummary(mTheme.getEntry());
mTheme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
mTheme.setValue((String) newValue);
mTheme.setSummary(mTheme.getEntry());
sPreferences.setTheme((String) newValue);
return false;
}
});
}
private static void initializeSearchKeyserver(final CheckBoxPreference mSearchKeyserver) { private static void initializeSearchKeyserver(final CheckBoxPreference mSearchKeyserver) {
Preferences.CloudSearchPrefs prefs = sPreferences.getCloudSearchPrefs(); Preferences.CloudSearchPrefs prefs = sPreferences.getCloudSearchPrefs();
mSearchKeyserver.setChecked(prefs.searchKeyserver); mSearchKeyserver.setChecked(prefs.searchKeyserver);

View File

@@ -691,6 +691,25 @@ public class ViewKeyActivity extends BaseNfcActivity implements
int mPreviousColor = 0; int mPreviousColor = 0;
/**
* Calculate a reasonable color for the status bar based on the given toolbar color.
* Style guides want the toolbar color to be a "700" on the Android scale and the status
* bar should be the same color at "500", this is roughly 17 / 20th of the value in each
* channel.
* http://www.google.com/design/spec/style/color.html#color-color-palette
*/
static public int getStatusBarBackgroundColor(int color) {
int r = (color >> 16) & 0xff;
int g = (color >> 8) & 0xff;
int b = color & 0xff;
r = r * 17 / 20;
g = g * 17 / 20;
b = b * 17 / 20;
return (0xff << 24) | (r << 16) | (g << 8) | b;
}
@Override @Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
/* TODO better error handling? May cause problems when a key is deleted, /* TODO better error handling? May cause problems when a key is deleted,
@@ -760,7 +779,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE); mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
State.REVOKED, R.color.icons, true); State.REVOKED, R.color.icons, true);
color = getResources().getColor(R.color.android_red_light); color = getResources().getColor(R.color.key_flag_red);
mActionEncryptFile.setVisibility(View.GONE); mActionEncryptFile.setVisibility(View.GONE);
mActionEncryptText.setVisibility(View.GONE); mActionEncryptText.setVisibility(View.GONE);
@@ -776,7 +795,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE); mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
State.EXPIRED, R.color.icons, true); State.EXPIRED, R.color.icons, true);
color = getResources().getColor(R.color.android_red_light); color = getResources().getColor(R.color.key_flag_red);
mActionEncryptFile.setVisibility(View.GONE); mActionEncryptFile.setVisibility(View.GONE);
mActionEncryptText.setVisibility(View.GONE); mActionEncryptText.setVisibility(View.GONE);
@@ -786,7 +805,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
} else if (mIsSecret) { } else if (mIsSecret) {
mStatusText.setText(R.string.view_key_my_key); mStatusText.setText(R.string.view_key_my_key);
mStatusImage.setVisibility(View.GONE); mStatusImage.setVisibility(View.GONE);
color = getResources().getColor(R.color.primary); color = getResources().getColor(R.color.key_flag_green);
// reload qr code only if the fingerprint changed // reload qr code only if the fingerprint changed
if (!mFingerprint.equals(mQrCodeLoaded)) { if (!mFingerprint.equals(mQrCodeLoaded)) {
loadQrCode(mFingerprint); loadQrCode(mFingerprint);
@@ -837,7 +856,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE); mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
State.VERIFIED, R.color.icons, true); State.VERIFIED, R.color.icons, true);
color = getResources().getColor(R.color.primary); color = getResources().getColor(R.color.key_flag_green);
photoTask.execute(mMasterKeyId); photoTask.execute(mMasterKeyId);
mFab.setVisibility(View.GONE); mFab.setVisibility(View.GONE);
@@ -846,20 +865,21 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE); mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText, KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
State.UNVERIFIED, R.color.icons, true); State.UNVERIFIED, R.color.icons, true);
color = getResources().getColor(R.color.android_orange_light); color = getResources().getColor(R.color.key_flag_orange);
mFab.setVisibility(View.VISIBLE); mFab.setVisibility(View.VISIBLE);
} }
} }
if (mPreviousColor == 0 || mPreviousColor == color) { if (mPreviousColor == 0 || mPreviousColor == color) {
mStatusBar.setBackgroundColor(color); mStatusBar.setBackgroundColor(getStatusBarBackgroundColor(color));
mBigToolbar.setBackgroundColor(color); mBigToolbar.setBackgroundColor(color);
mPreviousColor = color; mPreviousColor = color;
} else { } else {
ObjectAnimator colorFade1 = ObjectAnimator colorFade1 =
ObjectAnimator.ofObject(mStatusBar, "backgroundColor", ObjectAnimator.ofObject(mStatusBar, "backgroundColor",
new ArgbEvaluator(), mPreviousColor, color); new ArgbEvaluator(), mPreviousColor,
getStatusBarBackgroundColor(color));
ObjectAnimator colorFade2 = ObjectAnimator colorFade2 =
ObjectAnimator.ofObject(mBigToolbar, "backgroundColor", ObjectAnimator.ofObject(mBigToolbar, "backgroundColor",
new ArgbEvaluator(), mPreviousColor, color); new ArgbEvaluator(), mPreviousColor, color);
@@ -943,4 +963,4 @@ public class ViewKeyActivity extends BaseNfcActivity implements
public boolean onCryptoSetProgress(String msg, int progress, int max) { public boolean onCryptoSetProgress(String msg, int progress, int max) {
return true; return true;
} }
} }

View File

@@ -211,18 +211,18 @@ public class ViewKeyAdvActivity extends BaseActivity implements
// Note: order is important // Note: order is important
int color; int color;
if (isRevoked || isExpired) { if (isRevoked || isExpired) {
color = getResources().getColor(R.color.android_red_light); color = getResources().getColor(R.color.key_flag_red);
} else if (isSecret) { } else if (isSecret) {
color = getResources().getColor(R.color.primary); color = getResources().getColor(R.color.android_green_light);
} else { } else {
if (isVerified) { if (isVerified) {
color = getResources().getColor(R.color.primary); color = getResources().getColor(R.color.android_green_light);
} else { } else {
color = getResources().getColor(R.color.android_orange_light); color = getResources().getColor(R.color.key_flag_orange);
} }
} }
mToolbar.setBackgroundColor(color); mToolbar.setBackgroundColor(color);
mStatusBar.setBackgroundColor(color); mStatusBar.setBackgroundColor(ViewKeyActivity.getStatusBarBackgroundColor(color));
mSlidingTabLayout.setBackgroundColor(color); mSlidingTabLayout.setBackgroundColor(color);
break; break;

View File

@@ -58,6 +58,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider; import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style; import org.sufficientlysecure.keychain.ui.util.Notify.Style;
@@ -111,7 +112,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
View vKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard); View vKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard);
ImageButton vKeySafeSlingerButton = (ImageButton) view.findViewById(R.id.view_key_action_key_safeslinger); ImageButton vKeySafeSlingerButton = (ImageButton) view.findViewById(R.id.view_key_action_key_safeslinger);
View vKeyUploadButton = view.findViewById(R.id.view_key_action_upload); View vKeyUploadButton = view.findViewById(R.id.view_key_action_upload);
vKeySafeSlingerButton.setColorFilter(getResources().getColor(R.color.tertiary_text_light), vKeySafeSlingerButton.setColorFilter(FormattingUtils.getColorFromAttr(getActivity(), R.attr.colorTertiaryText),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
vFingerprintShareButton.setOnClickListener(new View.OnClickListener() { vFingerprintShareButton.setOnClickListener(new View.OnClickListener() {

View File

@@ -177,9 +177,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
} }
if (entry.isRevoked()) { if (entry.isRevoked()) {
KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, State.REVOKED, R.color.bg_gray); KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, State.REVOKED, R.color.key_flag_gray);
} else if (entry.isExpired()) { } else if (entry.isExpired()) {
KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, State.EXPIRED, R.color.bg_gray); KeyFormattingUtils.setStatusImage(getContext(), holder.status, null, State.EXPIRED, R.color.key_flag_gray);
} }
if (entry.isRevoked() || entry.isExpired()) { if (entry.isRevoked() || entry.isExpired()) {
@@ -188,9 +188,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
// no more space for algorithm display // no more space for algorithm display
holder.algorithm.setVisibility(View.GONE); holder.algorithm.setVisibility(View.GONE);
holder.mainUserId.setTextColor(getContext().getResources().getColor(R.color.bg_gray)); holder.mainUserId.setTextColor(getContext().getResources().getColor(R.color.key_flag_gray));
holder.mainUserIdRest.setTextColor(getContext().getResources().getColor(R.color.bg_gray)); holder.mainUserIdRest.setTextColor(getContext().getResources().getColor(R.color.key_flag_gray));
holder.keyId.setTextColor(getContext().getResources().getColor(R.color.bg_gray)); holder.keyId.setTextColor(getContext().getResources().getColor(R.color.key_flag_gray));
} else { } else {
holder.status.setVisibility(View.GONE); holder.status.setVisibility(View.GONE);
holder.algorithm.setVisibility(View.VISIBLE); holder.algorithm.setVisibility(View.VISIBLE);
@@ -198,11 +198,11 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
if (entry.isSecretKey()) { if (entry.isSecretKey()) {
holder.mainUserId.setTextColor(Color.RED); holder.mainUserId.setTextColor(Color.RED);
} else { } else {
holder.mainUserId.setTextColor(Color.BLACK); holder.mainUserId.setTextColor(FormattingUtils.getColorFromAttr(mActivity, R.attr.colorText));
} }
holder.mainUserIdRest.setTextColor(Color.BLACK); holder.mainUserIdRest.setTextColor(FormattingUtils.getColorFromAttr(mActivity, R.attr.colorText));
holder.keyId.setTextColor(Color.BLACK); holder.keyId.setTextColor(FormattingUtils.getColorFromAttr(mActivity, R.attr.colorText));
} }
if (entry.getUserIds().size() == 1) { if (entry.getUserIds().size() == 1) {
@@ -242,9 +242,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
uidView.setPadding(0, 0, FormattingUtils.dpToPx(getContext(), 8), 0); uidView.setPadding(0, 0, FormattingUtils.dpToPx(getContext(), 8), 0);
if (entry.isRevoked() || entry.isExpired()) { if (entry.isRevoked() || entry.isExpired()) {
uidView.setTextColor(getContext().getResources().getColor(R.color.bg_gray)); uidView.setTextColor(getContext().getResources().getColor(R.color.key_flag_gray));
} else { } else {
uidView.setTextColor(getContext().getResources().getColor(R.color.black)); uidView.setTextColor(FormattingUtils.getColorFromAttr(getContext(), R.attr.colorText));
} }
holder.userIdsList.addView(uidView); holder.userIdsList.addView(uidView);
@@ -258,9 +258,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
emailView.setText(highlighter.highlight(email)); emailView.setText(highlighter.highlight(email));
if (entry.isRevoked() || entry.isExpired()) { if (entry.isRevoked() || entry.isExpired()) {
emailView.setTextColor(getContext().getResources().getColor(R.color.bg_gray)); emailView.setTextColor(getContext().getResources().getColor(R.color.key_flag_gray));
} else { } else {
emailView.setTextColor(getContext().getResources().getColor(R.color.black)); emailView.setTextColor(FormattingUtils.getColorFromAttr(getContext(), R.attr.colorText));
} }
holder.userIdsList.addView(emailView); holder.userIdsList.addView(emailView);

View File

@@ -42,6 +42,7 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.ui.util.Highlighter; import org.sufficientlysecure.keychain.ui.util.Highlighter;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
@@ -49,6 +50,7 @@ public class KeyAdapter extends CursorAdapter {
protected String mQuery; protected String mQuery;
protected LayoutInflater mInflater; protected LayoutInflater mInflater;
protected Context mContext;
// These are the rows that we will retrieve. // These are the rows that we will retrieve.
public static final String[] PROJECTION = new String[]{ public static final String[] PROJECTION = new String[]{
@@ -77,6 +79,7 @@ public class KeyAdapter extends CursorAdapter {
public KeyAdapter(Context context, Cursor c, int flags) { public KeyAdapter(Context context, Cursor c, int flags) {
super(context, c, flags); super(context, c, flags);
mContext = context;
mInflater = LayoutInflater.from(context); mInflater = LayoutInflater.from(context);
} }
@@ -138,26 +141,26 @@ public class KeyAdapter extends CursorAdapter {
// Note: order is important! // Note: order is important!
if (item.mIsRevoked) { if (item.mIsRevoked) {
KeyFormattingUtils KeyFormattingUtils
.setStatusImage(context, mStatus, null, State.REVOKED, R.color.bg_gray); .setStatusImage(context, mStatus, null, State.REVOKED, R.color.key_flag_gray);
mStatus.setVisibility(View.VISIBLE); mStatus.setVisibility(View.VISIBLE);
mSlinger.setVisibility(View.GONE); mSlinger.setVisibility(View.GONE);
textColor = R.color.bg_gray; textColor = context.getResources().getColor(R.color.key_flag_gray);
} else if (item.mIsExpired) { } else if (item.mIsExpired) {
KeyFormattingUtils.setStatusImage(context, mStatus, null, State.EXPIRED, R.color.bg_gray); KeyFormattingUtils.setStatusImage(context, mStatus, null, State.EXPIRED, R.color.key_flag_gray);
mStatus.setVisibility(View.VISIBLE); mStatus.setVisibility(View.VISIBLE);
mSlinger.setVisibility(View.GONE); mSlinger.setVisibility(View.GONE);
textColor = R.color.bg_gray; textColor = context.getResources().getColor(R.color.key_flag_gray);
} else if (item.mIsSecret) { } else if (item.mIsSecret) {
mStatus.setVisibility(View.GONE); mStatus.setVisibility(View.GONE);
if (mSlingerButton.hasOnClickListeners()) { if (mSlingerButton.hasOnClickListeners()) {
mSlingerButton.setColorFilter( mSlingerButton.setColorFilter(
context.getResources().getColor(R.color.tertiary_text_light), FormattingUtils.getColorFromAttr(context, R.attr.colorTertiaryText),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
mSlinger.setVisibility(View.VISIBLE); mSlinger.setVisibility(View.VISIBLE);
} else { } else {
mSlinger.setVisibility(View.GONE); mSlinger.setVisibility(View.GONE);
} }
textColor = R.color.black; textColor = FormattingUtils.getColorFromAttr(context, R.attr.colorText);
} else { } else {
// this is a public key - show if it's verified // this is a public key - show if it's verified
if (item.mIsVerified) { if (item.mIsVerified) {
@@ -168,15 +171,15 @@ public class KeyAdapter extends CursorAdapter {
mStatus.setVisibility(View.VISIBLE); mStatus.setVisibility(View.VISIBLE);
} }
mSlinger.setVisibility(View.GONE); mSlinger.setVisibility(View.GONE);
textColor = R.color.black; textColor = FormattingUtils.getColorFromAttr(context, R.attr.colorText);
} }
if (!enabled) { if (!enabled) {
textColor = R.color.bg_gray; textColor = context.getResources().getColor(R.color.key_flag_gray);
} }
mMainUserId.setTextColor(context.getResources().getColor(textColor)); mMainUserId.setTextColor(textColor);
mMainUserIdRest.setTextColor(context.getResources().getColor(textColor)); mMainUserIdRest.setTextColor(textColor);
if (item.mHasDuplicate) { if (item.mHasDuplicate) {
String dateTime = DateUtils.formatDateTime(context, String dateTime = DateUtils.formatDateTime(context,
@@ -187,7 +190,7 @@ public class KeyAdapter extends CursorAdapter {
mCreationDate.setText(context.getString(R.string.label_key_created, mCreationDate.setText(context.getString(R.string.label_key_created,
dateTime)); dateTime));
mCreationDate.setTextColor(context.getResources().getColor(textColor)); mCreationDate.setTextColor(textColor);
mCreationDate.setVisibility(View.VISIBLE); mCreationDate.setVisibility(View.VISIBLE);
} else { } else {
mCreationDate.setVisibility(View.GONE); mCreationDate.setVisibility(View.GONE);

View File

@@ -149,11 +149,11 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter {
boolean enabled; boolean enabled;
if (cursor.getInt(mIndexIsRevoked) != 0) { if (cursor.getInt(mIndexIsRevoked) != 0) {
h.statusIcon.setVisibility(View.VISIBLE); h.statusIcon.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, State.REVOKED, R.color.bg_gray); KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, State.REVOKED, R.color.key_flag_gray);
enabled = false; enabled = false;
} else if (cursor.getInt(mIndexIsExpiry) != 0) { } else if (cursor.getInt(mIndexIsExpiry) != 0) {
h.statusIcon.setVisibility(View.VISIBLE); h.statusIcon.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, State.EXPIRED, R.color.bg_gray); KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, State.EXPIRED, R.color.key_flag_gray);
enabled = false; enabled = false;
} else { } else {
h.statusIcon.setVisibility(View.GONE); h.statusIcon.setVisibility(View.GONE);

View File

@@ -284,27 +284,27 @@ public class SubkeysAdapter extends CursorAdapter {
vStatus.setVisibility(View.VISIBLE); vStatus.setVisibility(View.VISIBLE);
vCertifyIcon.setColorFilter( vCertifyIcon.setColorFilter(
mContext.getResources().getColor(R.color.bg_gray), mContext.getResources().getColor(R.color.key_flag_gray),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
vSignIcon.setColorFilter( vSignIcon.setColorFilter(
mContext.getResources().getColor(R.color.bg_gray), mContext.getResources().getColor(R.color.key_flag_gray),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
vEncryptIcon.setColorFilter( vEncryptIcon.setColorFilter(
mContext.getResources().getColor(R.color.bg_gray), mContext.getResources().getColor(R.color.key_flag_gray),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
vAuthenticateIcon.setColorFilter( vAuthenticateIcon.setColorFilter(
mContext.getResources().getColor(R.color.bg_gray), mContext.getResources().getColor(R.color.key_flag_gray),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
if (isRevoked) { if (isRevoked) {
vStatus.setImageResource(R.drawable.status_signature_revoked_cutout_24dp); vStatus.setImageResource(R.drawable.status_signature_revoked_cutout_24dp);
vStatus.setColorFilter( vStatus.setColorFilter(
mContext.getResources().getColor(R.color.bg_gray), mContext.getResources().getColor(R.color.key_flag_gray),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
} else if (isExpired) { } else if (isExpired) {
vStatus.setImageResource(R.drawable.status_signature_expired_cutout_24dp); vStatus.setImageResource(R.drawable.status_signature_expired_cutout_24dp);
vStatus.setColorFilter( vStatus.setColorFilter(
mContext.getResources().getColor(R.color.bg_gray), mContext.getResources().getColor(R.color.key_flag_gray),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
} }
} else { } else {

View File

@@ -128,7 +128,7 @@ public class UserIdsAdapter extends UserAttributesAdapter {
if (isRevoked) { if (isRevoked) {
// set revocation icon (can this even be primary?) // set revocation icon (can this even be primary?)
KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.REVOKED, R.color.bg_gray); KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.REVOKED, R.color.key_flag_gray);
// disable revoked user ids // disable revoked user ids
vName.setEnabled(false); vName.setEnabled(false);

View File

@@ -18,6 +18,7 @@
package org.sufficientlysecure.keychain.ui.base; package org.sufficientlysecure.keychain.ui.base;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
@@ -29,6 +30,7 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
/** /**
* Setups Toolbar * Setups Toolbar
@@ -36,14 +38,28 @@ import org.sufficientlysecure.keychain.R;
public abstract class BaseActivity extends AppCompatActivity { public abstract class BaseActivity extends AppCompatActivity {
protected Toolbar mToolbar; protected Toolbar mToolbar;
protected View mStatusBar; protected View mStatusBar;
protected ThemeChanger mThemeChanger;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
mThemeChanger = new ThemeChanger(this);
mThemeChanger.changeTheme();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
initLayout(); initLayout();
initToolbar(); initToolbar();
} }
@Override
protected void onResume() {
super.onResume();
if (mThemeChanger.changeTheme()) {
Intent intent = getIntent();
finish();
startActivity(intent);
}
}
protected void initLayout() { protected void initLayout() {
} }

View File

@@ -28,5 +28,4 @@ public class CustomAlertDialogBuilder extends AlertDialog.Builder {
public CustomAlertDialogBuilder(Context context) { public CustomAlertDialogBuilder(Context context) {
super(context); super(context);
} }
} }

View File

@@ -30,6 +30,7 @@ import android.view.ContextThemeWrapper;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper; import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
@@ -67,11 +68,7 @@ public class OrbotStartDialogFragment extends DialogFragment {
int middleButton = getArguments().getInt(ARG_MIDDLE_BUTTON); int middleButton = getArguments().getInt(ARG_MIDDLE_BUTTON);
final Activity activity = getActivity(); final Activity activity = getActivity();
// if the dialog is displayed from the application class, design is missing. ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity);
// hack to get holo design (which is not automatically applied due to activity's
// Theme.NoDisplay)
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light_Dialog);
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme); CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
builder.setTitle(title).setMessage(message); builder.setTitle(title).setMessage(message);
@@ -126,4 +123,4 @@ public class OrbotStartDialogFragment extends DialogFragment {
return builder.show(); return builder.show();
} }
} }

View File

@@ -35,6 +35,7 @@ import android.widget.Button;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.KeychainService; import org.sufficientlysecure.keychain.service.KeychainService;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
/** /**
* meant to be used * meant to be used
@@ -98,10 +99,7 @@ public class ProgressDialogFragment extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity(); final Activity activity = getActivity();
// if the progress dialog is displayed from the application class, design is missing ContextThemeWrapper context = ThemeChanger.getDialogThemeWrapper(activity);
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
ContextThemeWrapper context = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light);
ProgressDialog dialog = new ProgressDialog(context); ProgressDialog dialog = new ProgressDialog(context);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);

View File

@@ -18,9 +18,11 @@
package org.sufficientlysecure.keychain.ui.util; package org.sufficientlysecure.keychain.ui.util;
import android.content.Context; import android.content.Context;
import android.content.res.Resources.Theme;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.StrikethroughSpan; import android.text.style.StrikethroughSpan;
import android.util.TypedValue;
public class FormattingUtils { public class FormattingUtils {
@@ -32,4 +34,10 @@ public class FormattingUtils {
return (int) ((px / context.getResources().getDisplayMetrics().density) + 0.5f); return (int) ((px / context.getResources().getDisplayMetrics().density) + 0.5f);
} }
public static int getColorFromAttr(Context context, int attr) {
TypedValue typedValue = new TypedValue();
Theme theme = context.getTheme();
theme.resolveAttribute(attr, typedValue, true);
return typedValue.data;
}
} }

View File

@@ -22,6 +22,7 @@ import android.text.Spannable;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -44,9 +45,12 @@ public class Highlighter {
Pattern pattern = Pattern.compile("(?i)(" + mQuery.trim().replaceAll("\\s+", "|") + ")"); Pattern pattern = Pattern.compile("(?i)(" + mQuery.trim().replaceAll("\\s+", "|") + ")");
Matcher matcher = pattern.matcher(text); Matcher matcher = pattern.matcher(text);
int colorEmphasis = FormattingUtils.getColorFromAttr(mContext, R.attr.colorEmphasis);
while (matcher.find()) { while (matcher.find()) {
highlight.setSpan( highlight.setSpan(
new ForegroundColorSpan(mContext.getResources().getColor(R.color.emphasis)), new ForegroundColorSpan(colorEmphasis),
matcher.start(), matcher.start(),
matcher.end(), matcher.end(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

View File

@@ -31,6 +31,7 @@ import android.view.ContextThemeWrapper;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder; import org.sufficientlysecure.keychain.ui.dialog.CustomAlertDialogBuilder;
import org.sufficientlysecure.keychain.ui.util.ThemeChanger;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
public class InstallDialogFragmentHelper { public class InstallDialogFragmentHelper {
@@ -65,11 +66,7 @@ public class InstallDialogFragmentHelper {
final String installPath = args.getString(ARG_INSTALL_PATH); final String installPath = args.getString(ARG_INSTALL_PATH);
final boolean useMiddleButton = args.getBoolean(ARG_USE_MIDDLE_BUTTON); final boolean useMiddleButton = args.getBoolean(ARG_USE_MIDDLE_BUTTON);
// if the dialog is displayed from the application class, design is missing. ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity);
// hack to get holo design (which is not automatically applied due to activity's
// Theme.NoDisplay)
ContextThemeWrapper theme = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light_Dialog);
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme); CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(theme);
builder.setTitle(title).setMessage(message); builder.setTitle(title).setMessage(message);

View File

@@ -40,6 +40,7 @@ import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm; import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Curve; import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Curve;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@@ -449,11 +450,11 @@ public class KeyFormattingUtils {
if (signatureResult != null && signatureResult.isSignatureOnly()) { if (signatureResult != null && signatureResult.isSignatureOnly()) {
encIcon = R.drawable.status_lock_open_24dp; encIcon = R.drawable.status_lock_open_24dp;
encText = R.string.decrypt_result_not_encrypted; encText = R.string.decrypt_result_not_encrypted;
encColor = R.color.android_red_light; encColor = R.color.key_flag_red;
} else { } else {
encIcon = R.drawable.status_lock_closed_24dp; encIcon = R.drawable.status_lock_closed_24dp;
encText = R.string.decrypt_result_encrypted; encText = R.string.decrypt_result_encrypted;
encColor = R.color.android_green_light; encColor = R.color.key_flag_green;
} }
int encColorRes = context.getResources().getColor(encColor); int encColorRes = context.getResources().getColor(encColor);
@@ -470,7 +471,7 @@ public class KeyFormattingUtils {
sigText = R.string.decrypt_result_no_signature; sigText = R.string.decrypt_result_no_signature;
sigIcon = R.drawable.status_signature_invalid_cutout_24dp; sigIcon = R.drawable.status_signature_invalid_cutout_24dp;
sigColor = R.color.bg_gray; sigColor = R.color.key_flag_gray;
// won't be used, but makes compiler happy // won't be used, but makes compiler happy
sigActionText = 0; sigActionText = 0;
@@ -481,7 +482,7 @@ public class KeyFormattingUtils {
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: { case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: {
sigText = R.string.decrypt_result_signature_certified; sigText = R.string.decrypt_result_signature_certified;
sigIcon = R.drawable.status_signature_verified_cutout_24dp; sigIcon = R.drawable.status_signature_verified_cutout_24dp;
sigColor = R.color.android_green_light; sigColor = R.color.key_flag_green;
sigActionText = R.string.decrypt_result_action_show; sigActionText = R.string.decrypt_result_action_show;
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp; sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
@@ -491,7 +492,7 @@ public class KeyFormattingUtils {
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: { case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: {
sigText = R.string.decrypt_result_signature_uncertified; sigText = R.string.decrypt_result_signature_uncertified;
sigIcon = R.drawable.status_signature_unverified_cutout_24dp; sigIcon = R.drawable.status_signature_unverified_cutout_24dp;
sigColor = R.color.android_orange_light; sigColor = R.color.key_flag_orange;
sigActionText = R.string.decrypt_result_action_show; sigActionText = R.string.decrypt_result_action_show;
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp; sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
@@ -501,7 +502,7 @@ public class KeyFormattingUtils {
case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: { case OpenPgpSignatureResult.SIGNATURE_KEY_REVOKED: {
sigText = R.string.decrypt_result_signature_revoked_key; sigText = R.string.decrypt_result_signature_revoked_key;
sigIcon = R.drawable.status_signature_revoked_cutout_24dp; sigIcon = R.drawable.status_signature_revoked_cutout_24dp;
sigColor = R.color.android_red_light; sigColor = R.color.key_flag_red;
sigActionText = R.string.decrypt_result_action_show; sigActionText = R.string.decrypt_result_action_show;
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp; sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
@@ -511,7 +512,7 @@ public class KeyFormattingUtils {
case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: { case OpenPgpSignatureResult.SIGNATURE_KEY_EXPIRED: {
sigText = R.string.decrypt_result_signature_expired_key; sigText = R.string.decrypt_result_signature_expired_key;
sigIcon = R.drawable.status_signature_expired_cutout_24dp; sigIcon = R.drawable.status_signature_expired_cutout_24dp;
sigColor = R.color.android_red_light; sigColor = R.color.key_flag_red;
sigActionText = R.string.decrypt_result_action_show; sigActionText = R.string.decrypt_result_action_show;
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp; sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
@@ -521,7 +522,7 @@ public class KeyFormattingUtils {
case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: { case OpenPgpSignatureResult.SIGNATURE_KEY_MISSING: {
sigText = R.string.decrypt_result_signature_missing_key; sigText = R.string.decrypt_result_signature_missing_key;
sigIcon = R.drawable.status_signature_unknown_cutout_24dp; sigIcon = R.drawable.status_signature_unknown_cutout_24dp;
sigColor = R.color.android_red_light; sigColor = R.color.key_flag_red;
sigActionText = R.string.decrypt_result_action_Lookup; sigActionText = R.string.decrypt_result_action_Lookup;
sigActionIcon = R.drawable.ic_file_download_grey_24dp; sigActionIcon = R.drawable.ic_file_download_grey_24dp;
@@ -532,7 +533,7 @@ public class KeyFormattingUtils {
case OpenPgpSignatureResult.SIGNATURE_ERROR: { case OpenPgpSignatureResult.SIGNATURE_ERROR: {
sigText = R.string.decrypt_result_invalid_signature; sigText = R.string.decrypt_result_invalid_signature;
sigIcon = R.drawable.status_signature_invalid_cutout_24dp; sigIcon = R.drawable.status_signature_invalid_cutout_24dp;
sigColor = R.color.android_red_light; sigColor = R.color.key_flag_red;
sigActionText = R.string.decrypt_result_action_show; sigActionText = R.string.decrypt_result_action_show;
sigActionIcon = R.drawable.ic_vpn_key_grey_24dp; sigActionIcon = R.drawable.ic_vpn_key_grey_24dp;
@@ -595,7 +596,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_verified_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_verified_cutout_24dp));
} }
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_green_light; color = R.color.key_flag_green;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -608,7 +609,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable( statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_lock_closed_24dp)); context.getResources().getDrawable(R.drawable.status_lock_closed_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_green_light; color = R.color.key_flag_green;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -627,7 +628,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_unverified_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_unverified_cutout_24dp));
} }
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_orange_light; color = R.color.key_flag_orange;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -640,7 +641,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable( statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light; color = R.color.key_flag_red;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -659,7 +660,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_revoked_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_revoked_cutout_24dp));
} }
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light; color = R.color.key_flag_red;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -677,7 +678,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_expired_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_expired_cutout_24dp));
} }
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light; color = R.color.key_flag_red;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -690,7 +691,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable( statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_lock_open_24dp)); context.getResources().getDrawable(R.drawable.status_lock_open_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light; color = R.color.key_flag_red;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -703,7 +704,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable( statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light; color = R.color.key_flag_red;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -716,7 +717,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable( statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light; color = R.color.key_flag_red;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);
@@ -730,7 +731,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable( statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout_24dp)); context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) { if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.bg_gray; color = R.color.key_flag_gray;
} }
statusIcon.setColorFilter(context.getResources().getColor(color), statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN); PorterDuff.Mode.SRC_IN);

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2015 Thialfihar <thi@thialfihar.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui.util;
import android.content.Context;
import android.view.ContextThemeWrapper;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Preferences;
public class ThemeChanger {
private Context mContext;
private Preferences mPreferences;
private String mCurrentTheme = null;
static public ContextThemeWrapper getDialogThemeWrapper(Context context) {
Preferences preferences = Preferences.getPreferences(context);
// if the dialog is displayed from the application class, design is missing.
// hack to get holo design (which is not automatically applied due to activity's
// Theme.NoDisplay)
if (Constants.Pref.Theme.DARK.equals(preferences.getTheme())) {
return new ContextThemeWrapper(context, R.style.Theme_AppCompat_Dialog);
} else {
return new ContextThemeWrapper(context, R.style.Theme_AppCompat_Light_Dialog);
}
}
public ThemeChanger(Context context) {
mContext = context;
mPreferences = Preferences.getPreferences(mContext);
}
/**
* Apply the theme set in preferences if it isn't equal to mCurrentTheme
* anymore or mCurrentTheme hasn't been set yet.
* If a new theme is applied in this method, then return true, so
* the caller can re-create the activity, if need be.
*/
public boolean changeTheme() {
String newTheme = mPreferences.getTheme();
if (mCurrentTheme != null && mCurrentTheme.equals(newTheme)) {
return false;
}
int themeId = R.style.LightTheme;
if (Constants.Pref.Theme.DARK.equals(newTheme)) {
themeId = R.style.DarkTheme;
}
ContextThemeWrapper w = new ContextThemeWrapper(mContext, themeId);
mContext.getTheme().setTo(w.getTheme());
mCurrentTheme = newTheme;
return true;
}
}

View File

@@ -99,9 +99,9 @@ public class PasswordStrengthView extends View {
public PasswordStrengthView(Context context, AttributeSet attrs) { public PasswordStrengthView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
int COLOR_FAIL = getResources().getColor(R.color.android_red_light); int COLOR_FAIL = getResources().getColor(R.color.password_strength_low);
int COLOR_WEAK = getResources().getColor(R.color.android_orange_light); int COLOR_WEAK = getResources().getColor(R.color.password_strength_medium);
int COLOR_STRONG = getResources().getColor(R.color.android_green_light); int COLOR_STRONG = getResources().getColor(R.color.password_strength_high);
TypedArray style = context.getTheme().obtainStyledAttributes( TypedArray style = context.getTheme().obtainStyledAttributes(
attrs, attrs,

View File

@@ -220,6 +220,15 @@ public class Preferences {
return mSharedPreferences.getBoolean(Pref.TEXT_USE_COMPRESSION, true); return mSharedPreferences.getBoolean(Pref.TEXT_USE_COMPRESSION, true);
} }
public String getTheme() {
return mSharedPreferences.getString(Pref.THEME, Pref.Theme.LIGHT);
}
public void setTheme(String value) {
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putString(Constants.Pref.THEME, value);
editor.commit();
}
public void setUseArmor(boolean useArmor) { public void setUseArmor(boolean useArmor) {
SharedPreferences.Editor editor = mSharedPreferences.edit(); SharedPreferences.Editor editor = mSharedPreferences.edit();
@@ -347,7 +356,7 @@ public class Preferences {
} }
} }
public void updatePreferences() { public void upgradePreferences() {
if (mSharedPreferences.getInt(Constants.Pref.PREF_DEFAULT_VERSION, 0) != if (mSharedPreferences.getInt(Constants.Pref.PREF_DEFAULT_VERSION, 0) !=
Constants.Defaults.PREF_VERSION) { Constants.Defaults.PREF_VERSION) {
switch (mSharedPreferences.getInt(Constants.Pref.PREF_DEFAULT_VERSION, 0)) { switch (mSharedPreferences.getInt(Constants.Pref.PREF_DEFAULT_VERSION, 0)) {
@@ -381,6 +390,10 @@ public class Preferences {
} }
// fall through // fall through
case 4: { case 4: {
setTheme(Constants.Pref.Theme.DEFAULT);
}
// fall through
case 5: {
} }
} }

View File

@@ -6,6 +6,6 @@
android:height="1dp" android:height="1dp"
android:width="1000dp" /> android:width="1000dp" />
<solid android:color="@color/bg_gray" /> <solid android:color="?attr/colorCardViewHeaderDivider" />
</shape> </shape>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/black_semi_transparent"/> <solid android:color="?attr/colorFabBackground"/>
<padding <padding
android:left="16dp" android:left="16dp"
android:top="4dp" android:top="4dp"
@@ -8,4 +8,4 @@
android:bottom="4dp"/> android:bottom="4dp"/>
<corners <corners
android:radius="2dp"/> android:radius="2dp"/>
</shape> </shape>

View File

@@ -6,6 +6,6 @@
android:height="2dp" android:height="2dp"
android:width="1000dp" /> android:width="1000dp" />
<solid android:color="@color/header_text" /> <solid android:color="?attr/colorHeaderText" />
</shape> </shape>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Borderless Buttons for API < 11, see http://stackoverflow.com/a/14663170 -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@color/bg_gray" />
<item android:drawable="@android:color/transparent" />
</selector>

View File

@@ -29,7 +29,7 @@
android:id="@+id/add_user_id_comment" android:id="@+id/add_user_id_comment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/tertiary_text_light" android:textColor="?attr/colorTertiaryText"
android:singleLine="true" android:singleLine="true"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"

View File

@@ -117,7 +117,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="4dp" android:elevation="4dp"
fab:fab_icon="@drawable/ic_play_arrow_white_24dp" fab:fab_icon="@drawable/ic_play_arrow_white_24dp"
fab:fab_colorNormal="@color/fab" fab:fab_colorNormal="?attr/colorFab"
fab:fab_colorPressed="@color/fab_pressed" /> fab:fab_colorPressed="?attr/colorFabPressed" />
</RelativeLayout> </RelativeLayout>

View File

@@ -28,7 +28,7 @@
android:id="@+id/certify_fingerprint_card" android:id="@+id/certify_fingerprint_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardBackgroundColor="@android:color/white" app:cardBackgroundColor="?attr/colorCardViewBackground"
app:cardUseCompatPadding="true" app:cardUseCompatPadding="true"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
android:layout_gravity="top"> android:layout_gravity="top">
@@ -151,4 +151,4 @@
</RelativeLayout> </RelativeLayout>

View File

@@ -51,7 +51,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -88,4 +88,4 @@
android:clickable="true" android:clickable="true"
style="?android:attr/borderlessButtonStyle" /> style="?android:attr/borderlessButtonStyle" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -28,7 +28,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:text="@string/label_name" android:text="@string/label_name"
android:textColor="@color/tertiary_text_light" android:textColor="?attr/colorTertiaryText"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView <TextView
@@ -44,7 +44,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:text="@string/label_email" android:text="@string/label_email"
android:textColor="@color/tertiary_text_light" android:textColor="?attr/colorTertiaryText"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView <TextView
@@ -87,7 +87,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/create_key_rsa" android:text="@string/create_key_rsa"
android:textColor="@color/android_green_light" android:textColor="?attr/colorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:clickable="true" android:clickable="true"
@@ -129,7 +129,7 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:text="@string/create_key_final_robot_text" android:text="@string/create_key_final_robot_text"
android:textColor="@color/android_green_light" android:textColor="?attr/colorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableLeft="@drawable/create_key_robot" android:drawableLeft="@drawable/create_key_robot"
android:drawablePadding="8dp" /> android:drawablePadding="8dp" />
@@ -144,7 +144,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -182,4 +182,4 @@
style="?android:attr/borderlessButtonStyle" /> style="?android:attr/borderlessButtonStyle" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -45,7 +45,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -82,4 +82,4 @@
android:clickable="true" android:clickable="true"
style="?android:attr/borderlessButtonStyle" /> style="?android:attr/borderlessButtonStyle" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -64,7 +64,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -101,4 +101,4 @@
android:clickable="true" android:clickable="true"
style="?android:attr/borderlessButtonStyle" /> style="?android:attr/borderlessButtonStyle" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -30,7 +30,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView

View File

@@ -34,7 +34,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -73,4 +73,4 @@
style="?android:attr/borderlessButtonStyle" style="?android:attr/borderlessButtonStyle"
android:layout_gravity="center_vertical" /> android:layout_gravity="center_vertical" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -84,7 +84,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -123,4 +123,4 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -69,7 +69,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -106,4 +106,4 @@
android:clickable="true" android:clickable="true"
style="?android:attr/borderlessButtonStyle" /> style="?android:attr/borderlessButtonStyle" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -70,7 +70,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
@@ -107,4 +107,4 @@
android:textAllCaps="true" android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -40,7 +40,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:id="@+id/create_key_buttons"> android:id="@+id/create_key_buttons">
<TextView <TextView
@@ -79,4 +79,4 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -7,7 +7,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="4dp" android:layout_margin="4dp"
custom:cardBackgroundColor="@android:color/white" custom:cardBackgroundColor="?attr/colorCardViewBackground"
custom:cardElevation="2dp" custom:cardElevation="2dp"
custom:cardUseCompatPadding="true" custom:cardUseCompatPadding="true"
custom:cardCornerRadius="4dp" custom:cardCornerRadius="4dp"
@@ -320,4 +320,4 @@
</org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator> </org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>

View File

@@ -1,16 +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:gravity="center"
android:background="@color/primary">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/app_name"
android:textColor="@color/white"
android:layout_gravity="center_horizontal" />
</LinearLayout>

View File

@@ -124,4 +124,4 @@
android:layout_marginBottom="8dp" /> android:layout_marginBottom="8dp" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -55,4 +55,4 @@
android:clickable="true" android:clickable="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:background="?android:selectableItemBackground" /> android:background="?android:selectableItemBackground" />
</RelativeLayout> </RelativeLayout>

View File

@@ -25,7 +25,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/none" android:text="@string/none"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="@color/header_text" /> android:textColor="?attr/colorHeaderText" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -34,4 +34,4 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

View File

@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -56,7 +60,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:background="@android:color/white"
android:textAppearance="@android:style/TextAppearance.Small" /> android:textAppearance="@android:style/TextAppearance.Small" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -25,21 +25,11 @@
android:id="@+id/import_keys_top_container" android:id="@+id/import_keys_top_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:orientation="vertical" android:orientation="vertical" />
android:background="@android:color/white" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="2dip" android:layout_height="1dip"
android:background="?android:attr/listDivider" />
<View
android:layout_width="match_parent"
android:layout_height="16dp" />
<View
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<FrameLayout <FrameLayout
@@ -47,22 +37,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical" android:orientation="vertical"
android:layout_weight="1" android:layout_weight="1" />
android:background="@android:color/white" />
<RelativeLayout <RelativeLayout
android:id="@+id/import_footer" android:id="@+id/import_footer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
android:background="@android:color/white">
<View <View
android:id="@+id/import_divider" android:id="@+id/import_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dip" android:layout_height="1dip"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<TextView <TextView
@@ -91,4 +77,4 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@@ -23,7 +23,7 @@
<!--<LinearLayout <!--<LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@@ -45,8 +45,8 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
fab:fab_addButtonColorNormal="@color/primary" fab:fab_addButtonColorNormal="?attr/colorPrimary"
fab:fab_addButtonColorPressed="@color/primary_dark" fab:fab_addButtonColorPressed="?attr/colorPrimaryDark"
fab:fab_addButtonSize="normal" fab:fab_addButtonSize="normal"
fab:fab_addButtonPlusIconColor="@color/icons" fab:fab_addButtonPlusIconColor="@color/icons"
fab:fab_expandDirection="up" fab:fab_expandDirection="up"
@@ -61,8 +61,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
fab:fab_icon="@drawable/ic_qrcode_white_24dp" fab:fab_icon="@drawable/ic_qrcode_white_24dp"
fab:fab_colorNormal="@color/primary" fab:fab_colorNormal="?attr/colorPrimary"
fab:fab_colorPressed="@color/primary_dark" fab:fab_colorPressed="?attr/colorPrimaryDark"
fab:fab_title="Scan QR Code" fab:fab_title="Scan QR Code"
fab:fab_size="mini" /> fab:fab_size="mini" />
@@ -71,8 +71,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
fab:fab_icon="@drawable/ic_cloud_search_24dp" fab:fab_icon="@drawable/ic_cloud_search_24dp"
fab:fab_colorNormal="@color/primary" fab:fab_colorNormal="?attr/colorPrimary"
fab:fab_colorPressed="@color/primary_dark" fab:fab_colorPressed="?attr/colorPrimaryDark"
fab:fab_title="Search Cloud" fab:fab_title="Search Cloud"
fab:fab_size="mini" /> fab:fab_size="mini" />
@@ -81,10 +81,10 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
fab:fab_icon="@drawable/ic_folder_white_24dp" fab:fab_icon="@drawable/ic_folder_white_24dp"
fab:fab_colorNormal="@color/primary" fab:fab_colorNormal="?attr/colorPrimary"
fab:fab_colorPressed="@color/primary_dark" fab:fab_colorPressed="?attr/colorPrimaryDark"
fab:fab_title="Import from File" fab:fab_title="Import from File"
fab:fab_size="mini" /> fab:fab_size="mini" />
</com.getbase.floatingactionbutton.FloatingActionsMenu> </com.getbase.floatingactionbutton.FloatingActionsMenu>
</RelativeLayout> </RelativeLayout>

View File

@@ -15,7 +15,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/log_img" android:id="@+id/log_img"
android:minWidth="10dp" android:minWidth="10dp"
android:background="@color/bg_gray" /> android:background="?attr/colorLogBackground" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
@@ -53,7 +53,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/log_second_img" android:id="@+id/log_second_img"
android:minWidth="10dp" android:minWidth="10dp"
android:background="@color/bg_gray" /> android:background="?attr/colorLogBackground" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
@@ -67,4 +67,4 @@
android:layout_gravity="center_vertical"/> android:layout_gravity="center_vertical"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -40,9 +40,9 @@
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
custom:strength="medium" custom:strength="medium"
custom:showGuides="false" custom:showGuides="false"
custom:color_fail="@color/android_red_light" custom:color_fail="@color/password_strength_low"
custom:color_weak="@color/android_orange_light" custom:color_weak="@color/password_strength_medium"
custom:color_strong="@color/android_green_light" /> custom:color_strong="@color/password_strength_high" />
</FrameLayout> </FrameLayout>
@@ -57,4 +57,4 @@
android:ems="10" android:ems="10"
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />
</LinearLayout> </LinearLayout>

View File

@@ -60,4 +60,4 @@
tools:src="@drawable/status_signature_revoked_cutout_24dp" tools:src="@drawable/status_signature_revoked_cutout_24dp"
/> />
</LinearLayout> </LinearLayout>

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/toolbar_include" android:id="@+id/toolbar_include"
android:elevation="4dp" android:elevation="4dp"
android:background="@color/white" android:background="?attr/colorBrightToolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar_include" android:id="@+id/toolbar_include"
android:elevation="4dp" android:elevation="4dp"
android:background="@color/white" android:background="?attr/colorBrightToolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@@ -17,8 +17,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:textColor="@color/tab_text" android:textColor="?attr/colorTabText"
app:pstsTextColorSelected="@color/tab_text_selected" app:pstsTextColorSelected="?attr/colorTabTextSelected"
app:pstsIndicatorColor="@color/tab_indicator" /> app:pstsIndicatorColor="?attr/colorTabIndicator" />
</RelativeLayout> </RelativeLayout>

View File

@@ -75,7 +75,7 @@
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
android:text="" android:text=""
tools:text="My Key" tools:text="My Key"
android:textColor="@color/tab_text" android:textColor="?attr/colorTabText"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_above="@+id/toolbar2" /> android:layout_above="@+id/toolbar2" />
@@ -200,7 +200,7 @@
tools:visibility="visible" tools:visibility="visible"
android:elevation="4dp" android:elevation="4dp"
fab:fab_icon="@drawable/ic_qrcode_white_24dp" fab:fab_icon="@drawable/ic_qrcode_white_24dp"
fab:fab_colorNormal="@color/fab" fab:fab_colorNormal="?attr/colorFab"
fab:fab_colorPressed="@color/fab_pressed" /> fab:fab_colorPressed="?attr/colorFabPressed" />
</RelativeLayout> </RelativeLayout>

View File

@@ -10,7 +10,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:padding="8dp" android:padding="8dp"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/certs_text" android:text="@string/certs_text"
@@ -45,4 +45,4 @@
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

View File

@@ -7,7 +7,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/holo_gray_bright" android:background="?attr/colorButtonRow"
android:padding="8dp" android:padding="8dp"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/key_trust_header_text" android:text="@string/key_trust_header_text"
@@ -123,4 +123,4 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>

View File

@@ -34,7 +34,7 @@
android:id="@+id/user_id_item_comment" android:id="@+id/user_id_item_comment"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/tertiary_text_light" android:textColor="?attr/colorTertiaryText"
android:text="comment" android:text="comment"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />

View File

@@ -17,7 +17,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
card_view:cardBackgroundColor="@android:color/white" card_view:cardBackgroundColor="?attr/colorCardViewBackground"
card_view:cardElevation="2dp" card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true" card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="4dp"> card_view:cardCornerRadius="4dp">
@@ -47,7 +47,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
card_view:cardBackgroundColor="@android:color/white" card_view:cardBackgroundColor="?attr/colorCardViewBackground"
card_view:cardElevation="2dp" card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true" card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="4dp"> card_view:cardCornerRadius="4dp">

View File

@@ -18,7 +18,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:transitionName="card" android:transitionName="card"
card_view:cardBackgroundColor="@android:color/white" card_view:cardBackgroundColor="?attr/colorCardViewBackground"
card_view:cardElevation="2dp" card_view:cardElevation="2dp"
card_view:cardUseCompatPadding="true" card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="4dp" card_view:cardCornerRadius="4dp"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="KeychainTheme" parent="KeychainTheme.Base"> <style name="LightTheme" parent="LightBaseTheme">
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
<!-- enable window content transitions --> <!-- enable window content transitions -->
@@ -12,4 +12,17 @@
<item name="android:windowSharedElementExitTransition">@android:transition/move</item> <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style> </style>
</resources>
<style name="DarkTheme" parent="DarkBaseTheme">
<item name="android:windowTranslucentStatus">true</item>
<!-- enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
</resources>

View File

@@ -61,4 +61,12 @@
<item>@string/key_size_custom</item> <item>@string/key_size_custom</item>
</string-array> </string-array>
<string-array name="theme_entries" translatable="false">
<item>@string/theme_dark</item>
<item>@string/theme_light</item>
</string-array>
<string-array name="theme_values" translatable="false">
<item>"dark"</item>
<item>"ligh"</item>
</string-array>
</resources> </resources>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CustomTheme">
<attr name="colorFab" format="color" />
<attr name="colorFabPressed" format="color" />
<attr name="colorFabBackground" format="color" />
<attr name="colorFabText" format="color" />
<attr name="colorEmphasis" format="color" />
<attr name="colorHeaderText" format="color" />
<attr name="colorTertiaryText" format="color" />
<attr name="colorButtonRow" format="color" />
<attr name="colorLogBackground" format="color" />
<attr name="colorCardViewHeaderDivider" format="color" />
<attr name="colorText" format="color" />
<attr name="colorBrightToolbar" format="color" />
<attr name="colorCardViewBackground" format="color" />
<attr name="colorTabText" format="color" />
<attr name="colorTabTextSelected" format="color" />
<attr name="colorTabIndicator" format="color" />
</declare-styleable>
</resources>

View File

@@ -1,54 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Main theme colors -->
<!-- green colors from OpenKeychain logo bottom right -->
<!-- your app branding color for the app bar -->
<color name="primary">#7bad45</color> <color name="primary">#7bad45</color>
<!-- darker variant for the status bar and contextual app bars -->
<color name="primary_dark">#6c983d</color>
<!-- theme UI controls like checkboxes and text fields -->
<color name="accent">#2196F3</color>
<!-- Other colors --> <color name="icons">#ffffff</color>
<color name="transparent">#00ffffff</color>
<color name="black">#000000</color> <color name="key_flag_gray">#808080</color>
<color name="key_flag_red">#f44336</color>
<color name="key_flag_orange">#ff9800</color>
<color name="key_flag_green">#7bad45</color>
<color name="primary_light">#C8E6C9</color> <color name="password_strength_low">#f44336</color>
<color name="fab">@color/accent</color> <color name="password_strength_medium">#ff9800</color>
<color name="fab_pressed">#1976D2</color> <color name="password_strength_high">#7bad45</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#727272</color>
<color name="icons">#FFFFFF</color>
<color name="divider">#B6B6B6</color>
<color name="transparent">#00FFFFFF</color>
<color name="header_text">#212121</color>
<!-- item selection, search highlight -->
<color name="emphasis">@color/accent</color>
<color name="bg_gray">#cecbce</color>
<color name="tertiary_text_light">#808080</color>
<color name="alert">#ffdd3333</color>
<color name="holo_gray_light">#33999999</color>
<color name="holo_gray_bright">#33CCCCCC</color>
<!-- tabs -->
<color name="tab_text">#70FFFFFF</color>
<color name="tab_text_selected">#FFFFFF</color>
<color name="tab_indicator">#FFFFFF</color>
<!-- floating action buttons -->
<color name="black_semi_transparent">#B2000000</color>
<color name="background">#e5e5e5</color>
<color name="half_black">#808080</color>
<color name="white">#fafafa</color>
<color name="white_pressed">#f1f1f1</color>
<!-- <!--
Standard Android colors:
http://www.google.com/design/spec/style/color.html#color-color-palette http://www.google.com/design/spec/style/color.html#color-color-palette
light = normal color light = normal color
dark = 900 dark = 900
@@ -58,10 +26,7 @@
<color name="android_red_light">#f44336</color> <color name="android_red_light">#f44336</color>
<color name="android_red_dark">#b71c1c</color> <color name="android_red_dark">#b71c1c</color>
<color name="android_orange_light">#ff9800</color> <color name="android_orange_light">#ff9800</color>
<color name="android_orange_dark">#e65100</color> <color name="android_green_light">#7bad45</color>
<color name="android_green_light">@color/primary</color> <color name="android_green_dark">#6c983d</color>
<color name="android_green_dark">@color/primary_dark</color>
<color name="android_purple_light">#673ab7</color>
<color name="android_purple_dark">#311b92</color>
</resources> </resources>

View File

@@ -50,6 +50,7 @@
<string name="section_cloud_search">"Cloud search"</string> <string name="section_cloud_search">"Cloud search"</string>
<string name="section_passphrase_cache">"Password/PIN Handling"</string> <string name="section_passphrase_cache">"Password/PIN Handling"</string>
<string name="section_proxy_settings">"Proxy Settings"</string> <string name="section_proxy_settings">"Proxy Settings"</string>
<string name="section_gui">"Interface"</string>
<string name="section_certify">"Confirm"</string> <string name="section_certify">"Confirm"</string>
<string name="section_actions">"Actions"</string> <string name="section_actions">"Actions"</string>
<string name="section_share_key">"Key"</string> <string name="section_share_key">"Key"</string>
@@ -167,6 +168,7 @@
<string name="label_verify_keyserver">"Verify keyserver"</string> <string name="label_verify_keyserver">"Verify keyserver"</string>
<string name="label_enter_keyserver_url">"Enter keyserver URL"</string> <string name="label_enter_keyserver_url">"Enter keyserver URL"</string>
<string name="label_keyserver_dialog_delete">"Delete keyserver"</string> <string name="label_keyserver_dialog_delete">"Delete keyserver"</string>
<string name="label_theme">"Theme"</string>
<string name="pref_keyserver">"OpenPGP keyservers"</string> <string name="pref_keyserver">"OpenPGP keyservers"</string>
<string name="pref_keyserver_summary">"Search keys on selected OpenPGP keyservers (HKP protocol)"</string> <string name="pref_keyserver_summary">"Search keys on selected OpenPGP keyservers (HKP protocol)"</string>
@@ -245,6 +247,8 @@
<string name="filemanager_title_open">"Open…"</string> <string name="filemanager_title_open">"Open…"</string>
<string name="error">"Error"</string> <string name="error">"Error"</string>
<string name="error_message">"Error: %s"</string> <string name="error_message">"Error: %s"</string>
<string name="theme_dark">"Dark"</string>
<string name="theme_light">"Light"</string>
<!-- key flags --> <!-- key flags -->
<string name="flag_certify">"Certify"</string> <string name="flag_certify">"Certify"</string>

View File

@@ -7,7 +7,7 @@
<item name="android:layout_marginTop">16dp</item> <item name="android:layout_marginTop">16dp</item>
<item name="android:paddingLeft">16dp</item> <item name="android:paddingLeft">16dp</item>
<item name="android:textStyle">normal</item> <item name="android:textStyle">normal</item>
<item name="android:textColor">@color/header_text</item> <item name="android:textColor">?attr/colorHeaderText</item>
<item name="android:textSize">17sp</item> <item name="android:textSize">17sp</item>
</style> </style>
@@ -17,13 +17,13 @@
<item name="android:layout_marginTop">8dp</item> <item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">8dp</item> <item name="android:paddingLeft">8dp</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:textColor">@color/header_text</item> <item name="android:textColor">?attr/colorHeaderText</item>
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
</style> </style>
<style name="FabMenuStyle"> <style name="FabMenuStyle">
<item name="android:background">@drawable/fab_label_background</item> <item name="android:background">@drawable/fab_label_background</item>
<item name="android:textColor">@color/white</item> <item name="android:textColor">?attr/colorFabText</item>
</style> </style>
<!-- This style is for use with our drag and drop RecyclerView since ItemDecoration did not <!-- This style is for use with our drag and drop RecyclerView since ItemDecoration did not
@@ -34,4 +34,4 @@
<item name="android:background">?android:attr/listDivider</item> <item name="android:background">?android:attr/listDivider</item>
</style> </style>
</resources> </resources>

View File

@@ -1,12 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="KeychainTheme" parent="KeychainTheme.Base" /> <style name="LightBaseTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#7bad45</item>
<item name="colorPrimaryDark">#6c983d</item>
<item name="colorAccent">#2196f3</item>
<item name="colorBrightToolbar">#dddddd</item>
<style name="KeychainTheme.Base" parent="Theme.AppCompat.Light"> <item name="colorFab">#2196f3</item>
<item name="colorPrimary">@color/primary</item> <item name="colorFabPressed">#1976d2</item>
<item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorFabBackground">#b2000000</item>
<item name="colorAccent">@color/accent</item> <item name="colorFabText">#fafafa</item>
<item name="colorTabText">#70ffffff</item>
<item name="colorTabTextSelected">#ffffff</item>
<item name="colorTabIndicator">#ffffff</item>
<item name="colorEmphasis">#2196f3</item>
<item name="colorButtonRow">#33cccccc</item>
<item name="colorLogBackground">#cecbce</item>
<item name="colorCardViewHeaderDivider">#808080</item>
<item name="colorCardViewBackground">#ffffff</item>
<item name="colorText">#000000</item>
<item name="colorHeaderText">#212121</item>
<item name="colorTertiaryText">#808080</item>
<!-- remove actionbar and title, we use toolbar! --> <!-- remove actionbar and title, we use toolbar! -->
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
@@ -16,6 +34,47 @@
<item name="searchViewStyle">@style/MySearchViewStyle</item> <item name="searchViewStyle">@style/MySearchViewStyle</item>
</style> </style>
<style name="DarkBaseTheme" parent="MaterialDrawerTheme.ActionBar">
<item name="colorPrimary">#268bd2</item>
<item name="colorPrimaryDark">#166bb2</item>
<item name="colorAccent">#2196f3</item>
<item name="colorBrightToolbar">#808080</item>
<item name="colorFab">#2196f3</item>
<item name="colorFabPressed">#1976d2</item>
<item name="colorFabBackground">#b2000000</item>
<item name="colorFabText">#fafafa</item>
<item name="colorTabText">#70ffffff</item>
<item name="colorTabTextSelected">#ffffff</item>
<item name="colorTabIndicator">#ffffff</item>
<item name="colorEmphasis">#2196f3</item>
<item name="colorButtonRow">#33cccccc</item>
<item name="colorLogBackground">#303030</item>
<item name="colorCardViewHeaderDivider">#808080</item>
<item name="colorCardViewBackground">#505050</item>
<item name="colorText">#ffffff</item>
<item name="colorHeaderText">#d0d0d0</item>
<item name="colorTertiaryText">#808080</item>
<item name="material_drawer_selected_text">#268bd2</item>
<!-- remove actionbar and title, we use toolbar! -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<!-- multi selection should overlay Toolbar! http://stackoverflow.com/a/26450875 -->
<item name="windowActionModeOverlay">true</item>
<item name="searchViewStyle">@style/MySearchViewStyle</item>
</style>
<style name="LightTheme" parent="LightBaseTheme">
</style>
<style name="DarkTheme" parent="DarkBaseTheme">
</style>
<!-- http://android-developers.blogspot.de/2014/10/appcompat-v21-material-design-for-pre.html --> <!-- http://android-developers.blogspot.de/2014/10/appcompat-v21-material-design-for-pre.html -->
<style name="MySearchViewStyle" parent="Widget.AppCompat.SearchView"> <style name="MySearchViewStyle" parent="Widget.AppCompat.SearchView">
<!-- Background for the search query section (e.g. EditText) --> <!-- Background for the search query section (e.g. EditText) -->
@@ -40,4 +99,4 @@
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
</resources> </resources>

View File

@@ -0,0 +1,10 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<ListPreference
android:persistent="false"
android:key="theme"
android:title="@string/label_theme"
android:entries="@array/theme_entries"
android:entryValues="@array/theme_values"
android:dialogTitle="@string/label_theme" />
</PreferenceScreen>

View File

@@ -1,4 +1,7 @@
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> <preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<!--<header-->
<!--android:fragment="org.sufficientlysecure.keychain.ui.SettingsActivity$GuiPrefsFragment"-->
<!--android:title="@string/section_gui" />-->
<header <header
android:fragment="org.sufficientlysecure.keychain.ui.SettingsActivity$CloudSearchPrefsFragment" android:fragment="org.sufficientlysecure.keychain.ui.SettingsActivity$CloudSearchPrefsFragment"
android:title="@string/section_cloud_search" /> android:title="@string/section_cloud_search" />

View File

@@ -7,5 +7,5 @@ include ':extern:spongycastle:pkix'
include ':extern:spongycastle:prov' include ':extern:spongycastle:prov'
include ':extern:minidns' include ':extern:minidns'
include ':extern:KeybaseLib:Lib' include ':extern:KeybaseLib:Lib'
include ':extern:safeslinger-exchange' include ':extern:safeslinger-exchange:safeslinger-exchange'
include ':extern:snackbar:lib' include ':extern:snackbar:lib'

View File

@@ -1 +1 @@
checkstyle -c tools/checkstyle.xml -r OpenPGP-Keychain/src/main/java 2>&1 | egrep -v 'log4j' checkstyle -c tools/checkstyle.xml -r OpenKeychain/src/main/java 2>&1 | egrep -v 'log4j'