Loading core/java/com/android/internal/widget/FloatingToolbar.java +22 −15 Original line number Diff line number Diff line Loading @@ -1163,21 +1163,21 @@ public final class FloatingToolbar { isLastItem && menuItemButtonWidth <= availableWidth - extraPadding; if (canFitWithOverflow || canFitNoOverflow) { if (isNewGroup) { final View border = createBorder(mContext); final int borderWidth = border.getLayoutParams().width; final View divider = createDivider(mContext); final int dividerWidth = divider.getLayoutParams().width; // Add extra padding to the end of the previous button. // Half of the extra padding (less borderWidth) goes to the previous button. View previousButton = mMainPanel.getChildAt(mMainPanel.getChildCount() - 1); final int prevPaddingEnd = previousButton.getPaddingEnd() + extraPadding / 2 - borderWidth; + extraPadding / 2 - dividerWidth; previousButton.setPaddingRelative( previousButton.getPaddingStart(), previousButton.getPaddingTop(), prevPaddingEnd, previousButton.getPaddingBottom()); final ViewGroup.LayoutParams prevParams = previousButton.getLayoutParams(); prevParams.width += extraPadding / 2 - borderWidth; prevParams.width += extraPadding / 2 - dividerWidth; previousButton.setLayoutParams(prevParams); // Add extra padding to the start of this button. Loading @@ -1190,8 +1190,8 @@ public final class FloatingToolbar { menuItemButton.getPaddingEnd(), menuItemButton.getPaddingBottom()); // Include a border. mMainPanel.addView(border); // Include a divider. mMainPanel.addView(divider); } setButtonTagAndClickListener(menuItemButton, menuItem); Loading Loading @@ -1670,21 +1670,28 @@ public final class FloatingToolbar { return popupWindow; } private static View createBorder(Context context) { private static View createDivider(Context context) { // TODO: Inflate this instead. View border = new View(context); View divider = new View(context); int _1dp = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 1, context.getResources().getDisplayMetrics()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( _1dp, ViewGroup.LayoutParams.MATCH_PARENT); params.setMarginsRelative(0, _1dp * 10, 0, _1dp * 10); border.setLayoutParams(params); border.setBackgroundColor(Color.parseColor("#9E9E9E")); border.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); border.setEnabled(false); border.setFocusable(false); border.setContentDescription(null); return border; divider.setLayoutParams(params); TypedArray a = context.obtainStyledAttributes( new TypedValue().data, new int[] { R.attr.floatingToolbarDividerColor }); divider.setBackgroundColor(a.getColor(0, 0)); a.recycle(); divider.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); divider.setEnabled(false); divider.setFocusable(false); divider.setContentDescription(null); return divider; } /** Loading core/res/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -576,6 +576,7 @@ <attr name="floatingToolbarItemBackgroundDrawable" format="reference" /> <attr name="floatingToolbarOpenDrawable" format="reference" /> <attr name="floatingToolbarPopupBackgroundDrawable" format="reference" /> <attr name="floatingToolbarDividerColor" format="reference" /> <!-- ============ --> <!-- Alert Dialog styles --> Loading core/res/res/values/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -194,4 +194,8 @@ <color name="tooltip_background_dark">#e6616161</color> <color name="tooltip_background_light">#e6FFFFFF</color> <!-- FloatingToolbar --> <color name="floating_popup_divider_dark">#2F2F2F</color> <color name="floating_popup_divider_light">#E9E9E9</color> </resources> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2425,6 +2425,7 @@ <java-symbol type="drawable" name="ft_avd_toarrow" /> <java-symbol type="drawable" name="ft_avd_toarrow_animation" /> <java-symbol type="drawable" name="ft_avd_tooverflow_animation" /> <java-symbol type="attr" name="floatingToolbarDividerColor" /> <java-symbol type="string" name="date_picker_prev_month_button" /> <java-symbol type="string" name="date_picker_next_month_button" /> Loading core/res/res/values/themes.xml +2 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,7 @@ please see themes_device_defaults.xml. <item name="floatingToolbarItemBackgroundDrawable">@drawable/item_background_material_dark</item> <item name="floatingToolbarOpenDrawable">@drawable/ic_menu_moreoverflow_material_dark</item> <item name="floatingToolbarPopupBackgroundDrawable">@drawable/floating_popup_background_dark</item> <item name="floatingToolbarDividerColor">@color/floating_popup_divider_dark</item> <!-- SearchView attributes --> <item name="searchViewStyle">@style/Widget.Holo.SearchView</item> Loading Loading @@ -559,6 +560,7 @@ please see themes_device_defaults.xml. <item name="floatingToolbarItemBackgroundDrawable">@drawable/item_background_material_light</item> <item name="floatingToolbarOpenDrawable">@drawable/ic_menu_moreoverflow_material_light</item> <item name="floatingToolbarPopupBackgroundDrawable">@drawable/floating_popup_background_light</item> <item name="floatingToolbarDividerColor">@color/floating_popup_divider_light</item> <!-- Tooltip popup colors --> <item name="tooltipForegroundColor">@color/bright_foreground_dark</item> Loading Loading
core/java/com/android/internal/widget/FloatingToolbar.java +22 −15 Original line number Diff line number Diff line Loading @@ -1163,21 +1163,21 @@ public final class FloatingToolbar { isLastItem && menuItemButtonWidth <= availableWidth - extraPadding; if (canFitWithOverflow || canFitNoOverflow) { if (isNewGroup) { final View border = createBorder(mContext); final int borderWidth = border.getLayoutParams().width; final View divider = createDivider(mContext); final int dividerWidth = divider.getLayoutParams().width; // Add extra padding to the end of the previous button. // Half of the extra padding (less borderWidth) goes to the previous button. View previousButton = mMainPanel.getChildAt(mMainPanel.getChildCount() - 1); final int prevPaddingEnd = previousButton.getPaddingEnd() + extraPadding / 2 - borderWidth; + extraPadding / 2 - dividerWidth; previousButton.setPaddingRelative( previousButton.getPaddingStart(), previousButton.getPaddingTop(), prevPaddingEnd, previousButton.getPaddingBottom()); final ViewGroup.LayoutParams prevParams = previousButton.getLayoutParams(); prevParams.width += extraPadding / 2 - borderWidth; prevParams.width += extraPadding / 2 - dividerWidth; previousButton.setLayoutParams(prevParams); // Add extra padding to the start of this button. Loading @@ -1190,8 +1190,8 @@ public final class FloatingToolbar { menuItemButton.getPaddingEnd(), menuItemButton.getPaddingBottom()); // Include a border. mMainPanel.addView(border); // Include a divider. mMainPanel.addView(divider); } setButtonTagAndClickListener(menuItemButton, menuItem); Loading Loading @@ -1670,21 +1670,28 @@ public final class FloatingToolbar { return popupWindow; } private static View createBorder(Context context) { private static View createDivider(Context context) { // TODO: Inflate this instead. View border = new View(context); View divider = new View(context); int _1dp = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 1, context.getResources().getDisplayMetrics()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( _1dp, ViewGroup.LayoutParams.MATCH_PARENT); params.setMarginsRelative(0, _1dp * 10, 0, _1dp * 10); border.setLayoutParams(params); border.setBackgroundColor(Color.parseColor("#9E9E9E")); border.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); border.setEnabled(false); border.setFocusable(false); border.setContentDescription(null); return border; divider.setLayoutParams(params); TypedArray a = context.obtainStyledAttributes( new TypedValue().data, new int[] { R.attr.floatingToolbarDividerColor }); divider.setBackgroundColor(a.getColor(0, 0)); a.recycle(); divider.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); divider.setEnabled(false); divider.setFocusable(false); divider.setContentDescription(null); return divider; } /** Loading
core/res/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -576,6 +576,7 @@ <attr name="floatingToolbarItemBackgroundDrawable" format="reference" /> <attr name="floatingToolbarOpenDrawable" format="reference" /> <attr name="floatingToolbarPopupBackgroundDrawable" format="reference" /> <attr name="floatingToolbarDividerColor" format="reference" /> <!-- ============ --> <!-- Alert Dialog styles --> Loading
core/res/res/values/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -194,4 +194,8 @@ <color name="tooltip_background_dark">#e6616161</color> <color name="tooltip_background_light">#e6FFFFFF</color> <!-- FloatingToolbar --> <color name="floating_popup_divider_dark">#2F2F2F</color> <color name="floating_popup_divider_light">#E9E9E9</color> </resources>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2425,6 +2425,7 @@ <java-symbol type="drawable" name="ft_avd_toarrow" /> <java-symbol type="drawable" name="ft_avd_toarrow_animation" /> <java-symbol type="drawable" name="ft_avd_tooverflow_animation" /> <java-symbol type="attr" name="floatingToolbarDividerColor" /> <java-symbol type="string" name="date_picker_prev_month_button" /> <java-symbol type="string" name="date_picker_next_month_button" /> Loading
core/res/res/values/themes.xml +2 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,7 @@ please see themes_device_defaults.xml. <item name="floatingToolbarItemBackgroundDrawable">@drawable/item_background_material_dark</item> <item name="floatingToolbarOpenDrawable">@drawable/ic_menu_moreoverflow_material_dark</item> <item name="floatingToolbarPopupBackgroundDrawable">@drawable/floating_popup_background_dark</item> <item name="floatingToolbarDividerColor">@color/floating_popup_divider_dark</item> <!-- SearchView attributes --> <item name="searchViewStyle">@style/Widget.Holo.SearchView</item> Loading Loading @@ -559,6 +560,7 @@ please see themes_device_defaults.xml. <item name="floatingToolbarItemBackgroundDrawable">@drawable/item_background_material_light</item> <item name="floatingToolbarOpenDrawable">@drawable/ic_menu_moreoverflow_material_light</item> <item name="floatingToolbarPopupBackgroundDrawable">@drawable/floating_popup_background_light</item> <item name="floatingToolbarDividerColor">@color/floating_popup_divider_light</item> <!-- Tooltip popup colors --> <item name="tooltipForegroundColor">@color/bright_foreground_dark</item> Loading