diff options
Diffstat (limited to 'java/com/android/dialer/main/impl')
11 files changed, 60 insertions, 22 deletions
diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index a0e92a8cb..e14c5b97f 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -116,6 +116,8 @@ import com.android.dialer.smartdial.util.SmartDialPrefix; import com.android.dialer.speeddial.SpeedDialFragment; import com.android.dialer.storage.StorageComponent; import com.android.dialer.telecom.TelecomUtil; +import com.android.dialer.theme.base.Theme; +import com.android.dialer.theme.base.ThemeComponent; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PermissionsUtil; import com.android.dialer.util.TransactionSafeActivity; @@ -229,12 +231,30 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @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/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 4edb08e55..3a43f8460 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -30,7 +30,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; import com.android.dialer.configprovider.ConfigProviderBindings; -import com.android.dialer.theme.ThemeUtil; +import com.android.dialer.theme.base.ThemeComponent; /** Navigation item in a bottom nav. */ final class BottomNavItem extends LinearLayout { @@ -54,7 +54,10 @@ final class BottomNavItem extends LinearLayout { @Override public void setSelected(boolean selected) { super.setSelected(selected); - int colorId = selected ? ThemeUtil.getColorPrimary() : ThemeUtil.getTextColorSecondary(); + int colorId = + selected + ? ThemeComponent.get(getContext()).theme().getColorPrimary() + : ThemeComponent.get(getContext()).theme().getTextColorSecondary(); image.setImageTintList(ColorStateList.valueOf(colorId)); text.setTextColor(colorId); } diff --git a/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml index dad566b68..65bc8f9b4 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml @@ -19,5 +19,5 @@ android:shape="rectangle"> <solid android:color="?android:attr/colorPrimary"/> <corners android:radius="20dp"/> - <stroke android:color="?android:attr/colorBackground" android:width="2dp"/> + <stroke android:color="?android:attr/colorBackgroundFloating" android:width="2dp"/> </shape>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml index 2197b4d21..3fbd9ffc9 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml @@ -58,7 +58,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" - android:textSize="12sp" - android:textColor="?android:attr/colorPrimary" - android:gravity="center_horizontal"/> + android:gravity="center_horizontal" + style="@style/Dialer.TextAppearance.Secondary"/> </com.android.dialer.main.impl.bottomnav.BottomNavItem>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml b/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml index 709de52b8..0edc03c3d 100644 --- a/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml +++ b/java/com/android/dialer/main/impl/res/layout/promotion_bottom_sheet.xml @@ -47,9 +47,7 @@ android:id="@+id/promotion_title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:fontFamily="sans-serif-medium" - android:textColor="#DD000000" - android:textSize="16sp" + style="@style/Dialer.TextAppearance.Header2" /> <TextView android:id="@+id/promotion_details" @@ -58,8 +56,7 @@ android:layout_marginTop="8dp" android:layout_marginBottom="16dp" android:lineSpacingMultiplier="1.5" - android:textColor="#DD000000" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> <Button android:id="@+id/ok_got_it" android:layout_width="wrap_content" diff --git a/java/com/android/dialer/main/impl/res/values-v27/styles.xml b/java/com/android/dialer/main/impl/res/values-v27/styles.xml index 9462bbc25..261012ed5 100644 --- a/java/com/android/dialer/main/impl/res/values-v27/styles.xml +++ b/java/com/android/dialer/main/impl/res/values-v27/styles.xml @@ -24,4 +24,13 @@ <item name="android:navigationBarColor">?android:attr/colorBackgroundFloating</item> <item name="android:navigationBarDividerColor">#E0E0E0</item> </style> + + <!-- Used on sdk 27 and above --> + <!-- TODO(a bug): refactor into dialer/theme --> + <style name="MainActivityTheme.Dark" parent="MainActivityThemeBase.Dark"> + <!-- Used to change the navigation bar color --> + <item name="android:windowLightNavigationBar">true</item> + <item name="android:navigationBarColor">?android:attr/colorBackgroundFloating</item> + <item name="android:navigationBarDividerColor">#E0E0E0</item> + </style> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/res/values/styles.xml b/java/com/android/dialer/main/impl/res/values/styles.xml index 467cb5be0..7b36e78ef 100644 --- a/java/com/android/dialer/main/impl/res/values/styles.xml +++ b/java/com/android/dialer/main/impl/res/values/styles.xml @@ -19,12 +19,23 @@ <!-- Activities should use this theme as their style --> <style name="MainActivityTheme" parent="MainActivityThemeBase"/> + <style name="MainActivityTheme.Dark" parent="MainActivityTheme.Dark"/> + <!-- Used as a procy for values-v27/styles.xml --> <style name="MainActivityThemeBase" parent="Dialer.ThemeBase.NoActionBar"> <!-- Required for actionmode/multiselect to render properly. --> <!-- TODO(a bug): Check to see if we can remove this after NewVoicemailFragment launches --> <item name="actionModeStyle">@style/MainActionModeStyle</item> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> + <item name="dialpad_style">@style/Dialpad.Light</item> + </style> + + <style name="MainActivityThemeBase.Dark" parent="Dialer.Dark.ThemeBase.NoActionBar"> + <!-- Required for actionmode/multiselect to render properly. --> + <!-- TODO(a bug): Check to see if we can remove this after NewVoicemailFragment launches --> + <item name="actionModeStyle">@style/MainActionModeStyle</item> + <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> + <item name="dialpad_style">@style/Dialpad.Light</item> </style> <!-- Colors our actionbar in action mode to dialer theme color. --> diff --git a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml index 8bc21c4a8..b797bd171 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background.xml @@ -16,5 +16,5 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="?android:attr/colorBackground"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> </shape> diff --git a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml index 2bbc8d106..88f5a04ca 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/drawable/search_bar_background_rounded_corners.xml @@ -16,6 +16,6 @@ --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> - <solid android:color="?android:attr/colorBackground"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> <corners android:radius="2dp"/> </shape> diff --git a/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml b/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml index 8a8730f78..e5b72f233 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/layout/expanded_search_bar.xml @@ -45,7 +45,7 @@ android:inputType="textFilter" android:maxLines="1" android:hint="@string/dialer_hint_find_contact" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorSecondary" android:textColorHint="?android:attr/textColorHint" android:textCursorDrawable="@drawable/custom_cursor" android:textSize="16sp"/> @@ -60,6 +60,6 @@ android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/description_clear_search" android:src="@drawable/quantum_ic_close_vd_theme_24" - android:tint="@color/dialer_secondary_text_color" + android:tint="?colorIcon" android:visibility="gone"/> </RelativeLayout>
\ No newline at end of file diff --git a/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml b/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml index 98b856361..578684ef8 100644 --- a/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml +++ b/java/com/android/dialer/main/impl/toolbar/res/layout/toolbar_layout.xml @@ -50,7 +50,7 @@ android:importantForAccessibility="no" android:scaleType="center" android:src="@drawable/quantum_ic_search_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> <TextView android:id="@+id/search_box_start_search" @@ -60,9 +60,8 @@ android:layout_centerVertical="true" android:layout_toEndOf="@+id/search_magnifying_glass" android:layout_toStartOf="@+id/voice_search_button" - android:fontFamily="sans-serif" android:text="@string/dialer_hint_find_contact" - android:textColor="@color/dialer_secondary_text_color" + android:textColor="?android:attr/textColorHint" android:textSize="16dp"/> <ImageView @@ -74,7 +73,7 @@ android:contentDescription="@string/description_start_voice_search" android:scaleType="center" android:src="@drawable/quantum_ic_mic_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> <ImageButton android:id="@+id/main_options_menu_button" @@ -85,7 +84,7 @@ android:contentDescription="@string/action_menu_overflow_description" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon"/> </RelativeLayout> <include layout="@layout/expanded_search_bar"/> @@ -122,14 +121,14 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:src="@drawable/quantum_ic_close_vd_theme_24" - android:tint="?android:attr/textColorPrimaryInverse"/> + android:tint="?colorIconOnUnthemedDarkBackground"/> <TextView android:id="@+id/remove_view_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_remove_contact" - android:textColor="?android:attr/textColorPrimaryInverse" + android:textColor="?colorTextOnUnthemedDarkBackground" android:textSize="16sp"/> </LinearLayout> </com.android.dialer.app.list.RemoveView> |