List of usage examples for android.content Intent ACTION_EDIT
String ACTION_EDIT
To view the source code for android.content Intent ACTION_EDIT.
Click Source Link
From source file:com.viktorrudometkin.burramys.activity.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); mEntriesFragment = (EntriesListFragment) getSupportFragmentManager() .findFragmentById(R.id.entries_list_fragment); mTitle = getTitle();//from ww w . j ava 2 s . com Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mLeftDrawer = findViewById(R.id.left_drawer); mDrawerList = (ListView) findViewById(R.id.drawer_list); mDrawerList.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mDrawerList.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectDrawerItem(position); if (mDrawerLayout != null) { mDrawerLayout.postDelayed(new Runnable() { @Override public void run() { mDrawerLayout.closeDrawer(mLeftDrawer); } }, 50); } } }); mDrawerList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { if (id > 0) { startActivity(new Intent(Intent.ACTION_EDIT).setData(FeedColumns.CONTENT_URI(id))); return true; } return false; } }); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (mDrawerLayout != null) { mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close); mDrawerLayout.setDrawerListener(mDrawerToggle); } if (savedInstanceState != null) { mCurrentDrawerPos = savedInstanceState.getInt(STATE_CURRENT_DRAWER_POS); } getLoaderManager().initLoader(LOADER_ID, null, this); if (PrefUtils.getBoolean(PrefUtils.REFRESH_ENABLED, true)) { // starts the service independent to this activity startService(new Intent(this, RefreshService.class)); } else { stopService(new Intent(this, RefreshService.class)); } if (PrefUtils.getBoolean(PrefUtils.REFRESH_ON_OPEN_ENABLED, false)) { if (!PrefUtils.getBoolean(PrefUtils.IS_REFRESHING, false)) { startService(new Intent(HomeActivity.this, FetcherService.class) .setAction(FetcherService.ACTION_REFRESH_FEEDS)); } } // Ask the permission to import the feeds if there is already one backup if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && new File(OPML.BACKUP_OPML).exists()) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.storage_request_explanation).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ActivityCompat.requestPermissions(HomeActivity.this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_IMPORT_FROM_OPML); } }); builder.show(); } else { // No explanation needed, we can request the permission. ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_IMPORT_FROM_OPML); } } }
From source file:com.money.manager.ex.assetallocation.editor.AssetAllocationEditorActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent;// www . j a v a 2 s. c o m switch (item.getItemId()) { case android.R.id.home: setResultAndFinish(); break; case R.id.menu_currencies: // open the Currencies activity. intent = new Intent(this, CurrencyListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); break; default: return super.onOptionsItemSelected(item); } return true; }
From source file:com.example.android.notepad.NotesList.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); //final boolean haveItems = getListAdapter().getCount() > 0; boolean haveItems = true; // If there are any notes in the list (which implies that one of // them is selected), then we need to generate the actions that // can be performed on the current selection. This will be a combination // of our own specific actions along with any extensions that can be // found./*from w w w .ja v a 2 s .c o m*/ if (haveItems) { // This is the selected item. Uri uri = ContentUris.withAppendedId(getIntent().getData(), getSelectedItemId()); // Build menu... always starts with the EDIT action... Intent[] specifics = new Intent[1]; specifics[0] = new Intent(Intent.ACTION_EDIT, uri); MenuItem[] items = new MenuItem[1]; // ... is followed by whatever other actions are available... Intent intent = new Intent(null, uri); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, null, specifics, intent, 0, items); // Give a shortcut to the edit action. if (items[0] != null) { items[0].setShortcut('1', 'e'); } } else { menu.removeGroup(Menu.CATEGORY_ALTERNATIVE); } return true; }
From source file:org.dmfs.tasks.model.Model.java
public boolean hasEditActivity() { if (mSupportsEditListIntent == null) { ComponentName editComponent = getListIntent(mContext, Intent.ACTION_EDIT, null) .setData(ContentUris.withAppendedId(TaskLists.getContentUri(mAuthority), 0 /* for pure intent resolution it doesn't matter which id we append */)) .resolveActivity(mContext.getPackageManager()); mSupportsEditListIntent = editComponent != null; }/*from w w w . j a v a 2 s . c o m*/ return mSupportsEditListIntent; }
From source file:org.odk.collect.android.activities.FormChooserList.java
/** * Stores the path of selected form and finishes. *//*from w w w . j a v a 2 s. c om*/ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (Collect.allowClick(getClass().getName())) { // get uri to form long idFormsTable = listView.getAdapter().getItemId(position); Uri formUri = ContentUris.withAppendedId(FormsColumns.CONTENT_URI, idFormsTable); String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action)) { // caller is waiting on a picked form setResult(RESULT_OK, new Intent().setData(formUri)); } else { // caller wants to view/edit a form, so launch formentryactivity Intent intent = new Intent(Intent.ACTION_EDIT, formUri); intent.putExtra(ApplicationConstants.BundleKeys.FORM_MODE, ApplicationConstants.FormModes.EDIT_SAVED); startActivity(intent); } finish(); } }
From source file:org.svij.taskwarriorapp.fragments.TaskListFragment.java
public void onTaskButtonClick(View view) { switch (view.getId()) { case R.id.btnTaskDelete: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.dialog_delete_task) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteTask(getTaskWithId(selectedItemId)); }//from w w w .j a v a 2 s . c o m }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog // Dialog is closing } }); builder.create(); builder.show(); break; case R.id.btnTaskModify: showAddTaskActivity(getTaskWithId(selectedItemId)); break; case R.id.btnTaskAddReminder: Task task = data.getTask(getTaskWithId(selectedItemId)); Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); if (task.getDue() != null) { intent.putExtra("beginTime", task.getDue().getTime()); intent.putExtra("endTime", task.getDue().getTime() + (30 * 60 * 1000)); } else { Calendar cal = new GregorianCalendar(); intent.putExtra("beginTime", cal.getTime().getTime()); cal.add(Calendar.MINUTE, 30); intent.putExtra("endTime", cal.getTime().getTime()); } intent.putExtra("title", task.getDescription()); startActivity(intent); break; case R.id.btnTaskDone: doneTask(getTaskWithId(selectedItemId)); break; default: break; } }
From source file:liqui.droid.activity.Test.java
@Override public boolean onContextItemSelected(MenuItem item) { // AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo(); // int i = info.position; switch (item.getItemId()) { case R.id.open_calendar: try {/*from w w w . jav a2s . co m*/ Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", System.currentTimeMillis()); intent.putExtra("endTime", System.currentTimeMillis() + 1000 * 60 * 5); intent.putExtra("title", "LQFB Test"); intent.putExtra("description", ""); intent.putExtra("eventLocation", ""); intent.putExtra("eventStatus", ""); startActivity(intent); return true; } catch (Exception e) { /* empty */ } default: return super.onContextItemSelected(item); } }
From source file:org.linphone.compatibility.ApiElevenPlus.java
public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) { Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI); Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id); intent.setData(contactUri);//w w w . j a va 2s. co m ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ContentValues sipAddressRow = new ContentValues(); sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE); sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri); data.add(sipAddressRow); intent.putParcelableArrayListExtra(Insert.DATA, data); return intent; }
From source file:edu.mit.mobile.android.livingpostcards.CardEditActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); mSherlock.setContentView(R.layout.activity_card_edit); final ActionBar ab = mSherlock.getActionBar(); ab.setDisplayHomeAsUpEnabled(true);//from w w w . j ava2s .c o m mTitle = (EditText) findViewById(R.id.title); mDescription = (EditText) findViewById(R.id.description); final View addFrame = findViewById(R.id.add_frame); addFrame.setOnClickListener(this); mCard = getIntent().getData(); final String action = getIntent().getAction(); final FragmentManager fm = getSupportFragmentManager(); if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_DELETE.equals(action)) { final FragmentTransaction ft = fm.beginTransaction(); final Fragment f = fm.findFragmentById(R.id.card_edit_fragment); if (f != null) { mCardViewFragment = (CardMediaEditFragment) f; } else { mCardViewFragment = CardMediaEditFragment.newInstance(Card.MEDIA.getUri(mCard)); ft.replace(R.id.card_edit_fragment, mCardViewFragment); } // if the dialog has been automatically restored by the system, hook it in. final SetCollabDescDialogFragment collab = (SetCollabDescDialogFragment) fm .findFragmentByTag(TAG_DIALOG_COLLABORATIVE); if (collab != null) { collab.setOnMarkCollaborativeListener(mOnMarkCollabListener); } mUserUri = Authenticator.getUserUri(this, Authenticator.ACCOUNT_TYPE); getSupportLoaderManager().initLoader(0, null, this); // if this isn't null, it was saved automatically for us. So hook it back in. final DeleteDialogFragment deleteDialog = (DeleteDialogFragment) fm .findFragmentByTag(TAG_DELETE_DIALOG); if (deleteDialog != null) { deleteDialog.registerOnDeleteListener(this); } else if (Intent.ACTION_DELETE.equals(action)) { onDeletePostcard(); } ft.commit(); } }
From source file:com.money.manager.ex.assetallocation.AssetAllocationActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent;/* ww w . j av a2 s .c o m*/ switch (item.getItemId()) { case android.R.id.home: setResultAndFinish(); break; case R.id.menu_currencies: // open the Currencies activity. intent = new Intent(this, CurrencyListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); break; // case R.id.menu_asset_allocation_overview: // // show the overview // intent = new Intent(this, AssetAllocationOverviewActivity.class); // startActivity(intent); // break; case R.id.menu_new_asset_allocation: intent = new Intent(this, FullAssetAllocationActivity.class); //intent.putExtra(KEY_ASSET_ALLOCATION, Parcels.wrap(this.assetAllocation)); startActivity(intent); break; default: return super.onOptionsItemSelected(item); } return true; }