Search in sources :

Example 1 with MessageListActivity

use of com.moez.QKSMS.ui.messagelist.MessageListActivity in project qksms by moezbhatti.

the class ConversationSettingsDialog method onPreferenceClick.

public boolean onPreferenceClick(Preference preference) {
    switch(preference.getKey()) {
        case SettingsFragment.THEME:
            ThemeManager.showColorPickerDialogForConversation(mContext, mConversationPrefs);
            break;
        case SettingsFragment.NOTIFICATION_LED_COLOR:
            ColorPickerDialog ledColorPickerDialog = new ColorPickerDialog();
            ledColorPickerDialog.initialize(R.string.pref_theme_led, mLedColors, Integer.parseInt(mConversationPrefs.getNotificationLedColor()), 3, 2);
            ledColorPickerDialog.setOnColorSelectedListener(color -> mConversationPrefs.putString(SettingsFragment.NOTIFICATION_LED_COLOR, "" + color));
            ledColorPickerDialog.show(getActivity().getFragmentManager(), "colorpicker");
            break;
        case SettingsFragment.NOTIFICATION_TONE:
            Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, getRingtoneUri());
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.pref_ringtone));
            intent.putExtra(ARG_THREAD_ID, mThreadId);
            ((MessageListActivity) getActivity()).getResultForThreadId(mThreadId);
            getActivity().startActivityForResult(intent, RINGTONE_REQUEST_CODE);
            break;
    }
    return true;
}
Also used : MessageListActivity(com.moez.QKSMS.ui.messagelist.MessageListActivity) Intent(android.content.Intent) ColorPickerDialog(com.moez.QKSMS.ui.view.colorpicker.ColorPickerDialog)

Example 2 with MessageListActivity

use of com.moez.QKSMS.ui.messagelist.MessageListActivity 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();
}
Also used : MessageListActivity(com.moez.QKSMS.ui.messagelist.MessageListActivity) QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) DefaultSmsHelper(com.moez.QKSMS.ui.dialog.DefaultSmsHelper) Conversation(com.moez.QKSMS.data.Conversation) HashSet(java.util.HashSet)

Aggregations

MessageListActivity (com.moez.QKSMS.ui.messagelist.MessageListActivity)2 Intent (android.content.Intent)1 Conversation (com.moez.QKSMS.data.Conversation)1 DefaultSmsHelper (com.moez.QKSMS.ui.dialog.DefaultSmsHelper)1 QKDialog (com.moez.QKSMS.ui.dialog.QKDialog)1 ColorPickerDialog (com.moez.QKSMS.ui.view.colorpicker.ColorPickerDialog)1 HashSet (java.util.HashSet)1