List of usage examples for android.content Intent ACTION_INSERT
String ACTION_INSERT
To view the source code for android.content Intent ACTION_INSERT.
Click Source Link
From source file:com.viktorrudometkin.burramys.activity.HomeActivity.java
private void selectDrawerItem(int position) { mCurrentDrawerPos = position;//from w ww .j a va 2 s. c om Uri newUri; boolean showFeedInfo = true; switch (position) { case 0: newUri = EntryColumns.UNREAD_ENTRIES_CONTENT_URI; break; case 1: newUri = EntryColumns.CONTENT_URI; break; case 2: newUri = EntryColumns.FAVORITES_CONTENT_URI; break; default: long feedOrGroupId = mDrawerAdapter.getItemId(position); if (mDrawerAdapter.isItemAGroup(position)) { newUri = EntryColumns.ENTRIES_FOR_GROUP_CONTENT_URI(feedOrGroupId); } else { newUri = EntryColumns.ENTRIES_FOR_FEED_CONTENT_URI(feedOrGroupId); showFeedInfo = false; } mTitle = mDrawerAdapter.getItemName(position); break; } if (!newUri.equals(mEntriesFragment.getUri())) { mEntriesFragment.setData(newUri, showFeedInfo); } mDrawerList.setItemChecked(position, true); // First open => we open the drawer for you if (PrefUtils.getBoolean(PrefUtils.FIRST_OPEN, true)) { PrefUtils.putBoolean(PrefUtils.FIRST_OPEN, false); if (mDrawerLayout != null) { mDrawerLayout.postDelayed(new Runnable() { @Override public void run() { mDrawerLayout.openDrawer(mLeftDrawer); } }, 500); } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.welcome_title).setItems(new CharSequence[] { getString(R.string.google_news_title), getString(R.string.add_custom_feed) }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (which == 1) { startActivity(new Intent(Intent.ACTION_INSERT).setData(FeedColumns.CONTENT_URI)); } else { startActivity(new Intent(HomeActivity.this, AddGoogleNewsActivity.class)); } } }); builder.show(); } // Set title & icon ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { switch (mCurrentDrawerPos) { case 0: getSupportActionBar().setTitle(R.string.unread_entries); break; case 1: getSupportActionBar().setTitle(R.string.all_entries); break; case 2: getSupportActionBar().setTitle(R.string.favorites); break; default: getSupportActionBar().setTitle(mTitle); break; } } // Put the good menu invalidateOptionsMenu(); }
From source file:com.carlrice.reader.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_edit); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);// w ww. j a va 2 s . com getSupportActionBar().setDisplayHomeAsUpEnabled(true); setResult(RESULT_CANCELED); Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, Constants.EMPTY_CURSOR); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startSupportActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); cursor.close(); } else { cursor.close(); Toast.makeText(EditFeedActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); finish(); } } } }
From source file:info.guardianproject.otr.app.im.app.AccountListActivity.java
public void showSetupAccountForm(String providerType, String username, String token, boolean createAccount, String formTitle, boolean hideTor) { long providerId = helper.createAdditionalProvider(providerType);//xmpp mApp.resetProviderSettings(); //clear cached provider list Intent intent = new Intent(); intent.setAction(Intent.ACTION_INSERT); intent.setData(ContentUris.withAppendedId(Imps.Provider.CONTENT_URI, providerId)); intent.addCategory(ImApp.IMPS_CATEGORY); if (username != null) intent.putExtra("newuser", username); if (token != null) intent.putExtra("newpass", token); if (formTitle != null) intent.putExtra("title", formTitle); intent.putExtra("hideTor", hideTor); intent.putExtra("register", createAccount); startActivity(intent);// ww w. ja v a2 s. com }
From source file:spit.matrix2017.Activities.EventDetails.java
private void setContacts(final String name1, final String number1, final String name2, final String number2) { TextView contactTextViewOne = (TextView) findViewById(R.id.contact_name_one); TextView contactTextViewTwo = (TextView) findViewById(R.id.contact_name_two); ImageButton callOne = (ImageButton) findViewById(R.id.call_contact_person_one); ImageButton saveOne = (ImageButton) findViewById(R.id.save_contact_person_one); ImageButton callTwo = (ImageButton) findViewById(R.id.call_contact_person_two); ImageButton saveTwo = (ImageButton) findViewById(R.id.save_contact_person_two); assert contactTextViewOne != null; contactTextViewOne.setText(name1 + "\n" + number1); assert contactTextViewTwo != null; contactTextViewTwo.setText(name2 + "\n" + number2); View.OnClickListener callOnClickListener = new View.OnClickListener() { @Override/*from ww w . j av a 2 s .c o m*/ public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_DIAL); switch (v.getId()) { case R.id.call_contact_person_one: intent.setData(Uri.parse("tel:" + number1)); break; case R.id.call_contact_person_two: intent.setData(Uri.parse("tel:" + number2)); break; } startActivity(intent); } }; View.OnClickListener saveOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI); switch (v.getId()) { case android.R.id.home: EventDetails.super.onBackPressed(); break; case R.id.save_contact_person_one: intent.putExtra(ContactsContract.Intents.Insert.NAME, name1); intent.putExtra(ContactsContract.Intents.Insert.PHONE, "" + number1); break; case R.id.save_contact_person_two: intent.putExtra(ContactsContract.Intents.Insert.NAME, name2); intent.putExtra(ContactsContract.Intents.Insert.PHONE, "" + number2); break; } startActivity(intent); } }; assert callOne != null; callOne.setOnClickListener(callOnClickListener); assert callTwo != null; callTwo.setOnClickListener(callOnClickListener); assert saveOne != null; saveOne.setOnClickListener(saveOnClickListener); assert saveTwo != null; saveTwo.setOnClickListener(saveOnClickListener); }
From source file:com.silentcircle.contacts.list.ScDefaultContactBrowseListFragment.java
/** * This method creates a pseudo user profile contact. When the returned query doesn't have * a profile, this methods creates 2 views that are inserted as headers to the listview: * 1. A header view with the "ME" title and the contacts count. * 2. A button that prompts the user to create a local profile *///from ww w .java 2 s . c om @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private void addEmptyUserProfileHeader(LayoutInflater inflater) { ListView list = getListView(); // Put a header with the "ME" name and a view for the number of contacts // The view is embedded in a frame view since you cannot change the visibility of a // view in a ListView without having a parent view. mProfileHeaderContainer = new FrameLayout(inflater.getContext()); mProfileHeader = inflater.inflate(R.layout.user_profile_header, null, false); mCounterHeaderView = (TextView) mProfileHeader.findViewById(R.id.contacts_count); mProfileTitle = (TextView) mProfileHeader.findViewById(R.id.profile_title); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) mProfileTitle.setAllCaps(true); mProfileHeaderContainer.addView(mProfileHeader); list.addHeaderView(mProfileHeaderContainer, null, false); // Add a selectable view with a message inviting the user to create a local profile mMessageContainer = new FrameLayout(inflater.getContext()); mProfileMessage = (Button) inflater.inflate(R.layout.user_profile_button, null, false); mMessageContainer.addView(mProfileMessage); list.addHeaderView(mMessageContainer, null, true); mProfileMessage.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_INSERT, RawContacts.CONTENT_URI); intent.putExtra(ContactEditorFragment.INTENT_EXTRA_NEW_LOCAL_PROFILE, true); startActivity(intent); } }); }
From source file:com.slp.rss_api.activity.HomeActivity.java
private void selectDrawerItem(int position) { mCurrentDrawerPos = position;// w w w .ja v a 2 s.co m mIcon = null; Uri newUri; boolean showFeedInfo = true; switch (position) { case SEARCH_DRAWER_POSITION: newUri = EntryColumns.SEARCH_URI(mEntriesFragment.getCurrentSearch()); break; case 0: newUri = EntryColumns.ALL_ENTRIES_CONTENT_URI; break; case 1: newUri = EntryColumns.FAVORITES_CONTENT_URI; break; default: long feedOrGroupId = mDrawerAdapter.getItemId(position); if (mDrawerAdapter.isItemAGroup(position)) { newUri = EntryColumns.ENTRIES_FOR_GROUP_CONTENT_URI(feedOrGroupId); } else { byte[] iconBytes = mDrawerAdapter.getItemIcon(position); Bitmap bitmap = UiUtils.getScaledBitmap(iconBytes, 24); if (bitmap != null) { mIcon = new BitmapDrawable(getResources(), bitmap); } newUri = EntryColumns.ENTRIES_FOR_FEED_CONTENT_URI(feedOrGroupId); showFeedInfo = false; } mTitle = mDrawerAdapter.getItemName(position); break; } if (!newUri.equals(mEntriesFragment.getUri())) { mEntriesFragment.setData(newUri, showFeedInfo); } mDrawerList.setItemChecked(position, true); // First open => we open the drawer for you if (PrefUtils.getBoolean(PrefUtils.FIRST_OPEN, true)) { PrefUtils.putBoolean(PrefUtils.FIRST_OPEN, false); if (mDrawerLayout != null) { mDrawerLayout.postDelayed(new Runnable() { @Override public void run() { mDrawerLayout.openDrawer(mLeftDrawer); } }, 500); } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.welcome_title).setItems(new CharSequence[] { getString(R.string.google_news_title), getString(R.string.add_custom_feed) }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (which == 1) { startActivity(new Intent(Intent.ACTION_INSERT).setData(FeedColumns.CONTENT_URI)); } else { startActivity(new Intent(HomeActivity.this, AddGoogleNewsActivity.class)); } } }); builder.show(); } // Set title & icon switch (mCurrentDrawerPos) { case SEARCH_DRAWER_POSITION: getSupportActionBar().setTitle(android.R.string.search_go); getSupportActionBar().setIcon(R.drawable.action_search); break; case 0: getSupportActionBar().setTitle(R.string.all); getSupportActionBar().setIcon(R.drawable.ic_statusbar_rss); break; case 1: getSupportActionBar().setTitle(R.string.favorites); getSupportActionBar().setIcon(R.drawable.rating_important); break; default: getSupportActionBar().setTitle(mTitle); if (mIcon != null) { getSupportActionBar().setIcon(mIcon); } else { getSupportActionBar().setIcon(null); } break; } // Put the good menu invalidateOptionsMenu(); }
From source file:edu.mit.mobile.android.livingpostcards.CameraActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.capture: capture();/*w w w .j a v a 2 s. c o m*/ break; case R.id.done: setResult(RESULT_OK); finish(); // when a new card is added, show the editor immediately afterward. if (mCard != null && Intent.ACTION_INSERT.equals(getIntent().getAction())) { startActivity(new Intent(Intent.ACTION_EDIT, mCard)); } break; } }
From source file:org.hfoss.posit.android.api.fragment.FindFragment.java
/** * Creates the menu for this activity by inflating a menu resource file. *//*from ww w.j a va 2 s .co m*/ @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.add_finds_menu, menu); if (getAction().equals(Intent.ACTION_INSERT)) { menu.removeItem(R.id.delete_find_menu_item); } // Add menu options based on function plug-ins for (FunctionPlugin plugin : mAddFindMenuPlugins) { // For all other function plug-ins MenuItem item = menu.add(plugin.getmMenuTitle()); int resId = getResources().getIdentifier(plugin.getmMenuIcon(), "drawable", getActivity().getPackageName()); item.setIcon(resId); if (resId != 0) // icon found; display it on the action bar item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); else // icon not found item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } }
From source file:com.android.contacts.preference.DisplayOptionsPreferenceFragment.java
@Override public boolean onPreferenceClick(Preference p) { final String prefKey = p.getKey(); if (KEY_ABOUT.equals(prefKey)) { ((ContactsPreferenceActivity) getActivity()).showAboutFragment(); return true; } else if (KEY_IMPORT.equals(prefKey)) { ImportDialogFragment.show(getFragmentManager()); return true; } else if (KEY_EXPORT.equals(prefKey)) { ExportDialogFragment.show(getFragmentManager(), ContactsPreferenceActivity.class, ExportDialogFragment.EXPORT_MODE_ALL_CONTACTS); return true; } else if (KEY_MY_INFO.equals(prefKey)) { if (mHasProfile) { final Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, mProfileContactId); ImplicitIntentsUtil.startQuickContact(getActivity(), uri, ScreenType.ME_CONTACT); } else {// w w w . j a va2 s .c om final Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); intent.putExtra(mNewLocalProfileExtra, true); ImplicitIntentsUtil.startActivityInApp(getActivity(), intent); } return true; } else if (KEY_ACCOUNTS.equals(prefKey)) { ImplicitIntentsUtil.startActivityOutsideApp(getContext(), ImplicitIntentsUtil.getIntentForAddingAccount()); return true; } else if (KEY_BLOCKED_NUMBERS.equals(prefKey)) { final Intent intent = TelecomManagerUtil.createManageBlockedNumbersIntent( (TelecomManager) getContext().getSystemService(Context.TELECOM_SERVICE)); startActivity(intent); return true; } else if (KEY_CUSTOM_CONTACTS_FILTER.equals(prefKey)) { final ContactListFilter filter = ContactListFilterController.getInstance(getContext()).getFilter(); AccountFilterUtil.startAccountFilterActivityForResult(this, REQUEST_CODE_CUSTOM_CONTACTS_FILTER, filter); } return false; }
From source file:nl.privacybarometer.privacyvandaag.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_edit); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from w ww . j a v a 2 s . c om getSupportActionBar().setDisplayHomeAsUpEnabled(true); setResult(RESULT_CANCELED); Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mCookieNameEditText = (EditText) findViewById(R.id.feed_cookiename); mCookieValueEditText = (EditText) findViewById(R.id.feed_cookievalue); mKeepTime = (Spinner) findViewById(R.id.settings_keep_times); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } String[] selectedValues = getResources().getStringArray(R.array.settings_keep_time_values); mKeepTime.setSelection(selectedValues.length - 1); } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, Constants.EMPTY_CURSOR); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startSupportActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); mCookieNameEditText.setText(cursor.getString(3)); mCookieValueEditText.setText(cursor.getString(4)); Integer intDate = cursor.getInt(5); String[] selectedValues = getResources().getStringArray(R.array.settings_keep_time_values); int index = Arrays.asList(selectedValues).indexOf(String.valueOf(intDate)); mKeepTime.setSelection(index >= 0 ? index : selectedValues.length - 1); cursor.close(); } else { cursor.close(); Toast.makeText(EditFeedActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); finish(); } } } }