コード例 #1
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo menuInfo = null;
    try {
      menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    } catch (ClassCastException e) {
      log("bad menuInfoIn e=" + e);
      return super.onContextItemSelected(item);
    }

    if (mDialpadItem == null) {
      mDialpadItem = mItemAdapter.getItem(mContextMenuIdx);
    }
    String name = mDialpadItem.getName();
    String number = mDialpadItem.getNumber();
    long contactId = mDialpadItem.getContactId();
    log("onContextItemSelected: name=" + name + " number=" + number + " contactId=" + contactId);
    switch (item.getItemId()) {
      case R.id.menu_new_contact:
        CommonMethod.newContact(this, number);
        break;

      case R.id.menu_add_to_contacts:
        CommonMethod.createContact(this, number);
        break;

      case R.id.menu_view_contact:
        CommonMethod.viewContact(this, contactId);
        break;

      case R.id.menu_send_message:
        CommonMethod.sendMessage(this, number, null);
        break;

      case R.id.menu_delete_log:
        CommonMethod.showConfirmDlg(
            this,
            R.string.clear_call_log_by_number_confirm,
            R.string.alert_dialog_title,
            new DelCallLogItemListener());
        break;

      case R.id.menu_log_detail:
        CommonMethod.viewPimDetail(this, name, number, contactId, DetailEntry.LOG_DETAIL);
        break;

      case R.id.menu_add_to_blacklist:
        CommonMethod.addToBlacklist(this, name, number);
        break;

      case R.id.menu_clear_from_blacklist:
        CommonMethod.clearFromBlacklist(this, name, number);
        break;

      default:
        break;
    }

    return super.onContextItemSelected(item);
  }
コード例 #2
0
  @Override
  public void call(String number) {
    // Woody Guo @ 2012/05/24
    if (number.equals(MAGIC_GENERATE_LOG_DATA)) {
      generateLog(true);
      mDialpad.setNumber(null);
      return;
    }
    if (number.equals(MAGIC_GENERATE_LOG_SDCARD)) {
      generateLog(false);
      mDialpad.setNumber(null);
      return;
    }
    // END

    // added by huizhang @2012/7/30
    if (number.equals(MAGIC_CALL_CIT)) {

      StartCit(true);
      mDialpad.setNumber(null);
      return;
    }
    // END

    CommonMethod.call(this, number);
  }
コード例 #3
0
  @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;
  }
コード例 #4
0
  private void deleteCallLog(DialpadItem dialpadItem) {
    if (dialpadItem == null) {
      return;
    }

    String number = dialpadItem.getNumber();
    if (!TextUtils.isEmpty(number)) {
      if (number.length() < CommonMethod.MIN_NUMBER_LENGTH_ALLOWED_TO_ADD_IP) {
        getContentResolver().delete(Calls.CONTENT_URI, ("number='" + number + "'"), null);
      } else {
        // add by zenghuaying 2012.6.28 for bug 7961
        if (CommonMethod.isStartWithIpPrefix(this, number)) {
          number = number.substring(5);
        }
        getContentResolver().delete(Calls.CONTENT_URI, ("number LIKE '%" + number + "'"), null);
      }
    }
  }
コード例 #5
0
 // add end
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   if (R.id.menu_delete_log == item.getItemId()) {
     CommonMethod.showConfirmDlg(
         this,
         R.string.clear_all_call_log_confirm,
         R.string.alert_dialog_title,
         new OptionsMenuDelListener());
   } else if (R.id.menu_ip_call_settings == item.getItemId()) {
     Intent intent = new Intent(this, IpCallSettingsActivity.class);
     startActivity(intent);
   } else if (R.id.menu_calllog_settings == item.getItemId()) {
     Intent intent = new Intent(Intent.ACTION_MAIN);
     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     intent.setClassName("com.android.phone", "com.android.phone.CallFeaturesSetting");
     startActivity(intent);
   }
   return true;
 }
コード例 #6
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    {
      super.onListItemClick(l, v, position, id);
      DialpadItem item = (DialpadItem) l.getItemAtPosition(position);
      String number = item.getNumber();
      long contactId = item.getContactId();
      String name = item.getName();
      SharedPreferences mPrefs = getSharedPreferences("call_log_settings", Context.MODE_PRIVATE);

      int mClickOption = mPrefs.getInt("call_log_click_option", 0);

      log("onListItemClick: " + position + " " + number + "Clickoption = " + mClickOption);
      if (!TextUtils.isEmpty(number)) {
        if (mClickOption == 0) {
          CommonMethod.viewPimDetail(
              this,
              name,
              number,
              contactId,
              (item.getType() == DialpadItem.CALLLOG_TYPE
                  ? DetailEntry.LOG_DETAIL
                  : DetailEntry.CONTACT_DETAIL));
        } else {
          // Added by GanFeng 20120213, fix bug3391
          if ((null != mDialpad) && TextUtils.isEmpty(mDialpad.getNumber())) {
            long timeElapsed = Math.abs(System.currentTimeMillis() - mDialpad.getTimeStamp());
            if (timeElapsed < 1000) { // the elapsed time < 1S
              return;
            }
          }
          if ((null != mDialpad) && !TextUtils.isEmpty(mDialpad.getNumber())) {
            mDialpad.setNumber(null);
            mDialpad.showNumberUI();
          }
          call(number);
        }
      }
    }
  }
コード例 #7
0
 public void cancelMissedCallNotification() {
   log("cancelMissedCallNotification");
   PimEngine.getInstance(this).setCallLogsRead();
   CommonMethod.cancelMissedCallNotification(this);
 }
コード例 #8
0
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfoIn) {
    super.onCreateContextMenu(menu, v, menuInfoIn);
    if (v.getId() == R.id.edt_dpkb_call_number) {
      menu.removeItem(android.R.id.switchInputMethod);
      menu.removeItem(android.R.id.selectAll);
      menu.removeItem(android.R.id.startSelectingText);

      return;
    }
    if (menuInfoIn != null) {
      AdapterView.AdapterContextMenuInfo menuInfo = null;
      try {
        menuInfo = (AdapterView.AdapterContextMenuInfo) menuInfoIn;
      } catch (ClassCastException e) {
        log("bad menuInfoIn e = " + e);
        return;
      }

      mContextMenuIdx = menuInfo.position;
      mDialpadItem = mItemAdapter.getItem(mContextMenuIdx);
      String name = mDialpadItem.getName();
      String number = mDialpadItem.getNumber();
      long contactId = mDialpadItem.getContactId();
      log("onCreateContextMenu: name=" + name + " number=" + number + " contactId=" + contactId);
      if (!TextUtils.isEmpty(name)) {
        menu.setHeaderTitle(name);
      } else {
        if (number.equals(CallerInfo.UNKNOWN_NUMBER)) {
          number = getResources().getString(R.string.unknown);
        } else if (number.equals(CallerInfo.PRIVATE_NUMBER)) {
          number = getResources().getString(R.string.private_num);
        } else if (number.equals(CallerInfo.PAYPHONE_NUMBER)) {
          number = getResources().getString(R.string.payphone);
        }
        menu.setHeaderTitle(number);
      }

      if (DialpadItem.CALLLOG_TYPE == mDialpadItem.getType()) {
        menu.add(0, R.id.menu_log_detail, 0, R.string.view_calllog_detail);
      }

      menu.add(0, R.id.menu_send_message, 0, R.string.send_message);
      if (0 == contactId) {
        menu.add(0, R.id.menu_new_contact, 0, R.string.menu_newContact);
        // modify by zenghuaying fix bug #5705
        if (!CommonMethod.contactsIsEmpty(this)) {
          menu.add(0, R.id.menu_add_to_contacts, 0, R.string.menu_add_to_contacts);
        }
        // modify end
      } else {
        menu.add(0, R.id.menu_view_contact, 0, R.string.view_contact);
      }

      if (DialpadItem.CALLLOG_TYPE == mDialpadItem.getType()) {
        menu.add(0, R.id.menu_delete_log, 0, R.string.delete_call_log);
      }

      if (CommonMethod.numberIsInBlacklist(this, number)) {
        menu.add(0, R.id.menu_clear_from_blacklist, 0, R.string.clear_from_blacklist);
      } else {
        menu.add(0, R.id.menu_add_to_blacklist, 0, R.string.add_to_blacklist);
      }
    }
  }
コード例 #9
0
 @Override
 public void sendMessage(String number) {
   // if (!CommonMethod.findContactByNumber(this, number)) {
   CommonMethod.sendMessage(this, number, null);
   // }
 }
コード例 #10
0
 @Override
 public void newContact(String number) {
   // if (!CommonMethod.findContactByNumber(this, number)) {
   CommonMethod.newContact(this, number);
   // }
 }
コード例 #11
0
 @Override
 public void enterContacts() {
   CommonMethod.enterContacts(this);
 }