Use discard instead of yes in several dialogs.

This commit is contained in:
Alex Ning 2021-08-18 21:23:44 +08:00
parent 9870c592eb
commit 6b874cc25d
9 changed files with 81 additions and 80 deletions

View File

@ -265,7 +265,7 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.yes, (dialogInterface, i) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i)
-> finish()) -> finish())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();

View File

@ -293,7 +293,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.yes, (dialogInterface, i) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i)
-> finish()) -> finish())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();

View File

@ -361,81 +361,81 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) { int itemId = item.getItemId();
case android.R.id.home: if (itemId == android.R.id.home) {
finish(); finish();
return true; return true;
case R.id.action_sort_filtered_thing_activity: } else if (itemId == R.id.action_sort_filtered_thing_activity) {
switch (postType) { switch (postType) {
case PostDataSource.TYPE_FRONT_PAGE: case PostDataSource.TYPE_FRONT_PAGE:
SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle bestBundle = new Bundle(); Bundle bestBundle = new Bundle();
bestBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, false); bestBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, false);
bestSortTypeBottomSheetFragment.setArguments(bestBundle); bestSortTypeBottomSheetFragment.setArguments(bestBundle);
bestSortTypeBottomSheetFragment.show(getSupportFragmentManager(), bestSortTypeBottomSheetFragment.getTag()); bestSortTypeBottomSheetFragment.show(getSupportFragmentManager(), bestSortTypeBottomSheetFragment.getTag());
break; break;
case PostDataSource.TYPE_SEARCH: case PostDataSource.TYPE_SEARCH:
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment(); SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment();
Bundle searchBundle = new Bundle(); Bundle searchBundle = new Bundle();
searchPostSortTypeBottomSheetFragment.setArguments(searchBundle); searchPostSortTypeBottomSheetFragment.setArguments(searchBundle);
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag()); searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
break; break;
case PostDataSource.TYPE_SUBREDDIT: case PostDataSource.TYPE_SUBREDDIT:
if (name.equals("popular") || name.equals("all")) { if (name.equals("popular") || name.equals("all")) {
SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle popularBundle = new Bundle(); Bundle popularBundle = new Bundle();
popularBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true); popularBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
popularAndAllSortTypeBottomSheetFragment.setArguments(popularBundle); popularAndAllSortTypeBottomSheetFragment.setArguments(popularBundle);
popularAndAllSortTypeBottomSheetFragment.show(getSupportFragmentManager(), popularAndAllSortTypeBottomSheetFragment.getTag()); popularAndAllSortTypeBottomSheetFragment.show(getSupportFragmentManager(), popularAndAllSortTypeBottomSheetFragment.getTag());
} else { } else {
SortTypeBottomSheetFragment subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); SortTypeBottomSheetFragment subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle subredditSheetBundle = new Bundle(); Bundle subredditSheetBundle = new Bundle();
subredditSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true); subredditSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
subredditSortTypeBottomSheetFragment.setArguments(subredditSheetBundle); subredditSortTypeBottomSheetFragment.setArguments(subredditSheetBundle);
subredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), subredditSortTypeBottomSheetFragment.getTag()); subredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), subredditSortTypeBottomSheetFragment.getTag());
}
break;
case PostDataSource.TYPE_MULTI_REDDIT:
SortTypeBottomSheetFragment multiRedditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle multiRedditBundle = new Bundle();
multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
multiRedditSortTypeBottomSheetFragment.setArguments(multiRedditBundle);
multiRedditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), multiRedditSortTypeBottomSheetFragment.getTag());
break;
case PostDataSource.TYPE_USER:
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = new UserThingSortTypeBottomSheetFragment();
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
}
return true;
case R.id.action_refresh_filtered_thing_activity:
if (mMenu != null) {
mMenu.findItem(R.id.action_lazy_mode_filtered_thing_activity).setTitle(R.string.action_start_lazy_mode);
}
if (mFragment instanceof FragmentCommunicator) {
((FragmentCommunicator) mFragment).refresh();
}
return true;
case R.id.action_lazy_mode_filtered_thing_activity:
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_filtered_thing_activity);
if (isInLazyMode) {
((FragmentCommunicator) mFragment).stopLazyMode();
isInLazyMode = false;
lazyModeItem.setTitle(R.string.action_start_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
collapsingToolbarLayout.setLayoutParams(params);
} else {
if (((FragmentCommunicator) mFragment).startLazyMode()) {
isInLazyMode = true;
lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
collapsingToolbarLayout.setLayoutParams(params);
} }
break;
case PostDataSource.TYPE_MULTI_REDDIT:
SortTypeBottomSheetFragment multiRedditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle multiRedditBundle = new Bundle();
multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
multiRedditSortTypeBottomSheetFragment.setArguments(multiRedditBundle);
multiRedditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), multiRedditSortTypeBottomSheetFragment.getTag());
break;
case PostDataSource.TYPE_USER:
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = new UserThingSortTypeBottomSheetFragment();
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
}
return true;
} else if (itemId == R.id.action_refresh_filtered_thing_activity) {
if (mMenu != null) {
mMenu.findItem(R.id.action_lazy_mode_filtered_thing_activity).setTitle(R.string.action_start_lazy_mode);
}
if (mFragment != null) {
((FragmentCommunicator) mFragment).refresh();
}
return true;
} else if (itemId == R.id.action_lazy_mode_filtered_thing_activity) {
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_filtered_thing_activity);
if (isInLazyMode) {
((FragmentCommunicator) mFragment).stopLazyMode();
isInLazyMode = false;
lazyModeItem.setTitle(R.string.action_start_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
collapsingToolbarLayout.setLayoutParams(params);
} else {
if (((FragmentCommunicator) mFragment).startLazyMode()) {
isInLazyMode = true;
lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
collapsingToolbarLayout.setLayoutParams(params);
} }
return true; }
case R.id.action_change_post_layout_filtered_post_activity: return true;
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); } else if (itemId == R.id.action_change_post_layout_filtered_post_activity) {
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
return true; postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
return true;
} }
return false; return false;
} }

View File

@ -509,7 +509,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.yes, (dialogInterface, i) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i)
-> finish()) -> finish())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();

View File

@ -449,7 +449,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.yes, (dialogInterface, i) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i)
-> finish()) -> finish())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();

View File

@ -418,7 +418,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.yes, (dialogInterface, i) -> finish()) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i) -> finish())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();
} }

View File

@ -439,7 +439,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.discard, (dialogInterface, i) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i)
-> finish()) -> finish())
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show(); .show();

View File

@ -459,7 +459,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(titleResId) .setTitle(titleResId)
.setMessage(messageResId) .setMessage(messageResId)
.setPositiveButton(R.string.yes, (dialogInterface, i) -> finish()) .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i) -> finish())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();
} }

View File

@ -607,6 +607,7 @@
<string name="discard_detail">All the draft will NOT be saved.</string> <string name="discard_detail">All the draft will NOT be saved.</string>
<string name="yes">Yes</string> <string name="yes">Yes</string>
<string name="no">No</string> <string name="no">No</string>
<string name="discard_dialog_button">Discard</string>
<string name="no_data_received">No data received</string> <string name="no_data_received">No data received</string>
<string name="no_image_path_received">No image path received</string> <string name="no_image_path_received">No image path received</string>