jenkins-bot has submitted this change and it was merged.

Change subject: Hygiene: rename FeedRecyclerAdapter to FeedAdapter
......................................................................


Hygiene: rename FeedRecyclerAdapter to FeedAdapter

FeedView now descends from a RecyclerView. Everything in FeedView is
RecyclerView-centric. Rename FeedRecyclerAdapter to FeedAdapter.

Change-Id: I994d1e82eea6c198f2b488ee5207134ce2d86d4e
---
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
M app/src/main/java/org/wikipedia/feed/model/Card.java
R app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
M app/src/main/java/org/wikipedia/feed/view/FeedView.java
4 files changed, 21 insertions(+), 20 deletions(-)

Approvals:
  Dbrant: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.java 
b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
index 3195a70..d1ea969 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -28,7 +28,7 @@
 import org.wikipedia.feed.image.FeaturedImageCard;
 import org.wikipedia.feed.model.Card;
 import org.wikipedia.feed.news.NewsItemCard;
-import org.wikipedia.feed.view.FeedRecyclerAdapter;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.feed.view.FeedView;
 import org.wikipedia.feed.view.FeedViewCallback;
 import org.wikipedia.history.HistoryEntry;
@@ -244,7 +244,7 @@
         @Override
         public boolean onRequestDismissCard(@NonNull Card card) {
             int position = coordinator.dismissCard(card);
-            funnel.dismissCard(FeedRecyclerAdapter.getCardType(card), 
position);
+            funnel.dismissCard(FeedAdapter.getCardType(card), position);
             showDismissCardUndoSnackbar(card, position);
             return true;
         }
diff --git a/app/src/main/java/org/wikipedia/feed/model/Card.java 
b/app/src/main/java/org/wikipedia/feed/model/Card.java
index 27fb306..e360f60 100644
--- a/app/src/main/java/org/wikipedia/feed/model/Card.java
+++ b/app/src/main/java/org/wikipedia/feed/model/Card.java
@@ -4,7 +4,7 @@
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 
-import org.wikipedia.feed.view.FeedRecyclerAdapter;
+import org.wikipedia.feed.view.FeedAdapter;
 import org.wikipedia.model.BaseModel;
 
 public abstract class Card extends BaseModel {
@@ -23,7 +23,7 @@
     }
 
     public String getHideKey() {
-        return Long.toString(FeedRecyclerAdapter.getCardType(this) + 
dismissHashCode());
+        return Long.toString(FeedAdapter.getCardType(this) + 
dismissHashCode());
     }
 
     protected int dismissHashCode() {
diff --git a/app/src/main/java/org/wikipedia/feed/view/FeedRecyclerAdapter.java 
b/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
similarity index 97%
rename from app/src/main/java/org/wikipedia/feed/view/FeedRecyclerAdapter.java
rename to app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
index a0e81c3..862e9b7 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedRecyclerAdapter.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
@@ -31,7 +31,7 @@
 import org.wikipedia.views.DefaultRecyclerAdapter;
 import org.wikipedia.views.DefaultViewHolder;
 
-public class FeedRecyclerAdapter extends DefaultRecyclerAdapter<Card, View> {
+public class FeedAdapter extends DefaultRecyclerAdapter<Card, View> {
     private static final int VIEW_TYPE_SEARCH_BAR = 0;
     private static final int VIEW_TYPE_CONTINUE_READING = 1;
     private static final int VIEW_TYPE_BECAUSE_YOU_READ = 2;
@@ -72,7 +72,7 @@
         }
     }
 
-    public FeedRecyclerAdapter(@NonNull FeedCoordinatorBase coordinator, 
@Nullable FeedViewCallback callback) {
+    public FeedAdapter(@NonNull FeedCoordinatorBase coordinator, @Nullable 
FeedViewCallback callback) {
         super(coordinator.getCards());
         this.coordinator = coordinator;
         this.callback = callback;
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 fdf90af..812a134 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedView.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedView.java
@@ -16,8 +16,8 @@
 
 public class FeedView extends AutoFitRecyclerView {
     private StaggeredGridLayoutManager recyclerLayoutManager;
-    @Nullable private FeedRecyclerAdapter recyclerAdapter;
-    @Nullable private ItemTouchHelper recyclerItemTouchHelper;
+    @Nullable private FeedAdapter adapter;
+    @Nullable private ItemTouchHelper itemTouchHelper;
 
     public FeedView(Context context) {
         super(context);
@@ -35,23 +35,23 @@
     }
 
     public void set(@NonNull FeedCoordinatorBase coordinator, @Nullable 
FeedViewCallback callback) {
-        recyclerAdapter = new FeedRecyclerAdapter(coordinator, callback);
-        setAdapter(recyclerAdapter);
+        adapter = new FeedAdapter(coordinator, callback);
+        setAdapter(adapter);
 
-        if (recyclerItemTouchHelper != null) {
-            recyclerItemTouchHelper.attachToRecyclerView(null);
-            recyclerItemTouchHelper = null;
+        if (itemTouchHelper != null) {
+            itemTouchHelper.attachToRecyclerView(null);
+            itemTouchHelper = null;
         }
 
         if (callback != null) {
-            recyclerItemTouchHelper = new ItemTouchHelper(new 
ItemTouchHelperSwipeAdapter(callback));
-            recyclerItemTouchHelper.attachToRecyclerView(this);
+            itemTouchHelper = new ItemTouchHelper(new 
ItemTouchHelperSwipeAdapter(callback));
+            itemTouchHelper.attachToRecyclerView(this);
         }
     }
 
     public void update() {
-        if (recyclerAdapter != null) {
-            recyclerAdapter.notifyDataSetChanged();
+        if (adapter != null) {
+            adapter.notifyDataSetChanged();
         }
     }
 
@@ -78,9 +78,10 @@
 
     private class RecyclerViewColumnCallback implements 
AutoFitRecyclerView.Callback {
         @Override public void onColumns(int columns) {
-            // todo: when there is only one column, should we setSpanCount to 
1? e.g.:
-            //   recyclerAdapter.getItemCount() <= 1 ? 1 : columns;
-            // We would need to also notify the layout manager when the data 
set changes though.
+            // todo: when there is only one element, should we setSpanCount to 
1? e.g.:
+            //       adapter.getItemCount() <= 1 ? 1 : columns;
+            //       we would need to also notify the layout manager when the 
data set changes
+            //       though.
             recyclerLayoutManager.setSpanCount(columns);
         }
     }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I994d1e82eea6c198f2b488ee5207134ce2d86d4e
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to