本文整理汇总了Java中android.provider.CallLog.Calls类的典型用法代码示例。如果您正苦于以下问题:Java Calls类的具体用法?Java Calls怎么用?Java Calls使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Calls类属于android.provider.CallLog包,在下文中一共展示了Calls类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: actionModeDelete
import android.provider.CallLog.Calls; //导入依赖的package包/类
private void actionModeDelete() {
ListView lv = getListView();
ArrayList<Long> checkedIds = new ArrayList<Long>();
for(int i = 0; i < lv.getCount(); i++) {
if(lv.isItemChecked(i)) {
long[] selectedIds = mAdapter.getCallIdsAtPosition(i);
for(long id : selectedIds) {
checkedIds.add(id);
}
}
}
if(checkedIds.size() > 0) {
String strCheckedIds = TextUtils.join(", ", checkedIds);
Log.d(THIS_FILE, "Checked positions ("+ strCheckedIds +")");
getActivity().getContentResolver().delete(SipManager.CALLLOG_URI, Calls._ID + " IN ("+strCheckedIds+")", null);
mMode.finish();
}
}
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:CallLogListFragment.java
示例2: set
import android.provider.CallLog.Calls; //导入依赖的package包/类
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);
}
开发者ID:redcracker,项目名称:TextSecure,代码行数:23,代码来源:ContactSelectionRecentFragment.java
示例3: onCreateLoader
import android.provider.CallLog.Calls; //导入依赖的package包/类
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new CursorLoader(getActivity(), SipManager.CALLLOG_URI, new String[] {
Calls._ID, Calls.CACHED_NAME, Calls.CACHED_NUMBER_LABEL,
Calls.CACHED_NUMBER_TYPE, Calls.DURATION, Calls.DATE,
Calls.NEW, Calls.NUMBER, Calls.TYPE,
SipManager.CALLLOG_PROFILE_ID_FIELD
},
null, null,
Calls.DEFAULT_SORT_ORDER);
}
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:12,代码来源:CallLogListFragment.java
示例4: onMenuRemoveFromCallLog
import android.provider.CallLog.Calls; //导入依赖的package包/类
public void onMenuRemoveFromCallLog(MenuItem menuItem) {
final StringBuilder callIds = new StringBuilder();
for (Uri callUri : getCallLogEntryUris()) {
if (callIds.length() != 0) {
callIds.append(",");
}
callIds.append(ContentUris.parseId(callUri));
}
getActivity().getContentResolver().delete(SipManager.CALLLOG_URI,
Calls._ID + " IN (" + callIds + ")", null);
if (quitListener != null) {
quitListener.onQuit();
}
}
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:16,代码来源:CallLogDetailsFragment.java
示例5: getCallTypeDrawable
import android.provider.CallLog.Calls; //导入依赖的package包/类
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);
}
}
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:13,代码来源:CallTypeIconsView.java
示例6: getCallTypeText
import android.provider.CallLog.Calls; //导入依赖的package包/类
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);
}
}
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:13,代码来源:CallDetailHistoryAdapter.java
示例7: getCalls
import android.provider.CallLog.Calls; //导入依赖的package包/类
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;
}
开发者ID:gothalo,项目名称:Android-2017,代码行数:31,代码来源:MainActivity.java
示例8: setViewImage
import android.provider.CallLog.Calls; //导入依赖的package包/类
@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);
}
}
开发者ID:gothalo,项目名称:Android-2017,代码行数:21,代码来源:CallLogAdapter.java
示例9: ContactFromCallsCursorWrapper
import android.provider.CallLog.Calls; //导入依赖的package包/类
private ContactFromCallsCursorWrapper(Cursor cursor) {
super(cursor);
cursor.moveToFirst();
ID = cursor.getColumnIndex(Calls._ID);
NUMBER = cursor.getColumnIndex(Calls.NUMBER);
NAME = cursor.getColumnIndex(Calls.CACHED_NAME);
}
开发者ID:kaliturin,项目名称:BlackList,代码行数:8,代码来源:ContactsAccessHelper.java
示例10: getMissedCalls
import android.provider.CallLog.Calls; //导入依赖的package包/类
private Cursor getMissedCalls(Context context) {
if (permissionChecker.canAccessMissedCallPermissions()) {
//noinspection MissingPermission
return context.getContentResolver().query(
Calls.CONTENT_URI,
new String[]{Calls.NUMBER, Calls.DATE, Calls.CACHED_NAME},
Calls.TYPE + " = ? AND " + Calls.NEW + " = ?",
new String[]{Integer.toString(Calls.MISSED_TYPE), "1"},
Calls.DATE + " DESC"
);
}
return null;
}
开发者ID:andyCano,项目名称:TaskApp,代码行数:14,代码来源:PhoneStateChangedReceiver.java
示例11: bindView
import android.provider.CallLog.Calls; //导入依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
long id = cursor.getLong(cursor.getColumnIndexOrThrow(Calls._ID));
String name = cursor.getString(cursor.getColumnIndexOrThrow(Calls.CACHED_NAME));
String label = cursor.getString(cursor.getColumnIndexOrThrow(Calls.CACHED_NUMBER_LABEL));
String number = cursor.getString(cursor.getColumnIndexOrThrow(Calls.NUMBER));
int type = cursor.getInt(cursor.getColumnIndexOrThrow(Calls.TYPE));
long date = cursor.getLong(cursor.getColumnIndexOrThrow(Calls.DATE));
((CallItemView)view).set(id, name, label, number, type, date);
}
开发者ID:redcracker,项目名称:TextSecure,代码行数:12,代码来源:ContactSelectionRecentFragment.java
示例12: onStart
import android.provider.CallLog.Calls; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
Receiver.engine(this).registerMore();
ContentResolver content = getContentResolver();
Cursor cursor = content.query(Calls.CONTENT_URI,
PROJECTION, Calls.NUMBER+" like ?", new String[] { "%@%" }, Calls.DEFAULT_SORT_ORDER);
CallsAdapter adapter = new CallsAdapter(this, cursor);
sip_uri_box.setAdapter(adapter);
sip_uri_box2.setAdapter(adapter);
}
开发者ID:mnhkahn,项目名称:cInterphone,代码行数:12,代码来源:Sipdroid.java
示例13: runQueryOnBackgroundThread
import android.provider.CallLog.Calls; //导入依赖的package包/类
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
if (getFilterQueryProvider() != null) {
return new CallsCursor(getFilterQueryProvider().runQuery(constraint));
}
StringBuilder buffer;
String[] args;
buffer = new StringBuilder();
buffer.append(Calls.NUMBER);
buffer.append(" LIKE ? OR ");
buffer.append(Calls.CACHED_NAME);
buffer.append(" LIKE ?");
String arg = "%" + (constraint != null && constraint.length() > 0?
constraint.toString() : "@") + "%";
args = new String[] { arg, arg};
return new CallsCursor(mContent.query(Calls.CONTENT_URI, PROJECTION,
buffer.toString(), args,
Calls.NUMBER + " asc"));
}
开发者ID:mnhkahn,项目名称:cInterphone,代码行数:22,代码来源:Sipdroid.java
示例14: log
import android.provider.CallLog.Calls; //导入依赖的package包/类
public void log(long start)
{
String number = getAddress();
long duration = (start != 0 ? SystemClock.elapsedRealtime()-start : 0);
boolean isPrivateNumber = false; // TODO: need API for isPrivate()
// Set the "type" to be displayed in the call log (see constants in CallLog.Calls)
int callLogType;
if (isIncoming()) {
callLogType = (duration == 0 ?
CallLog.Calls.MISSED_TYPE :
CallLog.Calls.INCOMING_TYPE);
} else {
callLogType = CallLog.Calls.OUTGOING_TYPE;
}
// get the callerinfo object and then log the call with it.
{
Object o = getUserData();
CallerInfo ci;
if ((o == null) || (o instanceof CallerInfo)){
ci = (CallerInfo) o;
} else {
ci = ((PhoneUtils.CallerInfoToken) o).currentInfo;
}
if (callLogType == CallLog.Calls.MISSED_TYPE)
Receiver.onText(Receiver.MISSED_CALL_NOTIFICATION, ci != null && ci.name != null?ci.name:number, android.R.drawable.stat_notify_missed_call, 0);
addCall(ci, Receiver.mContext, number, isPrivateNumber,
callLogType, date, (int) duration / 1000);
}
}
开发者ID:mnhkahn,项目名称:cInterphone,代码行数:32,代码来源:Connection.java
示例15: runQueryOnBackgroundThread
import android.provider.CallLog.Calls; //导入依赖的package包/类
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
if (getFilterQueryProvider() != null) {
return new CallsCursor(getFilterQueryProvider().runQuery(
constraint));
}
StringBuilder buffer;
String[] args;
buffer = new StringBuilder();
buffer.append(Calls.NUMBER);
buffer.append(" LIKE ? OR ");
buffer.append(Calls.CACHED_NAME);
buffer.append(" LIKE ?");
String arg = "%"
+ (constraint != null && constraint.length() > 0 ? constraint
.toString() : "@") + "%";
args = new String[] { arg, arg };
return new CallsCursor(mContent.query(Calls.CONTENT_URI,
PROJECTION, buffer.toString(), args, Calls.NUMBER + " asc"));
}
开发者ID:mnhkahn,项目名称:cInterphone,代码行数:23,代码来源:CInterphone.java
示例16: onChange
import android.provider.CallLog.Calls; //导入依赖的package包/类
@Override
public void onChange(boolean selfChange) {
Cursor cursor = context.getContentResolver().query(
Calls.CONTENT_URI,
null,
Calls.TYPE + " = ? AND " + Calls.NEW + " = ?",
new String[] { Integer.toString(Calls.MISSED_TYPE), "1" },
Calls.DATE + " DESC ");
int c = cursor.getCount();
if(c > 0) {
Log.d(LOG_TAG, "missed call=" + c + " register screen off for activate bln");
// initialize receiver
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
if(screenReceiver == null) {
screenReceiver = new ScreenReceiver();
}
context.registerReceiver(screenReceiver, filter);
}else {
Log.d(LOG_TAG, "deactivate bln");
//set BLN off
SysCommand.getInstance().writeSysfs("/sys/class/misc/backlightnotification/notification_led", "0");
}
}
开发者ID:DerTeufel,项目名称:DevilTools,代码行数:27,代码来源:MissedCallObserver.java
示例17: getMoinitorUri
import android.provider.CallLog.Calls; //导入依赖的package包/类
private Uri getMoinitorUri(int type) {
switch (type) {
case MONITOR_PHONE:
return Calls.CONTENT_URI;
case MONITOR_MESSAGE:
return Telephony.MmsSms.CONTENT_URI;
case MONITOR_UPDATE:
return null; // update uri
default:
break;
}
return null;
}
开发者ID:yftx,项目名称:fruit.launcher,代码行数:15,代码来源:LauncherMonitor.java
示例18: queryMissCallCount
import android.provider.CallLog.Calls; //导入依赖的package包/类
private static int queryMissCallCount(Context context) {
int count = 0;
Cursor cursor = null;
try {
cursor = context.getContentResolver().query(Calls.CONTENT_URI,
null, "type=3 and new=1", null, null);
} catch (IllegalStateException e) {
System.gc();
}
if (cursor != null) {
count = cursor.getCount();
cursor.close();
}
Log.d(TAG, "getMissCallCount count=" + count);
return count;
}
开发者ID:yftx,项目名称:fruit.launcher,代码行数:18,代码来源:LauncherMonitor.java
示例19: checkCallsSimIdColumn
import android.provider.CallLog.Calls; //导入依赖的package包/类
/**
* Check, if there is dual sim support.
*/
public static boolean checkCallsSimIdColumn(final ContentResolver cr) {
try {
String where = BuildConfig.DEBUG_LOG ? null : "1=2";
Cursor c = cr.query(Calls.CONTENT_URI, null, where, null, null);
boolean check = false;
if (c != null) {
check = SimIdColumnFinder.getsInstance().getSimIdColumn(cr, Calls.CONTENT_URI, c) >= 0;
c.close();
}
Log.i(TAG, "sim_id column found in calls database: " + check);
return check;
} catch (SQLiteException e) {
Log.w(TAG, "sim_id check for calls failed", e);
return false;
}
}
开发者ID:felixb,项目名称:callmeter,代码行数:20,代码来源:LogRunnerService.java
示例20: getProjectionMap
import android.provider.CallLog.Calls; //导入依赖的package包/类
@Override
protected Map<String,CursorCell<?>> getProjectionMap() {
Map<String,CursorCell<?>> projectionKeyToType = new HashMap<String, CursorCell<?>>();
projectionKeyToType.put(Calls._ID, intCell());
projectionKeyToType.put(Calls.NUMBER, new SensitiveCell(new PhoneNumberCell()));
projectionKeyToType.put(Calls.DATE, longCell());
projectionKeyToType.put(Calls.TYPE, intCell());
projectionKeyToType.put(Calls.DURATION, longCell());
projectionKeyToType.put(Calls.CACHED_NAME, sensitiveStringCell());
projectionKeyToType.put(Calls.CACHED_NUMBER_LABEL, sensitiveStringCell());
projectionKeyToType.put(Calls.CACHED_NUMBER_TYPE, sensitiveStringCell());
return projectionKeyToType;
}
开发者ID:OpenSensing,项目名称:funf-v4,代码行数:14,代码来源:CallLogProbe.java
注:本文中的android.provider.CallLog.Calls类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论