diff options
author | Danny Baumann <dannybaumann@web.de> | 2015-03-26 12:21:04 +0100 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2015-03-27 08:42:06 +0100 |
commit | 1cf98f06751b0e2c132c122ff0c259f6c2399434 (patch) | |
tree | 5850862115ec25927b5120905cd58ba9fe6534b3 | |
parent | 55690811ceec5d8b977a9563b723728ac01822be (diff) | |
download | packages_apps_InCallUI-staging/cm-12.1.tar.gz packages_apps_InCallUI-staging/cm-12.1.tar.bz2 packages_apps_InCallUI-staging/cm-12.1.zip |
Assign background ID to overflow button.staging/cm-12.1
Without it, the SIM color won't be applied to its background.
Change-Id: Iac8bb5fcd19dc50dfe4ea946859a1140e4193562
-rw-r--r-- | res/drawable/btn_overflow_horizontal.xml | 3 | ||||
-rw-r--r-- | src/com/android/incallui/CallButtonFragment.java | 46 | ||||
-rw-r--r-- | src/com/android/incallui/CallCardFragment.java | 1 |
3 files changed, 29 insertions, 21 deletions
diff --git a/res/drawable/btn_overflow_horizontal.xml b/res/drawable/btn_overflow_horizontal.xml index fdda87a6..55cbad86 100644 --- a/res/drawable/btn_overflow_horizontal.xml +++ b/res/drawable/btn_overflow_horizontal.xml @@ -15,7 +15,8 @@ Copyright (C) 2015 The CyanogenMod Project --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@drawable/btn_background" /> + <item android:id="@+id/backgroundItem" + android:drawable="@drawable/btn_background" /> <item> <inset diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java index 2c7fbe6f..06ad044f 100644 --- a/src/com/android/incallui/CallButtonFragment.java +++ b/src/com/android/incallui/CallButtonFragment.java @@ -76,7 +76,6 @@ public class CallButtonFragment private PopupMenu mAudioModePopup; private boolean mAudioModePopupVisible; private PopupMenu mOverflowPopup; - private PopupMenu mMoreMenu; private int mPrevAudioMode = 0; @@ -244,9 +243,7 @@ public class CallButtonFragment }; for (View button : compoundButtons) { - final LayerDrawable layers = (LayerDrawable) button.getBackground(); - final RippleDrawable btnCompoundDrawable = compoundBackgroundDrawable(themeColors); - layers.setDrawableByLayerId(R.id.compoundBackgroundItem, btnCompoundDrawable); + recolorCompoundDrawableBackground(button, themeColors); } ImageButton[] normalButtons = { @@ -259,21 +256,34 @@ public class CallButtonFragment }; for (ImageButton button : normalButtons) { - final LayerDrawable layers = (LayerDrawable) button.getBackground(); - final RippleDrawable btnDrawable = backgroundDrawable(themeColors); - layers.setDrawableByLayerId(R.id.backgroundItem, btnDrawable); + recolorDrawableBackground(button, themeColors); } mCurrentThemeColors = themeColors; } + /* package */ static void recolorCompoundDrawableBackground(View button, + MaterialPalette colors) { + final Resources res = button.getContext().getResources(); + final LayerDrawable layers = (LayerDrawable) button.getBackground(); + final RippleDrawable btnCompoundDrawable = compoundBackgroundDrawable(res, colors); + layers.setDrawableByLayerId(R.id.compoundBackgroundItem, btnCompoundDrawable); + } + + /* package */ static void recolorDrawableBackground(View button, MaterialPalette colors) { + final Resources res = button.getContext().getResources(); + final LayerDrawable layers = (LayerDrawable) button.getBackground(); + final RippleDrawable btnDrawable = backgroundDrawable(res, colors); + layers.setDrawableByLayerId(R.id.backgroundItem, btnDrawable); + } + /** * Generate a RippleDrawable which will be the background for a compound button, i.e. * a button with pressed and unpressed states. The unpressed state will be the same color * as the rest of the call card, the pressed state will be the dark version of that color. */ - private RippleDrawable compoundBackgroundDrawable(MaterialPalette palette) { - Resources res = getResources(); + private static RippleDrawable compoundBackgroundDrawable(Resources res, + MaterialPalette palette) { ColorStateList rippleColor = ColorStateList.valueOf(res.getColor(R.color.incall_accent_color)); @@ -290,8 +300,7 @@ public class CallButtonFragment * Generate a RippleDrawable which will be the background of a button to ensure it * is the same color as the rest of the call card. */ - private RippleDrawable backgroundDrawable(MaterialPalette palette) { - Resources res = getResources(); + private static RippleDrawable backgroundDrawable(Resources res, MaterialPalette palette) { ColorStateList rippleColor = ColorStateList.valueOf(res.getColor(R.color.incall_accent_color)); @@ -303,21 +312,22 @@ public class CallButtonFragment } // state_selected and state_focused - private void addSelectedAndFocused(Resources res, StateListDrawable drawable) { + private static void addSelectedAndFocused(Resources res, StateListDrawable drawable) { int[] selectedAndFocused = {android.R.attr.state_selected, android.R.attr.state_focused}; Drawable selectedAndFocusedDrawable = res.getDrawable(R.drawable.btn_selected_focused); drawable.addState(selectedAndFocused, selectedAndFocusedDrawable); } // state_focused - private void addFocused(Resources res, StateListDrawable drawable) { + private static void addFocused(Resources res, StateListDrawable drawable) { int[] focused = {android.R.attr.state_focused}; Drawable focusedDrawable = res.getDrawable(R.drawable.btn_unselected_focused); drawable.addState(focused, focusedDrawable); } // state_selected - private void addSelected(Resources res, StateListDrawable drawable, MaterialPalette palette) { + private static void addSelected(Resources res, StateListDrawable drawable, + MaterialPalette palette) { int[] selected = {android.R.attr.state_selected}; LayerDrawable selectedDrawable = (LayerDrawable) res.getDrawable(R.drawable.btn_selected); ((GradientDrawable) selectedDrawable.getDrawable(0)).setColor(palette.mSecondaryColor); @@ -325,7 +335,8 @@ public class CallButtonFragment } // default - private void addUnselected(Resources res, StateListDrawable drawable, MaterialPalette palette) { + private static void addUnselected(Resources res, StateListDrawable drawable, + MaterialPalette palette) { LayerDrawable unselectedDrawable = (LayerDrawable) res.getDrawable(R.drawable.btn_unselected); ((GradientDrawable) unselectedDrawable.getDrawable(0)).setColor(palette.mPrimaryColor); @@ -603,11 +614,6 @@ public class CallButtonFragment menu.findItem(R.id.overflow_manage_conference_menu_item).setVisible( showManageConferenceVideoCallOption); - if (mMoreMenu != null) { - menu = mMoreMenu.getMenu(); - menu.findItem(R.id.menu_start_record).setVisible(true); - } - mOverflowButton.setEnabled(menu.hasVisibleItems()); } diff --git a/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java index d67ae11d..00bfb7de 100644 --- a/src/com/android/incallui/CallCardFragment.java +++ b/src/com/android/incallui/CallCardFragment.java @@ -993,6 +993,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mPrimaryCallCardContainer.setBackgroundColor(themeColors.mPrimaryColor); mCallButtonsContainer.setBackgroundColor(themeColors.mPrimaryColor); + CallButtonFragment.recolorDrawableBackground(mMoreMenuButton, themeColors); mCurrentThemeColors = themeColors; } |