diff --git a/app/src/main/java/com/gh4a/activities/home/HomeActivity.java b/app/src/main/java/com/gh4a/activities/home/HomeActivity.java index 6b1542ab4..017d5ba8d 100644 --- a/app/src/main/java/com/gh4a/activities/home/HomeActivity.java +++ b/app/src/main/java/com/gh4a/activities/home/HomeActivity.java @@ -297,7 +297,7 @@ private FragmentFactory getFactoryForItem(int id) { case R.id.news_feed: return new NewsFeedFactory(this, mUserLogin); case R.id.notifications: - return new NotificationListFactory(this); + return new NotificationListFactory(this, mUserLogin); case R.id.my_repos: return new RepositoryFactory(this, mUserLogin, getPrefs()); case R.id.my_issues: diff --git a/app/src/main/java/com/gh4a/activities/home/NotificationListFactory.java b/app/src/main/java/com/gh4a/activities/home/NotificationListFactory.java index 58a848f36..4c3f58a43 100644 --- a/app/src/main/java/com/gh4a/activities/home/NotificationListFactory.java +++ b/app/src/main/java/com/gh4a/activities/home/NotificationListFactory.java @@ -5,18 +5,23 @@ import com.gh4a.R; import com.gh4a.fragment.NotificationListFragment; +import com.gh4a.fragment.WatchedRepositoryListFragment; public class NotificationListFactory extends FragmentFactory { - private static final int[] TAB_TITLES = new int[] { - R.string.notifications + private static final int[] TAB_TITLES = new int[] { + R.string.notifications, R.string.watching }; - protected NotificationListFactory(HomeActivity activity) { + private final String mUserLogin; + + protected NotificationListFactory(HomeActivity activity, String userLogin) { super(activity); + mUserLogin = userLogin; } @Override - protected @StringRes int getTitleResId() { + @StringRes + protected int getTitleResId() { return R.string.notifications; } @@ -27,6 +32,9 @@ protected int[] getTabTitleResIds() { @Override protected Fragment makeFragment(int position) { + if (position == 1) { + return WatchedRepositoryListFragment.newInstance(mUserLogin); + } return NotificationListFragment.newInstance(); } } diff --git a/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java b/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java index 34fb7a3d3..018e6bf35 100644 --- a/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java +++ b/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java @@ -196,9 +196,6 @@ private void applyFilterTypeAndSortOrder() { mMainFragment = StarredRepositoryListFragment.newInstance(mUserLogin, mSortOrder, mSortDirection); break; - case "watched": - mMainFragment = WatchedRepositoryListFragment.newInstance(mUserLogin); - break; default: mMainFragment = RepositoryListFragment.newInstance(mUserLogin, mIsOrg, mFilterType, mSortOrder, mSortDirection); @@ -367,7 +364,6 @@ public static class FilterDrawerHelper { FILTER_LOOKUP.put(R.id.filter_type_private, "private"); FILTER_LOOKUP.put(R.id.filter_type_sources, "sources"); FILTER_LOOKUP.put(R.id.filter_type_forks, "forks"); - FILTER_LOOKUP.put(R.id.filter_type_watched, "watched"); FILTER_LOOKUP.put(R.id.filter_type_starred, "starred"); } @@ -431,9 +427,8 @@ public void setFilterType(String type) { } public int getMenuResId() { - return TextUtils.equals(mFilterType, "starred") ? R.menu.repo_starred_sort - : TextUtils.equals(mFilterType, "watched") ? 0 - : R.menu.repo_sort; + return TextUtils.equals(mFilterType, "starred") + ? R.menu.repo_starred_sort : R.menu.repo_sort; } public void selectSortType(Menu menu, String order, String direction) { diff --git a/app/src/main/res/menu/repo_filter_logged_in.xml b/app/src/main/res/menu/repo_filter_logged_in.xml index 8b4f52fce..6f8674dea 100644 --- a/app/src/main/res/menu/repo_filter_logged_in.xml +++ b/app/src/main/res/menu/repo_filter_logged_in.xml @@ -24,9 +24,6 @@ - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 891654e2c..c63723ac2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -110,6 +110,7 @@ Quote Fork Notifications + Watching Mark all as read Mark as read Unsubscribe