Skip to content

Commit f99409d

Browse files
committed
Move starred repositories to bookmarks screen
Related to #578, #624 and #725
1 parent 0f90cd4 commit f99409d

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

app/src/main/java/com/gh4a/activities/home/BookmarkFactory.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@
55

66
import com.gh4a.R;
77
import com.gh4a.fragment.BookmarkListFragment;
8+
import com.gh4a.fragment.StarredRepositoryListFragment;
89

910
public class BookmarkFactory extends FragmentFactory {
1011
private static final int[] TAB_TITLES = new int[] {
11-
R.string.bookmarks
12+
R.string.bookmarks, R.string.starred
1213
};
1314

14-
public BookmarkFactory(HomeActivity activity) {
15+
private final String mUserLogin;
16+
17+
public BookmarkFactory(HomeActivity activity, String userLogin) {
1518
super(activity);
19+
mUserLogin = userLogin;
1620
}
1721

1822
@Override
19-
protected @StringRes int getTitleResId() {
20-
return R.string.bookmarks;
23+
@StringRes
24+
protected int getTitleResId() {
25+
return R.string.stars_and_bookmarks;
2126
}
2227

2328
@Override
@@ -27,6 +32,9 @@ protected int[] getTabTitleResIds() {
2732

2833
@Override
2934
protected Fragment makeFragment(int position) {
35+
if (position == 1) {
36+
return StarredRepositoryListFragment.newInstance(mUserLogin, "", ""); // TODO
37+
}
3038
return BookmarkListFragment.newInstance();
3139
}
3240
}

app/src/main/java/com/gh4a/activities/home/HomeActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private FragmentFactory getFactoryForItem(int id) {
309309
case R.id.search:
310310
return new SearchFactory(this);
311311
case R.id.bookmarks:
312-
return new BookmarkFactory(this);
312+
return new BookmarkFactory(this, mUserLogin);
313313
case R.id.pub_timeline:
314314
return new TimelineFactory(this);
315315
case R.id.blog:

app/src/main/java/com/gh4a/fragment/RepositoryListContainerFragment.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,6 @@ private void applyFilterTypeAndSortOrder() {
192192
}
193193

194194
switch (mFilterType) {
195-
case "starred":
196-
mMainFragment = StarredRepositoryListFragment.newInstance(mUserLogin,
197-
mSortOrder, mSortDirection);
198-
break;
199195
case "watched":
200196
mMainFragment = WatchedRepositoryListFragment.newInstance(mUserLogin);
201197
break;
@@ -368,7 +364,6 @@ public static class FilterDrawerHelper {
368364
FILTER_LOOKUP.put(R.id.filter_type_sources, "sources");
369365
FILTER_LOOKUP.put(R.id.filter_type_forks, "forks");
370366
FILTER_LOOKUP.put(R.id.filter_type_watched, "watched");
371-
FILTER_LOOKUP.put(R.id.filter_type_starred, "starred");
372367
}
373368

374369
public static FilterDrawerHelper create(String userLogin, boolean isOrg) {
@@ -431,9 +426,7 @@ public void setFilterType(String type) {
431426
}
432427

433428
public int getMenuResId() {
434-
return TextUtils.equals(mFilterType, "starred") ? R.menu.repo_starred_sort
435-
: TextUtils.equals(mFilterType, "watched") ? 0
436-
: R.menu.repo_sort;
429+
return TextUtils.equals(mFilterType, "watched") ? 0 : R.menu.repo_sort;
437430
}
438431

439432
public void selectSortType(Menu menu, String order, String direction) {

app/src/main/res/menu/home_nav_drawer.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
android:icon="@drawable/icon_search"/>
4141
<item
4242
android:id="@+id/bookmarks"
43-
android:title="@string/bookmarks"
43+
android:title="@string/stars_and_bookmarks"
4444
android:icon="@drawable/icon_bookmark" />
4545
</group>
4646
<group

app/src/main/res/menu/repo_filter_logged_in.xml

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
<item
2828
android:id="@+id/filter_type_watched"
2929
android:title="@string/repo_type_watched" />
30-
<item
31-
android:id="@+id/filter_type_starred"
32-
android:title="@string/repo_type_starred" />
3330
</group>
3431
</menu>
3532
</item>

app/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<string name="feedback_by_email">By Email</string>
3535
<string name="feedback_by_gh4a">By OctoDroid</string>
3636
<string name="bookmarks">Bookmarks</string>
37+
<string name="stars_and_bookmarks">Stars and Bookmarks</string>
3738
<string name="other_info">Other Information</string>
3839
<string name="view">View</string>
3940
<string name="readme">Readme</string>

0 commit comments

Comments
 (0)