Revert to include fragment_recycler_view in Fragment layouts, programmatically set padding as needed. Replace hardcoded dimens with dimen resources.

This commit is contained in:
Phillip Hsu
2016-08-30 16:27:49 -07:00
parent 02fc6f2bdd
commit d970505dd5
11 changed files with 95 additions and 61 deletions
@@ -26,15 +26,11 @@
android:textSize="@dimen/text_size_display_3"
style="@style/TextAppearance.AppCompat.Inverse"/>
<!-- Unfortunately, we can't reuse fragment_recycler_view
- due to different padding requirements here. -->
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
<include layout="@layout/fragment_recycler_view"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:paddingTop="8dp"/>
android:layout_marginTop="8dp"/>
</LinearLayout>
+16 -20
View File
@@ -3,9 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp">
android:layout_marginBottom="@dimen/cardview_margin"
android:layout_marginEnd="@dimen/cardview_margin">
<RelativeLayout
android:layout_width="match_parent"
@@ -17,9 +16,9 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Label"
android:textSize="17sp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
android:textSize="@dimen/text_size_medium"
android:layout_marginTop="@dimen/item_margin_between_elements"
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
<com.philliphsu.clock2.timers.CountdownChronometer
android:id="@+id/duration"
@@ -27,8 +26,8 @@
android:layout_height="wrap_content"
android:layout_below="@id/label"
android:layout_centerHorizontal="true"
android:textSize="45sp"
android:layout_marginBottom="8dp"/>
android:textSize="@dimen/text_size_display_2"
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
<!--TODO: Consider removing this bottom margin, because the seekbar
is rendering with HUGE top and bottom padding already. -->
@@ -44,18 +43,18 @@
<ImageButton
android:id="@+id/add_one_minute"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/cardview_action_icon_size"
android:layout_height="@dimen/cardview_action_icon_size"
android:src="@drawable/ic_half_day_1_24dp"
android:background="?selectableItemBackground"
android:layout_below="@id/seek_bar"
android:layout_alignParentStart="true"
android:layout_marginStart="8dp"/>
android:layout_marginStart="@dimen/cardview_action_icon_margin"/>
<ImageButton
android:id="@+id/start_pause"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/cardview_action_icon_size"
android:layout_height="@dimen/cardview_action_icon_size"
android:src="@drawable/ic_half_day_1_24dp"
android:background="?selectableItemBackground"
android:layout_below="@id/seek_bar"
@@ -63,22 +62,19 @@
<ImageButton
android:id="@+id/stop"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/cardview_action_icon_size"
android:layout_height="@dimen/cardview_action_icon_size"
android:src="@drawable/ic_half_day_1_24dp"
android:background="?selectableItemBackground"
android:layout_below="@id/seek_bar"
android:layout_alignParentEnd="true"
android:layout_marginEnd="8dp"/>
android:layout_marginEnd="@dimen/cardview_action_icon_margin"/>
<Space
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_height="@dimen/cardview_action_icon_margin"
android:layout_below="@id/stop"/>
<!--<View style="@style/Divider.Horizontal"
android:layout_below="@id/space"/>-->
</RelativeLayout>
</android.support.v7.widget.CardView>
@@ -4,6 +4,4 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:paddingStart="8dp"
android:paddingTop="8dp"/>
android:scrollbars="vertical"/>
@@ -20,14 +20,10 @@
android:textSize="@dimen/text_size_display_3"
style="@style/TextAppearance.AppCompat.Inverse"/>
<!-- Unfortunately, we can't reuse fragment_recycler_view
- due to different padding requirements here. -->
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:paddingTop="8dp"/>
<include layout="@layout/fragment_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"/>
</LinearLayout>
@@ -37,7 +37,7 @@
android:layout_height="wrap_content"
android:textAppearance="?textAppearanceListItem"
android:text="in %dh %dm"
android:layout_marginStart="4dp"
android:layout_marginStart="@dimen/item_margin_between_elements"
android:layout_below="@id/time_layout"
android:layout_toEndOf="@id/label"/>
+17 -20
View File
@@ -3,9 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp">
android:layout_marginStart="@dimen/cardview_margin"
android:layout_marginTop="@dimen/cardview_margin"
android:layout_marginEnd="@dimen/cardview_margin">
<RelativeLayout
android:layout_width="match_parent"
@@ -17,9 +17,9 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Label"
android:textSize="17sp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
android:textSize="@dimen/text_size_medium"
android:layout_marginTop="@dimen/item_margin_between_elements"
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
<com.philliphsu.clock2.timers.CountdownChronometer
android:id="@+id/duration"
@@ -27,8 +27,8 @@
android:layout_height="wrap_content"
android:layout_below="@id/label"
android:layout_centerHorizontal="true"
android:textSize="45sp"
android:layout_marginBottom="8dp"/>
android:textSize="@dimen/text_size_display_2"
android:layout_marginBottom="@dimen/item_margin_between_elements"/>
<!--TODO: Consider removing this bottom margin, because the seekbar
is rendering with HUGE top and bottom padding already. -->
@@ -44,18 +44,18 @@
<ImageButton
android:id="@+id/add_one_minute"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/cardview_action_icon_size"
android:layout_height="@dimen/cardview_action_icon_size"
android:src="@drawable/ic_half_day_1_24dp"
android:background="?selectableItemBackground"
android:layout_below="@id/seek_bar"
android:layout_alignParentStart="true"
android:layout_marginStart="8dp"/>
android:layout_marginStart="@dimen/cardview_action_icon_margin"/>
<ImageButton
android:id="@+id/start_pause"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/cardview_action_icon_size"
android:layout_height="@dimen/cardview_action_icon_size"
android:src="@drawable/ic_half_day_1_24dp"
android:background="?selectableItemBackground"
android:layout_below="@id/seek_bar"
@@ -63,22 +63,19 @@
<ImageButton
android:id="@+id/stop"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/cardview_action_icon_size"
android:layout_height="@dimen/cardview_action_icon_size"
android:src="@drawable/ic_half_day_1_24dp"
android:background="?selectableItemBackground"
android:layout_below="@id/seek_bar"
android:layout_alignParentEnd="true"
android:layout_marginEnd="8dp"/>
android:layout_marginEnd="@dimen/cardview_action_icon_margin"/>
<Space
android:layout_width="0dp"
android:layout_height="8dp"
android:layout_height="@dimen/cardview_action_icon_margin"
android:layout_below="@id/stop"/>
<!--<View style="@style/Divider.Horizontal"
android:layout_below="@id/space"/>-->
</RelativeLayout>
</android.support.v7.widget.CardView>
+5
View File
@@ -47,6 +47,11 @@
<dimen name="button_text_left_padding">16dp</dimen>
<dimen name="button_text_right_padding">16dp</dimen>
<!-- CardView -->
<dimen name="cardview_margin">8dp</dimen>
<dimen name="cardview_action_icon_margin">8dp</dimen>
<dimen name="cardview_action_icon_size">48dp</dimen>
<dimen name="text_size_body_1">14sp</dimen>
<dimen name="text_size_body_2">14sp</dimen>
<dimen name="text_size_button">14sp</dimen>