Niedzielski has uploaded a new change for review.

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

Change subject: Hygiene: move PageTitleListCardItemCallback
......................................................................

Hygiene: move PageTitleListCardItemCallback

Move PageTitleListCardItemCallback into
PageTitleListCardItemView.Callback since this is what the callback is
attached to and the pattern we use for Fragments.

Change-Id: Id56e2c3396f519bde077ffa08a24b1c0faccf235
---
D app/src/main/java/org/wikipedia/PageTitleListCardItemCallback.java
M app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
M app/src/main/java/org/wikipedia/feed/view/PageTitleListCardItemView.java
M app/src/main/java/org/wikipedia/news/NewsFragment.java
4 files changed, 13 insertions(+), 21 deletions(-)


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

diff --git a/app/src/main/java/org/wikipedia/PageTitleListCardItemCallback.java 
b/app/src/main/java/org/wikipedia/PageTitleListCardItemCallback.java
deleted file mode 100644
index 09460fa..0000000
--- a/app/src/main/java/org/wikipedia/PageTitleListCardItemCallback.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.wikipedia;
-
-import android.support.annotation.NonNull;
-
-import org.wikipedia.history.HistoryEntry;
-
-public interface PageTitleListCardItemCallback {
-    void onSelectPage(@NonNull HistoryEntry entry);
-    void onAddPageToList(@NonNull HistoryEntry entry);
-    void onSharePage(@NonNull HistoryEntry entry);
-}
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 a42cd99..e88e0ae 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedViewCallback.java
@@ -2,15 +2,14 @@
 
 import android.support.annotation.NonNull;
 
-import org.wikipedia.PageTitleListCardItemCallback;
-import org.wikipedia.feed.image.FeaturedImageCard;
 import org.wikipedia.feed.image.FeaturedImage;
-import org.wikipedia.feed.news.NewsItemCard;
+import org.wikipedia.feed.image.FeaturedImageCard;
 import org.wikipedia.feed.model.Card;
+import org.wikipedia.feed.news.NewsItemCard;
 import org.wikipedia.views.ItemTouchHelperSwipeAdapter;
 
 public interface FeedViewCallback extends ItemTouchHelperSwipeAdapter.Callback,
-        PageTitleListCardItemCallback {
+        PageTitleListCardItemView.Callback {
     void onRequestMore();
     void onSearchRequested();
     void onVoiceSearchRequested();
diff --git 
a/app/src/main/java/org/wikipedia/feed/view/PageTitleListCardItemView.java 
b/app/src/main/java/org/wikipedia/feed/view/PageTitleListCardItemView.java
index 27a6ae9..ca7fc79 100644
--- a/app/src/main/java/org/wikipedia/feed/view/PageTitleListCardItemView.java
+++ b/app/src/main/java/org/wikipedia/feed/view/PageTitleListCardItemView.java
@@ -7,13 +7,18 @@
 import android.view.MenuItem;
 import android.view.View;
 
-import org.wikipedia.PageTitleListCardItemCallback;
 import org.wikipedia.R;
 import org.wikipedia.history.HistoryEntry;
 import org.wikipedia.views.ViewUtil;
 
 public class PageTitleListCardItemView extends ListCardItemView {
-    @Nullable private PageTitleListCardItemCallback callback;
+    public interface Callback {
+        void onSelectPage(@NonNull HistoryEntry entry);
+        void onAddPageToList(@NonNull HistoryEntry entry);
+        void onSharePage(@NonNull HistoryEntry entry);
+    }
+
+    @Nullable private Callback callback;
     @Nullable private HistoryEntry entry;
 
     public PageTitleListCardItemView(Context context) {
@@ -34,7 +39,7 @@
         });
     }
 
-    @NonNull public PageTitleListCardItemView setCallback(@Nullable 
PageTitleListCardItemCallback callback) {
+    @NonNull public PageTitleListCardItemView setCallback(@Nullable Callback 
callback) {
         this.callback = callback;
         return this;
     }
diff --git a/app/src/main/java/org/wikipedia/news/NewsFragment.java 
b/app/src/main/java/org/wikipedia/news/NewsFragment.java
index 60deb5e..41ce284 100644
--- a/app/src/main/java/org/wikipedia/news/NewsFragment.java
+++ b/app/src/main/java/org/wikipedia/news/NewsFragment.java
@@ -15,7 +15,6 @@
 import android.view.ViewGroup;
 import android.widget.TextView;
 
-import org.wikipedia.PageTitleListCardItemCallback;
 import org.wikipedia.R;
 import org.wikipedia.Site;
 import org.wikipedia.feed.news.NewsItem;
@@ -115,7 +114,7 @@
     protected static class RecyclerAdapter extends 
DefaultRecyclerAdapter<NewsLinkCard, PageTitleListCardItemView> {
         @Nullable private Callback callback;
 
-        protected RecyclerAdapter(@NonNull List<NewsLinkCard> items, @NonNull 
Callback callback) {
+        RecyclerAdapter(@NonNull List<NewsLinkCard> items, @NonNull Callback 
callback) {
             super(items);
             this.callback = callback;
         }
@@ -132,7 +131,7 @@
         }
     }
 
-    private class Callback implements PageTitleListCardItemCallback {
+    private class Callback implements PageTitleListCardItemView.Callback {
         @Override
         public void onSelectPage(@NonNull HistoryEntry entry) {
             startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle(), false));

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

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