Example #1
1
 private void proceedIntent(Intent intent) {
   if (intent != null) {
     String link = intent.getStringExtra("link");
     if (!StringUtil.isEmpty(link)) {
       Intents.openBrowser(this, link);
       finish();
       return;
     }
     Uri data = intent.getData();
     if (data != null && data.getScheme().equalsIgnoreCase("tel")) {
       String path = data.getSchemeSpecificPart();
       showPhone(path);
       getTracker().track("onShowPhone:intent");
     }
     String action = intent.getAction();
     String type = intent.getType();
     if (action != null && "com.android.phone.action.RECENT_CALLS".equals(action)) {
       mViewPager.setCurrentItem(1);
     } else if ("android.intent.action.VIEW".equals(action)
         && "vnd.android.cursor.dir/calls".equals(type)) {
       mViewPager.setCurrentItem(1);
     } else if (type != null && "vnd.android.cursor.dir/calls".equals(type)) {
       mViewPager.setCurrentItem(1);
       onBackPressed();
     }
     removeMissedCallNotifications(this);
   }
 }
Example #2
0
 private String getContactIdFromNumber(String number) {
   if (StringUtil.isEmpty(number)) {
     return StringUtil.EMPTY;
   }
   Uri uri =
       Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
   try {
     Cursor c = ContextHolder.get().getContentResolver().query(uri, PROJECTION, null, null, null);
     if (!CursorUtils.isEmpty(c) && c.moveToFirst()) {
       String photoUri = CursorUtils.getString(ContactsContract.Contacts.PHOTO_URI, c);
       Long id = CursorUtils.getLong(ContactsContract.Contacts._ID, c);
       mContactIdCache.put(number, id);
       CursorUtils.close(c);
       return photoUri == null ? StringUtil.EMPTY : photoUri;
     } else {
       CursorUtils.close(c);
     }
   } catch (IllegalArgumentException e) {
     Crashlytics.logException(new IllegalArgumentException("number:" + number, e));
   }
   return StringUtil.EMPTY;
 }