Added seting for beige card background

This commit is contained in:
M66B 2020-09-25 09:09:41 +02:00
parent 5be2219435
commit 8268986db6
11 changed files with 74 additions and 9 deletions

View File

@ -60,6 +60,7 @@ public class FragmentAccounts extends FragmentBase {
private boolean settings;
private boolean cards;
private boolean beige;
private ViewGroup view;
private SwipeRefreshLayout swipeRefresh;
@ -84,6 +85,7 @@ public class FragmentAccounts extends FragmentBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", false);
}
@Override
@ -230,7 +232,9 @@ public class FragmentAccounts extends FragmentBase {
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
view.setBackgroundColor(ContextCompat.getColor(getContext(), beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
if (settings) {
fab.show();

View File

@ -43,6 +43,7 @@ import java.util.List;
public class FragmentAnswers extends FragmentBase {
private boolean cards;
private boolean beige;
private RecyclerView rvAnswer;
private ContentLoadingProgressBar pbWait;
@ -57,6 +58,7 @@ public class FragmentAnswers extends FragmentBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", false);
}
@Override
@ -100,7 +102,9 @@ public class FragmentAnswers extends FragmentBase {
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
view.setBackgroundColor(ContextCompat.getColor(getContext(), beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

View File

@ -78,6 +78,7 @@ public class FragmentFolders extends FragmentBase {
private FloatingActionButton fabError;
private boolean cards;
private boolean beige;
private boolean compact;
private long account;
@ -104,6 +105,7 @@ public class FragmentFolders extends FragmentBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", false);
compact = prefs.getBoolean("compact_folders", false);
show_flagged = prefs.getBoolean("flagged_folders", false);
@ -266,7 +268,9 @@ public class FragmentFolders extends FragmentBase {
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
view.setBackgroundColor(ContextCompat.getColor(getContext(), beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

View File

@ -45,6 +45,7 @@ import java.util.List;
public class FragmentIdentities extends FragmentBase {
private boolean cards;
private boolean beige;
private RecyclerView rvIdentity;
private ContentLoadingProgressBar pbWait;
@ -60,6 +61,7 @@ public class FragmentIdentities extends FragmentBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", false);
}
@Override
@ -115,7 +117,9 @@ public class FragmentIdentities extends FragmentBase {
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
view.setBackgroundColor(ContextCompat.getColor(getContext(), beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

View File

@ -271,6 +271,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private OpenPgpServiceConnection pgpService;
private boolean cards;
private boolean beige;
private boolean date;
private boolean threading;
private boolean swipenav;
@ -392,6 +393,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
swipenav = prefs.getBoolean("swipenav", true);
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", false);
date = prefs.getBoolean("date", true);
threading = prefs.getBoolean("threading", true);
seekbar = prefs.getBoolean("seekbar", false);
@ -1131,8 +1133,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
addKeyPressedListener(onBackPressedListener);
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
view.setBackgroundColor(ContextCompat.getColor(getContext(), beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
tvNoEmail.setVisibility(View.GONE);
tvNoEmailHint.setVisibility(View.GONE);

View File

@ -78,7 +78,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"portrait2", "landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "threading_unread",
"portrait2", "landscape", "landscape3", "startup", "cards", "beige", "indentation", "date", "threading", "threading_unread",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",

View File

@ -61,6 +61,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private Button btnTheme;
private Spinner spStartup;
private SwitchCompat swCards;
private SwitchCompat swBeige;
private SwitchCompat swDate;
private SwitchCompat swNavBarColorize;
private SwitchCompat swPortrait2;
@ -127,7 +128,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swAuthentication;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"theme", "startup", "cards", "beige", "date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
@ -155,6 +156,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
btnTheme = view.findViewById(R.id.btnTheme);
spStartup = view.findViewById(R.id.spStartup);
swCards = view.findViewById(R.id.swCards);
swBeige = view.findViewById(R.id.swBeige);
swDate = view.findViewById(R.id.swDate);
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
swPortrait2 = view.findViewById(R.id.swPortrait2);
@ -247,10 +249,18 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("cards", checked).apply();
swBeige.setEnabled(checked);
swIndentation.setEnabled(checked);
}
});
swBeige.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("beige", checked).apply();
}
});
swDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -809,6 +819,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
swCards.setChecked(prefs.getBoolean("cards", true));
swBeige.setChecked(prefs.getBoolean("beige", false));
swBeige.setEnabled(swCards.isChecked());
swDate.setChecked(prefs.getBoolean("date", true));
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
swPortrait2.setChecked(prefs.getBoolean("portrait2", false));

View File

@ -73,6 +73,7 @@ public class FragmentRules extends FragmentBase {
private String type;
private boolean cards;
private boolean beige;
private RecyclerView rvRule;
private ContentLoadingProgressBar pbWait;
@ -100,6 +101,7 @@ public class FragmentRules extends FragmentBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
cards = prefs.getBoolean("cards", true);
beige = prefs.getBoolean("beige", false);
}
@Override
@ -151,7 +153,9 @@ public class FragmentRules extends FragmentBase {
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
view.setBackgroundColor(ContextCompat.getColor(getContext(), beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

View File

@ -98,6 +98,30 @@
app:layout_constraintTop_toBottomOf="@id/tvStartupHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBeige"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_cards_beige"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCards"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBeigeHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_beige_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swBeige" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDate"
android:layout_width="0dp"
@ -107,7 +131,7 @@
android:text="@string/title_advanced_date_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCards"
app:layout_constraintTop_toBottomOf="@id/tvBeigeHint"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -33,6 +33,8 @@
<color name="lightColorCardBackground">#fff</color>
<color name="lightColorBackground_cards">#eee</color>
<!-- Cosmic Latte -->
<color name="lightColorBackground_cards_beige">#fff8e7</color>
<color name="lightActionForeground">#fff</color>
<color name="lightActionForegroundDisabled">#ddd</color>

View File

@ -338,6 +338,7 @@
<string name="title_advanced_landscape3">Show navigation menu in landscape mode by default</string>
<string name="title_advanced_startup">Show on start screen</string>
<string name="title_advanced_cards">Use card style instead of tabular style</string>
<string name="title_advanced_cards_beige">Use beige background for cards</string>
<string name="title_advanced_date_header">Group by date</string>
<string name="title_advanced_threading">Conversation threading</string>
<string name="title_advanced_threading_unread">Show number of unread messages in conversations</string>
@ -542,6 +543,7 @@
<string name="title_advanced_layout_hint">Switching to a more compact layout and changing the message text size can be done in the top action bar menu in the message view</string>
<string name="title_advanced_startup_hint">Long press any folder in the folder list to add or remove it from the list of unified folders</string>
<string name="title_advanced_beige_hint">Light themes only</string>
<string name="title_advanced_date_hint">Messages are only grouped by date if they are sorted by time</string>
<string name="title_advanced_navbar_colorize_hint">Whether this works depends on the Android version and variant</string>
<string name="title_advanced_threading_hint">Group messages related to each other</string>