diff --git a/app/src/main/java/eu/faircode/email/FragmentBase.java b/app/src/main/java/eu/faircode/email/FragmentBase.java
index 45f098fac0..519bd597c2 100644
--- a/app/src/main/java/eu/faircode/email/FragmentBase.java
+++ b/app/src/main/java/eu/faircode/email/FragmentBase.java
@@ -29,6 +29,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -61,6 +62,7 @@ import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.preference.PreferenceManager;
import java.io.File;
import java.io.FileInputStream;
@@ -72,6 +74,7 @@ import java.util.List;
import java.util.Map;
public class FragmentBase extends Fragment {
+ private CharSequence count = null;
private CharSequence title = null;
private CharSequence subtitle = " ";
private boolean finish = false;
@@ -97,6 +100,11 @@ public class FragmentBase extends Fragment {
return null;
}
+ protected void setCount(String count) {
+ this.count = count;
+ updateSubtitle();
+ }
+
protected void setTitle(int resid) {
setTitle(getString(resid));
}
@@ -410,9 +418,18 @@ public class FragmentBase extends Fragment {
actionbar.setTitle(title == null ? getString(R.string.app_name) : title);
actionbar.setSubtitle(subtitle);
} else {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
+ boolean list_count = prefs.getBoolean("list_count", false);
+
View custom = actionbar.getCustomView();
+ TextView tvCount = custom.findViewById(R.id.count);
TextView tvTitle = custom.findViewById(R.id.title);
TextView tvSubtitle = custom.findViewById(R.id.subtitle);
+ if (tvCount != null) {
+ tvCount.setText(count);
+ tvCount.setVisibility(!list_count || TextUtils.isEmpty(count)
+ ? View.GONE : View.VISIBLE);
+ }
if (tvTitle != null)
tvTitle.setText(title == null ? getString(R.string.app_name) : title);
if (tvSubtitle != null)
diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java
index 59a990a5c3..f2016aeaf9 100644
--- a/app/src/main/java/eu/faircode/email/FragmentMessages.java
+++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java
@@ -6193,6 +6193,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (messages == null)
return;
+ if (viewType != AdapterMessage.ViewType.SEARCH)
+ setCount(messages.size() == 0 ? null : NF.format(messages.size()));
+
if (viewType == AdapterMessage.ViewType.THREAD) {
if (handleThreadActions(messages, null, null))
return;
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java
index 7175dac4cc..0077748d88 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptions.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java
@@ -145,6 +145,7 @@ public class FragmentOptions extends FragmentBase {
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"message_zoom", "overview_mode", "override_width", "addresses", "button_extra", "attachments_alt", "thumbnails",
"contrast", "hyphenation", "display_font", "monospaced_pre",
+ "list_count", "bundled_fonts", "parse_classes",
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
"collapse_quotes", "image_placeholders", "inline_images",
"seekbar", "actionbar", "actionbar_color", "group_category",
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
index 41a834f7d1..64c37a862f 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsDisplay.java
@@ -171,6 +171,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swThumbnails;
+ private SwitchCompat swListCount;
private SwitchCompat swBundledFonts;
private SwitchCompat swParseClasses;
private SwitchCompat swBackgroundColor;
@@ -207,7 +208,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"text_separators",
"collapse_quotes", "image_placeholders", "inline_images", "button_extra",
"unzip", "attachments_alt", "thumbnails",
- "bundled_fonts", "parse_classes",
+ "list_count", "bundled_fonts", "parse_classes",
"background_color", "text_color", "text_size", "text_font", "text_align",
"authentication", "authentication_indicator"
};
@@ -327,6 +328,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swThumbnails = view.findViewById(R.id.swThumbnails);
+ swListCount = view.findViewById(R.id.swListCount);
swBundledFonts = view.findViewById(R.id.swBundledFonts);
swParseClasses = view.findViewById(R.id.swParseClasses);
swBackgroundColor = view.findViewById(R.id.swBackgroundColor);
@@ -1199,6 +1201,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
+ swListCount.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("list_count", checked).apply();
+ }
+ });
+
swBundledFonts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -1493,6 +1502,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));
+ swListCount.setChecked(prefs.getBoolean("list_count", false));
swBundledFonts.setChecked(prefs.getBoolean("bundled_fonts", true));
swParseClasses.setChecked(prefs.getBoolean("parse_classes", true));
swBackgroundColor.setChecked(prefs.getBoolean("background_color", false));
diff --git a/app/src/main/res/layout/action_bar.xml b/app/src/main/res/layout/action_bar.xml
index c682163876..c800c64117 100644
--- a/app/src/main/res/layout/action_bar.xml
+++ b/app/src/main/res/layout/action_bar.xml
@@ -12,10 +12,22 @@
android:singleLine="true"
android:text="Title"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
- app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintEnd_toStartOf="@+id/count"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
+
+
+
+
Use account color as background color for conversation action bar
Group by account category
Colorize the Android navigation bar
+ Show the number of messages or conversations in the top action bar
Use bundled fonts
Parse style sheets
Show authentication warnings