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:dev.drsoran.moloko.activities.TaskEditActivity.java
private void createIntentDependentFragment() { final String action = getIntent().getAction(); if (Intent.ACTION_EDIT.equals(action)) { addFragment(TaskEditFragment.class); } else if (Intent.ACTION_INSERT.equals(action)) { addFragment(TaskAddFragment.class); } else {/*w ww . j a v a 2s. c om*/ throw new UnsupportedOperationException( String.format("Intent action unhandled: %s", getIntent().getAction())); } }
From source file:net.dahanne.spring.android.ch3.restful.example.recipeapp.RecipesList.java
@Override public boolean onContextItemSelected(MenuItem item) { // The data from the menu item. AdapterView.AdapterContextMenuInfo info; try {// www . ja v a2 s . co m // Casts the data object in the item into the type for AdapterView objects. info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); } catch (ClassCastException e) { // If the object can't be cast, logs an error Log.e(TAG, "bad menuInfo", e); // Triggers default processing of the menu item. return false; } // Appends the selected recipe's ID to the URI sent with the incoming Intent. Uri recipeUri = ContentUris.withAppendedId(getIntent().getData(), info.id); /* * Gets the menu item's ID and compares it to known actions. */ switch (item.getItemId()) { case R.id.context_open: // Launch activity to view/edit the currently selected item startActivity(new Intent(Intent.ACTION_EDIT, recipeUri)); return true; case R.id.context_delete: getContentResolver().delete(recipeUri, // The URI of the provider null, // No where clause is needed, since only a single recipe ID is being // passed in. null // No where clause is used, so no where arguments are needed. ); // Returns to the caller and skips further processing. return true; default: return super.onContextItemSelected(item); } }
From source file:com.example.easyvoice.MessageDetail.java
public void onWrite(View view) { String which = getIntent().getAction(); Log.d(getClass().getSimpleName(), "which is " + which); if (which.equalsIgnoreCase(Intent.ACTION_MAIN)) { onSave(view);/*from w ww .j a v a 2s . co m*/ } else if (which.equalsIgnoreCase(Intent.ACTION_EDIT)) { // TODO set msgId? onUpdate(view); } }
From source file:com.money.manager.ex.account.FilterDialogFragment.java
private void initializeControls(View view) { // Edit account. Button editButton = (Button) view.findViewById(R.id.editButton); editButton.setOnClickListener(new View.OnClickListener() { @Override// ww w . j a v a 2 s.c om public void onClick(View v) { Intent intent = new Intent(getActivity(), AccountEditActivity.class); intent.putExtra(AccountEditActivity.KEY_ACCOUNT_ID, mAccount.getId()); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } }); // Favourite account FontIconButton favouriteButton = (FontIconButton) view.findViewById(R.id.favouriteButton); favouriteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // un/set favourite flag boolean favourite = mAccount.getFavorite(); mAccount.setFavorite(!favourite); // update AccountRepository repo = new AccountRepository(getActivity()); boolean updated = repo.save(mAccount); if (!updated) { new Core(getActivity()).alert(R.string.error_saving_record); } showFavouriteStatus(v); } }); }
From source file:cn.edu.nju.dapenti.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_feed_edit); setResult(RESULT_CANCELED);/*from w ww . j ava 2s. c o m*/ Intent intent = getIntent(); 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 filtersLayout = findViewById(R.id.filters_layout); View buttonLayout = findViewById(R.id.button_layout); if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); filtersLayout.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } restoreInstanceState(savedInstanceState); } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, null); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (!restoreInstanceState(savedInstanceState)) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mPreviousName = cursor.getString(0); mNameEditText.setText(mPreviousName); 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:pl.selvin.android.listsyncsample.ui.ListsListFragment.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) { switch (item.getItemId()) { case R.id.menu_list_edit: AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); Intent intent = new Intent(Intent.ACTION_EDIT, ListProvider.getHelper().getItemUri(Database.List.TABLE_NAME, menuInfo.id), getActivity(), EditListActivity.class); startActivity(intent);/*from w ww . j a v a2 s .c o m*/ return true; case R.id.menu_list_delete: menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); ConfirmDeleteDialog .newInstance(R.string.ui_alert_delete_list, ListProvider.getHelper().getItemUri(Database.List.TABLE_NAME, menuInfo.id)) .show(getFragmentManager(), "dialog"); return true; } return false; }
From source file:com.money.manager.ex.assetallocation.AssetClassEditFragment.java
private void initializeParentEdit(View view) { TextView edit = (TextView) view.findViewById(R.id.parentAssetClass); if (edit == null) return;/*from w w w.j av a 2 s . c o m*/ View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View v) { // show asset allocation selector. // send the allocation id to exclude from the selection list. Intent intent = new Intent(getContext(), AssetClassListActivity.class); intent.putExtra(AssetClassListActivity.EXTRA_ASSET_CLASS_ID, assetClass.getId()); startActivityForResult(intent, REQUEST_ASSET_CLASS_PARENT); } }; // allow changing parent only on existing items if (getActivity().getIntent().getAction().equals(Intent.ACTION_EDIT)) { edit.setOnClickListener(onClickListener); } displayParent(); }
From source file:net.reichholf.dreamdroid.activities.TimerListActivity.java
/** * Open a <code>TimerEditActivity</code> for timer editing * //w w w.j a v a2 s.c o m * @param timer * The timer to be edited */ private void editTimer(ExtendedHashMap timer, boolean newTimer) { Intent intent = new Intent(this, TimerEditActivity.class); ExtendedHashMap data = new ExtendedHashMap(); data.put("timer", timer); intent.putExtra(sData, data); if (!newTimer) { intent.setAction(Intent.ACTION_EDIT); } else { intent.setAction(DreamDroid.ACTION_NEW); } this.startActivityForResult(intent, CHANGE_TIMER_REQUEST); }
From source file:org.hfoss.posit.android.api.fragment.FindFragment.java
/** * This may be invoked by a FindActivity subclass, which may or may not have * latitude and longitude fields.// ww w .j a v a 2s . co m */ @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Sets listeners for various UI elements initializeListeners(); mAddFindMenuPlugins = FindPluginManager.getFunctionPlugins(FindPluginManager.ADD_FIND_MENU_EXTENSION); setHasOptionsMenu(true); // Initialize all UI elements for later uses mNameET = (EditText) getView().findViewById(R.id.nameEditText); mDescriptionET = (EditText) getView().findViewById(R.id.descriptionEditText); mGuidTV = (TextView) getView().findViewById(R.id.guidValueTextView); mGuidRealTV = (TextView) getView().findViewById(R.id.guidRealValueTextView); mTimeTV = (TextView) getView().findViewById(R.id.timeValueTextView); mLatTV = (TextView) getView().findViewById(R.id.latitudeTextView); mLatitudeTV = (TextView) getView().findViewById(R.id.latitudeValueTextView); mLongTV = (TextView) getView().findViewById(R.id.longitudeTextView); mLongitudeTV = (TextView) getView().findViewById(R.id.longitudeValueTextView); mAdhocTV = (TextView) getView().findViewById(R.id.isAdhocTextView); // Check if settings allow Geotagging SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mGeoTagEnabled = prefs.getBoolean("geotagKey", true); // If enabled, get location manager and provider if (mGeoTagEnabled) { mLocationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); } // Set the content of UI elements, either auto-generated or retrieved // from a Find Bundle extras = getArguments(); if (extras != null && !(extras.size() == 1 && extras.containsKey("ACTION"))) { // Existing Find if (getAction().equals(Intent.ACTION_EDIT)) { int id = extras.getInt(Find.ORM_ID); Log.i(TAG, "ORM_id = " + id); // Find find = getHelper().getFindById(id); mFind = getHelper().getFindById(id); Log.i(TAG, "Updating: " + mFind); displayContentInView(mFind); } else // Bundled Find (from SMS) if (getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { // Pull a Bundle corresponding to a Find from the Intent and put // that in the view Bundle findBundle = extras.getBundle("findbundle"); //Find find; try { FindPlugin plugin = FindPluginManager.mFindPlugin; if (plugin == null) { Log.e(TAG, "Could not retrieve Find Plugin."); Toast.makeText(getActivity(), "A fatal error occurred while trying to start FindActivity", Toast.LENGTH_LONG).show(); getActivity().finish(); return; } mFind = plugin.getmFindClass().newInstance(); } catch (IllegalAccessException e) { Toast.makeText(getActivity(), "A fatal error occurred while trying to start FindActivity", Toast.LENGTH_LONG).show(); getActivity().finish(); return; } catch (java.lang.InstantiationException e) { Toast.makeText(getActivity(), "A fatal error occurred while trying to start FindActivity", Toast.LENGTH_LONG).show(); getActivity().finish(); return; } mFind.updateObject(findBundle); displayContentInView(mFind); } else // CSV Find if (getAction().equals(CsvListFindsFragment.ACTION_CSV_FINDS)) { } // New Find } else { Log.i("TAG", "new find"); // Set real GUID if (mGuidRealTV != null) mGuidRealTV.setText(UUID.randomUUID().toString()); // Set displayed GUID if (mGuidTV != null) mGuidTV.setText(mGuidRealTV.getText().toString().substring(0, 8) + "..."); // Set Time if (mTimeTV != null) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); mTimeTV.setText(dateFormat.format(date)); } if (mGeoTagEnabled) { // Set Longitude and Latitude mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 60000, 0, this); mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this); Location netLocation = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); Location gpsLocation = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (gpsLocation != null) { mCurrentLocation = gpsLocation; } else { mCurrentLocation = netLocation; } if (mCurrentLocation == null) { Log.i(TAG, "Location issue, mCurrentLocation = " + mCurrentLocation); if (mLongitudeTV != null) mLongitudeTV.setText("0.0"); if (mLatitudeTV != null) mLatitudeTV.setText("0.0"); // Toast.makeText(this, "Unable to retrieve GPS info." + // " Please make sure your Data or Wi-Fi is enabled.", // Toast.LENGTH_SHORT).show(); // Log.i(TAG, // "Cannot request location updates; Data or Wifi might not be enabled."); } else { if (mLongitudeTV != null) mLongitudeTV.setText(String.valueOf(mCurrentLocation.getLongitude())); if (mLatitudeTV != null) mLatitudeTV.setText(String.valueOf(mCurrentLocation.getLatitude())); } } else { if (mLongitudeTV != null && mLongTV != null) { mLongitudeTV.setVisibility(TextView.INVISIBLE); mLongTV.setVisibility(TextView.INVISIBLE); } if (mLatitudeTV != null && mLatTV != null) { mLatitudeTV.setVisibility(TextView.INVISIBLE); mLatTV.setVisibility(TextView.INVISIBLE); } } } }
From source file:com.hangulo.powercontact.ErrorContactsListFragment.java
@Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { PowerContactAddress item = mErrorContactList.get(position); // ? ? ? --> . mPosition = position; // ?? ? mLastDataId = item.getData_id();//from ww w . j a va 2 s . co m mLastContactId = item.getContact_id(); mLastLookupKey = item.getLookup_key(); Uri mSelectedContactUri = ContactsContract.Contacts.getLookupUri(mLastContactId, mLastLookupKey); // Creates a new Intent to edit a contact Intent editIntent = new Intent(Intent.ACTION_EDIT); /* * Sets the contact URI to edit, and the data type that the * Intent must match */ editIntent.setDataAndType(mSelectedContactUri, ContactsContract.Contacts.CONTENT_ITEM_TYPE); // Sets the special extended data for navigation editIntent.putExtra("finishActivityOnSaveCompleted", true); // Sends the Intent getActivity().startActivityForResult(editIntent, Constants.RESULT_ERROR_CONTACTSLIST); }