Modified code to change color on expiry only for OTP values.
This commit is contained in:
parent
9a3b408720
commit
0f32b69a9d
3 changed files with 2 additions and 18 deletions
|
@ -23,7 +23,6 @@
|
|||
|
||||
package org.shadowice.flocke.andotp.Database;
|
||||
|
||||
import android.graphics.ColorFilter;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.apache.commons.codec.binary.Base32;
|
||||
|
|
|
@ -62,9 +62,7 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
private LinearLayout counterLayout;
|
||||
private FrameLayout thumbnailFrame;
|
||||
private ImageView visibleImg;
|
||||
private ImageView invisibleImg;
|
||||
private ImageView thumbnailImg;
|
||||
private TextView hidden;
|
||||
private TextView value;
|
||||
private TextView issuer;
|
||||
private TextView label;
|
||||
|
@ -80,7 +78,6 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
card = v.findViewById(R.id.card_view);
|
||||
value = v.findViewById(R.id.valueText);
|
||||
valueLayout = v.findViewById(R.id.valueLayout);
|
||||
hidden = v.findViewById(R.id.hiddenText);
|
||||
visibleImg = v.findViewById(R.id.valueImg);
|
||||
thumbnailFrame = v.findViewById(R.id.thumbnailFrame);
|
||||
thumbnailImg = v.findViewById(R.id.thumbnailImg);
|
||||
|
@ -91,10 +88,10 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
counterLayout = v.findViewById(R.id.counterLayout);
|
||||
counter = v.findViewById(R.id.counter);
|
||||
progressBar = v.findViewById(R.id.cardProgressBar);
|
||||
invisibleImg = v.findViewById(R.id.coverImg);
|
||||
|
||||
ImageButton menuButton = v.findViewById(R.id.menuButton);
|
||||
ImageButton copyButton = v.findViewById(R.id.copyButton);
|
||||
ImageView invisibleImg = v.findViewById(R.id.coverImg);
|
||||
|
||||
// Style the buttons in the current theme colors
|
||||
ColorFilter colorFilter = Tools.getThemeColorFilter(context, android.R.attr.textColorSecondary);
|
||||
|
@ -300,29 +297,18 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
void onCounterLongPressed(int position);
|
||||
}
|
||||
/**
|
||||
* Updates the color of the following items to red (if expiring) or default color (if new OTP)
|
||||
* TextViews: OTP, "Hidden" text, issuer, label, tags
|
||||
* ImageViews: Visible, Invisible
|
||||
* Updates the color of OTP to red (if expiring) or default color (if new OTP)
|
||||
*
|
||||
* @param color will define if the color needs to be changed to red or default
|
||||
* */
|
||||
public void updateColor(int color) {
|
||||
int textColor;
|
||||
ColorFilter colorFilter;
|
||||
if(color == Entry.COLOR_RED) {
|
||||
textColor = Tools.getThemeColor(context, R.attr.colorExpiring);
|
||||
colorFilter = Tools.getThemeColorFilter(context, R.attr.colorExpiring);
|
||||
} else {
|
||||
textColor = Tools.getThemeColor(context, android.R.attr.textColorSecondary);
|
||||
colorFilter = Tools.getThemeColorFilter(context, android.R.attr.textColorSecondary);
|
||||
}
|
||||
|
||||
value.setTextColor(textColor);
|
||||
hidden.setTextColor(textColor);
|
||||
issuer.setTextColor(textColor);
|
||||
label.setTextColor(textColor);
|
||||
tags.setTextColor(textColor);
|
||||
visibleImg.setColorFilter(colorFilter);
|
||||
invisibleImg.setColorFilter(colorFilter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
app:srcCompat="@drawable/ic_visibility_invisible"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hiddenText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.4"
|
||||
|
|
Loading…
Reference in a new issue