Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move watched repositories to Notifications screen #725

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -27,6 +32,9 @@ protected int[] getTabTitleResIds() {

@Override
protected Fragment makeFragment(int position) {
if (position == 1) {
return WatchedRepositoryListFragment.newInstance(mUserLogin);
}
return NotificationListFragment.newInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/menu/repo_filter_logged_in.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
<item
android:id="@+id/filter_type_forks"
android:title="@string/repo_type_forks" />
<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" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
<string name="quote">Quote</string>
<string name="fork">Fork</string>
<string name="notifications">Notifications</string>
<string name="watching">Watching</string>
<string name="mark_all_as_read">Mark all as read</string>
<string name="mark_as_read">Mark as read</string>
<string name="unsubscribe">Unsubscribe</string>
Expand Down