Resolve colors correctly

Closes #157
pull/189/head
Alex Baker 11 years ago
parent 4bf6610377
commit 50f8c0411a

@ -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();

@ -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<String> 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);

@ -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);

@ -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);

@ -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);

@ -234,6 +234,7 @@
<item name="android:windowIsFloating">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="asThemeTextColor">@color/dark_blue_theme_color</item>
</style>
<!--=============================================== TaskListActivity == -->

Loading…
Cancel
Save