Search in sources :

Example 11 with QKDialog

use of com.moez.QKSMS.ui.dialog.QKDialog in project qksms by moezbhatti.

the class MessageListFragment method onItemLongClick.

@Override
public void onItemLongClick(MessageItem messageItem, View view) {
    QKDialog dialog = new QKDialog();
    dialog.setContext(mContext);
    dialog.setTitle(R.string.message_options);
    MsgListMenuClickListener l = new MsgListMenuClickListener(messageItem);
    // to the clipboard, so we currently do SMS only.
    if (messageItem.isSms()) {
        // Message type is sms. Only allow "edit" if the message has a single recipient
        if (getRecipients().size() == 1 && (messageItem.mBoxId == Telephony.Sms.MESSAGE_TYPE_OUTBOX || messageItem.mBoxId == Telephony.Sms.MESSAGE_TYPE_FAILED)) {
            dialog.addMenuItem(R.string.menu_edit, MENU_EDIT_MESSAGE);
        }
        dialog.addMenuItem(R.string.copy_message_text, MENU_COPY_MESSAGE_TEXT);
    }
    addCallAndContactMenuItems(dialog, messageItem);
    // Forward is not available for undownloaded messages.
    if (messageItem.isDownloaded() && (messageItem.isSms() || MessageUtils.isForwardable(mContext, messageItem.getMessageId())) && mIsSmsEnabled) {
        dialog.addMenuItem(R.string.menu_forward, MENU_FORWARD_MESSAGE);
    }
    if (messageItem.isMms()) {
        switch(messageItem.mBoxId) {
            case Telephony.Mms.MESSAGE_BOX_INBOX:
                break;
            case Telephony.Mms.MESSAGE_BOX_OUTBOX:
                // editing a message for single-recipient conversations.
                if (getRecipients().size() == 1) {
                    dialog.addMenuItem(R.string.menu_edit, MENU_EDIT_MESSAGE);
                }
                break;
        }
        switch(messageItem.mAttachmentType) {
            case SmsHelper.TEXT:
                break;
            case SmsHelper.VIDEO:
            case SmsHelper.IMAGE:
                if (MessageUtils.haveSomethingToCopyToSDCard(mContext, messageItem.mMsgId)) {
                    dialog.addMenuItem(R.string.copy_to_sdcard, MENU_COPY_TO_SDCARD);
                }
                break;
            case SmsHelper.SLIDESHOW:
            default:
                dialog.addMenuItem(R.string.view_slideshow, MENU_VIEW_SLIDESHOW);
                if (MessageUtils.haveSomethingToCopyToSDCard(mContext, messageItem.mMsgId)) {
                    dialog.addMenuItem(R.string.copy_to_sdcard, MENU_COPY_TO_SDCARD);
                }
                if (MessageUtils.isDrmRingtoneWithRights(mContext, messageItem.mMsgId)) {
                    dialog.addMenuItem(MessageUtils.getDrmMimeMenuStringRsrc(mContext, messageItem.mMsgId), MENU_SAVE_RINGTONE);
                }
                break;
        }
    }
    if (messageItem.mLocked && mIsSmsEnabled) {
        dialog.addMenuItem(R.string.menu_unlock, MENU_UNLOCK_MESSAGE);
    } else if (mIsSmsEnabled) {
        dialog.addMenuItem(R.string.menu_lock, MENU_LOCK_MESSAGE);
    }
    dialog.addMenuItem(R.string.view_message_details, MENU_VIEW_MESSAGE_DETAILS);
    if (messageItem.mDeliveryStatus != MessageItem.DeliveryStatus.NONE || messageItem.mReadReport) {
        dialog.addMenuItem(R.string.view_delivery_report, MENU_DELIVERY_REPORT);
    }
    if (mIsSmsEnabled) {
        dialog.addMenuItem(R.string.delete_message, MENU_DELETE_MESSAGE);
    }
    dialog.buildMenu(l);
    dialog.show();
}
Also used : QKDialog(com.moez.QKSMS.ui.dialog.QKDialog)

Example 12 with QKDialog

use of com.moez.QKSMS.ui.dialog.QKDialog in project qksms by moezbhatti.

the class MessageListFragment method showDeliveryReport.

private void showDeliveryReport(long messageId, String type) {
    DeliveryReportHelper deliveryReportHelper = new DeliveryReportHelper(mContext, messageId, type);
    List<DeliveryReportItem> deliveryReportItems = deliveryReportHelper.getListItems();
    String[] items = new String[deliveryReportItems.size() * 3];
    for (int i = 0; i < deliveryReportItems.size() * 3; i++) {
        switch(i % 3) {
            case 0:
                items[i] = deliveryReportItems.get(i - (i / 3)).recipient;
                break;
            case 1:
                items[i] = deliveryReportItems.get(i - 1 - ((i - 1) / 3)).status;
                break;
            case 2:
                items[i] = deliveryReportItems.get(i - 2 - ((i - 2) / 3)).deliveryDate;
                break;
        }
    }
    new QKDialog().setContext(mContext).setTitle(R.string.delivery_header_title).setItems(items, null).setPositiveButton(R.string.okay, null).show();
}
Also used : DeliveryReportItem(com.moez.QKSMS.ui.delivery.DeliveryReportItem) QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) DeliveryReportHelper(com.moez.QKSMS.ui.delivery.DeliveryReportHelper) SpannableString(android.text.SpannableString)

Example 13 with QKDialog

use of com.moez.QKSMS.ui.dialog.QKDialog in project qksms by moezbhatti.

the class MessageListFragment method showMessageDetails.

private boolean showMessageDetails(MessageItem msgItem) {
    Cursor cursor = mAdapter.getCursorForItem(msgItem);
    if (cursor == null) {
        return false;
    }
    String messageDetails = MessageUtils.getMessageDetails(mContext, cursor, msgItem.mMessageSize);
    new QKDialog().setContext(mContext).setTitle(R.string.message_details_title).setMessage(messageDetails).setCancelOnTouchOutside(true).show();
    return true;
}
Also used : QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) SpannableString(android.text.SpannableString) Cursor(android.database.Cursor)

Example 14 with QKDialog

use of com.moez.QKSMS.ui.dialog.QKDialog in project qksms by moezbhatti.

the class ConversationDetailsDialog method showDetails.

@Override
public void showDetails(Conversation conversation) {
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    AbsListView.LayoutParams listParams = new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    View view = View.inflate(mContext, R.layout.dialog_conversation_details, null);
    view.setLayoutParams(listParams);
    ((QKTextView) view.findViewById(R.id.date)).setText(DateFormatter.getDate(mContext, conversation.getDate()));
    ((QKTextView) view.findViewById(R.id.message_count)).setText(Integer.toString(conversation.getMessageCount()));
    ((QKTextView) view.findViewById(R.id.recipients)).setText(mContext.getString(R.string.dialog_conversation_details_recipients, Integer.toString(conversation.getRecipients().size())));
    ListView listView = new ListView(mContext);
    listView.setLayoutParams(params);
    listView.addHeaderView(view);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setAdapter(new ConversationDetailsContactListAdapter(mContext, conversation.getRecipients()));
    new QKDialog().setContext(mContext).setTitle(R.string.dialog_conversation_details_title).setCustomView(listView).setPositiveButton(R.string.okay, null).show();
}
Also used : AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) ViewGroup(android.view.ViewGroup) AbsListView(android.widget.AbsListView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) QKTextView(com.moez.QKSMS.ui.view.QKTextView)

Example 15 with QKDialog

use of com.moez.QKSMS.ui.dialog.QKDialog in project qksms by moezbhatti.

the class MainActivity method showDialogIfNeeded.

/**
 * Shows at most one dialog using the intent extras and the restored state of the activity.
 *
 * @param savedInstanceState restored state
 */
private void showDialogIfNeeded(Bundle savedInstanceState) {
    // Check if the intent has the ICON_COLOR_CHANGED action; if so, show a new dialog.
    if (getIntent().getBooleanExtra(IconColorReceiver.EXTRA_ICON_COLOR_CHANGED, false)) {
        // Clear the flag in the intent so that the dialog doesn't show up anymore
        getIntent().putExtra(IconColorReceiver.EXTRA_ICON_COLOR_CHANGED, false);
        // Display a dialog showcasing the new icon!
        ImageView imageView = new ImageView(this);
        PackageManager manager = getPackageManager();
        try {
            ComponentInfo info = manager.getActivityInfo(getComponentName(), 0);
            imageView.setImageDrawable(ContextCompat.getDrawable(getBaseContext(), info.getIconResource()));
        } catch (PackageManager.NameNotFoundException ignored) {
        }
        new QKDialog().setContext(this).setTitle(getString(R.string.icon_ready)).setMessage(R.string.icon_ready_message).setCustomView(imageView).setPositiveButton(R.string.okay, null).show();
    // Only show the MMS setup fragment if it hasn't already been dismissed
    } else if (!wasMmsSetupFragmentDismissed(savedInstanceState)) {
        beginMmsSetup();
    }
}
Also used : QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) PackageManager(android.content.pm.PackageManager) ImageView(android.widget.ImageView) ComponentInfo(android.content.pm.ComponentInfo)

Aggregations

QKDialog (com.moez.QKSMS.ui.dialog.QKDialog)15 View (android.view.View)7 QKTextView (com.moez.QKSMS.ui.view.QKTextView)5 Intent (android.content.Intent)4 Log (android.util.Log)4 R (com.moez.QKSMS.R)4 QKPreference (com.moez.QKSMS.enums.QKPreference)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 Context (android.content.Context)3 Uri (android.net.Uri)3 AdapterView (android.widget.AdapterView)3 ImageView (android.widget.ImageView)3 ParseException (java.text.ParseException)3 SharedPreferences (android.content.SharedPreferences)2 PackageManager (android.content.pm.PackageManager)2 Resources (android.content.res.Resources)2 Drawable (android.graphics.drawable.Drawable)2 Bundle (android.os.Bundle)2 CheckBoxPreference (android.preference.CheckBoxPreference)2