|
|
|
|
@ -5,9 +5,6 @@
|
|
|
|
|
*/
|
|
|
|
|
package com.todoroo.astrid.service;
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
import android.graphics.PixelFormat;
|
|
|
|
|
|
|
|
|
|
import com.todoroo.andlib.utility.AndroidUtilities;
|
|
|
|
|
import com.todoroo.andlib.utility.Preferences;
|
|
|
|
|
|
|
|
|
|
@ -15,30 +12,10 @@ import org.tasks.R;
|
|
|
|
|
|
|
|
|
|
public class ThemeService {
|
|
|
|
|
|
|
|
|
|
public static void applyTheme(Activity activity) {
|
|
|
|
|
int currentTheme = getTheme();
|
|
|
|
|
activity.setTheme(currentTheme);
|
|
|
|
|
activity.getWindow().setFormat(PixelFormat.RGBA_8888);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static int getTheme() {
|
|
|
|
|
return Preferences.getBoolean(R.string.p_use_dark_theme, false) ? R.style.Tasks : R.style.Tasks_Light;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getThemeColor() {
|
|
|
|
|
int theme = getTheme();
|
|
|
|
|
switch(theme) {
|
|
|
|
|
case R.style.Tasks:
|
|
|
|
|
return R.color.blue_theme_color;
|
|
|
|
|
case R.style.Tasks_Light:
|
|
|
|
|
default:
|
|
|
|
|
return R.color.dark_blue_theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static int getEditDialogTheme() {
|
|
|
|
|
boolean ics = AndroidUtilities.getSdkVersion() >= 14;
|
|
|
|
|
int themeSetting = getTheme();
|
|
|
|
|
int themeSetting = Preferences.getBoolean(R.string.p_use_dark_theme, false) ? R.style.Tasks : R.style.Tasks_Light;
|
|
|
|
|
int theme;
|
|
|
|
|
if (themeSetting == R.style.Tasks) {
|
|
|
|
|
if (ics) {
|
|
|
|
|
@ -55,15 +32,4 @@ public class ThemeService {
|
|
|
|
|
}
|
|
|
|
|
return theme;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getDialogTheme() {
|
|
|
|
|
int themeSetting = getTheme();
|
|
|
|
|
int theme;
|
|
|
|
|
if (themeSetting == R.style.Tasks) {
|
|
|
|
|
theme = R.style.Tasks_Dialog;
|
|
|
|
|
} else {
|
|
|
|
|
theme = R.style.Tasks_Dialog_Light;
|
|
|
|
|
}
|
|
|
|
|
return theme;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|