Bug 888905: Tablet reading list for new about:home. [r=lucasr]
authorSriram Ramasubramanian <sriram@mozilla.com>
Fri, 09 Aug 2013 12:32:46 -0700
changeset 143523 20ae8ca101790415c8540d62bc2573884b5f4bc3
parent 143522 673e9806d6c302d5cda2c784106cb277ac49371a
child 143524 0de8644cd3e2d54bcf58fcef889ea5f22ab0d62a
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs888905
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 888905: Tablet reading list for new about:home. [r=lucasr]
mobile/android/base/Makefile.in
mobile/android/base/home/ReadingListPage.java
mobile/android/base/resources/layout/home_reading_list_page.xml
mobile/android/base/resources/values-large-v11/styles.xml
mobile/android/base/resources/values/styles.xml
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -471,16 +471,17 @@ RES_LAYOUT = \
   res/layout/home_item_row.xml \
   res/layout/home_header_row.xml \
   res/layout/home_history_page.xml \
   res/layout/home_history_tabs_indicator.xml \
   res/layout/home_last_tabs_page.xml \
   res/layout/home_history_list.xml \
   res/layout/home_most_recent_page.xml \
   res/layout/home_most_visited_page.xml \
+  res/layout/home_reading_list_page.xml \
   res/layout/home_search_item_row.xml \
   res/layout/home_suggestion_prompt.xml \
   res/layout/web_app.xml \
   res/layout/launch_app_list.xml \
   res/layout/launch_app_listitem.xml \
   res/layout/menu_action_bar.xml \
   res/layout/menu_item_action_view.xml \
   res/layout/menu_popup.xml \
--- a/mobile/android/base/home/ReadingListPage.java
+++ b/mobile/android/base/home/ReadingListPage.java
@@ -10,16 +10,17 @@ import org.mozilla.gecko.db.BrowserContr
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.BrowserDB.URLColumns;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.home.TwoLinePageRow;
 import org.mozilla.gecko.ReaderModeUtils;
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.res.Configuration;
 import android.database.Cursor;
 import android.os.Bundle;
 import android.support.v4.app.LoaderManager.LoaderCallbacks;
 import android.support.v4.content.Loader;
 import android.support.v4.widget.CursorAdapter;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -63,19 +64,17 @@ public class ReadingListPage extends Hom
     public void onDetach() {
         super.onDetach();
 
         mUrlOpenListener = null;
     }
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        // All list views are styled to look the same with a global activity theme.
-        // If the style of the list changes, inflate it from an XML.
-        mList = new HomeListView(container.getContext());
+        mList = (HomeListView) inflater.inflate(R.layout.home_reading_list_page, container, false);
         return mList;
     }
 
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
         mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@@ -99,16 +98,29 @@ public class ReadingListPage extends Hom
 
     @Override
     public void onDestroyView() {
         super.onDestroyView();
         mList = null;
     }
 
     @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+
+        // Detach and reattach the fragment as the layout changes.
+        if (isVisible()) {
+            getFragmentManager().beginTransaction()
+                                .detach(this)
+                                .attach(this)
+                                .commitAllowingStateLoss();
+        }
+    }
+
+    @Override
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
         mAdapter = new ReadingListAdapter(getActivity(), null);
         mList.setAdapter(mAdapter);
 
         // Create callbacks before the initial loader is started.
         mCursorLoaderCallbacks = new CursorLoaderCallbacks();
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/home_reading_list_page.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<org.mozilla.gecko.home.HomeListView xmlns:android="http://schemas.android.com/apk/res/android"
+                                     style="@style/Widget.ReadingListView"
+                                     android:layout_width="fill_parent"
+                                     android:layout_height="fill_parent"/>
--- a/mobile/android/base/resources/values-large-v11/styles.xml
+++ b/mobile/android/base/resources/values-large-v11/styles.xml
@@ -50,9 +50,13 @@
         <item name="android:paddingLeft">5dp</item>
         <item name="android:paddingRight">5dp</item>
         <item name="android:paddingTop">30dp</item>
         <item name="android:paddingBottom">30dp</item>
         <item name="android:horizontalSpacing">10dp</item>
         <item name="android:verticalSpacing">10dp</item>
     </style>
 
+    <style name="Widget.ReadingListView" parent="Widget.BookmarksListView">
+        <item name="android:paddingTop">30dp</item>
+    </style>
+
 </resources>
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -153,16 +153,18 @@
       <item name="android:paddingTop">5dip</item>
       <item name="android:gravity">left</item>
     </style>
 
     <style name="Widget.HomeListView" parent="Widget.ListView">
         <item name="android:divider">#E7ECF0</item>
     </style>
 
+    <style name="Widget.ReadingListView" parent="Widget.BookmarksListView"/>
+
     <style name="Widget.Home" />
 
     <style name="Widget.Home.HeaderItem">
         <item name="android:layout_width">fill_parent</item>
         <item name="android:layout_height">32dp</item>
         <item name="android:textAppearance">@style/TextAppearance.Widget.Home.Header</item>
         <item name="android:background">#fff5f7f9</item>
         <item name="android:focusable">false</item>