Added show recent option

pull/207/head
M66B 3 years ago
parent aa772f63b8
commit 5a16ff468b

@ -74,6 +74,7 @@ import android.text.style.QuoteSpan;
import android.text.style.RelativeSizeSpan; import android.text.style.RelativeSizeSpan;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.util.Pair; import android.util.Pair;
import android.util.TypedValue; import android.util.TypedValue;
@ -296,6 +297,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private static boolean debug; private static boolean debug;
private int level; private int level;
private boolean webview_legacy; private boolean webview_legacy;
private boolean show_recent;
private boolean gotoTop = false; private boolean gotoTop = false;
private Integer gotoPos = null; private Integer gotoPos = null;
@ -1339,10 +1341,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSize.setVisibility( tvSize.setVisibility(
message.totalSize != null && ("size".equals(sort) || "attachments".equals(sort)) message.totalSize != null && ("size".equals(sort) || "attachments".equals(sort))
? View.VISIBLE : View.GONE); ? View.VISIBLE : View.GONE);
tvTime.setText(date && FragmentMessages.SORT_DATE_HEADER.contains(sort) SpannableStringBuilder time = new SpannableStringBuilderEx(
? TF.format(message.received) date && FragmentMessages.SORT_DATE_HEADER.contains(sort)
: Helper.getRelativeTimeSpanString(context, message.received)); ? TF.format(message.received)
tvTime.setTextColor(BuildConfig.DEBUG && message.recent ? colorAccent : textColorTertiary); : Helper.getRelativeTimeSpanString(context, message.received));
if (show_recent && message.recent)
time.setSpan(new UnderlineSpan(), 0, time.length(), 0);
tvTime.setText(time);
// Line 2 // Line 2
tvSubject.setText(message.subject); tvSubject.setText(message.subject);
@ -6959,6 +6964,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
level = prefs.getInt("log_level", Log.getDefaultLogLevel()); level = prefs.getInt("log_level", Log.getDefaultLogLevel());
webview_legacy = prefs.getBoolean("webview_legacy", false); webview_legacy = prefs.getBoolean("webview_legacy", false);
show_recent = prefs.getBoolean("show_recent", false);
DiffUtil.ItemCallback<TupleMessageEx> callback = new DiffUtil.ItemCallback<TupleMessageEx>() { DiffUtil.ItemCallback<TupleMessageEx> callback = new DiffUtil.ItemCallback<TupleMessageEx>() {
@Override @Override

@ -155,7 +155,8 @@ public class FragmentOptions extends FragmentBase {
"swipe_reply", "swipe_reply",
"language_detection", "language_detection",
"quick_filter", "quick_scroll", "quick_filter", "quick_scroll",
"experiments", "debug", "log_level", "test1", "test2", "test3", "test4", "test5", "webview_legacy", "experiments", "debug", "log_level", "test1", "test2", "test3", "test4", "test5",
"webview_legacy", "browser_zoom", "show_recent",
"biometrics", "biometrics",
"default_light" "default_light"
}; };

@ -159,6 +159,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swUndoManager; private SwitchCompat swUndoManager;
private SwitchCompat swWebViewLegacy; private SwitchCompat swWebViewLegacy;
private SwitchCompat swBrowserZoom; private SwitchCompat swBrowserZoom;
private SwitchCompat swShowRecent;
private SwitchCompat swModSeq; private SwitchCompat swModSeq;
private SwitchCompat swUid; private SwitchCompat swUid;
private SwitchCompat swExpunge; private SwitchCompat swExpunge;
@ -213,7 +214,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"test2", "test3", "test4", "test5", "test2", "test3", "test4", "test5",
"work_manager", // "external_storage", "work_manager", // "external_storage",
"query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache", "query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache",
"chunk_size", "thread_range", "undo_manager", "webview_legacy", "browser_zoom", "chunk_size", "thread_range", "undo_manager", "webview_legacy", "browser_zoom", "show_recent",
"use_modseq", "uid_command", "perform_expunge", "uid_expunge", "use_modseq", "uid_command", "perform_expunge", "uid_expunge",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop",
"keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff", "keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff",
@ -332,6 +333,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swUndoManager = view.findViewById(R.id.swUndoManager); swUndoManager = view.findViewById(R.id.swUndoManager);
swWebViewLegacy = view.findViewById(R.id.swWebViewLegacy); swWebViewLegacy = view.findViewById(R.id.swWebViewLegacy);
swBrowserZoom = view.findViewById(R.id.swBrowserZoom); swBrowserZoom = view.findViewById(R.id.swBrowserZoom);
swShowRecent = view.findViewById(R.id.swShowRecent);
swModSeq = view.findViewById(R.id.swModSeq); swModSeq = view.findViewById(R.id.swModSeq);
swUid = view.findViewById(R.id.swUid); swUid = view.findViewById(R.id.swUid);
swExpunge = view.findViewById(R.id.swExpunge); swExpunge = view.findViewById(R.id.swExpunge);
@ -1061,6 +1063,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
} }
}); });
swShowRecent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("show_recent", checked).apply();
}
});
swModSeq.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swModSeq.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1764,6 +1773,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swUndoManager.setChecked(prefs.getBoolean("undo_manager", false)); swUndoManager.setChecked(prefs.getBoolean("undo_manager", false));
swWebViewLegacy.setChecked(prefs.getBoolean("webview_legacy", false)); swWebViewLegacy.setChecked(prefs.getBoolean("webview_legacy", false));
swBrowserZoom.setChecked(prefs.getBoolean("browser_zoom", false)); swBrowserZoom.setChecked(prefs.getBoolean("browser_zoom", false));
swShowRecent.setChecked(prefs.getBoolean("show_recent", false));
swModSeq.setChecked(prefs.getBoolean("use_modseq", true)); swModSeq.setChecked(prefs.getBoolean("use_modseq", true));
swUid.setChecked(prefs.getBoolean("uid_command", false)); swUid.setChecked(prefs.getBoolean("uid_command", false));
swExpunge.setChecked(prefs.getBoolean("perform_expunge", true)); swExpunge.setChecked(prefs.getBoolean("perform_expunge", true));

@ -1030,6 +1030,18 @@
app:layout_constraintTop_toBottomOf="@id/swWebViewLegacy" app:layout_constraintTop_toBottomOf="@id/swWebViewLegacy"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swShowRecent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_show_recent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBrowserZoom"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swModSeq" android:id="@+id/swModSeq"
android:layout_width="0dp" android:layout_width="0dp"
@ -1039,7 +1051,7 @@
android:text="@string/title_advanced_modseq" android:text="@string/title_advanced_modseq"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBrowserZoom" app:layout_constraintTop_toBottomOf="@id/swShowRecent"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -746,6 +746,7 @@
<string name="title_advanced_undo_manager" translatable="false">Use Android\'s undo manager</string> <string name="title_advanced_undo_manager" translatable="false">Use Android\'s undo manager</string>
<string name="title_advanced_webview_legacy" translatable="false">Old WebView behavior</string> <string name="title_advanced_webview_legacy" translatable="false">Old WebView behavior</string>
<string name="title_advanced_browser_zoom" translatable="false">Use browser zoom</string> <string name="title_advanced_browser_zoom" translatable="false">Use browser zoom</string>
<string name="title_advanced_show_recent" translatable="false">Show recent flag</string>
<string name="title_advanced_modseq" translatable="false">MODSEQ</string> <string name="title_advanced_modseq" translatable="false">MODSEQ</string>
<string name="title_advanced_uid" translatable="false">UID command</string> <string name="title_advanced_uid" translatable="false">UID command</string>
<string name="title_advanced_expunge" translatable="false">AUTO EXPUNGE</string> <string name="title_advanced_expunge" translatable="false">AUTO EXPUNGE</string>

Loading…
Cancel
Save