本文整理汇总了Java中android.provider.CallLog.Calls.MISSED_TYPE属性的典型用法代码示例。如果您正苦于以下问题:Java Calls.MISSED_TYPE属性的具体用法?Java Calls.MISSED_TYPE怎么用?Java Calls.MISSED_TYPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.CallLog.Calls
的用法示例。
在下文中一共展示了Calls.MISSED_TYPE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: set
public void set(long id, String name, String label, String number, int type, long date) {
if( name == null ) {
name = ContactAccessor.getInstance().getNameForNumber(getActivity(), number);
}
this.line1.setText((name == null || name.equals("")) ? number : name);
this.number.setText((name == null || name.equals("")) ? "" : number);
this.label.setText(label);
this.date.setText(DateUtils.getRelativeDateTimeString(context, date, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE));
if (type == Calls.INCOMING_TYPE || type == RedPhoneCallTypes.INCOMING) callTypeIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_call_log_list_incoming_call));
else if (type == Calls.OUTGOING_TYPE || type == RedPhoneCallTypes.OUTGOING) callTypeIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_call_log_list_outgoing_call));
else if (type == Calls.MISSED_TYPE || type == RedPhoneCallTypes.MISSED) callTypeIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_call_log_list_missed_call));
this.contactData = new ContactData(id, name);
this.contactData.numbers.add(new NumberData(null, number));
if (selectedContacts.containsKey(id))
this.line1.setChecked(true);
else
this.line1.setChecked(false);
}
示例2: getCallTypeDrawable
private Drawable getCallTypeDrawable(int callType) {
switch (callType) {
case Calls.INCOMING_TYPE:
return mResources.incoming;
case Calls.OUTGOING_TYPE:
return mResources.outgoing;
case Calls.MISSED_TYPE:
return mResources.missed;
default:
throw new IllegalArgumentException("invalid call type: " + callType);
}
}
示例3: getCallTypeText
private int getCallTypeText(int callType) {
switch (callType) {
case Calls.INCOMING_TYPE:
return R.string.type_incoming;
case Calls.OUTGOING_TYPE:
return R.string.type_outgoing;
case Calls.MISSED_TYPE:
return R.string.type_missed;
default:
throw new IllegalArgumentException("invalid call type: " + callType);
}
}
示例4: getCalls
private Cursor getCalls (int type) {
Uri llamadasUri = CallLog.Calls.CONTENT_URI;
ContentResolver contentResolver = getContentResolver();
String [] projection = new String [] {Calls._ID, Calls.NUMBER, Calls.DURATION, Calls.TYPE};
String selection = null;
String [] selectionArgs = null;
if (type == Calls.INCOMING_TYPE || type == Calls.OUTGOING_TYPE || type == Calls.MISSED_TYPE || type == Calls.REJECTED_TYPE ) {
selection = Calls.TYPE + " = ? ";
selectionArgs = new String [] {Integer.toString(type)};
}
String order = Calls.DATE + " DESC ";
// verificar permisos de llamada
int permissionCheck = ContextCompat.checkSelfPermission (this, Manifest.permission.READ_CALL_LOG);
if (permissionCheck == PackageManager.PERMISSION_GRANTED) {
cursor = contentResolver.query(llamadasUri, // URI del Content provider
projection, // Columnas a devolver
selection, // Condición a la query
selectionArgs, // Argumentos variables de la condición
order); // Orden de los resultados
}
return cursor;
}
示例5: setViewImage
@Override
public void setViewImage(ImageView view, String value) {
if (view.getId() == R.id.liCallIcon) {
switch (Integer.parseInt (value)) {
case Calls.INCOMING_TYPE :
view.setImageResource(R.drawable.ic_recived);
break;
case Calls.OUTGOING_TYPE :
view.setImageResource(R.drawable.ic_made);
break;
case Calls.MISSED_TYPE :
view.setImageResource(R.drawable.ic_missed);
break;
case Calls.REJECTED_TYPE :
view.setImageResource(R.drawable.ic_rejected);
break;
}
Log.d("APPTEST", value);
}
}
示例6: addGroups
/**
* Finds all groups of adjacent entries in the call log which should be grouped together and
* calls {@link CallLogListFragment.GroupCreator#addGroup(int, int, boolean)} on
* {@link #mGroupCreator} for each of them.
* <p>
* For entries that are not grouped with others, we do not need to create a group of size one.
* <p>
* It assumes that the cursor will not change during its execution.
*
* @see GroupingListAdapter#addGroups(Cursor)
*/
public void addGroups(Cursor cursor) {
final int count = cursor.getCount();
if (count == 0) {
return;
}
int numberColIndex = cursor.getColumnIndex(Calls.NUMBER);
int typeColIndex = cursor.getColumnIndex(Calls.TYPE);
int currentGroupSize = 1;
cursor.moveToFirst();
// The number of the first entry in the group.
String firstNumber = cursor.getString(numberColIndex);
// This is the type of the first call in the group.
int firstCallType = cursor.getInt(typeColIndex);
while (cursor.moveToNext()) {
// The number of the current row in the cursor.
final String currentNumber = cursor.getString(numberColIndex);
final int callType = cursor.getInt(typeColIndex);
final boolean sameNumber = equalNumbers(firstNumber, currentNumber);
final boolean shouldGroup;
if (!sameNumber) {
// Should only group with calls from the same number.
shouldGroup = false;
} else if ( firstCallType == Calls.MISSED_TYPE) {
// Voicemail and missed calls should only be grouped with subsequent missed calls.
shouldGroup = callType == Calls.MISSED_TYPE;
} else {
// Incoming and outgoing calls group together.
shouldGroup = callType == Calls.INCOMING_TYPE || callType == Calls.OUTGOING_TYPE;
}
if (shouldGroup) {
// Increment the size of the group to include the current call, but do not create
// the group until we find a call that does not match.
currentGroupSize++;
} else {
// Create a group for the previous set of calls, excluding the current one, but do
// not create a group for a single call.
if (currentGroupSize > 1) {
addGroup(cursor.getPosition() - currentGroupSize, currentGroupSize);
}
// Start a new group; it will include at least the current call.
currentGroupSize = 1;
// The current entry is now the first in the group.
firstNumber = currentNumber;
firstCallType = callType;
}
}
// If the last set of calls at the end of the call log was itself a group, create it now.
if (currentGroupSize > 1) {
addGroup(count - currentGroupSize, currentGroupSize);
}
}
示例7: getView
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Make sure we have a valid convertView to start with
final View result = convertView == null
? mLayoutInflater.inflate(R.layout.call_detail_history_item, parent, false)
: convertView;
PhoneCallDetails details = (PhoneCallDetails) getItem(position);
CallTypeIconsView callTypeIconView =
(CallTypeIconsView) result.findViewById(R.id.call_type_icon);
TextView callTypeTextView = (TextView) result.findViewById(R.id.call_type_text);
TextView dateView = (TextView) result.findViewById(R.id.date);
TextView durationView = (TextView) result.findViewById(R.id.duration);
int callType = details.callTypes[0];
callTypeIconView.clear();
callTypeIconView.add(callType);
StringBuilder typeSb = new StringBuilder();
typeSb.append(mContext.getResources().getString(getCallTypeText(callType)));
// If not 200, we add text for user feedback about what went wrong
if(details.statusCode != 200) {
typeSb.append(" - ");
typeSb.append(details.statusCode);
if(!TextUtils.isEmpty(details.statusText)) {
typeSb.append(" / ");
typeSb.append(details.statusText);
}
}
callTypeTextView.setText(typeSb.toString());
// Set the date.
CharSequence dateValue = DateUtils.formatDateRange(mContext, details.date, details.date,
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR);
dateView.setText(dateValue);
// Set the duration
if (callType == Calls.MISSED_TYPE) {
durationView.setVisibility(View.GONE);
} else {
durationView.setVisibility(View.VISIBLE);
durationView.setText(formatDuration(details.duration));
}
return result;
}
示例8: getView
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == 0) {
final View header = convertView == null ? mLayoutInflater.inflate(R.layout.call_detail_history_header, parent, false)
: convertView;
// Call and SMS controls are only shown in the main UI if there is a known number.
View callAndSmsContainer = header.findViewById(R.id.header_call_and_sms_container);
callAndSmsContainer.setVisibility(mShowCallAndSms ? View.VISIBLE : View.GONE);
header.setFocusable(true);
header.setOnFocusChangeListener(mHeaderFocusChangeListener);
return header;
}
// Make sure we have a valid convertView to start with
final View result = convertView == null ? mLayoutInflater.inflate(R.layout.call_detail_history_item, parent, false)
: convertView;
PhoneCallDetails details = mPhoneCallDetails[position - 1];
CallTypeIconsView callTypeIconView = (CallTypeIconsView) result.findViewById(R.id.call_type_icon);
TextView callTypeTextView = (TextView) result.findViewById(R.id.call_type_text);
TextView dateView = (TextView) result.findViewById(R.id.date);
TextView durationView = (TextView) result.findViewById(R.id.duration);
int callType = details.callTypes[0];
callTypeIconView.clear();
callTypeIconView.add(callType);
callTypeTextView.setText(mCallTypeHelper.getCallTypeText(callType));
// Set the date.
CharSequence dateValue = DateUtils.formatDateRange(mContext, details.date, details.date,
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR);
dateView.setText(dateValue);
if (callType == Calls.MISSED_TYPE) { // Set the duration
durationView.setVisibility(View.GONE);
} else {
durationView.setVisibility(View.VISIBLE);
durationView.setText(formatDuration(details.duration));
}
return result;
}