Add an option for History in the navigation drawer.

This commit is contained in:
Docile-Alligator 2022-07-15 11:54:08 +08:00
parent e6acd1bafc
commit 0265ac6227
3 changed files with 23 additions and 13 deletions

View File

@ -733,13 +733,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
} }
}); });
navigationWrapper.floatingActionButton.setOnLongClickListener(view -> { navigationWrapper.floatingActionButton.setOnLongClickListener(view -> {
/*FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment= new FABMoreOptionsBottomSheetFragment(); FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment= new FABMoreOptionsBottomSheetFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null); bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null);
fabMoreOptionsBottomSheetFragment.setArguments(bundle); fabMoreOptionsBottomSheetFragment.setArguments(bundle);
fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());*/ fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag());
Intent intent = new Intent(this, HistoryActivity.class);
startActivity(intent);
return true; return true;
}); });
navigationWrapper.floatingActionButton.setVisibility(View.VISIBLE); navigationWrapper.floatingActionButton.setVisibility(View.VISIBLE);
@ -762,6 +760,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
} else if (stringId == R.string.multi_reddit) { } else if (stringId == R.string.multi_reddit) {
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true); intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true);
} else if (stringId == R.string.history) {
intent = new Intent(MainActivity.this, HistoryActivity.class);
} else if (stringId == R.string.rpan) { } else if (stringId == R.string.rpan) {
intent = new Intent(MainActivity.this, RPANActivity.class); intent = new Intent(MainActivity.this, RPANActivity.class);
} else if (stringId == R.string.trending) { } else if (stringId == R.string.trending) {

View File

@ -25,8 +25,8 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private static final int VIEW_TYPE_MENU_GROUP_TITLE = 1; private static final int VIEW_TYPE_MENU_GROUP_TITLE = 1;
private static final int VIEW_TYPE_MENU_ITEM = 2; private static final int VIEW_TYPE_MENU_ITEM = 2;
private static final int ACCOUNT_SECTION_ITEMS = 4; private static final int ACCOUNT_SECTION_ITEMS = 5;
private static final int ANONYMOUS_ACCOUNT_SECTION_ITEMS = 2; private static final int ANONYMOUS_ACCOUNT_SECTION_ITEMS = 3;
private BaseActivity baseActivity; private BaseActivity baseActivity;
private int inboxCount; private int inboxCount;
@ -105,7 +105,7 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
stringId = R.string.multi_reddit; stringId = R.string.multi_reddit;
drawableId = R.drawable.ic_multi_reddit_24dp; drawableId = R.drawable.ic_multi_reddit_24dp;
break; break;
default: case 4:
setOnClickListener = false; setOnClickListener = false;
if (inboxCount > 0) { if (inboxCount > 0) {
((MenuItemViewHolder) holder).menuTextView.setText(baseActivity.getString(R.string.inbox_with_count, inboxCount)); ((MenuItemViewHolder) holder).menuTextView.setText(baseActivity.getString(R.string.inbox_with_count, inboxCount));
@ -118,15 +118,24 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy
baseActivity.startActivity(intent); baseActivity.startActivity(intent);
}); });
break; break;
default:
stringId = R.string.history;
drawableId = R.drawable.ic_history_24dp;
} }
} else { } else {
if (position == 1) { switch (position) {
case 1:
stringId = R.string.subscriptions; stringId = R.string.subscriptions;
drawableId = R.drawable.ic_subscritptions_bottom_app_bar_24dp; drawableId = R.drawable.ic_subscritptions_bottom_app_bar_24dp;
} else { break;
case 2:
stringId = R.string.multi_reddit; stringId = R.string.multi_reddit;
drawableId = R.drawable.ic_multi_reddit_24dp; drawableId = R.drawable.ic_multi_reddit_24dp;
break;
default:
stringId = R.string.history;
drawableId = R.drawable.ic_history_24dp;
} }
} }

View File

@ -135,6 +135,7 @@
<string name="profile">Profile</string> <string name="profile">Profile</string>
<string name="subscriptions">Subscriptions</string> <string name="subscriptions">Subscriptions</string>
<string name="multi_reddit">Multireddit</string> <string name="multi_reddit">Multireddit</string>
<string name="history">History</string>
<string name="inbox">Inbox</string> <string name="inbox">Inbox</string>
<string name="inbox_with_count">Inbox (%1$,d)</string> <string name="inbox_with_count">Inbox (%1$,d)</string>
<string name="rpan">RPAN</string> <string name="rpan">RPAN</string>