Dialer: cleanup old theme stuff
we use dynamic colors and one theme so we dont need all of this
also - DONT assert -1 as invalid color else you make
black and white lovers very unhappy
Change-Id: I9883cc37604314f8f67e667ec38527baf5b00e9a
diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java
index feb76ac..b072233 100644
--- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java
+++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java
@@ -232,30 +232,12 @@
@Override
public void onActivityCreate(Bundle savedInstanceState) {
LogUtil.enterBlock("OldMainActivityPeer.onActivityCreate");
- setTheme();
activity.setContentView(R.layout.main_activity);
initUiListeners();
initLayout(savedInstanceState);
SmartDialPrefix.initializeNanpSettings(activity);
}
- /** should be called before {@link AppCompatActivity#setContentView(int)}. */
- private void setTheme() {
- @Theme.Type int theme = ThemeComponent.get(activity).theme().getTheme();
- switch (theme) {
- case Theme.DARK:
- activity.setTheme(R.style.MainActivityTheme_Dark);
- break;
- case Theme.LIGHT:
- case Theme.LIGHT_M2:
- activity.setTheme(R.style.MainActivityTheme);
- break;
- case Theme.UNKNOWN:
- default:
- throw new IllegalArgumentException("Invalid theme.");
- }
- }
-
private void initUiListeners() {
getLastOutgoingCallListener =
DialerExecutorComponent.get(activity)
diff --git a/java/com/android/dialer/theme/base/Theme.java b/java/com/android/dialer/theme/base/Theme.java
index 6e0d20a..47fff56 100644
--- a/java/com/android/dialer/theme/base/Theme.java
+++ b/java/com/android/dialer/theme/base/Theme.java
@@ -27,19 +27,6 @@
/** Interface for theme. */
public interface Theme {
- /** IntDef for the different themes Dialer supports. */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({UNKNOWN, LIGHT, DARK, LIGHT_M2})
- @interface Type {}
-
- int UNKNOWN = 0;
- int LIGHT = 1;
- int DARK = 2;
- int LIGHT_M2 = 3;
-
- @Type
- int getTheme();
-
@StyleRes
int getApplicationThemeRes();
diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java
index c8f20c7..653392d 100644
--- a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java
+++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java
@@ -22,7 +22,6 @@
import android.support.annotation.StyleRes;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
-import com.android.dialer.common.Assert;
import com.android.dialer.theme.base.R;
import com.android.dialer.theme.base.Theme;
import javax.inject.Singleton;
@@ -47,7 +46,6 @@
private int colorIconOnUnthemedDarkBackground = -1;
public AospThemeImpl(Context context) {
-
context = context.getApplicationContext();
context.setTheme(getApplicationThemeRes());
TypedArray array =
@@ -86,27 +84,9 @@
array.recycle();
}
- /**
- * Returns the {@link Theme} that the application is using. Activities should check this value if
- * their custom style needs to customize further based on the application theme.
- */
- @Override
- public @Type int getTheme() {
- // TODO(a bug): add share prefs check to configure this
- return LIGHT;
- }
-
@Override
public @StyleRes int getApplicationThemeRes() {
- switch (getTheme()) {
- case DARK:
- return R.style.Dialer_Dark_ThemeBase_NoActionBar;
- case LIGHT:
- return R.style.Dialer_ThemeBase_NoActionBar;
- case UNKNOWN:
- default:
- throw Assert.createIllegalStateFailException("Theme hasn't been set yet.");
- }
+ return R.style.Dialer_ThemeBase_NoActionBar;
}
@Override
@@ -121,55 +101,46 @@
@Override
public @ColorInt int getColorIcon() {
- Assert.checkArgument(colorIcon != -1);
return colorIcon;
}
@Override
public @ColorInt int getColorIconSecondary() {
- Assert.checkArgument(colorIconSecondary != -1);
return colorIconSecondary;
}
@Override
public @ColorInt int getColorPrimary() {
- Assert.checkArgument(colorPrimary != -1);
return colorPrimary;
}
@Override
public int getColorPrimaryDark() {
- Assert.checkArgument(colorPrimaryDark != -1);
return colorPrimaryDark;
}
@Override
public @ColorInt int getColorAccent() {
- Assert.checkArgument(colorAccent != -1);
return colorAccent;
}
@Override
public @ColorInt int getTextColorSecondary() {
- Assert.checkArgument(textColorSecondary != -1);
return textColorSecondary;
}
@Override
public @ColorInt int getTextColorPrimary() {
- Assert.checkArgument(textColorPrimary != -1);
return textColorPrimary;
}
@Override
public @ColorInt int getColorTextOnUnthemedDarkBackground() {
- Assert.checkArgument(colorTextOnUnthemedDarkBackground != -1);
return colorTextOnUnthemedDarkBackground;
}
@Override
public @ColorInt int getColorIconOnUnthemedDarkBackground() {
- Assert.checkArgument(colorIconOnUnthemedDarkBackground != -1);
return colorIconOnUnthemedDarkBackground;
}
}
diff --git a/java/com/android/dialer/theme/base/res/values-night-v31/styles.xml b/java/com/android/dialer/theme/base/res/values-night-v31/styles.xml
index 8130c88..1a0579b 100644
--- a/java/com/android/dialer/theme/base/res/values-night-v31/styles.xml
+++ b/java/com/android/dialer/theme/base/res/values-night-v31/styles.xml
@@ -34,7 +34,7 @@
<item name="android:colorAccent">?android:attr/colorPrimary</item>
</style>
- <style name="Dialer.ThemeBase.ActionBar">
+ <style name="Dialer.ThemeBase.ActionBar" parent="Dialer.ThemeBase">
<item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
@@ -51,7 +51,7 @@
<item name="listChoiceBackgroundIndicator">@drawable/abc_list_selector_holo_dark</item>
</style>
- <style name="Dialer.ThemeBase.NoActionBar">
+ <style name="Dialer.ThemeBase.NoActionBar" parent="Dialer.ThemeBase">
<item name="android:windowLightStatusBar">false</item>
<item name="android:windowLightNavigationBar">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
diff --git a/java/com/android/dialer/theme/base/res/values-v31/styles.xml b/java/com/android/dialer/theme/base/res/values-v31/styles.xml
index b811508..82df4c8 100644
--- a/java/com/android/dialer/theme/base/res/values-v31/styles.xml
+++ b/java/com/android/dialer/theme/base/res/values-v31/styles.xml
@@ -34,7 +34,7 @@
<item name="android:colorAccent">?android:attr/colorPrimary</item>
</style>
- <style name="Dialer.ThemeBase.ActionBar">
+ <style name="Dialer.ThemeBase.ActionBar" parent="Dialer.ThemeBase">
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
@@ -50,7 +50,7 @@
<item name="listChoiceBackgroundIndicator">@drawable/abc_list_selector_holo_dark</item>
</style>
- <style name="Dialer.ThemeBase.NoActionBar">
+ <style name="Dialer.ThemeBase.NoActionBar" parent="Dialer.ThemeBase">
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>