Skip to content

Commit 7f26820

Browse files
committed
Move starred repositories to bookmarks screen
Related to #578, #624 and #725
1 parent 74c9b80 commit 7f26820

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
@@ -311,7 +311,7 @@ private FragmentFactory getFactoryForItem(int id) {
311311
case R.id.search:
312312
return new SearchFactory(this);
313313
case R.id.bookmarks:
314-
return new BookmarkFactory(this);
314+
return new BookmarkFactory(this, mUserLogin);
315315
case R.id.pub_timeline:
316316
return new TimelineFactory(this);
317317
case R.id.blog:

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

+1-8
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,6 @@ private void applyFilterTypeAndSortOrder() {
188188
}
189189

190190
switch (mFilterType) {
191-
case "starred":
192-
mMainFragment = StarredRepositoryListFragment.newInstance(mUserLogin,
193-
mSortOrder, mSortDirection);
194-
break;
195191
case "watched":
196192
mMainFragment = WatchedRepositoryListFragment.newInstance(mUserLogin);
197193
break;
@@ -364,7 +360,6 @@ public static class FilterDrawerHelper {
364360
FILTER_LOOKUP.put(R.id.filter_type_sources, "sources");
365361
FILTER_LOOKUP.put(R.id.filter_type_forks, "forks");
366362
FILTER_LOOKUP.put(R.id.filter_type_watched, "watched");
367-
FILTER_LOOKUP.put(R.id.filter_type_starred, "starred");
368363
}
369364

370365
public static FilterDrawerHelper create(String userLogin, boolean isOrg) {
@@ -427,9 +422,7 @@ public void setFilterType(String type) {
427422
}
428423

429424
public int getMenuResId() {
430-
return TextUtils.equals(mFilterType, "starred") ? R.menu.repo_starred_sort
431-
: TextUtils.equals(mFilterType, "watched") ? 0
432-
: R.menu.repo_sort;
425+
return TextUtils.equals(mFilterType, "watched") ? 0 : R.menu.repo_sort;
433426
}
434427

435428
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
@@ -45,6 +45,7 @@
4545
<string name="feedback_by_email">By Email</string>
4646
<string name="feedback_by_gh4a">By OctoDroid</string>
4747
<string name="bookmarks">Bookmarks</string>
48+
<string name="stars_and_bookmarks">Stars and Bookmarks</string>
4849
<string name="other_info">Other Information</string>
4950
<string name="view">View</string>
5051
<string name="readme">Readme</string>

0 commit comments

Comments
 (0)