mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Simplification
This commit is contained in:
parent
0293c52651
commit
1d30749958
6 changed files with 33 additions and 39 deletions
|
@ -81,12 +81,8 @@ public class ActivityWidget extends ActivityBase {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
long account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
|
||||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
? Color.TRANSPARENT
|
||||
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
int layout = prefs.getInt("widget." + appWidgetId + ".layout", 1 /* new */);
|
||||
|
||||
daynight = daynight && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
|
||||
|
@ -133,6 +129,12 @@ public class ActivityWidget extends ActivityBase {
|
|||
int color = btnColor.getColor();
|
||||
int editTextColor = Helper.resolveColor(ActivityWidget.this, android.R.attr.editTextColor);
|
||||
|
||||
if (color == Color.TRANSPARENT) {
|
||||
color = Color.WHITE;
|
||||
if (cbSemiTransparent.isChecked() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
color = ColorUtils.setAlphaComponent(color, 127);
|
||||
}
|
||||
|
||||
ColorPickerDialogBuilder
|
||||
.with(ActivityWidget.this)
|
||||
.setTitle(R.string.title_widget_background)
|
||||
|
@ -140,7 +142,7 @@ public class ActivityWidget extends ActivityBase {
|
|||
.setColorEditTextColor(editTextColor)
|
||||
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
||||
.density(6)
|
||||
.initialColor(color == Color.TRANSPARENT ? Color.WHITE : color)
|
||||
.initialColor(color)
|
||||
.showLightnessSlider(true)
|
||||
.showAlphaSlider(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
|
||||
|
|
|
@ -61,12 +61,8 @@ public class ActivityWidgetSync extends ActivityBase {
|
|||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
? Color.TRANSPARENT
|
||||
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
|
||||
daynight = daynight && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
|
||||
|
||||
|
@ -104,6 +100,12 @@ public class ActivityWidgetSync extends ActivityBase {
|
|||
int color = btnColor.getColor();
|
||||
int editTextColor = Helper.resolveColor(ActivityWidgetSync.this, android.R.attr.editTextColor);
|
||||
|
||||
if (color == Color.TRANSPARENT) {
|
||||
color = Color.WHITE;
|
||||
if (cbSemiTransparent.isChecked() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
color = ColorUtils.setAlphaComponent(color, 127);
|
||||
}
|
||||
|
||||
ColorPickerDialogBuilder
|
||||
.with(ActivityWidgetSync.this)
|
||||
.setTitle(R.string.title_widget_background)
|
||||
|
@ -111,7 +113,7 @@ public class ActivityWidgetSync extends ActivityBase {
|
|||
.setColorEditTextColor(editTextColor)
|
||||
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
||||
.density(6)
|
||||
.initialColor(color == Color.TRANSPARENT ? Color.WHITE : color)
|
||||
.initialColor(color)
|
||||
.showLightnessSlider(true)
|
||||
.showAlphaSlider(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
|
||||
|
|
|
@ -100,12 +100,8 @@ 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 semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
? Color.TRANSPARENT
|
||||
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
||||
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);
|
||||
|
@ -203,6 +199,12 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
int color = btnColor.getColor();
|
||||
int editTextColor = Helper.resolveColor(ActivityWidgetUnified.this, android.R.attr.editTextColor);
|
||||
|
||||
if (color == Color.TRANSPARENT) {
|
||||
color = Color.WHITE;
|
||||
if (cbSemiTransparent.isChecked() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
color = ColorUtils.setAlphaComponent(color, 127);
|
||||
}
|
||||
|
||||
ColorPickerDialogBuilder
|
||||
.with(ActivityWidgetUnified.this)
|
||||
.setTitle(R.string.title_widget_background)
|
||||
|
@ -210,7 +212,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
.setColorEditTextColor(editTextColor)
|
||||
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
||||
.density(6)
|
||||
.initialColor(color == Color.TRANSPARENT ? Color.WHITE : color)
|
||||
.initialColor(color)
|
||||
.showLightnessSlider(true)
|
||||
.showAlphaSlider(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
|
||||
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
|
||||
|
|
|
@ -60,12 +60,8 @@ public class Widget extends AppWidgetProvider {
|
|||
String name = prefs.getString("widget." + appWidgetId + ".name", null);
|
||||
long account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
|
||||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
? Color.TRANSPARENT
|
||||
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
int layout = prefs.getInt("widget." + appWidgetId + ".layout", 0);
|
||||
int version = prefs.getInt("widget." + appWidgetId + ".version", 0);
|
||||
|
||||
|
|
|
@ -51,12 +51,8 @@ public class WidgetSync extends AppWidgetProvider {
|
|||
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
boolean daynight = prefs.getBoolean("widget." + appWidgetId + ".daynight", false);
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
? Color.TRANSPARENT
|
||||
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
||||
boolean semi = prefs.getBoolean("widget." + appWidgetId + ".semi", true);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background", Color.TRANSPARENT);
|
||||
int version = prefs.getInt("widget." + appWidgetId + ".version", 0);
|
||||
|
||||
if (version <= 1550)
|
||||
|
|
|
@ -51,12 +51,8 @@ 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 semi = prefs.getBoolean("widget." + appWidgetId + ".semi",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S);
|
||||
int background = prefs.getInt("widget." + appWidgetId + ".background",
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S
|
||||
? Color.TRANSPARENT
|
||||
: ColorUtils.setAlphaComponent(Color.BLACK, 127));
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue