本文整理汇总了Java中android.provider.CallLog.Calls.INCOMING_TYPE属性的典型用法代码示例。如果您正苦于以下问题:Java Calls.INCOMING_TYPE属性的具体用法?Java Calls.INCOMING_TYPE怎么用?Java Calls.INCOMING_TYPE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.CallLog.Calls
的用法示例。
在下文中一共展示了Calls.INCOMING_TYPE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}