本文整理汇总了Java中android.provider.Telephony.Sms.MESSAGE_TYPE_SENT属性的典型用法代码示例。如果您正苦于以下问题:Java Sms.MESSAGE_TYPE_SENT属性的具体用法?Java Sms.MESSAGE_TYPE_SENT怎么用?Java Sms.MESSAGE_TYPE_SENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.Telephony.Sms
的用法示例。
在下文中一共展示了Sms.MESSAGE_TYPE_SENT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSmsReportItems
private List<DeliveryReportItem> getSmsReportItems() {
String selection = "_id = " + mMessageId;
Cursor c = SqliteWrapper.query(mContext, mContext.getContentResolver(), Sms.CONTENT_URI,
SMS_REPORT_STATUS_PROJECTION, selection, null, null);
if (c == null) {
return null;
}
try {
if (c.getCount() <= 0) {
return null;
}
List<DeliveryReportItem> items = new ArrayList<>();
while (c.moveToNext()) {
// For sent messages with delivery reports, we stick the delivery time in the
// date_sent column (see MessageStatusReceiver).
String deliveryDateString = null;
long deliveryDate = c.getLong(COLUMN_DATE_SENT);
int messageType = c.getInt(COLUMN_MESSAGE_TYPE);
if (messageType == Sms.MESSAGE_TYPE_SENT && deliveryDate > 0) {
deliveryDateString = mContext.getString(R.string.delivered_label) +
MessageUtils.formatTimeStampString(mContext, deliveryDate, true);
}
items.add(new DeliveryReportItem(
mContext.getString(R.string.recipient_label) + c.getString(COLUMN_RECIPIENT),
mContext.getString(R.string.status_label) +
getSmsStatusText(c.getInt(COLUMN_DELIVERY_STATUS)),
deliveryDateString));
}
return items;
} finally {
c.close();
}
}
示例2: getSmsReportItems
private List<DeliveryReportItem> getSmsReportItems() {
String selection = "_id = " + mMessageId;
Cursor c = SqliteWrapper.query(this, getContentResolver(), Sms.CONTENT_URI,
SMS_REPORT_STATUS_PROJECTION, selection, null, null);
if (c == null) {
return null;
}
try {
if (c.getCount() <= 0) {
return null;
}
List<DeliveryReportItem> items = new ArrayList<DeliveryReportItem>();
while (c.moveToNext()) {
// For sent messages with delivery reports, we stick the delivery time in the
// date_sent column (see MessageStatusReceiver).
String deliveryDateString = null;
long deliveryDate = c.getLong(COLUMN_DATE_SENT);
int messageType = c.getInt(COLUMN_MESSAGE_TYPE);
if (messageType == Sms.MESSAGE_TYPE_SENT && deliveryDate > 0) {
deliveryDateString = getString(R.string.delivered_label) +
MessageUtils.formatTimeStampString(this,
deliveryDate, true);
}
items.add(new DeliveryReportItem(
getString(R.string.recipient_label) + c.getString(COLUMN_RECIPIENT),
getString(R.string.status_label) +
getSmsStatusText(c.getInt(COLUMN_DELIVERY_STATUS)),
deliveryDateString));
}
return items;
} finally {
c.close();
}
}
示例3: toRealType
public String toRealType(int type) {
switch (type) {
case Sms.MESSAGE_TYPE_INBOX:
return INBOX_MESSAGE;
case Sms.MESSAGE_TYPE_OUTBOX:
return OUTBOX_MESSAGE;
case Sms.MESSAGE_TYPE_DRAFT:
return DRAFT_MESSAGE;
case Sms.MESSAGE_TYPE_SENT:
return SENT_MESSAGE;
default:
return "";
}
}
示例4: getTextMessageDetails
private static String getTextMessageDetails(Context context, Cursor cursor) {
Log.d(TAG, "getTextMessageDetails");
StringBuilder details = new StringBuilder();
Resources res = context.getResources();
// Message Type: Text message.
details.append(res.getString(R.string.message_type_label));
details.append(res.getString(R.string.text_message));
// Address: ***
details.append("\n\n");
int smsType = cursor.getInt(MessageColumns.COLUMN_SMS_TYPE);
if (SmsHelper.isOutgoingFolder(smsType)) {
details.append(res.getString(R.string.to_address_label));
} else {
details.append(res.getString(R.string.from_label));
}
details.append(cursor.getString(MessageColumns.COLUMN_SMS_ADDRESS));
// Sent: ***
if (smsType == Sms.MESSAGE_TYPE_INBOX) {
long date_sent = cursor.getLong(MessageColumns.COLUMN_SMS_DATE_SENT);
if (date_sent > 0) {
details.append("\n\n");
details.append(res.getString(R.string.sent_label));
details.append(MessageUtils.formatTimeStampString(context, date_sent, true));
}
}
// Received: ***
details.append("\n\n");
if (smsType == Sms.MESSAGE_TYPE_DRAFT) {
details.append(res.getString(R.string.saved_label));
} else if (smsType == Sms.MESSAGE_TYPE_INBOX) {
details.append(res.getString(R.string.received_label));
} else {
details.append(res.getString(R.string.sent_label));
}
long date = cursor.getLong(MessageColumns.COLUMN_SMS_DATE);
details.append(MessageUtils.formatTimeStampString(context, date, true));
// Delivered: ***
if (smsType == Sms.MESSAGE_TYPE_SENT) {
// For sent messages with delivery reports, we stick the delivery time in the
// date_sent column (see MessageStatusReceiver).
long dateDelivered = cursor.getLong(MessageColumns.COLUMN_SMS_DATE_SENT);
if (dateDelivered > 0) {
details.append("\n\n");
details.append(res.getString(R.string.delivered_label));
details.append(MessageUtils.formatTimeStampString(context, dateDelivered, true));
}
}
// Error code: ***
int errorCode = cursor.getInt(MessageColumns.COLUMN_SMS_ERROR_CODE);
if (errorCode != 0) {
details.append("\n\n")
.append(res.getString(R.string.error_code_label))
.append(errorCode);
}
return details.toString();
}
示例5: getTextMessageDetails
private static String getTextMessageDetails(Context context, Cursor cursor) {
Log.d(TAG, "getTextMessageDetails");
StringBuilder details = new StringBuilder();
Resources res = context.getResources();
// Message Type: Text message.
details.append(res.getString(R.string.message_type_label));
details.append(res.getString(R.string.text_message));
// Address: ***
details.append('\n');
int smsType = cursor.getInt(MessageListAdapter.COLUMN_SMS_TYPE);
if (Sms.isOutgoingFolder(smsType)) {
details.append(res.getString(R.string.to_address_label));
} else {
details.append(res.getString(R.string.from_label));
}
details.append(cursor.getString(MessageListAdapter.COLUMN_SMS_ADDRESS));
// Sent: ***
if (smsType == Sms.MESSAGE_TYPE_INBOX) {
long date_sent = cursor.getLong(MessageListAdapter.COLUMN_SMS_DATE_SENT);
if (date_sent > 0) {
details.append('\n');
details.append(res.getString(R.string.sent_label));
details.append(MessageUtils.formatTimeStampString(context, date_sent, true));
}
}
// Received: ***
details.append('\n');
if (smsType == Sms.MESSAGE_TYPE_DRAFT) {
details.append(res.getString(R.string.saved_label));
} else if (smsType == Sms.MESSAGE_TYPE_INBOX) {
details.append(res.getString(R.string.received_label));
} else {
details.append(res.getString(R.string.sent_label));
}
long date = cursor.getLong(MessageListAdapter.COLUMN_SMS_DATE);
details.append(MessageUtils.formatTimeStampString(context, date, true));
// Delivered: ***
if (smsType == Sms.MESSAGE_TYPE_SENT) {
// For sent messages with delivery reports, we stick the delivery time in the
// date_sent column (see MessageStatusReceiver).
long dateDelivered = cursor.getLong(MessageListAdapter.COLUMN_SMS_DATE_SENT);
if (dateDelivered > 0) {
details.append('\n');
details.append(res.getString(R.string.delivered_label));
details.append(MessageUtils.formatTimeStampString(context, dateDelivered, true));
}
}
// Error code: ***
int errorCode = cursor.getInt(MessageListAdapter.COLUMN_SMS_ERROR_CODE);
if (errorCode != 0) {
details.append('\n')
.append(res.getString(R.string.error_code_label))
.append(errorCode);
}
return details.toString();
}