Niedzielski has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311867

Change subject: Hygiene: treat FeedView like an AdapterView
......................................................................

Hygiene: treat FeedView like an AdapterView

FeedView is now a plain RecyclerView. It seems clearer to interact with
adapters conventionally than to invoke helper methods. Remove update().

Change-Id: I89092221fd3e2ca76aa20e66698d42b09b6a25fb
---
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
M app/src/main/java/org/wikipedia/feed/view/FeedView.java
2 files changed, 4 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/67/311867/1

diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.java 
b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
index 674401e..058eb55 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -112,7 +112,9 @@
             public void update(List<Card> cards) {
                 if (isAdded()) {
                     swipeRefreshLayout.setRefreshing(false);
-                    feedView.update();
+                    if (feedView.getAdapter() != null) {
+                        feedView.getAdapter().notifyDataSetChanged();
+                    }
                 }
             }
         });
diff --git a/app/src/main/java/org/wikipedia/feed/view/FeedView.java 
b/app/src/main/java/org/wikipedia/feed/view/FeedView.java
index 812a134..e7f1931 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedView.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedView.java
@@ -16,7 +16,6 @@
 
 public class FeedView extends AutoFitRecyclerView {
     private StaggeredGridLayoutManager recyclerLayoutManager;
-    @Nullable private FeedAdapter adapter;
     @Nullable private ItemTouchHelper itemTouchHelper;
 
     public FeedView(Context context) {
@@ -35,7 +34,7 @@
     }
 
     public void set(@NonNull FeedCoordinatorBase coordinator, @Nullable 
FeedViewCallback callback) {
-        adapter = new FeedAdapter(coordinator, callback);
+        FeedAdapter adapter = new FeedAdapter(coordinator, callback);
         setAdapter(adapter);
 
         if (itemTouchHelper != null) {
@@ -46,12 +45,6 @@
         if (callback != null) {
             itemTouchHelper = new ItemTouchHelper(new 
ItemTouchHelperSwipeAdapter(callback));
             itemTouchHelper.attachToRecyclerView(this);
-        }
-    }
-
-    public void update() {
-        if (adapter != null) {
-            adapter.notifyDataSetChanged();
         }
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/311867
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89092221fd3e2ca76aa20e66698d42b09b6a25fb
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to