diff options
author | wangqi <wangqi@google.com> | 2018-06-29 15:02:36 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-29 15:02:36 -0700 |
commit | 288303c95d776f5e2f8dd14ccb22a903173c92cb (patch) | |
tree | 272316c4ebced7e2e8b366fddf99a361f11ab702 | |
parent | d0ea13da747a9f17fb8f114201f7d5b500bf806c (diff) | |
parent | a3535c05c39631a6b07f42efaa7a19bd5c045713 (diff) |
Merge "UI refresh for reply with sms bottom sheet." am: 1c2630958c
am: a3535c05c3
Change-Id: I4faee656479c82da84dd35be03988837cf106d41
7 files changed, 71 insertions, 7 deletions
diff --git a/java/com/android/dialer/theme/base/Theme.java b/java/com/android/dialer/theme/base/Theme.java index 2a9975b4b..3356a018c 100644 --- a/java/com/android/dialer/theme/base/Theme.java +++ b/java/com/android/dialer/theme/base/Theme.java @@ -44,6 +44,9 @@ public interface Theme { @StyleRes int getApplicationThemeRes(); + @StyleRes + int getBottomSheetStyleRes(); + Context getThemedContext(Context context); LayoutInflater getThemedLayoutInflator(LayoutInflater inflater); diff --git a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java index 35dcef27c..cd1e16684 100644 --- a/java/com/android/dialer/theme/base/impl/AospThemeImpl.java +++ b/java/com/android/dialer/theme/base/impl/AospThemeImpl.java @@ -102,10 +102,25 @@ public class AospThemeImpl implements Theme { @Override public @StyleRes int getApplicationThemeRes() { switch (getTheme()) { + case LIGHT: + case LIGHT_M2: + return R.style.Dialer_ThemeBase_NoActionBar; case DARK: return R.style.Dialer_Dark_ThemeBase_NoActionBar; + case UNKNOWN: + default: + throw Assert.createIllegalStateFailException("Theme hasn't been set yet."); + } + } + + @Override + public @StyleRes int getBottomSheetStyleRes() { + switch (getTheme()) { case LIGHT: - return R.style.Dialer_ThemeBase_NoActionBar; + case LIGHT_M2: + return R.style.DialerBottomSheetDialogStyle_Light; + case DARK: + return R.style.DialerBottomSheetDialogStyle_Dark; case UNKNOWN: default: throw Assert.createIllegalStateFailException("Theme hasn't been set yet."); diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml index d2cc0fc9c..282ddfebb 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_dark.xml @@ -64,4 +64,10 @@ <item name="colorIconOnUnthemedDarkBackground">@android:color/white</item> <item name="colorPrimary20pct">@color/dialer_dark_theme_color_20pct</item> </style> -</resources>
\ No newline at end of file + + <style name="DialerBottomSheetDialogStyle.Dark"> + <item name="android:textColorPrimary">@color/dialer_dark_primary_text_color</item> + <item name="android:colorBackgroundFloating">@color/google_grey_800</item> + </style> + +</resources> diff --git a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml index 69ecba41e..b0428ee46 100644 --- a/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml +++ b/java/com/android/dialer/theme/base/res/values/theme_dialer_light.xml @@ -84,6 +84,11 @@ <item name="android:windowAnimationStyle">@android:style/Animation</item> </style> + <style name="DialerBottomSheetDialogStyle.Light"> + <item name="android:textColorPrimary">@color/dialer_primary_text_color</item> + <item name="android:colorBackgroundFloating">@android:color/white</item> + </style> + <!-- Deprecated: Use Toolbar instead of ActionBar. --> <!-- Used to style all Dialer's action bars. Every actionbar is awarded this for free if the parent activity's theme extends from Dialer.ThemeBase.ActionBar or doesn't specify a theme. --> diff --git a/java/com/android/dialer/theme/common/res/drawable/bottom_sheet_background.xml b/java/com/android/dialer/theme/common/res/drawable/bottom_sheet_background.xml new file mode 100644 index 000000000..558277d42 --- /dev/null +++ b/java/com/android/dialer/theme/common/res/drawable/bottom_sheet_background.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <corners + android:topLeftRadius="8dp" + android:topRightRadius="8dp"/> + <solid android:color="?android:attr/colorBackgroundFloating"/> +</shape>
\ No newline at end of file diff --git a/java/com/android/dialer/theme/common/res/values/styles.xml b/java/com/android/dialer/theme/common/res/values/styles.xml index 2c6446ca1..ac23bdf98 100644 --- a/java/com/android/dialer/theme/common/res/values/styles.xml +++ b/java/com/android/dialer/theme/common/res/values/styles.xml @@ -31,4 +31,13 @@ <item name="android:layout_marginStart">20dp</item> <item name="android:paddingLeft">12dp</item> </style> + + <style name="DialerBottomSheetDialogStyle" parent="Theme.Design.BottomSheetDialog"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="bottomSheetStyle">@style/BottomSheetStyle</item> + </style> + + <style name="BottomSheetStyle" parent="Widget.Design.BottomSheet.Modal"> + <item name="android:background">@drawable/bottom_sheet_background</item> + </style> </resources>
\ No newline at end of file diff --git a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java index 6742e4a36..b06a0c681 100644 --- a/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java +++ b/java/com/android/incallui/answer/impl/SmsBottomSheetFragment.java @@ -36,6 +36,7 @@ import android.widget.TextView; import com.android.dialer.common.DpUtil; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; +import com.android.dialer.theme.base.ThemeComponent; import com.android.incallui.incalluilock.InCallUiLock; import java.util.ArrayList; import java.util.List; @@ -68,6 +69,8 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment { } } layout.addView(newTextViewItem(null)); + int paddingVertical = (int) DpUtil.dpToPx(getContext(), 8); + layout.setPadding(0, paddingVertical, 0, paddingVertical); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); return layout; } @@ -100,11 +103,11 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment { TextView textView = new TextView(context); textView.setText(text == null ? getString(R.string.call_incoming_message_custom) : text); - int padding = (int) DpUtil.dpToPx(context, 16); - textView.setPadding(padding, padding, padding, padding); + int paddingHorizontal = (int) DpUtil.dpToPx(context, 24); + int paddingVertical = (int) DpUtil.dpToPx(context, 12); + textView.setPadding(paddingHorizontal, paddingVertical, paddingHorizontal, paddingVertical); textView.setBackground(background); - textView.setTextColor(context.getColor(R.color.blue_grey_100)); - textView.setTextAppearance(R.style.TextAppearance_AppCompat_Widget_PopupMenu_Large); + textView.setTextAppearance(R.style.Dialer_TextAppearance_Primary2); LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); @@ -124,7 +127,7 @@ public class SmsBottomSheetFragment extends BottomSheetDialogFragment { @Override public int getTheme() { - return R.style.Theme_Design_Light_BottomSheetDialog; + return ThemeComponent.get(getContext()).theme().getBottomSheetStyleRes(); } @Override |