From f763c242d69d06521d604ce8d1e280c80dc65e76 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 22 Mar 2016 10:22:58 -0500 Subject: [PATCH] Fix date and time dialog backgrounds --- src/generic/AndroidManifest.xml | 2 +- src/googleplay/AndroidManifest.xml | 6 +-- src/main/AndroidManifest.xml | 38 +++++++++---------- .../activities/DateAndTimePickerActivity.java | 6 +-- .../tasks/activities/DatePickerActivity.java | 6 +-- .../tasks/activities/TimePickerActivity.java | 6 +-- .../preferences/ActivityPreferences.java | 8 +--- .../reminder_dialog_inset_background.xml | 12 ------ src/main/res/values/styles.xml | 18 --------- src/main/res/values/styles_dark.xml | 9 +++-- src/main/res/values/styles_light.xml | 9 +++-- 11 files changed, 40 insertions(+), 80 deletions(-) delete mode 100644 src/main/res/drawable/reminder_dialog_inset_background.xml diff --git a/src/generic/AndroidManifest.xml b/src/generic/AndroidManifest.xml index cfb780861..88f3c863f 100644 --- a/src/generic/AndroidManifest.xml +++ b/src/generic/AndroidManifest.xml @@ -6,7 +6,7 @@ + android:theme="@style/DialogBase" /> diff --git a/src/googleplay/AndroidManifest.xml b/src/googleplay/AndroidManifest.xml index 5263d5e38..8cea210bb 100644 --- a/src/googleplay/AndroidManifest.xml +++ b/src/googleplay/AndroidManifest.xml @@ -40,13 +40,13 @@ + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> @@ -374,7 +374,7 @@ + android:theme="@style/DialogBase"/> @@ -386,38 +386,38 @@ + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase" /> + android:theme="@style/DialogBase"/> @@ -448,7 +448,7 @@ + android:theme="@style/DialogBase"> diff --git a/src/main/java/org/tasks/activities/DateAndTimePickerActivity.java b/src/main/java/org/tasks/activities/DateAndTimePickerActivity.java index bb66b1a15..dd2e41cc1 100644 --- a/src/main/java/org/tasks/activities/DateAndTimePickerActivity.java +++ b/src/main/java/org/tasks/activities/DateAndTimePickerActivity.java @@ -34,8 +34,6 @@ public class DateAndTimePickerActivity extends InjectingAppCompatActivity implem protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - preferences.applyTheme(); - initial = new DateTime(getIntent().getLongExtra(EXTRA_TIMESTAMP, currentTimeMillis())); if (savedInstanceState != null) { @@ -50,9 +48,7 @@ public class DateAndTimePickerActivity extends InjectingAppCompatActivity implem if (datePickerDialog == null) { datePickerDialog = new MyDatePickerDialog(); datePickerDialog.initialize(null, initial.getYear(), initial.getMonthOfYear() - 1, initial.getDayOfMonth()); - if (preferences.isDarkTheme()) { - datePickerDialog.setAccentColor(getResources().getColor(R.color.black_text_hint)); - } + datePickerDialog.setAccentColor(getResources().getColor(preferences.isDarkTheme() ? R.color.black_text_hint : R.color.primary)); datePickerDialog.show(fragmentManager, FRAG_TAG_DATE_PICKER); } datePickerDialog.setOnCancelListener(this); diff --git a/src/main/java/org/tasks/activities/DatePickerActivity.java b/src/main/java/org/tasks/activities/DatePickerActivity.java index 144ce2caa..233e7c336 100644 --- a/src/main/java/org/tasks/activities/DatePickerActivity.java +++ b/src/main/java/org/tasks/activities/DatePickerActivity.java @@ -31,8 +31,6 @@ public class DatePickerActivity extends InjectingAppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - preferences.applyTheme(); - long timestamp = getIntent().getLongExtra(EXTRA_TIMESTAMP, currentTimeMillis()); DateTime initial = (timestamp > 0 ? new DateTime(timestamp) : new DateTime()).startOfDay(); @@ -41,9 +39,7 @@ public class DatePickerActivity extends InjectingAppCompatActivity if (dialog == null) { dialog = new MyDatePickerDialog(); dialog.initialize(null, initial.getYear(), initial.getMonthOfYear() - 1, initial.getDayOfMonth()); - if (preferences.isDarkTheme()) { - dialog.setAccentColor(getResources().getColor(R.color.black_text_hint)); - } + dialog.setAccentColor(getResources().getColor(preferences.isDarkTheme() ? R.color.black_text_hint : R.color.primary)); dialog.show(fragmentManager, FRAG_TAG_DATE_PICKER); } dialog.setOnDismissListener(this); diff --git a/src/main/java/org/tasks/activities/TimePickerActivity.java b/src/main/java/org/tasks/activities/TimePickerActivity.java index d8db9919a..b92eec273 100644 --- a/src/main/java/org/tasks/activities/TimePickerActivity.java +++ b/src/main/java/org/tasks/activities/TimePickerActivity.java @@ -36,8 +36,6 @@ public class TimePickerActivity extends InjectingAppCompatActivity implements Ti protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - preferences.applyTheme(); - initial = new DateTime(getIntent().getLongExtra(EXTRA_TIMESTAMP, currentTimeMillis())); FragmentManager fragmentManager = getFragmentManager(); @@ -45,9 +43,7 @@ public class TimePickerActivity extends InjectingAppCompatActivity implements Ti if (dialog == null) { dialog = new MyTimePickerDialog(); dialog.initialize(null, initial.getHourOfDay(), initial.getMinuteOfHour(), 0, DateFormat.is24HourFormat(this)); - if (preferences.isDarkTheme()) { - dialog.setAccentColor(getResources().getColor(R.color.black_text_hint)); - } + dialog.setAccentColor(getResources().getColor(preferences.isDarkTheme() ? R.color.black_text_hint : R.color.primary)); dialog.show(fragmentManager, FRAG_TAG_TIME_PICKER); } dialog.setOnDismissListener(this); diff --git a/src/main/java/org/tasks/preferences/ActivityPreferences.java b/src/main/java/org/tasks/preferences/ActivityPreferences.java index b6360c8b0..8eaa354d5 100644 --- a/src/main/java/org/tasks/preferences/ActivityPreferences.java +++ b/src/main/java/org/tasks/preferences/ActivityPreferences.java @@ -29,11 +29,11 @@ public class ActivityPreferences extends Preferences { } public void applyTheme() { - applyTheme(isDarkTheme() ? R.style.TasksDark : R.style.Tasks); + applyTheme(getTheme()); } public void applyDialogTheme() { - applyTheme(isDarkTheme() ? R.style.TasksDialogDark : R.style.TasksDialog); + applyTheme(getDialogTheme()); } public void applyStatusBarColor() { @@ -53,10 +53,6 @@ public class ActivityPreferences extends Preferences { window.setStatusBarColor(resources.getColor(color)); } - public void applyTranslucentDialogTheme() { - applyTheme(R.style.ReminderDialog); - } - private void applyTheme(int theme) { activity.setTheme(theme); activity.getWindow().setFormat(PixelFormat.RGBA_8888); diff --git a/src/main/res/drawable/reminder_dialog_inset_background.xml b/src/main/res/drawable/reminder_dialog_inset_background.xml deleted file mode 100644 index 695adc453..000000000 --- a/src/main/res/drawable/reminder_dialog_inset_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index a498590bd..baef72fed 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -1,14 +1,5 @@ - - - - - - - + + - + +