public void onClick(DialogInterface dialog, int which) { if (DialogInterface.BUTTON_POSITIVE == which) { PimEngine.getInstance(DialpadActivity.this).deleteCallLogs((long[]) null); if (null != mItemAdapter) { mItemAdapter.update(null, false); } } }
@Override public void loadAllContacts() { // called by beforetext changed. String number = mDialpad.getNumber(); if (TextUtils.isEmpty(number)) { // enter first number, shold load contacts. log("loadAllContacts() loadDialpadItems..."); final List<DialpadItem> items = PimEngine.getInstance(this).loadDialpadItems(false); mItemAdapter.setIsShowInFilterList(true); mItemAdapter.update(items, true); } }
private void reloadDialpadItems() { String number = mDialpad.getNumber(); if (TextUtils.isEmpty(number)) { categorizeCallLog(DialpadView.CALLLOG_TYPE_ALL); return; } else { final List<DialpadItem> items = PimEngine.getInstance(this).loadDialpadItems(false); // loge("reloadDialpadItems items size=" + items.size()); resetFilter(); mItemAdapter.updateAndFilter(items, true, number, this); // filterNumber(number); } }
@Override public String getLastDialedNumber() { List<CallLogGroup> calllogGroups = PimEngine.getInstance(this).loadCallLogs(false); int count = calllogGroups.size(); CallLogGroup clGroup = null; for (int i = 0; i < count; ++i) { clGroup = calllogGroups.get(i); if (Calls.OUTGOING_TYPE == clGroup.getType()) { return clGroup.getNumber(); } } return null; }
@Override protected void onResume() { super.onResume(); mPhotoLoader.resume(); mNumLocationLoader.resume(); setVolumeControlStream(AudioManager.STREAM_SYSTEM); PimEngine.getInstance(this).setCallLogsRead(); CommonMethod.cancelMissedCallNotification(this); if (mHandler.hasMessages(RELOAD_DIALPADS)) { log("onResume"); mHandler.removeMessages(RELOAD_DIALPADS); reloadDialpadItems(); } mIsResume = true; }
@Override protected void onDestroy() { // unregisterReceiver(mOutgoingCallReceiver); // TelephonyManager telephonyMgr = (TelephonyManager // )getSystemService(Context.TELEPHONY_SERVICE); // telephonyMgr.listen(mCallListener, PhoneStateListener.LISTEN_NONE); resetFilter(); mPhotoLoader.stop(); mNumLocationLoader.stop(); PimEngine.getInstance(this).removeDataListenner(this); mActivityResultBridge = null; if (mPopupWin != null) { mPopupWin.dismiss(); mPopupWin = null; } super.onDestroy(); }
public void categorizeCallLog(int logType) { if (null != mItemAdapter) { final List<DialpadItem> logGroups = PimEngine.getInstance(this).loadDialpadItems(false); final int count = logGroups.size(); if (count > 0) { final ArrayList<DialpadItem> newValues = new ArrayList<DialpadItem>(count); for (int i = 0; i < count; i++) { final DialpadItem item = logGroups.get(i); if ((DialpadView.CALLLOG_TYPE_ALL == logType || item.hasCallType(logType)) && DialpadItem.CALLLOG_TYPE == item.getType()) { // add by zenghuaying fix bug #8908 if (item.getContactId() == 0) { item.setName(null); } // add end newValues.add(item); } } mItemAdapter.setIsShowInFilterList(false); // add by zenghuaying mItemAdapter.setFilterCallType(logType); mItemAdapter.update(newValues, false); loge("categorizeCallLog adapter update"); } if (Calls.OUTGOING_TYPE == logType) { setLogsEmptyHint(getResources().getText(R.string.outgoing_logs_empty)); } else if (Calls.INCOMING_TYPE == logType) { setLogsEmptyHint(getResources().getText(R.string.incoming_logs_empty)); } else if (Calls.MISSED_TYPE == logType) { setLogsEmptyHint(getResources().getText(R.string.missed_logs_empty)); } else { setLogsEmptyHint(getResources().getText(R.string.call_logs_empty)); } } }
public void cancelMissedCallNotification() { log("cancelMissedCallNotification"); PimEngine.getInstance(this).setCallLogsRead(); CommonMethod.cancelMissedCallNotification(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialpad_main_list); // setTitle(R.string.dialpad); PimStart.start(this.getApplicationContext()); PimEngine pimEng = PimEngine.getInstance(this); pimEng.loadCallLogs(false); mPhotoLoader = new ContactPhotoLoader( this, R.drawable.ic_contact_list_picture, R.drawable.ic_contact_header_unknow); mNumLocationLoader = new NumberLocationLoader(this); final List<DialpadItem> logGroups = PimEngine.getInstance(this).loadDialpadItems(false); final int count = logGroups.size(); if (count > 0) { final ArrayList<DialpadItem> newValues = new ArrayList<DialpadItem>(count); for (int i = 0; i < count; i++) { final DialpadItem item = logGroups.get(i); if (DialpadItem.CALLLOG_TYPE == item.getType()) { newValues.add(item); } } mItemAdapter = new DialpadListAdapter(this, newValues, mPhotoLoader, mNumLocationLoader, false); } else { mItemAdapter = new DialpadListAdapter(this, null, mPhotoLoader, mNumLocationLoader, false); } // mItemAdapter = new DialpadListAdapter(this, pimEng.loadCallLogItems(false), // mPhotoLoader, mNumLocationLoader); setListAdapter(mItemAdapter); ListView lv = getListView(); lv.setOnScrollListener(this); registerForContextMenu(lv); View dialpadView = findViewById(R.id.dialpad_keyboard); mDialpad = new DialpadView(dialpadView, this); Intent dialIntent = getIntent(); if (null != dialIntent) { Uri telUri = dialIntent.getData(); if (null != telUri) { mDialpad.setNumber(telUri.getSchemeSpecificPart()); mDialpad.showNumberUI(); } } mHandler = new Handler(Looper.myLooper(), this); /*IntentFilter intentFilter = new IntentFilter("android.intent.action.NEW_OUTGOING_CALL"); intentFilter.addCategory("android.intent.category.DEFAULT"); mOutgoingCallReceiver = new OutgoingCallReceiver(); registerReceiver(mOutgoingCallReceiver, intentFilter); mCallListener = new CallListener(); TelephonyManager telephonyMgr = (TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE); telephonyMgr.listen(mCallListener, PhoneStateListener.LISTEN_CALL_STATE);*/ pimEng.addDataListenner(this); }