OSDN Git Service

Make buttons more touch friendly.
authorDanny Baumann <dannybaumann@web.de>
Fri, 19 Dec 2014 12:42:57 +0000 (13:42 +0100)
committerSteve Kondik <shade@chemlab.org>
Sat, 27 Dec 2014 12:31:23 +0000 (12:31 +0000)
Do this by replacing margins and empty space around buttons by padding.
Doing this also makes the ripple touch feedback look better.

Change-Id: I7f2e933b9f7b481c9456f56860483c2e5e96b67b

res/layout/activity_player_fragment.xml
res/layout/audio_player_header_bar.xml
res/layout/edit_queue_list_item.xml
res/layout/grid_items_normal.xml
res/layout/header_bar.xml
res/layout/list_item_queue.xml
res/layout/list_item_simple.xml
res/values/dimens.xml
src/com/cyanogenmod/eleven/widgets/PopupMenuButton.java

index 3ecdc37..2b2c4f6 100644 (file)
 
             <!-- divider -->
             <View
+                android:id="@+id/action_button_left_top_divider"
                 android:layout_height="@dimen/audio_player_divider_height"
                 android:layout_width="@dimen/audio_player_divider_length"
                 android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
-                android:layout_marginBottom="@dimen/audio_player_divider_vertical_offset"
                 android:layout_alignParentRight="true"
                 android:layout_above="@id/audio_player_current_time"
                 android:background="@color/now_playing_divider" />
 
             <!-- divider -->
             <View
+                android:id="@+id/action_button_left_bottom_divider"
                 android:layout_height="@dimen/audio_player_divider_height"
                 android:layout_width="@dimen/audio_player_divider_length"
                 android:layout_marginRight="@dimen/audio_player_divider_horizontal_offset"
-                android:layout_marginTop="@dimen/audio_player_divider_vertical_offset"
                 android:layout_alignParentRight="true"
                 android:layout_below="@id/audio_player_current_time"
                 android:background="@color/now_playing_divider" />
                 android:id="@+id/action_button_browse"
                 android:layout_width="@dimen/audio_player_controls_end_button_width"
                 android:layout_height="@dimen/audio_player_controls_end_button_height"
-                android:layout_above="@id/action_button_previous"
+                android:layout_above="@id/action_button_left_top_divider"
                 android:layout_alignLeft="@id/action_button_previous"
                 android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
-                android:layout_marginBottom="@dimen/audio_player_secondary_control_offset"
                 android:contentDescription="@string/accessibility_browse"
                 android:focusable="true"
                 android:scaleType="fitCenter"
                 android:id="@+id/action_button_shuffle"
                 android:layout_width="@dimen/audio_player_controls_end_button_width"
                 android:layout_height="@dimen/audio_player_controls_end_button_height"
-                android:layout_below="@id/action_button_previous"
+                android:layout_below="@id/action_button_left_bottom_divider"
                 android:layout_alignLeft="@id/action_button_previous"
                 android:layout_marginLeft="@dimen/audio_player_controls_end_button_half_width"
-                android:layout_marginTop="@dimen/audio_player_secondary_control_offset"
                 android:contentDescription="@string/accessibility_shuffle"
                 android:scaleType="fitCenter"
                 android:src="@drawable/btn_playback_shuffle_all" />
 
             <!-- divider -->
             <View
+                android:id="@+id/action_button_right_top_divider"
                 android:layout_height="@dimen/audio_player_divider_height"
                 android:layout_width="@dimen/audio_player_divider_length"
                 android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
-                android:layout_marginBottom="@dimen/audio_player_divider_vertical_offset"
                 android:layout_alignParentLeft="true"
                 android:layout_above="@id/audio_player_total_time"
                 android:background="@color/now_playing_divider" />
 
             <!-- divider -->
             <View
+                android:id="@+id/action_button_right_bottom_divider"
                 android:layout_height="@dimen/audio_player_divider_height"
                 android:layout_width="@dimen/audio_player_divider_length"
                 android:layout_marginLeft="@dimen/audio_player_divider_horizontal_offset"
-                android:layout_marginTop="@dimen/audio_player_divider_vertical_offset"
                 android:layout_alignParentLeft="true"
                 android:layout_below="@id/audio_player_total_time"
                 android:background="@color/now_playing_divider" />
                 android:id="@+id/action_button_queue"
                 android:layout_width="@dimen/audio_player_controls_end_button_width"
                 android:layout_height="@dimen/audio_player_controls_end_button_height"
-                android:layout_above="@id/action_button_next"
+                android:layout_above="@id/action_button_right_top_divider"
                 android:layout_alignRight="@id/action_button_next"
                 android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
-                android:layout_marginBottom="@dimen/audio_player_secondary_control_offset"
                 android:contentDescription="@string/accessibility_queue"
                 android:focusable="true"
                 android:scaleType="fitCenter"
                 android:id="@+id/action_button_repeat"
                 android:layout_width="@dimen/audio_player_controls_end_button_width"
                 android:layout_height="@dimen/audio_player_controls_end_button_height"
-                android:layout_below="@id/action_button_next"
+                android:layout_below="@id/action_button_right_bottom_divider"
                 android:layout_alignRight="@id/action_button_next"
                 android:layout_marginRight="@dimen/audio_player_controls_end_button_half_width"
-                android:layout_marginTop="@dimen/audio_player_secondary_control_offset"
                 android:contentDescription="@string/accessibility_repeat"
                 android:focusable="true"
                 android:scaleType="fitCenter"
index 6b73ff3..9c71788 100644 (file)
@@ -20,7 +20,6 @@
     android:layout_height="@dimen/header_bar_height"
     android:orientation="horizontal"
     android:paddingStart="@dimen/header_bar_padding_left"
-    android:paddingEnd="@dimen/header_bar_padding_right"
     android:elevation="@dimen/action_bar_elevation"
     android:background="@android:color/transparent">
 
         <ImageView
             android:id="@+id/header_bar_add_button"
             android:layout_width="@dimen/header_bar_custom_button_width"
-            android:layout_height="@dimen/header_bar_custom_button_height"
+            android:layout_height="@dimen/header_bar_button_height"
             android:layout_gravity="center_vertical"
             android:layout_weight="0"
-            android:layout_marginStart="@dimen/header_bar_button_padding"
-            android:layout_marginEnd="@dimen/header_bar_button_padding"
             android:background="@drawable/selectable_background"
             android:src="@drawable/btn_add_to_playlist"
             android:scaleType="centerInside" />
         <ImageView
             android:id="@+id/header_bar_search_button"
             android:layout_width="@dimen/header_bar_custom_button_width"
-            android:layout_height="@dimen/header_bar_custom_button_height"
+            android:layout_height="@dimen/header_bar_button_height"
             android:layout_gravity="center_vertical"
             android:layout_weight="0"
-            android:layout_marginStart="@dimen/header_bar_button_padding"
-            android:layout_marginEnd="@dimen/header_bar_button_padding"
             android:background="@drawable/selectable_background"
             android:src="@drawable/ic_action_search"
             android:scaleType="centerInside" />
         <ImageView
             android:id="@+id/header_bar_menu_button"
             android:layout_width="@dimen/header_bar_menu_button_width"
-            android:layout_height="@dimen/header_bar_menu_button_height"
+            android:layout_height="@dimen/header_bar_button_height"
             android:layout_gravity="center_vertical"
             android:layout_weight="0"
             android:scaleType="centerInside"
-            android:layout_marginStart="@dimen/header_bar_button_padding"
             android:background="@drawable/selectable_background"
             android:src="@drawable/menu_button_light"/>
     </LinearLayout>
index af6309b..5982932 100644 (file)
@@ -33,8 +33,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_toRightOf="@+id/edit_track_list_item_handle"
-        android:gravity="center_vertical"
-        android:paddingRight="@dimen/list_item_general_margin" >
+        android:gravity="center_vertical">
 
         <include layout="@layout/list_item_queue" />
     </FrameLayout>
@@ -45,4 +44,4 @@
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:src="@drawable/dnd_list_divider_light" />
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
index 014db85..ebff650 100644 (file)
@@ -59,8 +59,7 @@
             <com.cyanogenmod.eleven.widgets.PopupMenuButton
                 android:id="@+id/popup_menu_button"
                 android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_vertical"
+                android:layout_height="match_parent"
                 android:paddingRight="@dimen/grid_item_padding_right"
                 android:src="@drawable/menu_button" />
 
index ed79e03..4e66b13 100644 (file)
@@ -21,7 +21,6 @@
     android:gravity="center_vertical"
     android:orientation="horizontal"
     android:paddingStart="@dimen/drag_and_drop_width"
-    android:paddingEnd="@dimen/header_bar_padding_right"
     android:background="@color/header_action_bar_color"
     android:elevation="@dimen/action_bar_elevation"
     android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar">
     <ImageView
         android:id="@+id/header_bar_up"
         android:layout_width="@dimen/header_bar_up_width"
-        android:layout_height="@dimen/header_bar_up_height"
+        android:layout_height="@dimen/header_bar_button_height"
         android:layout_gravity="center_vertical"
         android:layout_weight="0"
-        android:layout_marginRight="@dimen/header_bar_button_padding"
         android:scaleType="centerCrop"
         android:background="@drawable/selectable_background"
         android:src="@drawable/btn_header_collapse"/>
     <ImageView
         android:id="@+id/header_bar_search_button"
         android:layout_width="@dimen/header_bar_custom_button_width"
-        android:layout_height="@dimen/header_bar_custom_button_height"
+        android:layout_height="@dimen/header_bar_button_height"
         android:layout_gravity="center_vertical"
         android:layout_weight="0"
-        android:layout_marginStart="@dimen/header_bar_button_padding"
-        android:layout_marginEnd="@dimen/header_bar_button_padding"
         android:src="@drawable/ic_action_search"
         android:background="@drawable/selectable_background"
         android:scaleType="centerInside" />
     <ImageView
         android:id="@+id/header_bar_menu_button"
         android:layout_width="@dimen/header_bar_menu_button_width"
-        android:layout_height="@dimen/header_bar_menu_button_height"
+        android:layout_height="@dimen/header_bar_button_height"
         android:layout_gravity="center_vertical"
         android:layout_weight="0"
         android:scaleType="centerInside"
-        android:layout_marginStart="@dimen/header_bar_button_padding"
         android:background="@drawable/selectable_background"
         android:src="@drawable/menu_button_light"/>
 
index 1c1f835..9b699ec 100644 (file)
@@ -68,8 +68,8 @@
 
     <com.cyanogenmod.eleven.widgets.PopupMenuButton
         android:id="@id/popup_menu_button"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        android:layout_width="@dimen/overflow_width"
+        android:layout_height="@dimen/overflow_height"
         android:layout_alignParentRight="true"
         android:layout_centerVertical="true"
         android:src="@drawable/menu_button_light" />
index 32432b7..6fa8228 100644 (file)
@@ -61,8 +61,8 @@
 
         <com.cyanogenmod.eleven.widgets.PopupMenuButton
             android:id="@id/popup_menu_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_width="@dimen/overflow_width"
+            android:layout_height="@dimen/overflow_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:src="@drawable/menu_button" />
@@ -74,4 +74,4 @@
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:src="@drawable/inset_list_divider" />
-</RelativeLayout>
\ No newline at end of file
+</RelativeLayout>
index 38314c2..c0da43f 100644 (file)
@@ -29,8 +29,8 @@
     <dimen name="standard_padding">16.0dip</dimen>
 
     <!-- overflow menu used on page headers and in list items -->
-    <dimen name="overflow_height">30.0dip</dimen>
-    <dimen name="overflow_width">24.0dip</dimen>
+    <dimen name="overflow_height">48.0dip</dimen>
+    <dimen name="overflow_width">38.0dip</dimen>
 
     <!-- List and grid view padding -->
     <dimen name="list_preferred_item_padding">14.0dip</dimen>
     <dimen name="playlist_detail_header_bottom_height">40.0dip</dimen>
 
     <!-- Audio player Buttons (play/pause/shuffle/repeat/next/previous)-->
-    <dimen name="audio_player_controls_end_button_width">34.0dip</dimen>
-    <dimen name="audio_player_controls_end_button_height">34.0dip</dimen>
-    <dimen name="audio_player_controls_end_button_half_width">17.0dip</dimen>
+    <dimen name="audio_player_controls_end_button_width">50.0dip</dimen>
+    <dimen name="audio_player_controls_end_button_height">50.0dip</dimen>
+    <dimen name="audio_player_controls_end_button_half_width">25.0dip</dimen>
+    <dimen name="audio_player_controls_end_button_padding">8.0dip</dimen>
     <dimen name="audio_player_controls_main_button_width">100.0dip</dimen>
     <dimen name="audio_player_controls_main_button_height">100.0dip</dimen>
     <dimen name="audio_player_controls_top_button_width">26.0dip</dimen>
     <dimen name="audio_player_controls_top_button_height">30.0dip</dimen>
     <dimen name="audio_player_controls_side_width">83.0dip</dimen>
     <dimen name="audio_player_control_padding_top">26.0dip</dimen>
-    <dimen name="audio_player_secondary_control_offset">16dp</dimen>
 
     <!-- Audio player track text settings-->
     <dimen name="audio_player_track_name_padding_side">36.0dip</dimen>
 
     <dimen name="audio_player_divider_length">86.0dip</dimen>
     <dimen name="audio_player_divider_height">1.0dip</dimen>
-    <dimen name="audio_player_divider_vertical_offset">8.0dip</dimen>
     <dimen name="audio_player_divider_horizontal_offset">8.0dip</dimen>
 
     <!-- App Widgets -->
     <!-- Header Bar -->
     <dimen name="header_bar_height">56.0dip</dimen>
     <dimen name="header_bar_up_width">30.0dip</dimen>
-    <dimen name="header_bar_up_height">30.0dip</dimen>
-    <dimen name="header_bar_menu_button_width">24.0dip</dimen>
-    <dimen name="header_bar_menu_button_height">30.0dip</dimen>
-    <dimen name="header_bar_custom_button_width">30.0dip</dimen>
-    <dimen name="header_bar_custom_button_height">30.0dip</dimen>
+    <dimen name="header_bar_menu_button_width">38.0dip</dimen>
+    <dimen name="header_bar_custom_button_width">48.0dip</dimen>
+    <dimen name="header_bar_button_height">48.0dip</dimen>
     <dimen name="header_bar_button_padding_small">5.0dip</dimen>
     <dimen name="header_bar_button_padding_large">10.0dip</dimen>
     <dimen name="header_bar_padding_left">16.0dp</dimen>
-    <dimen name="header_bar_padding_right">16.0dp</dimen>
     <dimen name="header_bar_button_container_padding">8.0dp</dimen>
-    <dimen name="header_bar_button_padding">16.0dp</dimen>
 
     <!-- Title Page Indicator Settings -->
     <dimen name="tpi_height">48dp</dimen>
index c23ef35..a7b6f6f 100644 (file)
@@ -31,6 +31,7 @@ public class PopupMenuButton extends ImageView implements IPopupMenuCallback,
     public PopupMenuButton(Context context, AttributeSet attrs) {
         super(context, attrs);
 
+        setScaleType(ScaleType.CENTER_INSIDE);
         setBackground(getResources().getDrawable(R.drawable.selectable_background_light));
         setOnClickListener(this);
     }