Fix a minor string issue.

This commit is contained in:
Alex Ning 2021-01-05 23:22:52 +08:00
parent 68b1c6a7f4
commit 29b6c66ae2
2 changed files with 66 additions and 84 deletions

View File

@ -676,46 +676,35 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
@Override @Override
public void onMenuClick(int stringId) { public void onMenuClick(int stringId) {
Intent intent = null; Intent intent = null;
switch (stringId) { if (stringId == R.string.profile) {
case R.string.profile:
intent = new Intent(MainActivity.this, ViewUserDetailActivity.class); intent = new Intent(MainActivity.this, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName);
break; } else if (stringId == R.string.subscriptions) {
case R.string.subscriptions:
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
break; } else if (stringId == R.string.multi_reddit) {
case 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);
break; } else if (stringId == R.string.inbox) {
case R.string.inbox:
intent = new Intent(MainActivity.this, InboxActivity.class); intent = new Intent(MainActivity.this, InboxActivity.class);
break; } else if (stringId == R.string.upvoted) {
case R.string.upvoted:
intent = new Intent(MainActivity.this, AccountPostsActivity.class); intent = new Intent(MainActivity.this, AccountPostsActivity.class);
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED); intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED);
break; } else if (stringId == R.string.downvoted) {
case R.string.downvoted:
intent = new Intent(MainActivity.this, AccountPostsActivity.class); intent = new Intent(MainActivity.this, AccountPostsActivity.class);
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED); intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED);
break; } else if (stringId == R.string.hidden) {
case R.string.hidden:
intent = new Intent(MainActivity.this, AccountPostsActivity.class); intent = new Intent(MainActivity.this, AccountPostsActivity.class);
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN); intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN);
break; } else if (stringId == R.string.account_saved_thing_activity_label) {
case R.string.saved:
intent = new Intent(MainActivity.this, AccountSavedThingActivity.class); intent = new Intent(MainActivity.this, AccountSavedThingActivity.class);
break; } else if (stringId == R.string.gilded) {
case R.string.gilded:
intent = new Intent(MainActivity.this, AccountPostsActivity.class); intent = new Intent(MainActivity.this, AccountPostsActivity.class);
intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED); intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED);
break; } else if (stringId == R.string.light_theme) {
case R.string.light_theme:
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply(); mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT); mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
break; } else if (stringId == R.string.dark_theme) {
case R.string.dark_theme:
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
@ -723,42 +712,35 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
} else { } else {
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
} }
break; } else if (stringId == R.string.enable_nsfw) {
case R.string.enable_nsfw:
if (sectionsPagerAdapter != null) { if (sectionsPagerAdapter != null) {
mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, true).apply(); mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, true).apply();
sectionsPagerAdapter.changeNSFW(true); sectionsPagerAdapter.changeNSFW(true);
} }
break; } else if (stringId == R.string.disable_nsfw) {
case R.string.disable_nsfw:
if (sectionsPagerAdapter != null) { if (sectionsPagerAdapter != null) {
mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false).apply(); mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false).apply();
sectionsPagerAdapter.changeNSFW(false); sectionsPagerAdapter.changeNSFW(false);
} }
break; } else if (stringId == R.string.settings) {
case R.string.settings:
intent = new Intent(MainActivity.this, SettingsActivity.class); intent = new Intent(MainActivity.this, SettingsActivity.class);
break; } else if (stringId == R.string.add_account) {
case R.string.add_account:
Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class); Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class);
startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE); startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE);
break; } else if (stringId == R.string.anonymous_account) {
case R.string.anonymous_account:
new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false, new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false,
() -> { () -> {
Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class); Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class);
startActivity(anonymousIntent); startActivity(anonymousIntent);
finish(); finish();
}).execute(); }).execute();
break; } else if (stringId == R.string.log_out) {
case R.string.log_out:
new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true, new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true,
() -> { () -> {
Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class); Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class);
startActivity(logOutIntent); startActivity(logOutIntent);
finish(); finish();
}).execute(); }).execute();
} }
if (intent != null) { if (intent != null) {
startActivity(intent); startActivity(intent);

View File

@ -293,7 +293,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
drawableId = R.drawable.ic_outline_lock_24dp; drawableId = R.drawable.ic_outline_lock_24dp;
break; break;
case 10: case 10:
stringId = R.string.saved; stringId = R.string.account_saved_thing_activity_label;
drawableId = R.drawable.ic_outline_bookmarks_24dp; drawableId = R.drawable.ic_outline_bookmarks_24dp;
break; break;
case 11: case 11: