From 1af0b6fd488ed0a1dabbd37b660db8a944903ac2 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 30 Mar 2018 09:56:09 +0200 Subject: [PATCH] fixes a bug where the ProgressBar in NotificationsFragment would not show up --- .../tusky/adapter/NotificationsAdapter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java b/app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java index 0e728b31..1748fd89 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/NotificationsAdapter.java @@ -20,6 +20,7 @@ import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.Typeface; import android.graphics.drawable.Drawable; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; @@ -75,8 +76,9 @@ public class NotificationsAdapter extends RecyclerView.Adapter { mediaPreviewEnabled = true; } + @NonNull @Override - public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { switch (viewType) { default: case VIEW_TYPE_MENTION: { @@ -108,7 +110,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter { } @Override - public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { if (position < notifications.size()) { NotificationViewData notification = notifications.get(position); if (notification instanceof NotificationViewData.Placeholder) { @@ -226,7 +228,11 @@ public class NotificationsAdapter extends RecyclerView.Adapter { } public void setFooterState(FooterViewHolder.State newFooterState) { + FooterViewHolder.State oldValue = footerState; footerState = newFooterState; + if (footerState != oldValue) { + notifyItemChanged(notifications.size()); + } } public void setMediaPreviewEnabled(boolean enabled) {