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:org.klnusbaum.udj.network.PlaylistSyncService.java
@Override public void onHandleIntent(Intent intent) { final Account account = (Account) intent.getParcelableExtra(Constants.ACCOUNT_EXTRA); String playerId = AccountManager.get(this).getUserData(account, Constants.LAST_PLAYER_ID_DATA); //TODO handle error if playerId is bad if (intent.getAction().equals(Intent.ACTION_INSERT)) { if (intent.getData().equals(Constants.PLAYLIST_URI)) { String libId = intent.getStringExtra(Constants.LIB_ID_EXTRA); addSongToPlaylist(account, playerId, libId, true, intent); } else if (intent.getData().equals(Constants.VOTES_URI)) { //TODO handle if lib id is bad String libId = intent.getStringExtra(Constants.LIB_ID_EXTRA); //TODO handle if votetype is bad int voteWeight = intent.getIntExtra(Constants.VOTE_WEIGHT_EXTRA, 0); voteOnSong(account, playerId, libId, voteWeight, true); }// ww w. j a v a 2 s. co m //updateActivePlaylist(account, playerId, true); } /*else if(intent.getAction().equals(Intent.ACTION_VIEW)){ updateActivePlaylist(account, playerId, true); }*/ else if (intent.getAction().equals(Intent.ACTION_DELETE)) { Log.d(TAG, "Handling delete"); if (intent.getData().equals(Constants.PLAYLIST_URI)) { Log.d(TAG, "In plalist syncservice, about to insert song into remove requests"); //TODO handle if Playlist id is bad. String libId = intent.getStringExtra(Constants.LIB_ID_EXTRA); removeSongFromPlaylist(account, playerId, libId, true, intent); } //updateActivePlaylist(account, playerId, true); } else if (intent.getAction().equals(Constants.ACTION_SET_CURRENT_SONG)) { Log.d(TAG, "Handling setting current song"); String libId = intent.getStringExtra(Constants.LIB_ID_EXTRA); setCurrentSong(account, playerId, libId, true, intent); //updateActivePlaylist(account, playerId, true); } else if (intent.getAction().equals(Constants.ACTION_SET_PLAYBACK)) { setPlaybackState(intent, account, playerId, true); //updateActivePlaylist(account, playerId, true); } else if (intent.getAction().equals(Constants.ACTION_SET_VOLUME)) { setPlayerVolume(intent, account, playerId, true); //updateActivePlaylist(account, playerId, true); } }
From source file:pl.selvin.android.listsyncsample.ui.ListsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.ui_menu_newlist: Intent intent = new Intent(Intent.ACTION_INSERT, null, getActivity(), EditListActivity.class); startActivity(intent);//from www . j a v a2s. c o m return true; default: return super.onOptionsItemSelected(item); } }
From source file:dev.drsoran.moloko.activities.NoteEditActivity.java
private void createIntentDependentFragment() { final String action = getIntent().getAction(); if (Intent.ACTION_EDIT.equals(action)) { addFragment(NoteEditFragment.class); } else if (Intent.ACTION_INSERT.equals(action)) { addFragment(NoteAddFragment.class); } else {//from ww w. j a v a2s . c o m throw new UnsupportedOperationException( String.format("Intent action unhandled: %s", getIntent().getAction())); } }
From source file:bander.notepad.NoteEditAppCompat.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Setting the theme Notepad.setAppCompatThemeFromPreferences(this, "Edit"); if (savedInstanceState != null) { final Object note = savedInstanceState.get(ORIGINAL_NOTE); if (note != null) mOriginalNote = (Note) note; }/*from w w w. jav a2 s .c om*/ final Intent intent = getIntent(); final String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action)) { mState = STATE_EDIT; mUri = intent.getData(); } else if (Intent.ACTION_INSERT.equals(action)) { mState = STATE_INSERT; if (mOriginalNote == null) { mUri = getContentResolver().insert(intent.getData(), null); } else { mUri = mOriginalNote.getUri(); } setResult(RESULT_OK, (new Intent()).setAction(mUri.toString())); } if (mUri == null) { finish(); return; } { setContentView(R.layout.edit_appcompat); SharedPreferences mSettings = PreferenceManager.getDefaultSharedPreferences(this); ViewStub stub = (ViewStub) findViewById(R.id.toolbarWrapper); if (mSettings.getBoolean("darkAppCompatTheme", false)) stub.setLayoutResource(R.layout.toolbar_dark); else stub.setLayoutResource(R.layout.toolbar_light); stub.inflate(); toolbar = (Toolbar) findViewById(R.id.toolbar); Notepad.setToolbarColor(this); setSupportActionBar(toolbar); if (mSettings.getBoolean("darkAppCompatTheme", false)) { toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); } else { toolbar.setNavigationIcon( IconTintFactory.setDarkMaterialColor(R.drawable.abc_ic_ab_back_mtrl_am_alpha, this)); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); mBodyText = (EditText) findViewById(R.id.body); } }
From source file:markson.visuals.sitapp.eventActivity.java
public void addtocal() throws ParseException { String location = null;/*from www . j av a 2 s . c o m*/ DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.US); formatter.setTimeZone(TimeZone.getTimeZone("America/New_York")); Date StartTime = formatter.parse(date); Log.e("n", String.valueOf(StartTime.getTime())); Intent calint = new Intent(Intent.ACTION_INSERT); calint.setType("vnd.android.cursor.item/event"); calint.putExtra("title", name); calint.putExtra("description", description); calint.putExtra("beginTime", StartTime.getTime()); //calint.putExtra(Events.EVENT_TIMEZONE, "America/New_York"); if (description.contains("at")) { location = description.substring(description.lastIndexOf("at") + 3, description.length()); calint.putExtra("eventLocation", location); } startActivity(calint); }
From source file:com.intel.xdk.contacts.Contacts.java
public void addContact(String first, String last, String street, String city, String state, String zip, String country, String phone, String email) { if (busy == true) { String js = "javascript: var e = document.createEvent('Events');e.initEvent('intel.xdk.contacts.busy',true,true);e.success=false;e.message='busy';document.dispatchEvent(e);"; injectJS(js);/* w w w.j av a 2 s . c o m*/ return; } try { busy = true; Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType(ContactsContract.Contacts.CONTENT_TYPE); intent.putExtra(ContactsContract.Intents.Insert.FULL_MODE, true); cordova.setActivityResultCallback(this); activity.startActivityForResult(intent, CONTACT_ADDER_RESULT); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:cz.maresmar.sfm.view.credential.LoginListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_list); mUserUri = getIntent().getData();/*w w w . java 2s . co m*/ mPortalsUri = Uri.withAppendedPath(mUserUri, ProviderContract.PORTAL_PATH); // Toolbar Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mRecyclerView = findViewById(R.id.credential_list); setupRecyclerView(mRecyclerView); FloatingActionButton fab = findViewById(R.id.main_discard_fab); fab.setOnClickListener((View v) -> startPortalPickerActivity()); // Prepare empty view mEmptyView = findViewById(R.id.empty_content); ((TextView) findViewById(R.id.empty_description_text)).setText(R.string.empty_try_to_add_credential); String intentAction = getIntent().getAction(); if (intentAction == null) { intentAction = "null"; } switch (intentAction) { case Intent.ACTION_VIEW: break; case Intent.ACTION_INSERT: startPortalPickerActivity(); break; default: throw new UnsupportedOperationException("Unknown intent action " + intentAction); } }
From source file:com.money.manager.ex.assetallocation.AssetClassEditActivity.java
private boolean save() { // todo: validate boolean result; AssetClassEditFragment fragment = getFragment(); AssetClass assetClass = fragment.assetClass; AssetClassRepository repo = new AssetClassRepository(this); switch (getIntent().getAction()) { case Intent.ACTION_INSERT: result = repo.insert(assetClass); break;/*from w w w . j a v a 2s . c o m*/ case Intent.ACTION_EDIT: result = repo.update(assetClass); break; default: result = false; } return result; }
From source file:org.hfoss.posit.android.api.fragment.ListFindsFragment.java
/** * Called when the Activity starts.// w w w.j a v a2 s .com * * @param savedInstanceState * contains the Activity's previously frozen state. In this case * it is unused. * @see android.support.v4.app.Fragment#onActivityCreated(android.os.Bundle) */ @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListMenuPlugins = FindPluginManager.getFunctionPlugins(FindPluginManager.LIST_MENU_EXTENSION); Log.i(TAG, "# of List menu plugins = " + mListMenuPlugins.size()); setHasOptionsMenu(true); View findFrame = getActivity().findViewById(R.id.find); mIsDualPane = findFrame != null && findFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { mCurrCheckPosition = savedInstanceState.getInt("currChoice", 0); } if (mIsDualPane) { getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); displayFind(mCurrCheckPosition, Intent.ACTION_INSERT, null, null); } }