use of com.moez.QKSMS.ui.dialog.DefaultSmsHelper in project qksms by moezbhatti.
the class DialogHelper method showDeleteFailedMessagesDialog.
public static void showDeleteFailedMessagesDialog(final MainActivity context, final Set<Long> threadIds) {
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
// Make a copy so the list isn't reset when multi-select is disabled
Set<Long> threads = new HashSet<>(threadIds);
new QKDialog().setContext(context).setTitle(R.string.delete_all_failed).setMessage(context.getString(R.string.delete_all_failed_confirmation, threads.size())).setPositiveButton(R.string.yes, v -> {
new Thread(() -> {
for (long threadId : threads) {
SmsHelper.deleteFailedMessages(context, threadId);
}
}).start();
}).setNegativeButton(R.string.cancel, null).show();
}
use of com.moez.QKSMS.ui.dialog.DefaultSmsHelper in project qksms by moezbhatti.
the class ConversationLegacy method markUnread.
public void markUnread() {
new DefaultSmsHelper(context, R.string.not_default_mark_unread).showIfNotDefault(null);
try {
cursor = context.getContentResolver().query(getUri(), MessageColumns.PROJECTION, null, null, SmsHelper.sortDateDesc);
cursor.moveToFirst();
MessageColumns.ColumnsMap columnsMap = new MessageColumns.ColumnsMap(cursor);
MessageItem message = new MessageItem(context, cursor.getString(columnsMap.mColumnMsgType), cursor, columnsMap, null, true);
if (message.isMe()) {
while (cursor.moveToNext()) {
MessageItem message2 = new MessageItem(context, cursor.getString(columnsMap.mColumnMsgType), cursor, columnsMap, null, true);
if (!message2.isMe()) {
message = message2;
break;
}
}
}
ContentValues cv = new ContentValues();
cv.put("read", false);
cv.put("seen", false);
context.getContentResolver().update(message.mMessageUri, cv, null, null);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (cursor != null) {
cursor.close();
}
}
NotificationManager.create(context);
}
use of com.moez.QKSMS.ui.dialog.DefaultSmsHelper in project qksms by moezbhatti.
the class MessageListActivity method onActivityResult.
/**
* When In-App billing is done, it'll return information via onActivityResult().
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ConversationSettingsDialog.RINGTONE_REQUEST_CODE) {
if (data != null) {
if (mWaitingForThreadId > 0) {
ConversationPrefsHelper conversationPrefs = new ConversationPrefsHelper(this, mWaitingForThreadId);
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
conversationPrefs.putString(SettingsFragment.NOTIFICATION_TONE, (uri == null) ? "" : uri.toString());
mWaitingForThreadId = -1;
}
}
} else if (requestCode == WelcomeActivity.WELCOME_REQUEST_CODE) {
new DefaultSmsHelper(this, R.string.not_default_first).showIfNotDefault(null);
}
}
use of com.moez.QKSMS.ui.dialog.DefaultSmsHelper in project qksms by moezbhatti.
the class ConversationLegacy method delete.
public void delete() {
// TODO do this using AsyncQueryHandler
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
SqliteWrapper.delete(context, context.getContentResolver(), getUri(), null, null);
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
Toast.makeText(context, R.string.toast_conversation_deleted, Toast.LENGTH_SHORT).show();
}
}.execute((Void[]) null);
}
use of com.moez.QKSMS.ui.dialog.DefaultSmsHelper in project qksms by moezbhatti.
the class DialogHelper method showDeleteConversationsDialog.
public static void showDeleteConversationsDialog(final QKActivity context, final Set<Long> threadIds) {
new DefaultSmsHelper(context, R.string.not_default_delete).showIfNotDefault(null);
// Make a copy so the list isn't reset when multi-select is disabled
Set<Long> threads = new HashSet<>(threadIds);
new QKDialog().setContext(context).setTitle(R.string.delete_conversation).setMessage(context.getString(R.string.delete_confirmation, threads.size())).setPositiveButton(R.string.yes, v -> {
Log.d(TAG, "Deleting threads: " + Arrays.toString(threads.toArray()));
Conversation.ConversationQueryHandler handler = new Conversation.ConversationQueryHandler(context.getContentResolver(), context);
Conversation.startDelete(handler, 0, false, threads);
Conversation.asyncDeleteObsoleteThreads(handler, 0);
if (context instanceof MessageListActivity) {
context.onBackPressed();
}
}).setNegativeButton(R.string.cancel, null).show();
}
Aggregations