Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Enable random client for looking through random articles

  • Loading branch information...
FlorianSW committed May 6, 2018
1 parent 220c518 commit 07f9190ea3fcbaaa3f329c1e93a2eec1f43792ee
@@ -11,6 +11,7 @@
import org.wikipedia.feed.continuereading.ContinueReadingClient;
import org.wikipedia.feed.dataclient.FeedClient;
import org.wikipedia.feed.mainpage.MainPageClient;
import org.wikipedia.feed.random.RandomClient;
import org.wikipedia.model.EnumCode;
import org.wikipedia.model.EnumCodeMap;
import org.wikipedia.settings.Prefs;
@@ -56,13 +57,13 @@ public FeedClient newClient(AggregatedFeedContentClient aggregatedClient, int ag
return isEnabled() && age == 0 ? new MainPageClient() : null;
}
},
// RANDOM(5, R.string.view_random_card_title, R.string.feed_item_type_randomizer, false) {
// @Nullable
// @Override
// public FeedClient newClient(AggregatedFeedContentClient aggregatedClient, int age, boolean isOnline) {
// return isEnabled() && age % 2 == 0 ? new RandomClient() : null;
// }
// },
RANDOM(5, R.string.view_random_card_title, R.string.feed_item_type_randomizer, false) {
@Nullable
@Override
public FeedClient newClient(AggregatedFeedContentClient aggregatedClient, int age, boolean isOnline) {
return isEnabled() && age % 2 == 0 ? new RandomClient() : null;
}
},
// FEATURED_ARTICLE(6, R.string.view_featured_article_card_title, R.string.feed_item_type_featured_article, true) {
// @Nullable
// @Override
@@ -101,8 +101,8 @@ public int getAge() {
public int dismissCard(@NonNull Card card) {
int position = cards.indexOf(card);
if (card.type() == CardType.RANDOM) {
// FeedContentType.RANDOM.setEnabled(false);
// FeedContentType.saveState();
FeedContentType.RANDOM.setEnabled(false);
FeedContentType.saveState();
} else if (card.type() == CardType.MAIN_PAGE) {
FeedContentType.MAIN_PAGE.setEnabled(false);
FeedContentType.saveState();
@@ -119,8 +119,8 @@ public int dismissCard(@NonNull Card card) {

public void undoDismissCard(@NonNull Card card, int position) {
if (card.type() == CardType.RANDOM) {
// FeedContentType.RANDOM.setEnabled(true);
// FeedContentType.saveState();
FeedContentType.RANDOM.setEnabled(true);
FeedContentType.saveState();
} else if (card.type() == CardType.MAIN_PAGE) {
FeedContentType.MAIN_PAGE.setEnabled(true);
FeedContentType.saveState();

0 comments on commit 07f9190

Please sign in to comment.
You can’t perform that action at this time.