Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354118 )

Change subject: Hygiene: Decompose page fragment layout
......................................................................

Hygiene: Decompose page fragment layout

fragment_page is a large file and easy to get lost in.  This breaks it up
so it's easier to digest.

Change-Id: I15af5859e7d12c855d6133d50a572c6657fa851b
---
M app/src/main/res/layout/fragment_page.xml
A app/src/main/res/layout/fragment_page_bottom_content.xml
A app/src/main/res/layout/fragment_page_read_more.xml
A app/src/main/res/layout/fragment_page_toc.xml
4 files changed, 117 insertions(+), 111 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/18/354118/1

diff --git a/app/src/main/res/layout/fragment_page.xml 
b/app/src/main/res/layout/fragment_page.xml
index b0e8e94..d18edf4 100644
--- a/app/src/main/res/layout/fragment_page.xml
+++ b/app/src/main/res/layout/fragment_page.xml
@@ -43,78 +43,10 @@
                     android:orientation="vertical"
                     android:visibility="gone">
 
-                    <!-- Read more -->
-                    <LinearLayout
-                        android:id="@+id/read_more_container"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:orientation="vertical"
-                        android:paddingTop="@dimen/list_item_vertical_padding"
-                        
android:paddingBottom="@dimen/list_item_vertical_padding"
-                        android:visibility="gone">
-                        <org.wikipedia.views.ConfigurableTextView
-                            android:id="@+id/read_more_header"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            
android:textAppearance="?android:attr/textAppearanceLarge"
-                            
android:paddingRight="@dimen/list_item_horizontal_padding"
-                            android:paddingBottom="16dp"
-                            
android:paddingLeft="@dimen/list_item_horizontal_padding"
-                            android:fontFamily="serif"
-                            android:textSize="24sp"
-                            android:text="@string/read_more_section" />
-                        <org.wikipedia.views.ConfigurableListView
-                            android:id="@+id/read_more_list"
-                            android:layout_width="match_parent"
-                            android:layout_height="0dp" />
-                    </LinearLayout>
+                    <include layout="@layout/fragment_page_read_more"/>
 
-                    <!-- Bottom content (view in browser link, license, last 
updated) -->
-                    <LinearLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:orientation="vertical"
-                        android:paddingBottom="16dp"
-                        android:background="?attr/subtle_gray_color">
-                        <View
-                            android:layout_width="match_parent"
-                            android:layout_height="8dp"
-                            
android:background="@drawable/toolbar_bottom_shadow"/>
+                    <include layout="@layout/fragment_page_bottom_content"/>
 
-                        <TextView
-                            android:id="@+id/page_external_link"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:paddingTop="8dp"
-                            
android:paddingLeft="@dimen/activity_horizontal_margin"
-                            
android:paddingRight="@dimen/activity_horizontal_margin"
-                            style="?android:textAppearanceSmall"
-                            android:text="@string/page_view_in_browser"
-                            android:textColor="?attr/link_color"
-                            android:gravity="center"/>
-                        <TextView
-                            android:id="@+id/page_last_updated_text"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_gravity="center_horizontal"
-                            android:paddingTop="8dp"
-                            
android:paddingLeft="@dimen/activity_horizontal_margin"
-                            
android:paddingRight="@dimen/activity_horizontal_margin"
-                            style="?android:textAppearanceSmall"
-                            android:textIsSelectable="true"
-                            android:textColorLink="?attr/link_color"/>
-                        <TextView
-                            android:id="@+id/page_license_text"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            android:paddingTop="8dp"
-                            
android:paddingLeft="@dimen/activity_horizontal_margin"
-                            
android:paddingRight="@dimen/activity_horizontal_margin"
-                            style="?android:textAppearanceSmall"
-                            android:textIsSelectable="true"
-                            android:textColorLink="?attr/link_color"
-                            android:gravity="center"/>
-                    </LinearLayout>
                 </LinearLayout>
 
                 <org.wikipedia.views.WikiErrorView
@@ -141,47 +73,7 @@
 
         </org.wikipedia.views.SwipeRefreshLayoutWithScroll>
 
-        <!-- Table of contents -->
-        <FrameLayout
-                android:layout_width="288dp"
-                android:layout_height="match_parent"
-                android:layout_gravity="end">
-
-            <ProgressBar
-                android:id="@+id/page_toc_in_progress"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                style="?android:progressBarStyleLarge"
-                android:indeterminate="true"
-                android:layout_gravity="center" />
-
-            <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent"
-                    android:layout_gravity="center_vertical">
-
-                <View android:layout_width="@dimen/shadow_thickness"
-                      android:layout_height="match_parent"
-                      android:background="@drawable/toc_shadow" />
-
-                <FrameLayout
-                        android:layout_width="0dp"
-                        android:layout_height="match_parent"
-                        android:layout_gravity="center_vertical"
-                        android:layout_weight="1"
-                        android:background="?attr/toc_background_color">
-
-                    <org.wikipedia.views.ConfigurableListView
-                            android:id="@+id/page_toc_list"
-                            android:layout_width="match_parent"
-                            android:layout_height="match_parent"
-                            android:visibility="gone"
-                            android:choiceMode="singleChoice" />
-                </FrameLayout>
-
-            </LinearLayout>
-
-        </FrameLayout>
+        <include layout="@layout/fragment_page_toc"/>
 
     </org.wikipedia.views.WikiDrawerLayout>
 
diff --git a/app/src/main/res/layout/fragment_page_bottom_content.xml 
b/app/src/main/res/layout/fragment_page_bottom_content.xml
new file mode 100644
index 0000000..a3dc6ff
--- /dev/null
+++ b/app/src/main/res/layout/fragment_page_bottom_content.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android";
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:paddingBottom="16dp"
+    android:background="?attr/subtle_gray_color">
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="8dp"
+        android:background="@drawable/toolbar_bottom_shadow"/>
+    <TextView
+        android:id="@+id/page_external_link"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingTop="8dp"
+        android:paddingLeft="@dimen/activity_horizontal_margin"
+        android:paddingRight="@dimen/activity_horizontal_margin"
+        style="?android:textAppearanceSmall"
+        android:text="@string/page_view_in_browser"
+        android:textColor="?attr/link_color"
+        android:gravity="center"/>
+    <TextView
+        android:id="@+id/page_last_updated_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:paddingTop="8dp"
+        android:paddingLeft="@dimen/activity_horizontal_margin"
+        android:paddingRight="@dimen/activity_horizontal_margin"
+        style="?android:textAppearanceSmall"
+        android:textIsSelectable="true"
+        android:textColorLink="?attr/link_color"/>
+    <TextView
+        android:id="@+id/page_license_text"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingTop="8dp"
+        android:paddingLeft="@dimen/activity_horizontal_margin"
+        android:paddingRight="@dimen/activity_horizontal_margin"
+        style="?android:textAppearanceSmall"
+        android:textIsSelectable="true"
+        android:textColorLink="?attr/link_color"
+        android:gravity="center"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_page_read_more.xml 
b/app/src/main/res/layout/fragment_page_read_more.xml
new file mode 100644
index 0000000..fbb69a6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_page_read_more.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android";
+    android:id="@+id/read_more_container"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:paddingTop="@dimen/list_item_vertical_padding"
+    android:paddingBottom="@dimen/list_item_vertical_padding"
+    android:visibility="gone">
+    <org.wikipedia.views.ConfigurableTextView
+        android:id="@+id/read_more_header"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:paddingRight="@dimen/list_item_horizontal_padding"
+        android:paddingBottom="16dp"
+        android:paddingLeft="@dimen/list_item_horizontal_padding"
+        android:fontFamily="serif"
+        android:textSize="24sp"
+        android:text="@string/read_more_section" />
+    <org.wikipedia.views.ConfigurableListView
+        android:id="@+id/read_more_list"
+        android:layout_width="match_parent"
+        android:layout_height="0dp" />
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_page_toc.xml 
b/app/src/main/res/layout/fragment_page_toc.xml
new file mode 100644
index 0000000..0f150ae
--- /dev/null
+++ b/app/src/main/res/layout/fragment_page_toc.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android";
+    android:layout_width="288dp"
+    android:layout_height="match_parent"
+    android:layout_gravity="end">
+
+    <ProgressBar
+        android:id="@+id/page_toc_in_progress"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        style="?android:progressBarStyleLarge"
+        android:indeterminate="true"
+        android:layout_gravity="center" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center_vertical">
+
+        <View android:layout_width="@dimen/shadow_thickness"
+            android:layout_height="match_parent"
+            android:background="@drawable/toc_shadow" />
+
+        <FrameLayout
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_gravity="center_vertical"
+            android:layout_weight="1"
+            android:background="?attr/toc_background_color">
+
+            <org.wikipedia.views.ConfigurableListView
+                android:id="@+id/page_toc_list"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="gone"
+                android:choiceMode="singleChoice" />
+        </FrameLayout>
+
+    </LinearLayout>
+
+</FrameLayout>
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/354118
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15af5859e7d12c855d6133d50a572c6657fa851b
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <mhollo...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to