Add an option to show individual timeout bars for each entry
Closes #166
This commit is contained in:
parent
36b84ae0bc
commit
c5e4ba1e19
9 changed files with 541 additions and 499 deletions
|
@ -583,4 +583,8 @@ public class Settings {
|
||||||
public boolean isHideGlobalTimeoutEnabled() {
|
public boolean isHideGlobalTimeoutEnabled() {
|
||||||
return getBoolean(R.string.settings_key_hide_global_timeout, false);
|
return getBoolean(R.string.settings_key_hide_global_timeout, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowIndividualTimeoutsEnabled() {
|
||||||
|
return getBoolean(R.string.settings_key_show_individual_timeouts, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
package org.shadowice.flocke.andotp.View;
|
package org.shadowice.flocke.andotp.View;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ClipData;
|
|
||||||
import android.content.ClipboardManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
@ -231,15 +229,17 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntryViewHolder>
|
||||||
|
|
||||||
for (Entry e : entries) {
|
for (Entry e : entries) {
|
||||||
if (e.isTimeBased()) {
|
if (e.isTimeBased()) {
|
||||||
|
boolean cardVisible = !settings.getTapToReveal() || e.isVisible();
|
||||||
|
|
||||||
boolean item_changed = e.updateOTP();
|
boolean item_changed = e.updateOTP();
|
||||||
boolean color_changed = false;
|
boolean color_changed = false;
|
||||||
|
|
||||||
//Check color change only if highlighting token feature is enabled
|
// Check color change only if highlighting token feature is enabled and the entry is visible
|
||||||
if(settings.isHighlightTokenOptionEnabled()) {
|
if(settings.isHighlightTokenOptionEnabled())
|
||||||
color_changed = e.hasColorChanged();
|
color_changed = cardVisible && e.hasColorChanged();
|
||||||
}
|
|
||||||
|
|
||||||
change = change || item_changed || e.hasNonDefaultPeriod() || color_changed;
|
change = change || item_changed || color_changed ||
|
||||||
|
(cardVisible && (e.hasNonDefaultPeriod() || settings.isShowIndividualTimeoutsEnabled()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,9 +198,13 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
||||||
thumbnailImg.setImageBitmap(EntryThumbnail.getThumbnailGraphic(context, entry.getIssuer(), entry.getLabel(), thumbnailSize, entry.getThumbnail()));
|
thumbnailImg.setImageBitmap(EntryThumbnail.getThumbnailGraphic(context, entry.getIssuer(), entry.getLabel(), thumbnailSize, entry.getThumbnail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.isTimeBased() && entry.hasNonDefaultPeriod()) {
|
if (entry.isTimeBased() && (entry.hasNonDefaultPeriod() || settings.isShowIndividualTimeoutsEnabled())) {
|
||||||
|
if (!this.tapToReveal || entry.isVisible()) {
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
updateProgress(entry);
|
updateProgress(entry);
|
||||||
|
} else {
|
||||||
|
progressBar.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,11 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -221,7 +226,6 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||||
android:id="@+id/cardProgressBar"
|
android:id="@+id/cardProgressBar"
|
||||||
|
@ -237,4 +241,8 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
|
@ -38,6 +38,11 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -221,7 +226,6 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||||
android:id="@+id/cardProgressBar"
|
android:id="@+id/cardProgressBar"
|
||||||
|
@ -237,4 +241,8 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
|
@ -38,6 +38,11 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -207,7 +212,6 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||||
android:id="@+id/cardProgressBar"
|
android:id="@+id/cardProgressBar"
|
||||||
|
@ -223,4 +227,8 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
|
@ -34,6 +34,7 @@
|
||||||
<string name="settings_key_search_includes" translatable="false">pref_search_includes</string>
|
<string name="settings_key_search_includes" translatable="false">pref_search_includes</string>
|
||||||
<string name="settings_key_label_highlight_token" translatable="false">pref_label_highlight_token</string>
|
<string name="settings_key_label_highlight_token" translatable="false">pref_label_highlight_token</string>
|
||||||
<string name="settings_key_hide_global_timeout" translatable="false">pref_hide_global_timeout</string>
|
<string name="settings_key_hide_global_timeout" translatable="false">pref_hide_global_timeout</string>
|
||||||
|
<string name="settings_key_show_individual_timeouts" translatable="false">pref_show_individual_timeouts</string>
|
||||||
|
|
||||||
<string name="settings_key_backup_append_date_time" translatable="false">pref_backup_append_date_time</string>
|
<string name="settings_key_backup_append_date_time" translatable="false">pref_backup_append_date_time</string>
|
||||||
<string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string>
|
<string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string>
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
<string name="settings_title_search_includes">Search behavior</string>
|
<string name="settings_title_search_includes">Search behavior</string>
|
||||||
<string name="settings_title_label_highlight_token">Highlight expiring tokens</string>
|
<string name="settings_title_label_highlight_token">Highlight expiring tokens</string>
|
||||||
<string name="settings_title_hide_global_timeout">Hide global timeout bar</string>
|
<string name="settings_title_hide_global_timeout">Hide global timeout bar</string>
|
||||||
|
<string name="settings_title_show_individual_timeouts">Show individual timeouts</string>
|
||||||
|
|
||||||
<string name="settings_title_backup_append_date">Append date to filename</string>
|
<string name="settings_title_backup_append_date">Append date to filename</string>
|
||||||
<string name="settings_title_backup_ask">Ask for filename</string>
|
<string name="settings_title_backup_ask">Ask for filename</string>
|
||||||
|
@ -72,7 +73,9 @@
|
||||||
<string name="settings_desc_minimize_on_copy">App will be minimized when you copy the OTP to clipboard</string>
|
<string name="settings_desc_minimize_on_copy">App will be minimized when you copy the OTP to clipboard</string>
|
||||||
<string name="settings_desc_search_includes">Specify which values should be included when searching</string>
|
<string name="settings_desc_search_includes">Specify which values should be included when searching</string>
|
||||||
<string name="settings_desc_label_highlight_token">Highlights token in red if it\'s expiring in 8 seconds</string>
|
<string name="settings_desc_label_highlight_token">Highlights token in red if it\'s expiring in 8 seconds</string>
|
||||||
<string name="settings_desc_hide_global_timeout">Hide the global timeout bar shown at the top of the screen.</string>
|
<string name="settings_desc_hide_global_timeout">Hide the global timeout bar shown at the top of the screen</string>
|
||||||
|
<string name="settings_desc_show_individual_timeouts">Show an individual timeout bar for every entry.
|
||||||
|
This can slow down the app, only enable if really necessary.</string>
|
||||||
|
|
||||||
<string name="settings_desc_backup_append_date">Append the current date and time to the suggested
|
<string name="settings_desc_backup_append_date">Append the current date and time to the suggested
|
||||||
backup filename</string>
|
backup filename</string>
|
||||||
|
|
|
@ -167,6 +167,12 @@
|
||||||
android:summary="@string/settings_desc_hide_global_timeout"
|
android:summary="@string/settings_desc_hide_global_timeout"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/settings_key_show_individual_timeouts"
|
||||||
|
android:title="@string/settings_title_show_individual_timeouts"
|
||||||
|
android:summary="@string/settings_desc_show_individual_timeouts"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|
Loading…
Reference in a new issue