diff --git a/app/src/main/java/com/gh4a/activities/home/BookmarkFactory.java b/app/src/main/java/com/gh4a/activities/home/BookmarkFactory.java index d349ede45..a2b5defa1 100644 --- a/app/src/main/java/com/gh4a/activities/home/BookmarkFactory.java +++ b/app/src/main/java/com/gh4a/activities/home/BookmarkFactory.java @@ -5,19 +5,24 @@ import com.gh4a.R; import com.gh4a.fragment.BookmarkListFragment; +import com.gh4a.fragment.StarredRepositoryListFragment; public class BookmarkFactory extends FragmentFactory { private static final int[] TAB_TITLES = new int[] { - R.string.bookmarks + R.string.bookmarks, R.string.starred }; - public BookmarkFactory(HomeActivity activity) { + private final String mUserLogin; + + public BookmarkFactory(HomeActivity activity, String userLogin) { super(activity); + mUserLogin = userLogin; } @Override - protected @StringRes int getTitleResId() { - return R.string.bookmarks; + @StringRes + protected int getTitleResId() { + return R.string.stars_and_bookmarks; } @Override @@ -27,6 +32,9 @@ protected int[] getTabTitleResIds() { @Override protected Fragment makeFragment(int position) { + if (position == 1) { + return StarredRepositoryListFragment.newInstance(mUserLogin, "", ""); // TODO + } return BookmarkListFragment.newInstance(); } } 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 4dddb2f8d..532e010e0 100644 --- a/app/src/main/java/com/gh4a/activities/home/HomeActivity.java +++ b/app/src/main/java/com/gh4a/activities/home/HomeActivity.java @@ -311,7 +311,7 @@ private FragmentFactory getFactoryForItem(int id) { case R.id.search: return new SearchFactory(this); case R.id.bookmarks: - return new BookmarkFactory(this); + return new BookmarkFactory(this, mUserLogin); case R.id.pub_timeline: return new TimelineFactory(this); case R.id.blog: diff --git a/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java b/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java index b43ecd44b..6dac89a6d 100644 --- a/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java +++ b/app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java @@ -188,10 +188,6 @@ private void applyFilterTypeAndSortOrder() { } switch (mFilterType) { - case "starred": - mMainFragment = StarredRepositoryListFragment.newInstance(mUserLogin, - mSortOrder, mSortDirection); - break; case "watched": mMainFragment = WatchedRepositoryListFragment.newInstance(mUserLogin); break; @@ -364,7 +360,6 @@ public static class FilterDrawerHelper { 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"); } public static FilterDrawerHelper create(String userLogin, boolean isOrg) { @@ -427,9 +422,7 @@ 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, "watched") ? 0 : R.menu.repo_sort; } public void selectSortType(Menu menu, String order, String direction) { diff --git a/app/src/main/res/menu/home_nav_drawer.xml b/app/src/main/res/menu/home_nav_drawer.xml index 46f40b417..bafd8f9ac 100644 --- a/app/src/main/res/menu/home_nav_drawer.xml +++ b/app/src/main/res/menu/home_nav_drawer.xml @@ -40,7 +40,7 @@ android:icon="@drawable/icon_search"/> <item android:id="@+id/bookmarks" - android:title="@string/bookmarks" + android:title="@string/stars_and_bookmarks" android:icon="@drawable/icon_bookmark" /> </group> <group 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..2f2a8c84d 100644 --- a/app/src/main/res/menu/repo_filter_logged_in.xml +++ b/app/src/main/res/menu/repo_filter_logged_in.xml @@ -27,9 +27,6 @@ <item android:id="@+id/filter_type_watched" android:title="@string/repo_type_watched" /> - <item - android:id="@+id/filter_type_starred" - android:title="@string/repo_type_starred" /> </group> </menu> </item> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3b23fba55..c445c30e4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -45,6 +45,7 @@ <string name="feedback_by_email">By Email</string> <string name="feedback_by_gh4a">By OctoDroid</string> <string name="bookmarks">Bookmarks</string> + <string name="stars_and_bookmarks">Stars and Bookmarks</string> <string name="other_info">Other Information</string> <string name="view">View</string> <string name="readme">Readme</string>