From 27d7f0a5a307c15dee5a048ec36ca256fa90d1bd Mon Sep 17 00:00:00 2001 From: wangqi Date: Fri, 29 Jun 2018 11:28:00 -0700 Subject: UI refresh for reply with sms bottom sheet. Bug: 79878432 Test: manual PiperOrigin-RevId: 202678951 Change-Id: I89cf9dc7ec78f2b6bd10889d50d3c9a139168bca --- java/com/android/dialer/theme/base/Theme.java | 3 +++ .../dialer/theme/base/impl/AospThemeImpl.java | 17 +++++++++++++++- .../theme/base/res/values/theme_dialer_dark.xml | 8 +++++++- .../theme/base/res/values/theme_dialer_light.xml | 5 +++++ .../res/drawable/bottom_sheet_background.xml | 23 ++++++++++++++++++++++ .../dialer/theme/common/res/values/styles.xml | 9 +++++++++ .../answer/impl/SmsBottomSheetFragment.java | 13 +++++++----- 7 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 java/com/android/dialer/theme/common/res/drawable/bottom_sheet_background.xml (limited to 'java') 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 @@ @android:color/white @color/dialer_dark_theme_color_20pct - \ No newline at end of file + + + + 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 @@ @android:style/Animation + + 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 @@ + + + + + + \ 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 @@ 20dp 12dp + + + + \ 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 -- cgit v1.2.3