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();
}
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();
}
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;
}
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();
}
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();
}
}
Aggregations