jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/386391 )

Change subject: Follow-up to List all trending articles.
......................................................................


Follow-up to List all trending articles.

Bug: T170884
Change-Id: Id5be5b8d211a476ba6cf82a851d14cedb6fca7ab
---
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
M app/src/main/java/org/wikipedia/feed/mostread/MostReadArticlesActivity.java
M app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
M app/src/main/java/org/wikipedia/feed/mostread/MostReadFragment.java
M app/src/main/java/org/wikipedia/feed/mostread/MostReadListCard.java
M app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
M app/src/main/java/org/wikipedia/feed/view/ListCardView.java
M app/src/main/java/org/wikipedia/history/HistoryEntry.java
M app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
M app/src/main/res/layout/view_list_card.xml
M app/src/main/res/values/strings.xml
11 files changed, 71 insertions(+), 72 deletions(-)

Approvals:
  Sharvaniharan: 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 f43d161..afacfa9 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -27,6 +27,8 @@
 import org.wikipedia.feed.image.FeaturedImage;
 import org.wikipedia.feed.image.FeaturedImageCard;
 import org.wikipedia.feed.model.Card;
+import org.wikipedia.feed.mostread.MostReadArticlesActivity;
+import org.wikipedia.feed.mostread.MostReadListCard;
 import org.wikipedia.feed.news.NewsItemCard;
 import org.wikipedia.feed.random.RandomCardView;
 import org.wikipedia.feed.view.FeedAdapter;
@@ -460,6 +462,11 @@
                 
startActivity(LocalCompilationsActivity.newIntent(getContext()));
             }
         }
+
+        @Override
+        public void onMoreContentSelected(@NonNull Card card) {
+            startActivity(MostReadArticlesActivity.newIntent(getContext(), 
(MostReadListCard) card));
+        }
     }
 
     private class FeedScrollListener extends RecyclerView.OnScrollListener {
diff --git 
a/app/src/main/java/org/wikipedia/feed/mostread/MostReadArticlesActivity.java 
b/app/src/main/java/org/wikipedia/feed/mostread/MostReadArticlesActivity.java
index b048846..8a6751d 100644
--- 
a/app/src/main/java/org/wikipedia/feed/mostread/MostReadArticlesActivity.java
+++ 
b/app/src/main/java/org/wikipedia/feed/mostread/MostReadArticlesActivity.java
@@ -1,32 +1,23 @@
 package org.wikipedia.feed.mostread;
 
-import android.graphics.Color;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.view.WindowManager;
+import android.content.Context;
+import android.content.Intent;
+import android.support.annotation.NonNull;
 
 import org.wikipedia.activity.SingleFragmentActivity;
+import org.wikipedia.json.GsonMarshaller;
 import org.wikipedia.json.GsonUnmarshaller;
-
 
 public class MostReadArticlesActivity extends 
SingleFragmentActivity<MostReadFragment> {
     protected static final String MOST_READ_CARD = "item";
 
-    @Override
-    public void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setSharedElementTransitions();
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
-            getWindow().setStatusBarColor(Color.TRANSPARENT);
-        }
+    public static Intent newIntent(@NonNull Context context, @NonNull 
MostReadListCard card) {
+        return new Intent(context, MostReadArticlesActivity.class)
+                .putExtra(MOST_READ_CARD, GsonMarshaller.marshal(card));
     }
 
     @Override
     public MostReadFragment createFragment() {
         return 
MostReadFragment.newInstance(GsonUnmarshaller.unmarshal(MostReadItemCard.class, 
getIntent().getStringExtra(MOST_READ_CARD)));
     }
-
-
 }
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 d9f8701..630aa7c 100644
--- a/app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/mostread/MostReadCardView.java
@@ -1,28 +1,23 @@
 package org.wikipedia.feed.mostread;
 
 import android.content.Context;
-import android.content.Intent;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 
 import org.wikipedia.R;
-import org.wikipedia.WikipediaApp;
 import org.wikipedia.feed.view.CardHeaderView;
 import org.wikipedia.feed.view.ListCardItemView;
 import org.wikipedia.feed.view.ListCardRecyclerAdapter;
 import org.wikipedia.feed.view.ListCardView;
 import org.wikipedia.history.HistoryEntry;
-import org.wikipedia.json.GsonMarshaller;
 import org.wikipedia.util.ResourceUtil;
 import org.wikipedia.views.DefaultViewHolder;
 import org.wikipedia.views.ItemTouchHelperSwipeAdapter;
 
 import java.util.List;
 
-import static 
org.wikipedia.feed.mostread.MostReadArticlesActivity.MOST_READ_CARD;
-
 public class MostReadCardView extends ListCardView<MostReadListCard>
-        implements ItemTouchHelperSwipeAdapter.SwipeableView, 
ListCardView.Callback {
+        implements ItemTouchHelperSwipeAdapter.SwipeableView {
     private static final int EVENTS_SHOWN = 5;
     private MostReadListCard card;
     public MostReadCardView(Context context) {
@@ -34,17 +29,8 @@
         header(card);
         this.card = card;
         set(new RecyclerAdapter(card.items().subList(0, 
Math.min(card.items().size(), EVENTS_SHOWN))));
-        
setMoreEventsTextView(String.format(getContext().getString(R.string.all_trending_text),
 card.subtitle()), this);
+        
setMoreContentTextView(String.format(getContext().getString(R.string.all_trending_text),
 card.subtitle()));
     }
-
-
-    private void launchMoreEventsActivity() {
-        Context context = WikipediaApp.getInstance();
-        Intent intent = new Intent(context, MostReadArticlesActivity.class);
-        intent.putExtra(MOST_READ_CARD, GsonMarshaller.marshal(card));
-        context.startActivity(intent);
-    }
-
 
     private void header(@NonNull MostReadListCard card) {
         CardHeaderView header = new CardHeaderView(getContext())
@@ -55,11 +41,6 @@
                 .setCard(card)
                 .setCallback(getCallback());
         header(header);
-    }
-
-    @Override
-    public void onMoreEventsSelected() {
-        launchMoreEventsActivity();
     }
 
     private class RecyclerAdapter extends 
ListCardRecyclerAdapter<MostReadItemCard> {
diff --git 
a/app/src/main/java/org/wikipedia/feed/mostread/MostReadFragment.java 
b/app/src/main/java/org/wikipedia/feed/mostread/MostReadFragment.java
index 52e2252..576ba91 100644
--- a/app/src/main/java/org/wikipedia/feed/mostread/MostReadFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/mostread/MostReadFragment.java
@@ -1,6 +1,5 @@
 package org.wikipedia.feed.mostread;
 
-
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
@@ -34,11 +33,9 @@
 
 import static 
org.wikipedia.feed.mostread.MostReadArticlesActivity.MOST_READ_CARD;
 
-
 public class MostReadFragment extends Fragment {
 
-    @BindView(R.id.view_most_read_fullscreen_link_card_list)
-    RecyclerView mostReadLinks;
+    @BindView(R.id.view_most_read_fullscreen_link_card_list) RecyclerView 
mostReadLinks;
     private ExclusiveBottomSheetPresenter bottomSheetPresenter = new 
ExclusiveBottomSheetPresenter();
     private Unbinder unbinder;
 
@@ -73,7 +70,6 @@
         super.onDestroyView();
     }
 
-
     private void initRecycler() {
         mostReadLinks.setLayoutManager(new LinearLayoutManager(getContext()));
         mostReadLinks.addItemDecoration(new 
DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
@@ -99,7 +95,7 @@
             MostReadItemCard card = item(position);
             holder.getView().setCard(card)
                     .setHistoryEntry(new HistoryEntry(card.pageTitle(),
-                            
HistoryEntry.SOURCE_FEED_MOST_READ)).setCallback(callback);
+                            
HistoryEntry.SOURCE_FEED_MOST_READ_ACTIVITY)).setCallback(callback);
 
         }
     }
@@ -118,7 +114,7 @@
         public void onAddPageToList(@NonNull HistoryEntry entry) {
             bottomSheetPresenter.show(getChildFragmentManager(),
                     AddToReadingListDialog.newInstance(entry.getTitle(),
-                            AddToReadingListDialog.InvokeSource.FEED));
+                            
AddToReadingListDialog.InvokeSource.MOST_READ_ACTIVITY));
         }
 
         @Override
diff --git 
a/app/src/main/java/org/wikipedia/feed/mostread/MostReadListCard.java 
b/app/src/main/java/org/wikipedia/feed/mostread/MostReadListCard.java
index 28a790c..ed9563c 100644
--- a/app/src/main/java/org/wikipedia/feed/mostread/MostReadListCard.java
+++ b/app/src/main/java/org/wikipedia/feed/mostread/MostReadListCard.java
@@ -19,8 +19,6 @@
 import java.util.concurrent.TimeUnit;
 
 public class MostReadListCard extends ListCard<MostReadItemCard> {
-    private static final int MAX_SIZE = 5;
-
     @NonNull private final MostReadArticles articles;
 
     public MostReadListCard(@NonNull MostReadArticles articles, @NonNull 
WikiSite wiki) {
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 99195f4..db3e9fd 100644
--- a/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
+++ b/app/src/main/java/org/wikipedia/feed/view/FeedAdapter.java
@@ -28,7 +28,7 @@
             ListCardItemView.Callback, CardHeaderView.Callback,
             FeaturedImageCardView.Callback, SearchCardView.Callback, 
NewsListCardView.Callback,
             AnnouncementCardView.Callback, FeaturedArticleCardView.Callback,
-            RandomCardView.Callback, OfflineCompilationCardView.Callback {
+            RandomCardView.Callback, OfflineCompilationCardView.Callback, 
ListCardView.Callback {
         void onShowCard(@Nullable Card card);
         void onRequestMore();
         void onRetryFromOffline();
diff --git a/app/src/main/java/org/wikipedia/feed/view/ListCardView.java 
b/app/src/main/java/org/wikipedia/feed/view/ListCardView.java
index 45c9811..60e5620 100644
--- a/app/src/main/java/org/wikipedia/feed/view/ListCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/view/ListCardView.java
@@ -5,12 +5,13 @@
 import android.support.annotation.Nullable;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
 import android.view.View;
+import android.widget.TextView;
 
 import org.wikipedia.R;
 import org.wikipedia.feed.model.Card;
 import org.wikipedia.views.DrawableItemDecoration;
-import org.wikipedia.views.GoneIfEmptyTextView;
 import org.wikipedia.views.ViewUtil;
 
 import butterknife.BindView;
@@ -18,11 +19,15 @@
 import butterknife.OnClick;
 
 public abstract class ListCardView<T extends Card> extends 
DefaultFeedCardView<T> {
+    public interface Callback {
+        void onMoreContentSelected(@NonNull Card card);
+    }
+
     @BindView(R.id.view_list_card_header) View headerView;
     @BindView(R.id.view_list_card_large_header) View largeHeaderView;
     @BindView(R.id.view_list_card_list) RecyclerView recyclerView;
-    @BindView(R.id.more_events) GoneIfEmptyTextView moreEvents;
-    private Callback callback;
+    @BindView(R.id.view_list_card_more_container) View moreContentContainer;
+    @BindView(R.id.view_list_card_more_text) TextView moreContentTextView;
 
     public ListCardView(Context context) {
         super(context);
@@ -67,19 +72,14 @@
         recyclerView.setNestedScrollingEnabled(false);
     }
 
-    protected void setMoreEventsTextView(String moreEventsText, Callback 
callback) {
-        moreEvents.setVisibility(VISIBLE);
-        moreEvents.setText(moreEventsText);
-        this.callback = callback;
+    protected void setMoreContentTextView(@NonNull String text) {
+        moreContentContainer.setVisibility(TextUtils.isEmpty(text) ? GONE : 
VISIBLE);
+        moreContentTextView.setText(text);
     }
 
-    @OnClick(R.id.more_events) void moreEventsClicked() {
-        if (callback != null) {
-            callback.onMoreEventsSelected();
+    @OnClick(R.id.view_list_card_more_container) void moreContentClicked() {
+        if (getCallback() != null && getCard() != null) {
+            getCallback().onMoreContentSelected(getCard());
         }
-    }
-
-    public interface Callback {
-        void onMoreEventsSelected();
     }
 }
diff --git a/app/src/main/java/org/wikipedia/history/HistoryEntry.java 
b/app/src/main/java/org/wikipedia/history/HistoryEntry.java
index dc082ee..ae73459 100644
--- a/app/src/main/java/org/wikipedia/history/HistoryEntry.java
+++ b/app/src/main/java/org/wikipedia/history/HistoryEntry.java
@@ -31,6 +31,7 @@
     public static final int SOURCE_GALLERY = 19; // Or should we just use 
SOURCE_INTERNAL_LINK as before?  Some of these things seem not like the others.
     public static final int SOURCE_APP_SHORTCUT_RANDOM = 20;
     public static final int SOURCE_APP_SHORTCUT_CONTINUE_READING = 21;
+    public static final int SOURCE_FEED_MOST_READ_ACTIVITY = 22;
 
     @NonNull private final PageTitle title;
     @NonNull private final Date timestamp;
diff --git 
a/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java 
b/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
index 9cb7042..4f169f3 100644
--- a/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
+++ b/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
@@ -42,7 +42,8 @@
         PAGE_OVERFLOW_MENU(3),
         FEED(4),
         NEWS_ACTIVITY(5),
-        READING_LIST_ACTIVITY(6);
+        READING_LIST_ACTIVITY(6),
+        MOST_READ_ACTIVITY(7);
 
         private static final EnumCodeMap<InvokeSource> MAP = new 
EnumCodeMap<>(InvokeSource.class);
 
diff --git a/app/src/main/res/layout/view_list_card.xml 
b/app/src/main/res/layout/view_list_card.xml
index e43cf69..eb54b02 100644
--- a/app/src/main/res/layout/view_list_card.xml
+++ b/app/src/main/res/layout/view_list_card.xml
@@ -1,4 +1,7 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android";
+    xmlns:app="http://schemas.android.com/apk/res-auto";
+    xmlns:tools="http://schemas.android.com/tools";
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
@@ -21,14 +24,35 @@
         android:layout_height="wrap_content"
         android:layout_below="@id/view_list_card_large_header" />
 
-    <org.wikipedia.views.GoneIfEmptyTextView
-        android:id="@+id/more_events"
+    <LinearLayout
+        android:id="@+id/view_list_card_more_container"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="48dp"
+        android:background="?android:colorBackground"
+        android:foreground="?attr/selectableItemBackground"
+        android:clickable="true"
         android:layout_below="@+id/view_list_card_list"
-        android:background="@color/black12"
-        android:drawableEnd="@drawable/ic_chevron_forward_gray"
-        android:drawableRight="@drawable/ic_chevron_forward_gray"
-        android:padding="12dp"
-        android:visibility="gone" />
+        android:visibility="gone"
+        tools:visibility="visible">
+
+        <TextView
+            android:id="@+id/view_list_card_more_text"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:paddingLeft="16dp"
+            android:paddingRight="16dp"
+            android:textColor="?attr/secondary_text_color"
+            android:gravity="center_vertical"/>
+
+        <ImageView
+            android:layout_width="48dp"
+            android:layout_height="match_parent"
+            android:scaleType="center"
+            app:srcCompat="@drawable/ic_chevron_forward_gray"
+            android:tint="?attr/secondary_text_color"
+            android:contentDescription="@null"/>
+
+    </LinearLayout>
+
 </RelativeLayout>
diff --git a/app/src/main/res/values/strings.xml 
b/app/src/main/res/values/strings.xml
index c0adbe7..33ebab1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -553,7 +553,7 @@
     <string name="app_shortcuts_continue_reading">Continue reading</string>
     <string name="app_shortcuts_search">Search</string>
     <string name="all_trending_text">All trending articles on %1$s</string>
-    <string name="top_on_this_day">Top on %1$s</string>
+    <string name="top_on_this_day">Trending on %1$s</string>
     <!-- /App Shortcuts -->
 
 </resources>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5be5b8d211a476ba6cf82a851d14cedb6fca7ab
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Cooltey <[email protected]>
Gerrit-Reviewer: Sharvaniharan <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to