Improve messages for multi-delete

This commit is contained in:
Moez Bhatti
2015-10-31 11:57:24 -04:00
parent 8774d107bf
commit e4a27ba7e9
2 changed files with 14 additions and 12 deletions
@@ -22,21 +22,21 @@ public class DialogHelper {
}
public static void showDeleteConversationsDialog(final MainActivity context, final Set<Long> threadIds) {
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
Set<Long> threads = new HashSet<>(threadIds); // Make a copy so the list isn't reset when multi-select is disabled
new QKDialog()
.setContext(context)
.setTitle(R.string.delete_conversation)
.setMessage(R.string.delete_confirmation)
.setMessage(context.getString(R.string.delete_confirmation, threads.size()))
.setPositiveButton(R.string.yes, v -> {
Log.d(TAG, "Deleting threads: " + Arrays.toString(threadIds.toArray()));
Log.d(TAG, "Deleting threads: " + Arrays.toString(threads.toArray()));
Conversation.ConversationQueryHandler handler = new Conversation.ConversationQueryHandler(context.getContentResolver());
Conversation.startDelete(handler, 0, false, threadIds);
Conversation.startDelete(handler, 0, false, threads);
Conversation.asyncDeleteObsoleteThreads(handler, 0);
context.showMenu();
}).setNegativeButton(R.string.cancel, null)
})
.setNegativeButton(R.string.cancel, null)
.show(context.getFragmentManager(), QKDialog.CONFIRMATION_TAG);
}
@@ -44,17 +44,19 @@ public class DialogHelper {
public static void showDeleteFailedMessagesDialog(final MainActivity context, final Set<Long> threadIds) {
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
Set<Long> threads = new HashSet<>(threadIds); // Make a copy so the list isn't reset when multi-select is disabled
new QKDialog()
.setContext(context)
.setTitle(R.string.delete_all_failed)
.setMessage(R.string.delete_all_failed_confirmation)
.setMessage(context.getString(R.string.delete_all_failed_confirmation, threads.size()))
.setPositiveButton(R.string.yes, v -> {
new Thread(() -> {
for (long threadId : threadIds) {
for (long threadId : threads) {
SmsHelper.deleteFailedMessages(context, threadId);
}
}).start();
}).setNegativeButton(R.string.cancel, null)
})
.setNegativeButton(R.string.cancel, null)
.show(context.getFragmentManager(), QKDialog.CONFIRMATION_TAG);
}
+3 -3
View File
@@ -344,13 +344,13 @@
<!--Text for app restart confirmation dialog-->
<string name="restart_message">These changes will take effect the next time QKSMS is opened</string>
<!--Dialog title for asking if a user wants to delete a conversation-->
<string name="delete_conversation">Delete conversation</string>
<string name="delete_conversation">Delete conversations</string>
<!--Dialog title for asking if a user wants to delete all failed messages-->
<string name="delete_all_failed">Delete failed messages</string>
<!--CDialog title for asking if a user wants to delete a conversation-->
<string name="delete_confirmation">Are you sure you would like to delete the conversation?</string>
<string name="delete_confirmation">Are you sure you would like to delete (%s) conversations?</string>
<!--CDialog title for asking if a user wants to delete all failed messages-->
<string name="delete_all_failed_confirmation">Are you sure you would like to all failed messages?</string>
<string name="delete_all_failed_confirmation">Are you sure you would like to delete failed messages from (%s) conversations?</string>
<!--(Unused) Dialog title shown if APNs have not been set-->
<string name="apns_not_set">APNs not set</string>
<!--(Unused) Dialog description shown if APNs have not been set-->