Dbrant has submitted this change and it was merged. Change subject: Display Main Page when app first loads ......................................................................
Display Main Page when app first loads Change-Id: If8798b609fc492a72749dd8b79afa5a3c6eff4bd --- M wikipedia/src/main/java/org/wikipedia/history/HistoryActivity.java M wikipedia/src/main/java/org/wikipedia/history/HistoryEntry.java M wikipedia/src/main/java/org/wikipedia/page/PageActivity.java 3 files changed, 10 insertions(+), 0 deletions(-) Approvals: Dbrant: Looks good to me, approved diff --git a/wikipedia/src/main/java/org/wikipedia/history/HistoryActivity.java b/wikipedia/src/main/java/org/wikipedia/history/HistoryActivity.java index 6552816..a7ba8a7 100644 --- a/wikipedia/src/main/java/org/wikipedia/history/HistoryActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/history/HistoryActivity.java @@ -111,6 +111,8 @@ return R.drawable.link; case HistoryEntry.SOURCE_RANDOM: return R.drawable.random; + case HistoryEntry.SOURCE_MAIN_PAGE: + return R.drawable.link; default: throw new RuntimeException("Unknown source id encountered"); } diff --git a/wikipedia/src/main/java/org/wikipedia/history/HistoryEntry.java b/wikipedia/src/main/java/org/wikipedia/history/HistoryEntry.java index 6995150..be1da7b 100644 --- a/wikipedia/src/main/java/org/wikipedia/history/HistoryEntry.java +++ b/wikipedia/src/main/java/org/wikipedia/history/HistoryEntry.java @@ -15,6 +15,7 @@ public static final int SOURCE_SAVED_PAGE = 5; public static final int SOURCE_LANGUAGE_LINK = 6; public static final int SOURCE_RANDOM = 7; + public static final int SOURCE_MAIN_PAGE = 8; private final PageTitle title; private final Date timestamp; diff --git a/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java b/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java index 503a1dc..54b684a 100644 --- a/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/page/PageActivity.java @@ -18,6 +18,7 @@ import org.wikipedia.recurring.*; import org.wikipedia.search.*; import org.wikipedia.settings.*; +import org.wikipedia.staticdata.*; public class PageActivity extends ActionBarActivity { public static final String ACTION_PAGE_FOR_TITLE = "org.wikipedia.page_for_title"; @@ -79,6 +80,12 @@ PageTitle title = intent.getParcelableExtra(EXTRA_PAGETITLE); HistoryEntry historyEntry = intent.getParcelableExtra(EXTRA_HISTORYENTRY); bus.post(new NewWikiPageNavigationEvent(title, historyEntry)); + } else { + // Unrecognized, let us load the main page! + // FIXME: Design something better for this? + PageTitle title = new PageTitle(MainPageNameData.valueFor(app.getPrimaryLanguage()), app.getPrimarySite()); + HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_MAIN_PAGE); + bus.post(new NewWikiPageNavigationEvent(title, historyEntry)); } } -- To view, visit https://gerrit.wikimedia.org/r/130606 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If8798b609fc492a72749dd8b79afa5a3c6eff4bd Gerrit-PatchSet: 2 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org> Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits