Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

SQ-166/Empty state(s) for favourites #188

Merged
merged 23 commits into from Mar 29, 2017
Merged

SQ-166/Empty state(s) for favourites #188

merged 23 commits into from Mar 29, 2017

Conversation

alexstyl
Copy link
Contributor

This PR includes empty states for the favorite screen.

  • When the user is logged out, we prompt them to sign in.
  • When they are logged in, we teach them how to favorite talks.

Screenshots

Before signing in
device-2017-03-28-225215

After signing in:
achievement

@alexstyl alexstyl changed the base branch from develop to SQ-55/feature_branch March 28, 2017 21:56
@alexstyl alexstyl changed the base branch from SQ-55/feature_branch to develop March 28, 2017 22:00
@alexstyl alexstyl changed the title SQ-55/Empty state(s) for favourites SQ-166/Empty state(s) for favourites Mar 28, 2017
@danybony danybony self-assigned this Mar 29, 2017
Copy link
Contributor

@danybony danybony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea regarding the snackbar for the feedback 💯
There are some required changes

private void promptToFavorite() {
favoritesListView.setVisibility(GONE);
progressBar.setVisibility(GONE);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove this empty line

public void promptToSign() {
favoritesListView.setVisibility(GONE);
progressBar.setVisibility(GONE);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove this empty line

@@ -92,8 +104,53 @@ public void onStop() {
subscription.dispose();
}

public void updateWith(Schedule schedule, ScheduleViewPagerAdapter.OnEventClickedListener listener) {
private void updateWith(ScheduledAndSignedIn scheduledAndSignedIn, ScheduleViewPagerAdapter.OnEventClickedListener listener) {
if (scheduledAndSignedIn.hasPages()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is leaking the fact that Schedule contains pages IMHO (I totally forgot about that TBH and it doesn't feel needed here).
I think that a isEmpty() or hasSchedule() would be better

.observeOn(AndroidSchedulers.mainThread())
.subscribe(schedule -> updateWith(schedule, this::onEventClicked));
}

private BiFunction<Schedule, Boolean, ScheduledAndSignedIn> toScheduleAndLoggedInStuff() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stuff?
toScheduledAndSignedIn()


public class NoFavoritesView extends LinearLayout {

private static final int MAGIC_NUMBER_TO_TRIGGER_ACHIEVEMENT = 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is magic as in... magical ~ 💖

android:layout_height="wrap_content"
android:tint="?colorAccent"
android:src="@drawable/illustration_lunch"
android:contentDescription="Sad picture of a panda" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper content description and extract to strings

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH if it's not important for a11y we should simply not set one (@ataulm might confirm here)

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="We are sad and so should you" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper text and extract to strings

android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract to dimensions

android:layout_height="wrap_content"
android:drawableTop="@drawable/illustration_prompt_to_sign_in"
android:visibility="gone"
android:foreground="@drawable/card_touch_feedback"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to style

@@ -0,0 +1,26 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this layout used?

@rock3r
Copy link
Collaborator

rock3r commented Mar 29, 2017

@alexstyl the build is failing:

/home/travis/build/rock3r/squanchy/app/src/main/res/layout/merge_no_favorites_view.xml:26:25-54: AAPT: No resource found that matches the given name (at 'foreground' with value '@drawable/card_touch_feedback').
    
/home/travis/build/rock3r/squanchy/app/src/main/res/layout/view_page_favorites.xml:51:27-56: AAPT: No resource found that matches the given name (at 'foreground' with value '@drawable/card_touch_feedback').
    
/home/travis/build/rock3r/squanchy/app/build/intermediates/res/merged/debug/layout/merge_no_favorites_view.xml:17: error: Error: No resource found that matches the given name (at 'foreground' with value '@drawable/card_touch_feedback').
/home/travis/build/rock3r/squanchy/app/build/intermediates/res/merged/debug/layout/view_page_favorites.xml:44: error: Error: No resource found that matches the given name (at 'foreground' with value '@drawable/card_touch_feedback').

Did you not push those changes?

@ataulm
Copy link

ataulm commented Mar 29, 2017 via email


setupToolbar();

if (!isInEditMode()) {
Activity activity = unwrapToActivityContext(getContext());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block was moved to the !isInEditMode() so that we can have a preview of this screen. As it turns out there is a specific kind of Context being used in the Preview mode and unwrapToActivityContext() is crashing because it is unhandled. The specific Context is BridgeContext and looks like a Hidden API, so we cannot possibly handle it properly

# Conflicts:
#	app/src/main/res/layout/view_page_schedule.xml
#	app/src/main/res/values/styles.xml
@rock3r rock3r merged commit 2bac566 into develop Mar 29, 2017
@rock3r rock3r deleted the SQ-55/favorite-empty branch March 29, 2017 16:44
@rock3r rock3r mentioned this pull request Mar 29, 2017
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants