aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java3
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyAdapter.java5
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CustomAlertDialogBuilder.java1
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java8
-rw-r--r--OpenKeychain/src/main/res/drawable/section_header.xml4
-rw-r--r--OpenKeychain/src/main/res/layout/add_user_id_dialog.xml2
-rw-r--r--OpenKeychain/src/main/res/layout/create_key_final_fragment.xml6
-rw-r--r--OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml2
-rw-r--r--OpenKeychain/src/main/res/layout/file_list_entry.xml2
-rw-r--r--OpenKeychain/src/main/res/layout/foldable_linearlayout.xml4
-rw-r--r--OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml2
-rw-r--r--OpenKeychain/src/main/res/layout/view_key_adv_user_id_item.xml2
-rw-r--r--OpenKeychain/src/main/res/values/attrs.xml2
-rw-r--r--OpenKeychain/src/main/res/values/colors.xml4
-rw-r--r--OpenKeychain/src/main/res/values/styles.xml6
-rw-r--r--OpenKeychain/src/main/res/values/themes.xml5
20 files changed, 44 insertions, 36 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java
index 65baf0593..5ca7c6bc7 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyFragment.java
@@ -53,6 +53,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
import org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter;
import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment;
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.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
@@ -154,7 +155,7 @@ public class CertifyKeyFragment
// make certify image gray, like action icons
ImageView vActionCertifyImage =
(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);
View vCertifyButton = view.findViewById(R.id.certify_key_certify_button);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index 21af2c83b..0488d8235 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -28,7 +28,6 @@ import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources.Theme;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
@@ -47,7 +46,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.util.TypedValue;
import android.widget.AbsListView.MultiChoiceModeListener;
import android.widget.AdapterView;
import android.widget.ListView;
@@ -70,6 +68,7 @@ import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter;
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
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.Style;
import org.sufficientlysecure.keychain.util.FabContainer;
@@ -710,10 +709,7 @@ public class KeyListFragment extends LoaderFragment
// let the adapter handle setting up the row views
View v = super.getView(position, convertView, parent);
- TypedValue typedValue = new TypedValue();
- Theme theme = mContext.getTheme();
- theme.resolveAttribute(R.attr.colorEmphasis, typedValue, true);
- int colorEmphasis = typedValue.data;
+ int colorEmphasis = FormattingUtils.getColorFromAttr(mContext, R.attr.colorEmphasis);
if (mSelection.get(position) != null) {
// selected position color
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java
index d15cea5a4..534dbfd05 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java
@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
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.util.Log;
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);
- buttonIcon.setColorFilter(getResources().getColor(R.color.tertiary_text_light),
+ buttonIcon.setColorFilter(FormattingUtils.getColorFromAttr(this, R.attr.colorTertiaryText),
PorterDuff.Mode.SRC_IN);
View button = findViewById(R.id.safe_slinger_button);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java
index 65f70ec14..4a46896bc 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvShareFragment.java
@@ -58,6 +58,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
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.Notify;
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);
ImageButton vKeySafeSlingerButton = (ImageButton) view.findViewById(R.id.view_key_action_key_safeslinger);
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);
vFingerprintShareButton.setOnClickListener(new View.OnClickListener() {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyAdapter.java
index fbab1959a..0507923f7 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyAdapter.java
@@ -42,6 +42,7 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
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.State;
@@ -49,6 +50,7 @@ public class KeyAdapter extends CursorAdapter {
protected String mQuery;
protected LayoutInflater mInflater;
+ protected Context mContext;
// These are the rows that we will retrieve.
public static final String[] PROJECTION = new String[]{
@@ -77,6 +79,7 @@ public class KeyAdapter extends CursorAdapter {
public KeyAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
+ mContext = context;
mInflater = LayoutInflater.from(context);
}
@@ -151,7 +154,7 @@ public class KeyAdapter extends CursorAdapter {
mStatus.setVisibility(View.GONE);
if (mSlingerButton.hasOnClickListeners()) {
mSlingerButton.setColorFilter(
- context.getResources().getColor(R.color.tertiary_text_light),
+ FormattingUtils.getColorFromAttr(context, R.attr.colorTertiaryText),
PorterDuff.Mode.SRC_IN);
mSlinger.setVisibility(View.VISIBLE);
} else {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CustomAlertDialogBuilder.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CustomAlertDialogBuilder.java
index 8a5cc0656..840b95a3c 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CustomAlertDialogBuilder.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CustomAlertDialogBuilder.java
@@ -28,5 +28,4 @@ public class CustomAlertDialogBuilder extends AlertDialog.Builder {
public CustomAlertDialogBuilder(Context context) {
super(context);
}
-
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java
index eb5c3df45..902a7ec56 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java
@@ -18,9 +18,11 @@
package org.sufficientlysecure.keychain.ui.util;
import android.content.Context;
+import android.content.res.Resources.Theme;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.StrikethroughSpan;
+import android.util.TypedValue;
public class FormattingUtils {
@@ -32,4 +34,10 @@ public class FormattingUtils {
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;
+ }
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java
index 22c5315a9..ac34d5526 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java
@@ -18,12 +18,11 @@
package org.sufficientlysecure.keychain.ui.util;
import android.content.Context;
-import android.content.res.Resources.Theme;
import android.text.Spannable;
import android.text.style.ForegroundColorSpan;
-import android.util.TypedValue;
import org.sufficientlysecure.keychain.R;
+import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -47,10 +46,7 @@ public class Highlighter {
Pattern pattern = Pattern.compile("(?i)(" + mQuery.trim().replaceAll("\\s+", "|") + ")");
Matcher matcher = pattern.matcher(text);
- TypedValue typedValue = new TypedValue();
- Theme theme = mContext.getTheme();
- theme.resolveAttribute(R.attr.colorEmphasis, typedValue, true);
- int colorEmphasis = typedValue.data;
+ int colorEmphasis = FormattingUtils.getColorFromAttr(mContext, R.attr.colorEmphasis);
while (matcher.find()) {
highlight.setSpan(
diff --git a/OpenKeychain/src/main/res/drawable/section_header.xml b/OpenKeychain/src/main/res/drawable/section_header.xml
index 04d3d4957..4bee8049b 100644
--- a/OpenKeychain/src/main/res/drawable/section_header.xml
+++ b/OpenKeychain/src/main/res/drawable/section_header.xml
@@ -6,6 +6,6 @@
android:height="2dp"
android:width="1000dp" />
- <solid android:color="@color/header_text" />
+ <solid android:color="?attr/colorHeaderText" />
-</shape> \ No newline at end of file
+</shape>
diff --git a/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml b/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml
index ffb7493f6..b3969a2bd 100644
--- a/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml
+++ b/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml
@@ -29,7 +29,7 @@
android:id="@+id/add_user_id_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textColor="@color/tertiary_text_light"
+ android:textColor="?attr/colorTertiaryText"
android:singleLine="true"
android:lines="1"
android:maxLines="1"
diff --git a/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml
index e085fcb09..51b3c087c 100644
--- a/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml
@@ -28,7 +28,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:text="@string/label_name"
- android:textColor="@color/tertiary_text_light"
+ android:textColor="?attr/colorTertiaryText"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
@@ -44,7 +44,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:text="@string/label_email"
- android:textColor="@color/tertiary_text_light"
+ android:textColor="?attr/colorTertiaryText"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
@@ -182,4 +182,4 @@
style="?android:attr/borderlessButtonStyle" />
</LinearLayout>
-</RelativeLayout> \ No newline at end of file
+</RelativeLayout>
diff --git a/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml
index 925b7d778..7bd919abc 100644
--- a/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml
+++ b/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml
@@ -124,4 +124,4 @@
android:layout_marginBottom="8dp" />
</LinearLayout>
-</ScrollView> \ No newline at end of file
+</ScrollView>
diff --git a/OpenKeychain/src/main/res/layout/file_list_entry.xml b/OpenKeychain/src/main/res/layout/file_list_entry.xml
index 7f0e1e89e..e1b03f8ae 100644
--- a/OpenKeychain/src/main/res/layout/file_list_entry.xml
+++ b/OpenKeychain/src/main/res/layout/file_list_entry.xml
@@ -55,4 +55,4 @@
android:clickable="true"
android:layout_centerVertical="true"
android:background="?android:selectableItemBackground" />
-</RelativeLayout> \ No newline at end of file
+</RelativeLayout>
diff --git a/OpenKeychain/src/main/res/layout/foldable_linearlayout.xml b/OpenKeychain/src/main/res/layout/foldable_linearlayout.xml
index 773a9d416..a7b1e6a53 100644
--- a/OpenKeychain/src/main/res/layout/foldable_linearlayout.xml
+++ b/OpenKeychain/src/main/res/layout/foldable_linearlayout.xml
@@ -25,7 +25,7 @@
android:layout_height="wrap_content"
android:text="@string/none"
android:layout_gravity="center_vertical"
- android:textColor="@color/header_text" />
+ android:textColor="?attr/colorHeaderText" />
</LinearLayout>
<LinearLayout
@@ -34,4 +34,4 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone" />
-</LinearLayout> \ No newline at end of file
+</LinearLayout>
diff --git a/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml b/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml
index a9e86057c..2b39cf54c 100644
--- a/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml
+++ b/OpenKeychain/src/main/res/layout/recipient_selection_list_entry.xml
@@ -60,4 +60,4 @@
tools:src="@drawable/status_signature_revoked_cutout_24dp"
/>
-</LinearLayout> \ No newline at end of file
+</LinearLayout>
diff --git a/OpenKeychain/src/main/res/layout/view_key_adv_user_id_item.xml b/OpenKeychain/src/main/res/layout/view_key_adv_user_id_item.xml
index 1c55a1446..a9ebe43d3 100644
--- a/OpenKeychain/src/main/res/layout/view_key_adv_user_id_item.xml
+++ b/OpenKeychain/src/main/res/layout/view_key_adv_user_id_item.xml
@@ -34,7 +34,7 @@
android:id="@+id/user_id_item_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="@color/tertiary_text_light"
+ android:textColor="?attr/colorTertiaryText"
android:text="comment"
android:textAppearance="?android:attr/textAppearanceSmall" />
diff --git a/OpenKeychain/src/main/res/values/attrs.xml b/OpenKeychain/src/main/res/values/attrs.xml
index ce110418e..1755756fb 100644
--- a/OpenKeychain/src/main/res/values/attrs.xml
+++ b/OpenKeychain/src/main/res/values/attrs.xml
@@ -4,5 +4,7 @@
<attr name="colorFab" format="color" />
<attr name="colorFabPressed" format="color" />
<attr name="colorEmphasis" format="color" />
+ <attr name="colorHeaderText" format="color" />
+ <attr name="colorTertiaryText" format="color" />
</declare-styleable>
</resources>
diff --git a/OpenKeychain/src/main/res/values/colors.xml b/OpenKeychain/src/main/res/values/colors.xml
index b6b46ec8c..3d9e3e1ed 100644
--- a/OpenKeychain/src/main/res/values/colors.xml
+++ b/OpenKeychain/src/main/res/values/colors.xml
@@ -4,11 +4,7 @@
<color name="icons">#FFFFFF</color>
<color name="transparent">#00FFFFFF</color>
- <color name="header_text">#212121</color>
-
<color name="bg_gray">#cecbce</color>
- <color name="tertiary_text_light">#808080</color>
- <color name="alert">#ffdd3333</color>
<color name="holo_gray_bright">#33CCCCCC</color>
diff --git a/OpenKeychain/src/main/res/values/styles.xml b/OpenKeychain/src/main/res/values/styles.xml
index c7b326b7a..e21e3749c 100644
--- a/OpenKeychain/src/main/res/values/styles.xml
+++ b/OpenKeychain/src/main/res/values/styles.xml
@@ -7,7 +7,7 @@
<item name="android:layout_marginTop">16dp</item>
<item name="android:paddingLeft">16dp</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>
</style>
@@ -17,7 +17,7 @@
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">8dp</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>
</style>
@@ -34,4 +34,4 @@
<item name="android:background">?android:attr/listDivider</item>
</style>
-</resources> \ No newline at end of file
+</resources>
diff --git a/OpenKeychain/src/main/res/values/themes.xml b/OpenKeychain/src/main/res/values/themes.xml
index 823622269..a9a12966a 100644
--- a/OpenKeychain/src/main/res/values/themes.xml
+++ b/OpenKeychain/src/main/res/values/themes.xml
@@ -10,6 +10,9 @@
<item name="colorFabPressed">#1976d2</item>
<item name="colorEmphasis">#2196f3</item>
+ <item name="colorHeaderText">#212121</item>
+ <item name="colorTertiaryText">#808080</item>
+
<!-- remove actionbar and title, we use toolbar! -->
<item name="windowNoTitle">true</item>
@@ -28,6 +31,8 @@
<item name="colorFabPressed">#1976d2</item>
<item name="colorEmphasis">#2196f3</item>
+ <item name="colorHeaderText">#a0a0a0</item>
+ <item name="colorTertiaryText">#808080</item>
<!-- remove actionbar and title, we use toolbar! -->
<item name="windowNoTitle">true</item>