Improve delete marker confirmation tite and message

This commit is contained in:
Jimmy Shih
2013-12-11 10:30:33 -08:00
parent 7cbda8a9d5
commit 20bd0287dc
4 changed files with 25 additions and 11 deletions
+10 -6
View File
@@ -789,8 +789,12 @@ limitations under the License.
translation_description="The text on a button to say cancel."> translation_description="The text on a button to say cancel.">
Cancel Cancel
</string> </string>
<string name="generic_delete_all_confirm_title"
translation_description="When deleting all the items, the title on the confirmation dialog.">
Delete all?
</string>
<string name="generic_delete_selected_confirm_title" <string name="generic_delete_selected_confirm_title"
translation_description="When deleting selected items, the title of the confirmation dialog."> translation_description="When deleting selected items, the title on the confirmation dialog.">
Delete selected? Delete selected?
</string> </string>
<string name="generic_description" <string name="generic_description"
@@ -1038,6 +1042,10 @@ limitations under the License.
translation_description="When adding a marker, the message indicating it is canceled."> translation_description="When adding a marker, the message indicating it is canceled.">
Canceled, no marker added. Canceled, no marker added.
</string> </string>
<string name="marker_delete_all_confirm_message"
translation_description="When deleting all markers, the confirmation message.">
All markers for this track will be permanently deleted from the device.
</string>
<string name="marker_delete_one_confirm_message" <string name="marker_delete_one_confirm_message"
translation_description="When deleting one marker, the confirmation message."> translation_description="When deleting one marker, the confirmation message.">
The marker will be permanently deleted from the device. The marker will be permanently deleted from the device.
@@ -1048,7 +1056,7 @@ limitations under the License.
</string> </string>
<string name="marker_delete_multiple_confirm_message" <string name="marker_delete_multiple_confirm_message"
translation_description="When deleting multiple markers, the confirmation message."> translation_description="When deleting multiple markers, the confirmation message.">
All markers for this track will be permanently deleted from the device. The selected markers will be permanently deleted from the device.
</string> </string>
<string name="marker_label_end" <string name="marker_label_end"
translation_description="When inserting a marker to indicate the end of a track, the marker's translation_description="When inserting a marker to indicate the end of a track, the marker's
@@ -2293,10 +2301,6 @@ limitations under the License.
All tracks and markers will be permanently deleted from the device. Google Drive sync will be All tracks and markers will be permanently deleted from the device. Google Drive sync will be
turned off. No tracks will be deleted on Google Drive and on external storage. turned off. No tracks will be deleted on Google Drive and on external storage.
</string> </string>
<string name="track_delete_all_confirm_title"
translation_description="When deleting all the tracks, the title of the confirmation dialog.">
Delete all?
</string>
<string name="track_delete_one_confirm_message" <string name="track_delete_one_confirm_message"
translation_description="When deleting one track, the confirmation message."> translation_description="When deleting one track, the confirmation message.">
The track and its markers will be permanently deleted from the device. If Google Drive sync is The track and its markers will be permanently deleted from the device. If Google Drive sync is
@@ -318,6 +318,9 @@ public class MarkerListActivity extends AbstractMyTracksActivity implements Dele
} }
return true; return true;
case R.id.list_context_menu_delete: case R.id.list_context_menu_delete:
if (markerIds.length > 1 && markerIds.length == listView.getCount()) {
markerIds = new long[] { -1L };
}
DeleteMarkerDialogFragment.newInstance(markerIds) DeleteMarkerDialogFragment.newInstance(markerIds)
.show(getSupportFragmentManager(), DeleteMarkerDialogFragment.DELETE_MARKER_DIALOG_TAG); .show(getSupportFragmentManager(), DeleteMarkerDialogFragment.DELETE_MARKER_DIALOG_TAG);
return true; return true;
@@ -84,7 +84,7 @@ public class ConfirmDeleteDialogFragment extends AbstractMyTracksDialogFragment
int titleId; int titleId;
int messageId; int messageId;
if (trackIds.length == 1 && trackIds[0] == -1L) { if (trackIds.length == 1 && trackIds[0] == -1L) {
titleId = R.string.track_delete_all_confirm_title; titleId = R.string.generic_delete_all_confirm_title;
messageId = R.string.track_delete_all_confirm_message; messageId = R.string.track_delete_all_confirm_message;
} else { } else {
titleId = trackIds.length > 1 ? R.string.generic_delete_selected_confirm_title titleId = trackIds.length > 1 ? R.string.generic_delete_selected_confirm_title
@@ -76,10 +76,17 @@ public class DeleteMarkerDialogFragment extends AbstractMyTracksDialogFragment {
protected Dialog createDialog() { protected Dialog createDialog() {
final FragmentActivity fragmentActivity = getActivity(); final FragmentActivity fragmentActivity = getActivity();
final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS); final long[] markerIds = getArguments().getLongArray(KEY_MARKER_IDS);
int titleId = markerIds.length > 1 ? R.string.generic_delete_selected_confirm_title int titleId;
: R.string.marker_delete_one_confirm_title; int messageId;
int messageId = markerIds.length > 1 ? R.string.marker_delete_multiple_confirm_message if (markerIds.length == 1 && markerIds[0] == -1L) {
: R.string.marker_delete_one_confirm_message; titleId = R.string.generic_delete_all_confirm_title;
messageId = R.string.marker_delete_all_confirm_message;
} else {
titleId = markerIds.length > 1 ? R.string.generic_delete_selected_confirm_title
: R.string.marker_delete_one_confirm_title;
messageId = markerIds.length > 1 ? R.string.marker_delete_multiple_confirm_message
: R.string.marker_delete_one_confirm_message;
}
return DialogUtils.createConfirmationDialog( return DialogUtils.createConfirmationDialog(
fragmentActivity, titleId, getString(messageId), new DialogInterface.OnClickListener() { fragmentActivity, titleId, getString(messageId), new DialogInterface.OnClickListener() {
@Override @Override