diff --git a/astrid/src/main/java/com/todoroo/astrid/calls/MissedCallActivity.java b/astrid/src/main/java/com/todoroo/astrid/calls/MissedCallActivity.java index 5dbe843cb..0012baa70 100644 --- a/astrid/src/main/java/com/todoroo/astrid/calls/MissedCallActivity.java +++ b/astrid/src/main/java/com/todoroo/astrid/calls/MissedCallActivity.java @@ -9,7 +9,6 @@ import android.app.AlertDialog; import android.content.ContentUris; import android.content.DialogInterface; import android.content.Intent; -import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; @@ -34,7 +33,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tasks.R; import org.tasks.injection.InjectingActivity; -import org.tasks.preferences.Preferences; +import org.tasks.preferences.ActivityPreferences; import org.tasks.preferences.ResourceResolver; import java.io.InputStream; @@ -57,7 +56,7 @@ public class MissedCallActivity extends InjectingActivity { @Inject StartupService startupService; @Inject TaskService taskService; - @Inject Preferences preferences; + @Inject ActivityPreferences preferences; @Inject ResourceResolver resourceResolver; private final OnClickListener dismissListener = new OnClickListener() { @@ -113,6 +112,7 @@ public class MissedCallActivity extends InjectingActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + preferences.applyTranslucentDialogTheme(); startupService.onStartupApplication(this); setContentView(R.layout.missed_call_activity); @@ -124,7 +124,7 @@ public class MissedCallActivity extends InjectingActivity { String timeString = intent.getStringExtra(EXTRA_TIME); long contactId = intent.getExtras().getLong(EXTRA_CONTACT_ID); - int color = resourceResolver.getResource(R.attr.asThemeTextColor); + int color = resourceResolver.getData(R.attr.asThemeTextColor); returnCallButton = (TextView) findViewById(R.id.call_now); callLaterButton = (TextView) findViewById(R.id.call_later); @@ -151,9 +151,8 @@ public class MissedCallActivity extends InjectingActivity { } } - Resources r = getResources(); - returnCallButton.setBackgroundColor(r.getColor(color)); - callLaterButton.setBackgroundColor(r.getColor(color)); + returnCallButton.setBackgroundColor(color); + callLaterButton.setBackgroundColor(color); addListeners(); diff --git a/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmListCreator.java b/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmListCreator.java index 8690c9cf3..46b39e86e 100644 --- a/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmListCreator.java +++ b/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarAlarmListCreator.java @@ -20,6 +20,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tasks.R; import org.tasks.injection.InjectingActivity; +import org.tasks.preferences.ActivityPreferences; import org.tasks.preferences.ResourceResolver; import java.util.ArrayList; @@ -33,6 +34,7 @@ public class CalendarAlarmListCreator extends InjectingActivity { public static final String TOKEN_LIST_NAME = "listName"; //$NON-NLS-1$ @Inject TagDataService tagDataService; + @Inject ActivityPreferences preferences; @Inject ResourceResolver resourceResolver; private ArrayList names; @@ -63,6 +65,7 @@ public class CalendarAlarmListCreator extends InjectingActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + preferences.applyTranslucentDialogTheme(); setContentView(R.layout.calendar_alarm_list_creator); Intent intent = getIntent(); @@ -85,7 +88,7 @@ public class CalendarAlarmListCreator extends InjectingActivity { TextView dialogView = (TextView) findViewById(R.id.reminder_message); StringBuilder builder = new StringBuilder(getString(R.string.CRA_created_list_dialog, tagName)); String attendeesString = buildAttendeesString(); - int color = resourceResolver.getResource(R.attr.asThemeTextColor); + int color = resourceResolver.getData(R.attr.asThemeTextColor); String title; if (!TextUtils.isEmpty(attendeesString)) { @@ -93,11 +96,11 @@ public class CalendarAlarmListCreator extends InjectingActivity { .append(attendeesString) .append(" ") //$NON-NLS-1$ .append(getString(R.string.CRA_invitation_prompt)); - inviteAll.setBackgroundColor(getResources().getColor(color)); + inviteAll.setBackgroundColor(color); title = getString(R.string.CRA_share_list_title); } else { title = getString(R.string.CRA_list_created_title); - moreOptions.setBackgroundColor(getResources().getColor(color)); + moreOptions.setBackgroundColor(color); inviteAll.setVisibility(View.GONE); ignoreButton.setVisibility(View.GONE); ignoreSettingsButton.setVisibility(View.GONE); diff --git a/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java b/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java index aace75682..0bb25607b 100644 --- a/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java +++ b/astrid/src/main/java/com/todoroo/astrid/gcal/CalendarReminderActivity.java @@ -25,7 +25,7 @@ import com.todoroo.astrid.tags.TagFilterExposer; import org.tasks.R; import org.tasks.injection.InjectingActivity; -import org.tasks.preferences.Preferences; +import org.tasks.preferences.ActivityPreferences; import org.tasks.preferences.ResourceResolver; import javax.inject.Inject; @@ -50,7 +50,7 @@ public class CalendarReminderActivity extends InjectingActivity { @Inject StartupService startupService; @Inject TagDataService tagDataService; - @Inject Preferences preferences; + @Inject ActivityPreferences preferences; @Inject ResourceResolver resourceResolver; private String eventName; @@ -110,7 +110,7 @@ public class CalendarReminderActivity extends InjectingActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + preferences.applyTranslucentDialogTheme(); startupService.onStartupApplication(this); setContentView(R.layout.calendar_reminder_activity); @@ -147,7 +147,7 @@ public class CalendarReminderActivity extends InjectingActivity { dialogView.setText(speechText); - createListButton.setBackgroundColor(resourceResolver.getResource(R.attr.asThemeTextColor)); + createListButton.setBackgroundColor(resourceResolver.getData(R.attr.asThemeTextColor)); if (fromPostpone) { postponeButton.setVisibility(View.GONE); diff --git a/astrid/src/main/java/org/tasks/preferences/ActivityPreferences.java b/astrid/src/main/java/org/tasks/preferences/ActivityPreferences.java index 68bcb358b..b6193a686 100644 --- a/astrid/src/main/java/org/tasks/preferences/ActivityPreferences.java +++ b/astrid/src/main/java/org/tasks/preferences/ActivityPreferences.java @@ -39,6 +39,10 @@ public class ActivityPreferences extends Preferences { applyTheme(isDarkTheme() ? R.style.Tasks_Dialog : R.style.Tasks_Dialog_Light); } + public void applyTranslucentDialogTheme() { + applyTheme(R.style.ReminderDialog); + } + private void applyTheme(int theme) { activity.setTheme(theme); activity.getWindow().setFormat(PixelFormat.RGBA_8888); diff --git a/astrid/src/main/java/org/tasks/preferences/ResourceResolver.java b/astrid/src/main/java/org/tasks/preferences/ResourceResolver.java index f533cadd6..e19d7c11f 100644 --- a/astrid/src/main/java/org/tasks/preferences/ResourceResolver.java +++ b/astrid/src/main/java/org/tasks/preferences/ResourceResolver.java @@ -20,6 +20,10 @@ public class ResourceResolver { return getResource(activity, attr); } + public int getData(int attr) { + return getData(activity, attr); + } + public static int getResource(Activity activity, int attr) { TypedValue typedValue = new TypedValue(); activity.getTheme().resolveAttribute(attr, typedValue, true); diff --git a/astrid/src/main/res/values/styles.xml b/astrid/src/main/res/values/styles.xml index 2c7b91a0b..f4a3cc5e5 100644 --- a/astrid/src/main/res/values/styles.xml +++ b/astrid/src/main/res/values/styles.xml @@ -234,8 +234,9 @@ true @android:style/Animation.Dialog stateUnspecified|adjustPan + @color/dark_blue_theme_color - +