From 2cf387bc216ec17c4ef136ab463f4c1d8d2c95da Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 7 Mar 2017 14:21:24 +0100 Subject: [PATCH] Visually center initial loading indicator. Abandon "end of content" messages (not necessary from UX perspective imo) and retry button (perhaps it should be a Snackbar with a retry action instead) --- .../keylesspalace/tusky/BlocksAdapter.java | 3 -- .../keylesspalace/tusky/FollowAdapter.java | 3 -- .../keylesspalace/tusky/FooterViewHolder.java | 31 ------------------ .../tusky/NotificationsAdapter.java | 3 -- .../keylesspalace/tusky/TimelineAdapter.java | 3 -- app/src/main/res/layout/item_footer.xml | 32 ++----------------- 6 files changed, 2 insertions(+), 73 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/BlocksAdapter.java b/app/src/main/java/com/keylesspalace/tusky/BlocksAdapter.java index c37ae1ba6..94fb7a3c0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BlocksAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/BlocksAdapter.java @@ -66,9 +66,6 @@ class BlocksAdapter extends AccountAdapter { } else { FooterViewHolder holder = (FooterViewHolder) viewHolder; holder.setState(footerState); - holder.setupButton(footerActionListener); - holder.setRetryMessage(R.string.footer_retry_accounts); - holder.setEndOfTimelineMessage(R.string.footer_end_of_accounts); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java b/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java index 13b865d05..c19afcb4b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/FollowAdapter.java @@ -61,9 +61,6 @@ class FollowAdapter extends AccountAdapter { } else { FooterViewHolder holder = (FooterViewHolder) viewHolder; holder.setState(footerState); - holder.setupButton(footerActionListener); - holder.setRetryMessage(R.string.footer_retry_accounts); - holder.setEndOfTimelineMessage(R.string.footer_end_of_accounts); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java index d285d8a84..46d9d7a19 100644 --- a/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/FooterViewHolder.java @@ -22,11 +22,7 @@ import android.widget.ProgressBar; import android.widget.TextView; class FooterViewHolder extends RecyclerView.ViewHolder { - private View retryBar; - private TextView retryMessage; - private Button retry; private ProgressBar progressBar; - private TextView endOfTimelineMessage; enum State { LOADING, @@ -36,49 +32,22 @@ class FooterViewHolder extends RecyclerView.ViewHolder { FooterViewHolder(View itemView) { super(itemView); - retryBar = itemView.findViewById(R.id.footer_retry_bar); - retryMessage = (TextView) itemView.findViewById(R.id.footer_retry_message); - retry = (Button) itemView.findViewById(R.id.footer_retry_button); progressBar = (ProgressBar) itemView.findViewById(R.id.footer_progress_bar); progressBar.setIndeterminate(true); - endOfTimelineMessage = (TextView) itemView.findViewById(R.id.footer_end_of_timeline_text); - } - - void setupButton(final FooterActionListener listener) { - retry.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - listener.onLoadMore(); - } - }); - } - - void setRetryMessage(int messageId) { - retryMessage.setText(messageId); - } - - void setEndOfTimelineMessage(int messageId) { - endOfTimelineMessage.setText(messageId); } void setState(State state) { switch (state) { case LOADING: { - retryBar.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); - endOfTimelineMessage.setVisibility(View.GONE); break; } case RETRY: { - retryBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); - endOfTimelineMessage.setVisibility(View.GONE); break; } case END_OF_TIMELINE: { - retryBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); - endOfTimelineMessage.setVisibility(View.VISIBLE); break; } } diff --git a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java index eecb1e33e..53aa5da30 100644 --- a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java @@ -110,9 +110,6 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe } else { FooterViewHolder holder = (FooterViewHolder) viewHolder; holder.setState(footerState); - holder.setupButton(footerListener); - holder.setRetryMessage(R.string.footer_retry_notifications); - holder.setEndOfTimelineMessage(R.string.footer_end_of_notifications); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java b/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java index f0598d893..4bf1c5981 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java @@ -68,9 +68,6 @@ class TimelineAdapter extends RecyclerView.Adapter implements AdapterItemRemover } else { FooterViewHolder holder = (FooterViewHolder) viewHolder; holder.setState(footerState); - holder.setupButton(footerListener); - holder.setRetryMessage(R.string.footer_retry_statuses); - holder.setEndOfTimelineMessage(R.string.footer_end_of_statuses); } } diff --git a/app/src/main/res/layout/item_footer.xml b/app/src/main/res/layout/item_footer.xml index 477f94213..69204b57d 100644 --- a/app/src/main/res/layout/item_footer.xml +++ b/app/src/main/res/layout/item_footer.xml @@ -2,7 +2,8 @@ - - - - - -