/** * Get the phone number that raised this activity. * * @return The phone number we are trying to call with this activity */ public String getPhoneNumber() { if (phoneNumber == null) { Intent it = getIntent(); // Use utility function to extract number phoneNumber = UriUtils.extractNumberFromIntent(it, this); // Additional check to know if a csip uri (so that no rewriting rules applies) if (phoneNumber != null) { String action = it.getAction(); Uri data = it.getData(); if (!Intent.ACTION_SENDTO.equalsIgnoreCase(action) && data != null) { String scheme = data.getScheme(); if (scheme != null) { scheme = scheme.toLowerCase(); } if (SCHEME_CSIP.equals(scheme)) { ignoreRewritingRules = true; } } } // Still null ... well make it empty. if (phoneNumber == null) { phoneNumber = ""; } return phoneNumber; } return phoneNumber; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); if (Intent.ACTION_SENDTO.equals(intent.getAction())) { if (!resolveIntent(intent)) { finish(); return; } if (TextUtils.isEmpty(mToAddress)) { Log.w(ImApp.LOG_TAG, "<ImUrlActivity>Invalid to address:" + mToAddress); finish(); return; } mApp = ImApp.getApplication(this); mApp.callWhenServiceConnected( new Handler(), new Runnable() { public void run() { handleIntent(); } }); } else { finish(); } }
@Override public void onCreate(Bundle savedInstanceState) { if (Intent.ACTION_VIEW.equals(getIntent().getAction()) || Intent.ACTION_SEND.equals(getIntent().getAction()) || Intent.ACTION_SENDTO.equals(getIntent().getAction()) || Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) { ActivityManager.getInstance().startNewTask(this); } super.onCreate(savedInstanceState); if (isFinishing()) { return; } setContentView(R.layout.contact_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default); toolbar.setOnClickListener(this); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.application_title_short, R.string.application_title_short); drawerLayout.setDrawerListener(drawerToggle); toolbar.inflateMenu(R.menu.contact_list); optionsMenu = toolbar.getMenu(); setUpSearchView(optionsMenu); toolbar.setOnMenuItemClickListener(this); barPainter = new BarPainter(this, toolbar); barPainter.setDefaultColor(); toolbar.setTitle(R.string.application_title_full); if (savedInstanceState != null) { sendText = savedInstanceState.getString(SAVED_SEND_TEXT); action = savedInstanceState.getString(SAVED_ACTION); } else { getSupportFragmentManager() .beginTransaction() .add(R.id.container, new ContactListFragment(), CONTACT_LIST_TAG) .commit(); sendText = null; action = getIntent().getAction(); } getIntent().setAction(null); }
@Override void onBackendConnected() { this.accounts = xmppConnectionService.getAccounts(); if (Intent.ACTION_SENDTO.equals(getIntent().getAction())) { getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setHomeButtonEnabled(false); String jid; try { jid = URLDecoder.decode(getIntent().getData().getEncodedPath(), "UTF-8").split("/")[1]; } catch (UnsupportedEncodingException e) { jid = null; } if (jid != null) { final String finalJid = jid; if (this.accounts.size() > 1) { getAccountChooser( new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Conversation conversation = xmppConnectionService.findOrCreateConversation( accounts.get(which), finalJid, false); switchToConversation(conversation, null, false); finish(); } }) .show(); } else { Conversation conversation = xmppConnectionService.findOrCreateConversation(this.accounts.get(0), jid, false); switchToConversation(conversation, null, false); finish(); } } } if (xmppConnectionService.getConversationCount() == 0) { getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setHomeButtonEnabled(false); } this.rosterContacts.clear(); for (Account account : accounts) { if (account.getStatus() != Account.STATUS_DISABLED) { rosterContacts.addAll(account.getRoster().getContacts()); } } updateAggregatedContacts(); }