Niedzielski has uploaded a new change for review.

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

Change subject: Hygiene: move FeedViewCallback to FeedAdapter
......................................................................

Hygiene: move FeedViewCallback to FeedAdapter

Change-Id: Id9f302237469637405de51c4bd413cf311186bb0
---
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
M 
app/src/main/java/org/wikipedia/feed/becauseyouread/BecauseYouReadCardView.java
M app/src/main/java/org/wikipedia/feed/mainpage/MainPageCardView.java
M app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
M app/src/main/java/org/wikipedia/feed/news/NewsListCardView.java
M app/src/main/java/org/wikipedia/feed/progress/ProgressCardView.java
M app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
M app/src/main/java/org/wikipedia/feed/view/DefaultFeedCardView.java
M app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
M app/src/main/java/org/wikipedia/feed/view/FeedCardView.java
D app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
M 
app/src/main/java/org/wikipedia/feed/view/HorizontalScrollingListCardItemView.java
12 files changed, 36 insertions(+), 40 deletions(-)


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

diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.java 
b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
index f233f3e..cc8ba76 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -30,7 +30,6 @@
 import org.wikipedia.feed.news.NewsItemCard;
 import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.FeedView;
-import org.wikipedia.feed.view.FeedViewCallback;
 import org.wikipedia.history.HistoryEntry;
 import org.wikipedia.login.LoginActivity;
 import org.wikipedia.settings.Prefs;
@@ -134,7 +133,7 @@
         coordinator.setFeedUpdateListener(null);
         swipeRefreshLayout.setOnRefreshListener(null);
         feedView.removeOnScrollListener(feedScrollListener);
-        feedView.setCallback((FeedViewCallback) null);
+        feedView.setCallback((FeedAdapter.Callback) null);
         unbinder.unbind();
         unbinder = null;
         super.onDestroyView();
diff --git 
a/app/src/main/java/org/wikipedia/feed/becauseyouread/BecauseYouReadCardView.java
 
b/app/src/main/java/org/wikipedia/feed/becauseyouread/BecauseYouReadCardView.java
index 7bb7fce..98319e5 100644
--- 
a/app/src/main/java/org/wikipedia/feed/becauseyouread/BecauseYouReadCardView.java
+++ 
b/app/src/main/java/org/wikipedia/feed/becauseyouread/BecauseYouReadCardView.java
@@ -9,7 +9,7 @@
 import org.wikipedia.R;
 import org.wikipedia.feed.view.CardHeaderView;
 import org.wikipedia.feed.view.CardLargeHeaderView;
-import org.wikipedia.feed.view.FeedViewCallback;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.ListCardView;
 import org.wikipedia.feed.view.PageTitleListCardItemView;
 import org.wikipedia.feed.view.PageTitleRecyclerAdapter;
@@ -66,9 +66,10 @@
     }
 
     private static class RecyclerAdapter extends 
PageTitleRecyclerAdapter<BecauseYouReadItemCard> {
-        @Nullable private FeedViewCallback callback;
+        @Nullable private FeedAdapter.Callback callback;
 
-        RecyclerAdapter(@NonNull List<BecauseYouReadItemCard> items, @Nullable 
FeedViewCallback callback) {
+        RecyclerAdapter(@NonNull List<BecauseYouReadItemCard> items,
+                        @Nullable FeedAdapter.Callback callback) {
             super(items);
             this.callback = callback;
         }
diff --git 
a/app/src/main/java/org/wikipedia/feed/mainpage/MainPageCardView.java 
b/app/src/main/java/org/wikipedia/feed/mainpage/MainPageCardView.java
index fb87390..1fe5bd1 100644
--- a/app/src/main/java/org/wikipedia/feed/mainpage/MainPageCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/mainpage/MainPageCardView.java
@@ -7,7 +7,7 @@
 
 import org.wikipedia.R;
 import org.wikipedia.WikipediaApp;
-import org.wikipedia.feed.view.FeedViewCallback;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.StaticCardView;
 import org.wikipedia.history.HistoryEntry;
 import org.wikipedia.page.PageTitle;
@@ -29,16 +29,16 @@
         setIcon(R.drawable.icon_feed_today);
     }
 
-    @Override public void setCallback(@Nullable FeedViewCallback callback) {
+    @Override public void setCallback(@Nullable FeedAdapter.Callback callback) 
{
         super.setCallback(callback);
         setOnClickListener(new CallbackAdapter(callback));
     }
 
     private static class CallbackAdapter implements OnClickListener {
         @NonNull private WikipediaApp app = WikipediaApp.getInstance();
-        @Nullable private final FeedViewCallback callback;
+        @Nullable private final FeedAdapter.Callback callback;
 
-        CallbackAdapter(@Nullable FeedViewCallback callback) {
+        CallbackAdapter(@Nullable FeedAdapter.Callback callback) {
             this.callback = callback;
         }
 
diff --git 
a/app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java 
b/app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
index 1fdba5f..4f2febf 100644
--- a/app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
@@ -6,7 +6,7 @@
 
 import org.wikipedia.R;
 import org.wikipedia.feed.view.CardHeaderView;
-import org.wikipedia.feed.view.FeedViewCallback;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.ListCardView;
 import org.wikipedia.feed.view.PageTitleListCardItemView;
 import org.wikipedia.feed.view.PageTitleRecyclerAdapter;
@@ -40,9 +40,10 @@
     }
 
     private static class RecyclerAdapter extends 
PageTitleRecyclerAdapter<MostReadItemCard> {
-        @Nullable private FeedViewCallback callback;
+        @Nullable private FeedAdapter.Callback callback;
 
-        RecyclerAdapter(@NonNull List<MostReadItemCard> items, @Nullable 
FeedViewCallback callback) {
+        RecyclerAdapter(@NonNull List<MostReadItemCard> items,
+                        @Nullable FeedAdapter.Callback callback) {
             super(items);
             this.callback = callback;
         }
diff --git a/app/src/main/java/org/wikipedia/feed/news/NewsListCardView.java 
b/app/src/main/java/org/wikipedia/feed/news/NewsListCardView.java
index 17affef..d34a217 100644
--- a/app/src/main/java/org/wikipedia/feed/news/NewsListCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/news/NewsListCardView.java
@@ -6,8 +6,8 @@
 import android.view.View;
 
 import org.wikipedia.R;
-import org.wikipedia.feed.view.FeedViewCallback;
 import org.wikipedia.feed.view.CardHeaderView;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.HorizontalScrollingListCardItemView;
 import org.wikipedia.feed.view.HorizontalScrollingListCardView;
 import org.wikipedia.util.DateUtil;
@@ -44,9 +44,9 @@
     }
 
     private static class RecyclerAdapter extends 
HorizontalScrollingListCardView.RecyclerAdapter<NewsItemCard> {
-        @Nullable private FeedViewCallback callback;
+        @Nullable private FeedAdapter.Callback callback;
 
-        RecyclerAdapter(@NonNull List<NewsItemCard> items, @Nullable 
FeedViewCallback callback) {
+        RecyclerAdapter(@NonNull List<NewsItemCard> items, @Nullable 
FeedAdapter.Callback callback) {
             super(items);
             this.callback = callback;
         }
diff --git 
a/app/src/main/java/org/wikipedia/feed/progress/ProgressCardView.java 
b/app/src/main/java/org/wikipedia/feed/progress/ProgressCardView.java
index c041574..5516b6b 100644
--- a/app/src/main/java/org/wikipedia/feed/progress/ProgressCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/progress/ProgressCardView.java
@@ -7,8 +7,8 @@
 
 import org.wikipedia.R;
 import org.wikipedia.feed.model.Card;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.FeedCardView;
-import org.wikipedia.feed.view.FeedViewCallback;
 
 public class ProgressCardView extends FrameLayout implements 
FeedCardView<Card> {
     public ProgressCardView(Context context) {
@@ -17,5 +17,5 @@
     }
 
     @Override public void setCard(@NonNull Card card) { }
-    @Override public void setCallback(@Nullable FeedViewCallback callback) { }
+    @Override public void setCallback(@Nullable FeedAdapter.Callback callback) 
{ }
 }
\ No newline at end of file
diff --git a/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java 
b/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
index 1cb941e..7d6af36 100644
--- a/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
@@ -6,7 +6,7 @@
 import android.view.View;
 
 import org.wikipedia.R;
-import org.wikipedia.feed.view.FeedViewCallback;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.StaticCardView;
 import org.wikipedia.history.HistoryEntry;
 import org.wikipedia.page.PageTitle;
@@ -25,15 +25,15 @@
         setIcon(R.drawable.icon_feed_random);
     }
 
-    @Override public void setCallback(@Nullable FeedViewCallback callback) {
+    @Override public void setCallback(@Nullable FeedAdapter.Callback callback) 
{
         super.setCallback(callback);
         setOnClickListener(new CallbackAdapter(callback));
     }
 
     private class CallbackAdapter implements OnClickListener {
-        @Nullable private final FeedViewCallback callback;
+        @Nullable private final FeedAdapter.Callback callback;
 
-        CallbackAdapter(@Nullable FeedViewCallback callback) {
+        CallbackAdapter(@Nullable FeedAdapter.Callback callback) {
             this.callback = callback;
         }
 
diff --git a/app/src/main/java/org/wikipedia/feed/view/DefaultFeedCardView.java 
b/app/src/main/java/org/wikipedia/feed/view/DefaultFeedCardView.java
index 67d88ab..0e2434b 100644
--- a/app/src/main/java/org/wikipedia/feed/view/DefaultFeedCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/view/DefaultFeedCardView.java
@@ -9,7 +9,7 @@
 
 public abstract class DefaultFeedCardView<T extends Card> extends CardView 
implements FeedCardView<T> {
     @Nullable private T card;
-    @Nullable private FeedViewCallback callback;
+    @Nullable private FeedAdapter.Callback callback;
 
     public DefaultFeedCardView(Context context) {
         super(context);
@@ -19,7 +19,7 @@
         this.card = card;
     }
 
-    @Override public void setCallback(@Nullable FeedViewCallback callback) {
+    @Override public void setCallback(@Nullable FeedAdapter.Callback callback) 
{
         this.callback = callback;
     }
 
@@ -27,7 +27,7 @@
         return card;
     }
 
-    @Nullable protected FeedViewCallback getCallback() {
+    @Nullable protected FeedAdapter.Callback getCallback() {
         return callback;
     }
 }
\ No newline at end of file
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 3f84cfb..88ae1f8 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
@@ -7,13 +7,19 @@
 import android.view.ViewGroup;
 
 import org.wikipedia.feed.FeedCoordinatorBase;
+import org.wikipedia.feed.image.FeaturedImageCardView;
 import org.wikipedia.feed.model.Card;
 import org.wikipedia.feed.model.CardType;
+import org.wikipedia.feed.news.NewsListCardView;
+import org.wikipedia.feed.searchbar.SearchCardView;
 import org.wikipedia.views.DefaultRecyclerAdapter;
 import org.wikipedia.views.DefaultViewHolder;
+import org.wikipedia.views.ItemTouchHelperSwipeAdapter;
 
 public class FeedAdapter<T extends View & FeedCardView<?>> extends 
DefaultRecyclerAdapter<Card, T> {
-    public interface Callback extends FeedViewCallback {
+    public interface Callback extends ItemTouchHelperSwipeAdapter.Callback,
+            PageTitleListCardItemView.Callback, CardHeaderView.Callback,
+            FeaturedImageCardView.Callback, SearchCardView.Callback, 
NewsListCardView.Callback {
         void onRequestMore();
     }
 
diff --git a/app/src/main/java/org/wikipedia/feed/view/FeedCardView.java 
b/app/src/main/java/org/wikipedia/feed/view/FeedCardView.java
index b07dde2..dd91ab6 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedCardView.java
@@ -7,5 +7,5 @@
 
 public interface FeedCardView<T extends Card> {
     void setCard(@NonNull T card);
-    void setCallback(@Nullable FeedViewCallback callback);
+    void setCallback(@Nullable FeedAdapter.Callback callback);
 }
\ No newline at end of file
diff --git a/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java 
b/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
deleted file mode 100644
index 323eb86..0000000
--- a/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.wikipedia.feed.view;
-
-import org.wikipedia.feed.image.FeaturedImageCardView;
-import org.wikipedia.feed.news.NewsListCardView;
-import org.wikipedia.feed.searchbar.SearchCardView;
-import org.wikipedia.views.ItemTouchHelperSwipeAdapter;
-
-public interface FeedViewCallback extends ItemTouchHelperSwipeAdapter.Callback,
-        PageTitleListCardItemView.Callback, CardHeaderView.Callback, 
FeaturedImageCardView.Callback,
-        SearchCardView.Callback, NewsListCardView.Callback {
-}
diff --git 
a/app/src/main/java/org/wikipedia/feed/view/HorizontalScrollingListCardItemView.java
 
b/app/src/main/java/org/wikipedia/feed/view/HorizontalScrollingListCardItemView.java
index 893f6f3..e686261 100644
--- 
a/app/src/main/java/org/wikipedia/feed/view/HorizontalScrollingListCardItemView.java
+++ 
b/app/src/main/java/org/wikipedia/feed/view/HorizontalScrollingListCardItemView.java
@@ -17,7 +17,7 @@
 public class HorizontalScrollingListCardItemView extends CardView {
     @BindView(R.id.horizontal_scroll_list_item_image) 
FaceAndColorDetectImageView imageView;
     @BindView(R.id.horizontal_scroll_list_item_text) TextView textView;
-    @Nullable private FeedViewCallback callback;
+    @Nullable private FeedAdapter.Callback callback;
 
     public HorizontalScrollingListCardItemView(@NonNull Context context) {
         super(context);
@@ -25,12 +25,12 @@
         ButterKnife.bind(this);
     }
 
-    public void setCallback(@Nullable FeedViewCallback callback) {
+    public void setCallback(@Nullable FeedAdapter.Callback callback) {
         this.callback = callback;
     }
 
     @Nullable
-    public FeedViewCallback getCallback() {
+    public FeedAdapter.Callback getCallback() {
         return callback;
     }
 

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

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