Give key flag colors their own color names

This removes "bg_gray" and selector_transparent_button.xml, which is
unused and the last file to reference "bg_gray".
This commit is contained in:
Thialfihar 2015-06-26 12:05:15 +02:00
parent 6b8127ca94
commit dfe5a64fb0
11 changed files with 47 additions and 51 deletions

View file

@ -760,7 +760,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
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);
mActionEncryptText.setVisibility(View.GONE);
@ -776,7 +776,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
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);
mActionEncryptText.setVisibility(View.GONE);
@ -846,7 +846,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
mStatusImage.setVisibility(View.VISIBLE);
KeyFormattingUtils.setStatusImage(this, mStatusImage, mStatusText,
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);
}
@ -943,4 +943,4 @@ public class ViewKeyActivity extends BaseNfcActivity implements
public boolean onCryptoSetProgress(String msg, int progress, int max) {
return true;
}
}
}

View file

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

View file

@ -177,9 +177,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
}
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()) {
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()) {
@ -188,9 +188,9 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
// no more space for algorithm display
holder.algorithm.setVisibility(View.GONE);
holder.mainUserId.setTextColor(getContext().getResources().getColor(R.color.bg_gray));
holder.mainUserIdRest.setTextColor(getContext().getResources().getColor(R.color.bg_gray));
holder.keyId.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.key_flag_gray));
holder.keyId.setTextColor(getContext().getResources().getColor(R.color.key_flag_gray));
} else {
holder.status.setVisibility(View.GONE);
holder.algorithm.setVisibility(View.VISIBLE);
@ -242,7 +242,7 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
uidView.setPadding(0, 0, FormattingUtils.dpToPx(getContext(), 8), 0);
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 {
uidView.setTextColor(getContext().getResources().getColor(R.color.black));
}
@ -258,7 +258,7 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
emailView.setText(highlighter.highlight(email));
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 {
emailView.setTextColor(getContext().getResources().getColor(R.color.black));
}

View file

@ -141,15 +141,15 @@ public class KeyAdapter extends CursorAdapter {
// Note: order is important!
if (item.mIsRevoked) {
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);
mSlinger.setVisibility(View.GONE);
textColor = R.color.bg_gray;
textColor = context.getResources().getColor(R.color.key_flag_gray);
} 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);
mSlinger.setVisibility(View.GONE);
textColor = R.color.bg_gray;
textColor = context.getResources().getColor(R.color.key_flag_gray);
} else if (item.mIsSecret) {
mStatus.setVisibility(View.GONE);
if (mSlingerButton.hasOnClickListeners()) {
@ -175,11 +175,11 @@ public class KeyAdapter extends CursorAdapter {
}
if (!enabled) {
textColor = R.color.bg_gray;
textColor = context.getResources().getColor(R.color.key_flag_gray);
}
mMainUserId.setTextColor(context.getResources().getColor(textColor));
mMainUserIdRest.setTextColor(context.getResources().getColor(textColor));
mMainUserId.setTextColor(textColor);
mMainUserIdRest.setTextColor(textColor);
if (item.mHasDuplicate) {
String dateTime = DateUtils.formatDateTime(context,

View file

@ -149,11 +149,11 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter {
boolean enabled;
if (cursor.getInt(mIndexIsRevoked) != 0) {
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;
} else if (cursor.getInt(mIndexIsExpiry) != 0) {
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;
} else {
h.statusIcon.setVisibility(View.GONE);

View file

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

View file

@ -128,7 +128,7 @@ public class UserIdsAdapter extends UserAttributesAdapter {
if (isRevoked) {
// 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
vName.setEnabled(false);

View file

@ -595,7 +595,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_verified_cutout_24dp));
}
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_green_light;
color = R.color.key_flag_green;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -608,7 +608,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_lock_closed_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_green_light;
color = R.color.key_flag_green;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -627,7 +627,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_unverified_cutout_24dp));
}
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_orange_light;
color = R.color.key_flag_orange;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -640,7 +640,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light;
color = R.color.key_flag_red;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -659,7 +659,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_revoked_cutout_24dp));
}
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light;
color = R.color.key_flag_red;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -677,7 +677,7 @@ public class KeyFormattingUtils {
context.getResources().getDrawable(R.drawable.status_signature_expired_cutout_24dp));
}
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light;
color = R.color.key_flag_red;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -690,7 +690,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_lock_open_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light;
color = R.color.key_flag_red;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -703,7 +703,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light;
color = R.color.key_flag_red;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -716,7 +716,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.android_red_light;
color = R.color.key_flag_red;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);
@ -730,7 +730,7 @@ public class KeyFormattingUtils {
statusIcon.setImageDrawable(
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout_24dp));
if (color == KeyFormattingUtils.DEFAULT_COLOR) {
color = R.color.bg_gray;
color = R.color.key_flag_gray;
}
statusIcon.setColorFilter(context.getResources().getColor(color),
PorterDuff.Mode.SRC_IN);

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

@ -87,7 +87,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/create_key_rsa"
android:textColor="@color/android_green_light"
android:textColor="?attr/colorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:minHeight="?android:attr/listPreferredItemHeight"
android:clickable="true"
@ -129,7 +129,7 @@
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:text="@string/create_key_final_robot_text"
android:textColor="@color/android_green_light"
android:textColor="?attr/colorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableLeft="@drawable/create_key_robot"
android:drawablePadding="8dp" />

View file

@ -4,7 +4,10 @@
<color name="icons">#FFFFFF</color>
<color name="transparent">#00FFFFFF</color>
<color name="bg_gray">#00ff00</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>
<!-- tabs -->
<color name="tab_text">#70FFFFFF</color>
@ -27,8 +30,8 @@
<color name="android_red_dark">#b71c1c</color>
<color name="android_orange_light">#ff9800</color>
<color name="android_orange_dark">#e65100</color>
<color name="android_green_light">#00ff00</color>
<color name="android_green_dark">#008000</color>
<color name="android_green_light">#7bad45</color>
<color name="android_green_dark">#6c983d</color>
<color name="android_purple_light">#673ab7</color>
<color name="android_purple_dark">#311b92</color>