mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-01 01:06:11 +00:00
Unified widget dark theme
This commit is contained in:
parent
6f93205376
commit
ebca5f95b6
5 changed files with 36 additions and 32 deletions
|
@ -61,9 +61,9 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
private CheckBox cbDayNight;
|
||||
private CheckBox cbHighlight;
|
||||
private ViewButtonColor btnHighlight;
|
||||
private CheckBox cbSeparatorLines;
|
||||
private CheckBox cbSemiTransparent;
|
||||
private ViewButtonColor btnColor;
|
||||
private CheckBox cbSeparatorLines;
|
||||
private Spinner spFontSize;
|
||||
private Spinner spPadding;
|
||||
private CheckBox cbAvatars;
|
||||
|
@ -99,9 +99,9 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean highlight = prefs.getBoolean("widget." + appWidgetId + ".highlight", false);
|
||||
int highlight_color = prefs.getInt("widget." + appWidgetId + ".highlight_color", Color.TRANSPARENT);
|
||||
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
int font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||
int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
|
||||
|
@ -119,9 +119,9 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
cbDayNight = findViewById(R.id.cbDayNight);
|
||||
cbHighlight = findViewById(R.id.cbHighlight);
|
||||
btnHighlight = findViewById(R.id.btnHighlight);
|
||||
cbSeparatorLines = findViewById(R.id.cbSeparatorLines);
|
||||
cbSemiTransparent = findViewById(R.id.cbSemiTransparent);
|
||||
btnColor = findViewById(R.id.btnColor);
|
||||
cbSeparatorLines = findViewById(R.id.cbSeparatorLines);
|
||||
spFontSize = findViewById(R.id.spFontSize);
|
||||
spPadding = findViewById(R.id.spPadding);
|
||||
cbAvatars = findViewById(R.id.cbAvatars);
|
||||
|
@ -240,9 +240,9 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
editor.putBoolean("widget." + appWidgetId + ".flagged", cbFlagged.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".highlight", cbHighlight.isChecked());
|
||||
editor.putInt("widget." + appWidgetId + ".highlight_color", btnHighlight.getColor());
|
||||
editor.putBoolean("widget." + appWidgetId + ".separators", cbSeparatorLines.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".semi", cbSemiTransparent.isChecked());
|
||||
editor.putInt("widget." + appWidgetId + ".background", btnColor.getColor());
|
||||
editor.putBoolean("widget." + appWidgetId + ".separators", cbSeparatorLines.isChecked());
|
||||
editor.putInt("widget." + appWidgetId + ".font", tinyOut(font));
|
||||
editor.putInt("widget." + appWidgetId + ".padding", tinyOut(padding));
|
||||
editor.putBoolean("widget." + appWidgetId + ".avatars", cbAvatars.isChecked());
|
||||
|
@ -368,11 +368,11 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
btnHighlight.setVisibility(highlight ? View.VISIBLE : View.GONE);
|
||||
btnHighlight.setColor(highlight_color);
|
||||
btnHighlight.setEnabled(highlight && !daynight);
|
||||
cbSeparatorLines.setChecked(separators);
|
||||
cbSemiTransparent.setChecked(semi);
|
||||
cbSemiTransparent.setEnabled(!daynight);
|
||||
btnColor.setColor(background);
|
||||
btnColor.setEnabled(!daynight);
|
||||
cbSeparatorLines.setChecked(separators);
|
||||
spFontSize.setSelection(tinyIn(font));
|
||||
spPadding.setSelection(tinyIn(padding));
|
||||
cbAvatars.setChecked(avatars);
|
||||
|
|
|
@ -51,9 +51,9 @@ public class WidgetUnified extends AppWidgetProvider {
|
|||
long folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L);
|
||||
String type = prefs.getString("widget." + appWidgetId + ".type", null);
|
||||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
int font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||
int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
|
||||
|
@ -134,6 +134,7 @@ public class WidgetUnified extends AppWidgetProvider {
|
|||
|
||||
boolean syncing = prefs.getBoolean("widget." + appWidgetId + ".syncing", false);
|
||||
|
||||
// https://developer.android.com/guide/topics/ui/look-and-feel/darktheme
|
||||
if (!daynight && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
views.setColorStateListAttr(R.id.background, "setBackgroundTintList", 0);
|
||||
views.setColorStateListAttr(R.id.separator, "setBackgroundTintList", 0);
|
||||
|
|
|
@ -110,9 +110,9 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
highlight = prefs.getBoolean("widget." + appWidgetId + ".highlight", false);
|
||||
highlight_color = prefs.getInt("widget." + appWidgetId + ".highlight_color", Color.TRANSPARENT);
|
||||
separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||
padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false);
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
android:id="@+id/cbHighlight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_highlight_unread"
|
||||
|
@ -98,6 +99,30 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbHighlight" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSemiTransparent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_widget_semi_transparent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnHighlight" />
|
||||
|
||||
<eu.faircode.email.ViewButtonColor
|
||||
android:id="@+id/btnColor"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:tag="disable"
|
||||
android:text="@string/title_widget_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSemiTransparent" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSeparatorLines"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -106,29 +131,7 @@
|
|||
android:checked="true"
|
||||
android:text="@string/title_widget_separator_lines"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnHighlight" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSemiTransparent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_widget_semi_transparent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSeparatorLines" />
|
||||
|
||||
<eu.faircode.email.ViewButtonColor
|
||||
android:id="@+id/btnColor"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:tag="disable"
|
||||
android:text="@string/title_widget_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSemiTransparent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnColor" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvFontSize"
|
||||
|
@ -138,7 +141,7 @@
|
|||
android:text="@string/title_widget_font_size"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnColor" />
|
||||
app:layout_constraintTop_toBottomOf="@id/cbSeparatorLines" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spFontSize"
|
||||
|
|
|
@ -1939,7 +1939,7 @@
|
|||
<string name="title_widget_refresh">Show refresh messages button</string>
|
||||
<string name="title_widget_compose">Show compose new message button</string>
|
||||
<string name="title_widget_background">Background color</string>
|
||||
<string name="title_widget_day_night">Use day/night mode (if available)</string>
|
||||
<string name="title_widget_day_night">Follow system dark theme</string>
|
||||
|
||||
<string name="title_accessibility_collapsed">Collapsed</string>
|
||||
<string name="title_accessibility_expanded">Expanded</string>
|
||||
|
|
Loading…
Reference in a new issue