コード例 #1
0
 /**
  * Iterates over all data items that represent phone numbers are tries to calculate a formatted
  * number. This function can safely be called several times as no unformatted data is overwritten
  */
 private void computeFormattedPhoneNumbers(Contact contactData) {
   final String countryIso = GeoUtil.getCurrentCountryIso(getContext());
   final ImmutableList<RawContact> rawContacts = contactData.getRawContacts();
   final int rawContactCount = rawContacts.size();
   for (int rawContactIndex = 0; rawContactIndex < rawContactCount; rawContactIndex++) {
     final RawContact rawContact = rawContacts.get(rawContactIndex);
     final List<DataItem> dataItems = rawContact.getDataItems();
     final int dataCount = dataItems.size();
     for (int dataIndex = 0; dataIndex < dataCount; dataIndex++) {
       final DataItem dataItem = dataItems.get(dataIndex);
       if (dataItem instanceof PhoneDataItem) {
         final PhoneDataItem phoneDataItem = (PhoneDataItem) dataItem;
         phoneDataItem.computeFormattedPhoneNumber(countryIso);
       }
     }
   }
 }
コード例 #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /// M: [ALPS01840043] save Panel state
    mIsPanelOpen =
        savedInstanceState != null ? savedInstanceState.getBoolean(PANEL_OPEN_STATE) : true;
    if (DEBUG) {
      Log.d(
          TAG, "onCreate mIsPanelOpen=" + (savedInstanceState == null ? "default" : mIsPanelOpen));
    }
    mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(), this, 1);
    final String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
    mCallLogAdapter =
        ObjectFactory.newCallLogAdapter(
            getActivity(),
            this,
            new ContactInfoHelper(getActivity(), currentCountryIso),
            null,
            null,
            false);

    mMergedAdapter = new ShortcutCardsAdapter(getActivity(), this, mCallLogAdapter);
  }