forked from upstream-mirrors/quik
Improve messages for multi-delete
This commit is contained in:
@@ -22,21 +22,21 @@ public class DialogHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showDeleteConversationsDialog(final MainActivity context, final Set<Long> threadIds) {
|
public static void showDeleteConversationsDialog(final MainActivity context, final Set<Long> threadIds) {
|
||||||
|
|
||||||
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
|
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()
|
new QKDialog()
|
||||||
.setContext(context)
|
.setContext(context)
|
||||||
.setTitle(R.string.delete_conversation)
|
.setTitle(R.string.delete_conversation)
|
||||||
.setMessage(R.string.delete_confirmation)
|
.setMessage(context.getString(R.string.delete_confirmation, threads.size()))
|
||||||
.setPositiveButton(R.string.yes, v -> {
|
.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.ConversationQueryHandler handler = new Conversation.ConversationQueryHandler(context.getContentResolver());
|
||||||
|
Conversation.startDelete(handler, 0, false, threads);
|
||||||
Conversation.startDelete(handler, 0, false, threadIds);
|
|
||||||
Conversation.asyncDeleteObsoleteThreads(handler, 0);
|
Conversation.asyncDeleteObsoleteThreads(handler, 0);
|
||||||
context.showMenu();
|
context.showMenu();
|
||||||
}).setNegativeButton(R.string.cancel, null)
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.show(context.getFragmentManager(), QKDialog.CONFIRMATION_TAG);
|
.show(context.getFragmentManager(), QKDialog.CONFIRMATION_TAG);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -44,17 +44,19 @@ public class DialogHelper {
|
|||||||
public static void showDeleteFailedMessagesDialog(final MainActivity context, final Set<Long> threadIds) {
|
public static void showDeleteFailedMessagesDialog(final MainActivity context, final Set<Long> threadIds) {
|
||||||
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
|
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()
|
new QKDialog()
|
||||||
.setContext(context)
|
.setContext(context)
|
||||||
.setTitle(R.string.delete_all_failed)
|
.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 -> {
|
.setPositiveButton(R.string.yes, v -> {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
for (long threadId : threadIds) {
|
for (long threadId : threads) {
|
||||||
SmsHelper.deleteFailedMessages(context, threadId);
|
SmsHelper.deleteFailedMessages(context, threadId);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}).setNegativeButton(R.string.cancel, null)
|
})
|
||||||
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.show(context.getFragmentManager(), QKDialog.CONFIRMATION_TAG);
|
.show(context.getFragmentManager(), QKDialog.CONFIRMATION_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -344,13 +344,13 @@
|
|||||||
<!--Text for app restart confirmation dialog-->
|
<!--Text for app restart confirmation dialog-->
|
||||||
<string name="restart_message">These changes will take effect the next time QKSMS is opened</string>
|
<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-->
|
<!--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-->
|
<!--Dialog title for asking if a user wants to delete all failed messages-->
|
||||||
<string name="delete_all_failed">Delete failed messages</string>
|
<string name="delete_all_failed">Delete failed messages</string>
|
||||||
<!--CDialog title for asking if a user wants to delete a conversation-->
|
<!--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-->
|
<!--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-->
|
<!--(Unused) Dialog title shown if APNs have not been set-->
|
||||||
<string name="apns_not_set">APNs not set</string>
|
<string name="apns_not_set">APNs not set</string>
|
||||||
<!--(Unused) Dialog description shown if APNs have not been set-->
|
<!--(Unused) Dialog description shown if APNs have not been set-->
|
||||||
|
|||||||
Reference in New Issue
Block a user