Niedzielski has uploaded a new change for review.

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

Change subject: Hygiene: encapsulate FeedAdapter callback in class
......................................................................

Hygiene: encapsulate FeedAdapter callback in class

Move FeedAdapter specific callback into FeedAdapter.Callback.

Change-Id: Id8c68b20b1b5693cc7a1c473a92d4fd31b07ca0e
---
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
M app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
M app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
3 files changed, 9 insertions(+), 6 deletions(-)


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

diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.java 
b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
index dcd093c..f233f3e 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -53,7 +53,7 @@
     private WikipediaApp app;
     private FeedCoordinator coordinator;
     private FeedFunnel funnel;
-    private FeedViewCallback feedCallback = new FeedCallback();
+    private FeedAdapter.Callback feedCallback = new FeedCallback();
     private FeedScrollListener feedScrollListener = new FeedScrollListener();
     private OverflowCallback overflowCallback = new OverflowCallback();
     private boolean searchIconVisible;
@@ -194,7 +194,7 @@
         return FragmentUtil.getCallback(this, Callback.class);
     }
 
-    private class FeedCallback implements FeedViewCallback {
+    private class FeedCallback implements FeedAdapter.Callback {
         @Override
         public void onRequestMore() {
             funnel.requestMore(coordinator.getAge());
diff --git a/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java 
b/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
index fa6c99d..3f84cfb 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
@@ -13,10 +13,14 @@
 import org.wikipedia.views.DefaultViewHolder;
 
 public class FeedAdapter<T extends View & FeedCardView<?>> extends 
DefaultRecyclerAdapter<Card, T> {
-    @NonNull private FeedCoordinatorBase coordinator;
-    @Nullable private FeedViewCallback callback;
+    public interface Callback extends FeedViewCallback {
+        void onRequestMore();
+    }
 
-    public FeedAdapter(@NonNull FeedCoordinatorBase coordinator, @Nullable 
FeedViewCallback callback) {
+    @NonNull private FeedCoordinatorBase coordinator;
+    @Nullable private Callback callback;
+
+    public FeedAdapter(@NonNull FeedCoordinatorBase coordinator, @Nullable 
Callback callback) {
         super(coordinator.getCards());
         this.coordinator = coordinator;
         this.callback = callback;
diff --git a/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java 
b/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
index e88e0ae..29c6fd7 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
@@ -10,7 +10,6 @@
 
 public interface FeedViewCallback extends ItemTouchHelperSwipeAdapter.Callback,
         PageTitleListCardItemView.Callback {
-    void onRequestMore();
     void onSearchRequested();
     void onVoiceSearchRequested();
     boolean onRequestDismissCard(@NonNull Card card);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8c68b20b1b5693cc7a1c473a92d4fd31b07ca0e
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