Closed Bug 891953 Opened 11 years ago Closed 11 years ago

Implement empty screen state for reading list

Categories

(Firefox for Android Graveyard :: Awesomescreen, defect, P1)

All
Android
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 26

People

(Reporter: lucasr, Assigned: liuche)

References

Details

(Whiteboard: abouthome-hackathon, fixed-fig)

Attachments

(4 files, 3 obsolete files)

i.e. show some helpful message when you have no reading list items.
Ian, any ideas?
Flags: needinfo?(ibarlow)
Yes! Likely a quick description and a tip for how to add things to this list -- I'll mock up what I'm thinking about and post it here shortly
Flags: needinfo?(ibarlow)
Implementation note: this should probably be implemented in the same fashion than the 'Visited' page.
Whiteboard: abouthome-hackathon
I'll take this for the hackathon, but I'll need some mockups :)
Assignee: nobody → margaret.leibovic
Flags: needinfo?(ibarlow)
Attached image mockup of empty states
Reading list is shown on the far right.
Flags: needinfo?(ibarlow)
Icons for this screen can be found at https://bugzilla.mozilla.org/attachment.cgi?id=779998
Passing this off to Chenxia, since she's already working on the empty screen state bugs for the other pages.
Assignee: margaret.leibovic → liuche
Bug 895866 does most of the work for this bug, so this will only need a tiny patch after it's reviewed.
Depends on: 895866
Blocks: 903158
Blocks: 903160
It's interesting that I didn't have to do this for any of the history/tabs empty screens, but for reading list, I need to set the topView, otherwise the empty view gets set most of the time for the history tab.

May need to file follow-ups to store the top View for the other pages.
Attachment #789847 - Flags: review?(sriram)
Comment on attachment 789847 [details] [diff] [review]
Part 1: Display empty image when list is empty v1

Actually, scratch the review for the moment - I think that I'm going to have to create another ViewStub specifically for readinglist that includes the TIP at the bottom.
Attachment #789847 - Flags: review?(sriram)
Attached image Screenshot: bottom tip (obsolete) —
This is coming together nicely! 

Is there anything we can do to get that Reader icon aligning a little better with the tip text? Let me know if you need a new image cropped at a different size or something.
(In reply to Ian Barlow (:ibarlow) from comment #14)
> This is coming together nicely! 
> 
> Is there anything we can do to get that Reader icon aligning a little better
> with the tip text? Let me know if you need a new image cropped at a
> different size or something.

There you go! yup yup yup.. we need a new icon with no padding around it :D
Here are some cropped icons http://cl.ly/412B1a3i140r
This is almost complete, and just needs a slightly smaller icon so the line spacing looks correct.
Attachment #790510 - Attachment is obsolete: true
Attachment #790849 - Flags: feedback?(lucasr.at.mozilla)
This is the screenshot with the current icon sizing, linespacing of +3.
Attachment #790514 - Attachment is obsolete: true
With smaller icons we don't need line spacing changes! Ready for review, finally.
Attachment #790849 - Attachment is obsolete: true
Attachment #790849 - Flags: feedback?(lucasr.at.mozilla)
Attachment #790889 - Flags: review?(sriram)
Attachment #789847 - Flags: review?(sriram)
Comment on attachment 789847 [details] [diff] [review]
Part 1: Display empty image when list is empty v1

Review of attachment 789847 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM. r+ with recommended changes.

::: mobile/android/base/home/ReadingListPage.java
@@ +48,5 @@
> +    // Reference to the View to display when there are no results.
> +    private View mEmptyView;
> +
> +    // Reference to top view.
> +    private View topView;

mTopView.

@@ +84,5 @@
>      @Override
>      public void onViewCreated(View view, Bundle savedInstanceState) {
>          super.onViewCreated(view, savedInstanceState);
>  
> +        topView = view;

mTopView.

@@ +147,5 @@
>  
> +    private void updateUiFromCursor(Cursor c) {
> +        if (c == null || c.getCount() == 0) {
> +            // Cursor is empty, so set the empty view if it hasn't been set already.
> +            if (mEmptyView == null) {

Combine all the if together. One identation would be saved :)

if ((c == null || c.getCount() == 0) && (mEmptyView == null)) {
 ... 
}

@@ +218,5 @@
>                  case LOADER_ID_READING_LIST:
>                      mAdapter.swapCursor(c);
>                      break;
>             }
> +           updateUiFromCursor(c);

A new line before this line.
Attachment #789847 - Flags: review?(sriram) → review+
Comment on attachment 790889 [details] [diff] [review]
Part 2: Add "Tip" to empty reading list page v2

Review of attachment 790889 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. I would like to move the text and images to XML as much as possible.
r+ with that.

::: mobile/android/base/home/ReadingListPage.java
@@ +159,2 @@
>                  final TextView emptyText = (TextView) mEmptyView.findViewById(R.id.home_empty_text);
>                  emptyText.setText(R.string.home_reading_list_empty);

This could go in XML.

@@ +159,3 @@
>                  final TextView emptyText = (TextView) mEmptyView.findViewById(R.id.home_empty_text);
>                  emptyText.setText(R.string.home_reading_list_empty);
> +                emptyText.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.icon_reading_list_empty, 0, 0);

This can be set in XML with "drawableTop".
I see that you are creating an empty page specific to reading-list. It's better to set the text and image values there.

::: mobile/android/base/resources/layout/home_empty_reading_page.xml
@@ +13,5 @@
> +    <View android:layout_width="fill_parent"
> +          android:layout_height="0dp"
> +          android:layout_weight="1"/>
> +
> +    <TextView android:id="@+id/home_empty_text"

When you move the text and the image here, since we don't have to refer to this TextView in java, please remove the id.

@@ +15,5 @@
> +          android:layout_weight="1"/>
> +
> +    <TextView android:id="@+id/home_empty_text"
> +              android:layout_width="fill_parent"
> +              android:layout_height="wrap_content"

0dip. Please use height as "0" whenever you set the layout_weight property. This would reduce unnecessary calculations of actual height during onMeasure() pass.

Additional notes: Setting a wrap_content will try to measure the size of text, image and everything before deciding on its inherent size. Setting as 0dip will return this to the parent during first pass. In second pass, parent won't do much work of asking the view to recalculate, as the weight is given a value, a ratio of the available space is set to this view by the parent.

@@ +23,5 @@
> +              android:paddingLeft="50dp"
> +              android:paddingRight="50dp"
> +              android:layout_weight="1"/>
> +
> +    <ImageView android:id="@+id/home_empty_divider"

Please remove this id. It's not used anywhere.

@@ +30,5 @@
> +               android:layout_height="wrap_content"
> +               android:paddingLeft="25dp"
> +               android:paddingRight="25dp"/>
> +
> +    <TextView android:id="@+id/home_empty_hint"

I would recommend try to set the text here. And adding the image alone in Java (if that's easier and possible). I believe you could probably do getText().doCalculationToInsertImage() in java.
Attachment #790889 - Flags: review?(sriram) → review+
https://hg.mozilla.org/projects/fig/rev/7b96d62ba83a
https://hg.mozilla.org/projects/fig/rev/1b57558f8619
Whiteboard: abouthome-hackathon → abouthome-hackathon, fixed-fig
https://hg.mozilla.org/mozilla-central/rev/1b57558f8619
https://hg.mozilla.org/mozilla-central/rev/7b96d62ba83a
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: