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)
This commit is contained in:
parent
d067c8bf27
commit
2cf387bc21
6 changed files with 2 additions and 73 deletions
|
@ -66,9 +66,6 @@ class BlocksAdapter extends AccountAdapter {
|
||||||
} else {
|
} else {
|
||||||
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
||||||
holder.setState(footerState);
|
holder.setState(footerState);
|
||||||
holder.setupButton(footerActionListener);
|
|
||||||
holder.setRetryMessage(R.string.footer_retry_accounts);
|
|
||||||
holder.setEndOfTimelineMessage(R.string.footer_end_of_accounts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,6 @@ class FollowAdapter extends AccountAdapter {
|
||||||
} else {
|
} else {
|
||||||
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
||||||
holder.setState(footerState);
|
holder.setState(footerState);
|
||||||
holder.setupButton(footerActionListener);
|
|
||||||
holder.setRetryMessage(R.string.footer_retry_accounts);
|
|
||||||
holder.setEndOfTimelineMessage(R.string.footer_end_of_accounts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,7 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
class FooterViewHolder extends RecyclerView.ViewHolder {
|
class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||||
private View retryBar;
|
|
||||||
private TextView retryMessage;
|
|
||||||
private Button retry;
|
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
private TextView endOfTimelineMessage;
|
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
LOADING,
|
LOADING,
|
||||||
|
@ -36,49 +32,22 @@ class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
FooterViewHolder(View itemView) {
|
FooterViewHolder(View itemView) {
|
||||||
super(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 = (ProgressBar) itemView.findViewById(R.id.footer_progress_bar);
|
||||||
progressBar.setIndeterminate(true);
|
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) {
|
void setState(State state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case LOADING: {
|
case LOADING: {
|
||||||
retryBar.setVisibility(View.GONE);
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
endOfTimelineMessage.setVisibility(View.GONE);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RETRY: {
|
case RETRY: {
|
||||||
retryBar.setVisibility(View.VISIBLE);
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
endOfTimelineMessage.setVisibility(View.GONE);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case END_OF_TIMELINE: {
|
case END_OF_TIMELINE: {
|
||||||
retryBar.setVisibility(View.GONE);
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
endOfTimelineMessage.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,6 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe
|
||||||
} else {
|
} else {
|
||||||
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
||||||
holder.setState(footerState);
|
holder.setState(footerState);
|
||||||
holder.setupButton(footerListener);
|
|
||||||
holder.setRetryMessage(R.string.footer_retry_notifications);
|
|
||||||
holder.setEndOfTimelineMessage(R.string.footer_end_of_notifications);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,6 @@ class TimelineAdapter extends RecyclerView.Adapter implements AdapterItemRemover
|
||||||
} else {
|
} else {
|
||||||
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
FooterViewHolder holder = (FooterViewHolder) viewHolder;
|
||||||
holder.setState(footerState);
|
holder.setState(footerState);
|
||||||
holder.setupButton(footerListener);
|
|
||||||
holder.setRetryMessage(R.string.footer_retry_statuses);
|
|
||||||
holder.setEndOfTimelineMessage(R.string.footer_end_of_statuses);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -10,39 +11,10 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
<com.keylesspalace.tusky.FlowLayout
|
|
||||||
android:id="@+id/footer_retry_bar"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/footer_retry_message"
|
|
||||||
android:padding="@dimen/footer_text_padding" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/footer_retry_button"
|
|
||||||
android:text="@string/action_retry" />
|
|
||||||
|
|
||||||
</com.keylesspalace.tusky.FlowLayout>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/footer_progress_bar"
|
android:id="@+id/footer_progress_bar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/footer_end_of_timeline_text"
|
|
||||||
android:padding="@dimen/footer_text_padding"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in a new issue