Bug 891953 - Part 2: Add "Tip" for reading list empty screen. r=sriram
authorChenxia Liu <liuche@mozilla.com>
Fri, 16 Aug 2013 01:41:00 -0700
changeset 143545 7b96d62ba83a19bcc871cff18d722667f4d17402
parent 143544 1b57558f86194acb700792ecfde7ab8035302139
child 143546 b35d078803e4d1ad12a146d844c6738d9f7e875f
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)
reviewerssriram
bugs891953
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 891953 - Part 2: Add "Tip" for reading list empty screen. r=sriram
mobile/android/base/Makefile.in
mobile/android/base/home/ReadingListPage.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/resources/drawable-hdpi/reader_cropped.png
mobile/android/base/resources/drawable-mdpi/reader_cropped.png
mobile/android/base/resources/drawable-xhdpi/reader_cropped.png
mobile/android/base/resources/drawable/divider_horizontal.xml
mobile/android/base/resources/layout/home_empty_reading_page.xml
mobile/android/base/resources/layout/home_reading_list_page.xml
mobile/android/base/strings.xml.in
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -464,16 +464,17 @@ RES_LAYOUT = \
   res/layout/datetime_picker.xml \
   res/layout/doorhanger.xml \
   res/layout/doorhanger_button.xml \
   res/layout/find_in_page_content.xml \
   res/layout/font_size_preference.xml \
   res/layout/gecko_app.xml \
   res/layout/home_bookmarks_page.xml \
   res/layout/home_empty_page.xml \
+  res/layout/home_empty_reading_page.xml \
   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 \
@@ -711,16 +712,17 @@ RES_DRAWABLE_MDPI = \
   res/drawable-mdpi/shield.png \
   res/drawable-mdpi/shield_doorhanger.png \
   res/drawable-mdpi/tabs_normal.png \
   res/drawable-mdpi/tabs_private.png \
   res/drawable-mdpi/tabs_synced.png \
   res/drawable-mdpi/top_bookmark_add.png \
   res/drawable-mdpi/urlbar_stop.png \
   res/drawable-mdpi/reader.png \
+  res/drawable-mdpi/reader_cropped.png \
   res/drawable-mdpi/reader_active.png \
   res/drawable-mdpi/reading_list.png \
   res/drawable-mdpi/validation_arrow.png \
   res/drawable-mdpi/validation_arrow_inverted.png \
   res/drawable-mdpi/validation_bg.9.png \
   res/drawable-mdpi/bookmarkdefaults_favicon_support.png \
   res/drawable-mdpi/bookmarkdefaults_favicon_addons.png \
   res/drawable-mdpi/handle_end.png \
@@ -817,16 +819,17 @@ RES_DRAWABLE_HDPI = \
   res/drawable-hdpi/shield.png \
   res/drawable-hdpi/shield_doorhanger.png \
   res/drawable-hdpi/tabs_normal.png \
   res/drawable-hdpi/tabs_private.png \
   res/drawable-hdpi/tabs_synced.png \
   res/drawable-hdpi/top_bookmark_add.png \
   res/drawable-hdpi/urlbar_stop.png \
   res/drawable-hdpi/reader.png \
+  res/drawable-hdpi/reader_cropped.png \
   res/drawable-hdpi/reader_active.png \
   res/drawable-hdpi/reading_list.png \
   res/drawable-hdpi/validation_arrow.png \
   res/drawable-hdpi/validation_arrow_inverted.png \
   res/drawable-hdpi/validation_bg.9.png \
   res/drawable-hdpi/handle_end.png \
   res/drawable-hdpi/handle_middle.png \
   res/drawable-hdpi/handle_start.png \
@@ -890,16 +893,17 @@ RES_DRAWABLE_XHDPI = \
   res/drawable-xhdpi/tabs_count_foreground.png \
   res/drawable-xhdpi/tip_addsearch.png \
   res/drawable-xhdpi/find_close.png \
   res/drawable-xhdpi/find_next.png \
   res/drawable-xhdpi/find_prev.png \
   res/drawable-xhdpi/top_bookmark_add.png \
   res/drawable-xhdpi/urlbar_stop.png \
   res/drawable-xhdpi/reader.png \
+  res/drawable-xhdpi/reader_cropped.png \
   res/drawable-xhdpi/reader_active.png \
   res/drawable-xhdpi/reading_list.png \
   res/drawable-xhdpi/larry.png \
   res/drawable-xhdpi/lock_identified.png \
   res/drawable-xhdpi/lock_verified.png \
   res/drawable-xhdpi/menu.png \
   res/drawable-xhdpi/menu_pb.png \
   res/drawable-xhdpi/menu_panel_bg.9.png \
@@ -1097,16 +1101,17 @@ RES_DRAWABLE += \
   res/drawable/action_bar_button_inverse.xml          \
   res/drawable/bookmark_thumbnail_bg.xml              \
   res/drawable/url_bar_bg.xml                         \
   res/drawable/url_bar_bg_shadow_repeat.xml           \
   res/drawable/url_bar_entry.xml                      \
   res/drawable/url_bar_nav_button.xml                 \
   res/drawable/url_bar_right_edge.xml                 \
   res/drawable/bookmark_folder.xml                    \
+  res/drawable/divider_horizontal.xml                 \
   res/drawable/divider_vertical.xml                   \
   res/drawable/favicon_bg.xml                         \
   res/drawable/handle_end_level.xml                   \
   res/drawable/handle_start_level.xml                 \
   res/drawable/home_history_tabs_indicator.xml        \
   res/drawable/home_page_title_background.xml         \
   res/drawable/ic_menu_back.xml                       \
   res/drawable/ic_menu_desktop_mode_off.xml           \
--- a/mobile/android/base/home/ReadingListPage.java
+++ b/mobile/android/base/home/ReadingListPage.java
@@ -16,16 +16,19 @@ 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.text.SpannableStringBuilder;
+import android.text.Spanned;
+import android.text.style.ImageSpan;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewStub;
 import android.widget.AdapterView;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
@@ -147,21 +150,28 @@ public class ReadingListPage extends Hom
 
     private void updateUiFromCursor(Cursor c) {
         // We delay setting the empty view until the cursor is actually empty.
         // This avoids image flashing.
         if ((c == null || c.getCount() == 0) && mEmptyView == null) {
             final ViewStub emptyViewStub = (ViewStub) mTopView.findViewById(R.id.home_empty_view_stub);
             mEmptyView = emptyViewStub.inflate();
 
-            final ImageView emptyIcon = (ImageView) mEmptyView.findViewById(R.id.home_empty_image);
-            emptyIcon.setImageResource(R.drawable.icon_reading_list_empty);
+            final TextView emptyHint = (TextView) mEmptyView.findViewById(R.id.home_empty_hint);
+            String readingListHint = emptyHint.getText().toString();
 
-            final TextView emptyText = (TextView) mEmptyView.findViewById(R.id.home_empty_text);
-            emptyText.setText(R.string.home_reading_list_empty);
+            // Use an ImageSpan to include the reader icon in the "Tip".
+            int imageSpanIndex = readingListHint.indexOf("%I");
+            if (imageSpanIndex != -1) {
+                final ImageSpan readingListIcon = new ImageSpan(getActivity(), R.drawable.reader_cropped, ImageSpan.ALIGN_BOTTOM);
+                final SpannableStringBuilder hintBuilder = new SpannableStringBuilder(readingListHint);
+                hintBuilder.setSpan(readingListIcon, imageSpanIndex, imageSpanIndex + 2, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
+
+                emptyHint.setText(hintBuilder, TextView.BufferType.SPANNABLE);
+            }
 
             mList.setEmptyView(mEmptyView);
         }
     }
 
     /**
      * Cursor loader for the list of reading list items.
      */
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -272,16 +272,22 @@ size. -->
 <!ENTITY home_history_title "History">
 <!ENTITY home_last_tabs_title "Tabs from last time">
 <!ENTITY home_last_tabs_open "Open all tabs from last time">
 <!ENTITY home_last_tabs_empty "Your recent tabs show up here.">
 <!ENTITY home_most_recent_title "Most recent">
 <!ENTITY home_most_recent_empty "Websites you visited most recently show up here.">
 <!ENTITY home_most_visited_title "Most visited">
 <!ENTITY home_reading_list_empty "Articles you save for later show up here.">
+<!-- Localization note (home_reading_list_hint): The "TIP" string is synonymous to "hint", "clue", etc. This string is displayed
+     as an advisory message on how to add content to the reading list when the reading list empty.
+     The "&#37;I" in the string will be replaced by a small image of the icon described, and can be moved to wherever
+     it is applicable.. -->
+<!ENTITY home_reading_list_hint "TIP: Save articles to your reading list by long pressing the &#37;I icon when it appears in the title bar.">
+
 <!ENTITY home_most_visited_empty "Websites you visit most frequently show up here.">
 <!ENTITY pin_bookmark_dialog_hint "Enter a search keyword">
 
 <!ENTITY filepicker_title "Choose File">
 <!ENTITY filepicker_audio_title "Choose or record a sound">
 <!ENTITY filepicker_image_title "Choose or take a picture">
 <!ENTITY filepicker_video_title "Choose or record a video">
 
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..75943d8afcb2e85c50bdc5e720d3a31c115fc62c
GIT binary patch
literal 292
zc$@(w0o(qGP)<h;3K|Lk000e1NJLTq000{R000#T1^@s6x89W{0002%Nkl<Zc-r06
zzY0N79Ki7(vp-p^CU0;J242O$;1!g?Gk69oWwIG9EJ}*H2%{t^l<*yHH{DLT=j14E
zed;W~`>o%pBc*b6fJaDMG!ciuK^waevjg!Cx_ZdtqBCa}1BQ4Q$M{6WTUi1{bYEsR
zC?kUiB*-Kd)PRdL#Ag!Yyi}~gg?OUKK|T>1V;?YtXfj`;l^Ex>VvP%1v6&(^`HMBK
zzPUzM5u5(>8tun49MM7wf&%(D*?jf8aB$Uq^+yJ=J35*(^T7SQy|WZ*xZ#W)Do8@0
q;{Qi8=Bwj?ECjF@i=hh9i9G?uXEajWmh4vm0000<MNUMnLSTaR7<rZe
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4dd118650becd49fd601a4a3cb2d4fbd7843de8a
GIT binary patch
literal 206
zc$@*w05SiGP)<h;3K|Lk000e1NJLTq000sI000gM1^@s6BHB#10001$Nkl<Zc-qC%
zzY4-Y49D^8rO(p}(xvavjt(w9se_wCp-`~xO>Vjfg2?$T6bbZCpvxV6AVc_(gp<SZ
z<ltv~a7B&;XS^1AoeYJ+p|$${LA;^XA{4lf3Pcdi3exu2K@>BnhgW)twt1qhL0y1}
zLft4#(1I^2WJqzrd+le}@GEX;jGk6l37D=Hqr?Nxv5p~geqG|V-n<TgCIA2c07*qo
IM6N<$g4()Q+yDRo
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..d066d5ae00414b6a78f0e4da521ec4134f9487fb
GIT binary patch
literal 373
zc$@)s0gC>KP)<h;3K|Lk000e1NJLTq001Na000~a1^@s62`L>|0003zNkl<Zc-rmO
zKTE?v7=ZB?1;uvgAWp8G9Q;BK1zlWpc2aQAQFQ3yXum)O!47t5Q4m2~T>S&0pcI@c
zG~x9b-r)%7kzSe%P2d-f<2W9;5KbB!o5vVIQyAhAhggJ|Ijp0Dcf=|79N|QGMbH4R
zSVj%E&;XIxAk-O}&`?<gec*E<K|Jyw*36@hExbToHn)wstrb^tzbt}W3ur-2%jU$9
zUyzx_B|0{iLW9hTk%<K{?m<0z5J%xbeTb{@Bb(kJ#y3!p>pX+n7<inQ-%y&MsrwK0
z%l}XrG)@o(e~6*x8+X`A+<#`Uh6}u5=-)T{E9^aLsNyP%E9?(6&=C%xfnwpcj|dvz
z8Bd`xI2Bb*#g1kbyZC}4GHP>swx;U)sFTJCaxI|?HC>w%M}9%3f(KK9garKpeTx{4
TYdJu}00000NkvXXu0mjfgrA#R
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/drawable/divider_horizontal.xml
@@ -0,0 +1,12 @@
+<?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/. -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+
+    <solid android:color="#D1D5DA"/>
+    <size android:height="1dp" />
+
+</shape>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/home_empty_reading_page.xml
@@ -0,0 +1,46 @@
+<?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/. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/home_empty_view"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+              android:orientation="vertical"
+              android:gravity="center">
+
+    <!-- Empty spacer view -->
+    <View android:layout_width="fill_parent"
+          android:layout_height="0dip"
+          android:layout_weight="1"/>
+
+    <TextView android:id="@+id/home_empty_text"
+              android:layout_width="fill_parent"
+              android:layout_height="0dip"
+              android:gravity="top|center"
+              android:text="@string/home_reading_list_empty"
+              android:textAppearance="@style/TextAppearance.EmptyMessage"
+              android:drawableTop="@drawable/icon_reading_list_empty"
+              android:drawablePadding="10dp"
+              android:paddingLeft="50dp"
+              android:paddingRight="50dp"
+              android:layout_weight="4"/>
+
+    <ImageView android:src="@drawable/divider_horizontal"
+               android:layout_width="fill_parent"
+               android:layout_height="1dip"
+               android:paddingLeft="25dp"
+               android:paddingRight="25dp"/>
+
+    <TextView android:id="@+id/home_empty_hint"
+              android:layout_width="fill_parent"
+              android:layout_height="wrap_content"
+              android:gravity="bottom"
+              android:text="@string/home_reading_list_hint"
+              android:textAppearance="@style/TextAppearance.Small"
+              android:paddingTop="20dp"
+              android:paddingBottom="15dp"
+              android:paddingLeft="25dp"
+              android:paddingRight="40dp"/>
+
+</LinearLayout>
--- a/mobile/android/base/resources/layout/home_reading_list_page.xml
+++ b/mobile/android/base/resources/layout/home_reading_list_page.xml
@@ -4,17 +4,17 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:orientation="vertical">
 
     <ViewStub android:id="@+id/home_empty_view_stub"
-              android:layout="@layout/home_empty_page"
+              android:layout="@layout/home_empty_reading_page"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"/>
 
     <org.mozilla.gecko.home.HomeListView android:id="@+id/list"
                                          style="@style/Widget.ReadingListView"
                                          android:layout_width="fill_parent"
                                          android:layout_height="wrap_content"/>
 </LinearLayout>
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -255,16 +255,17 @@
   <string name="home_last_tabs_title">&home_last_tabs_title;</string>
   <string name="home_last_tabs_open">&home_last_tabs_open;</string>
   <string name="home_last_tabs_empty">&home_last_tabs_empty;</string>
   <string name="home_most_recent_title">&home_most_recent_title;</string>
   <string name="home_most_recent_empty">&home_most_recent_empty;</string>
   <string name="home_most_visited_title">&home_most_visited_title;</string>
   <string name="home_most_visited_empty">&home_most_visited_empty;</string>
   <string name="home_reading_list_empty">&home_reading_list_empty;</string>
+  <string name="home_reading_list_hint">&home_reading_list_hint;</string>
   <string name="pin_bookmark_dialog_hint">&pin_bookmark_dialog_hint;</string>
 
   <string name="filepicker_title">&filepicker_title;</string>
   <string name="filepicker_audio_title">&filepicker_audio_title;</string>
   <string name="filepicker_image_title">&filepicker_image_title;</string>
   <string name="filepicker_video_title">&filepicker_video_title;</string>
 
   <!-- Default bookmarks. Use bookmarks titles shared with XUL from mobile's