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.dahl.brendan.wordsearch.view.WordSearchActivity.java
/** when menu button option selected */ @Override//from w w w .java 2 s. c o m public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_scores: this.showDialog(DIALOG_ID_HIGH_SCORES_LOCAL_SHOW); return true; case R.id.menu_options: startActivity(new Intent(this, WordSearchPreferences.class)); return true; case R.id.menu_new: control.newWordSearch(); return true; case R.id.menu_custom: { Intent intent = new Intent(Intent.ACTION_EDIT, Word.CONTENT_URI); intent.setType(Word.CONTENT_TYPE); this.startActivity(intent); return true; } case R.id.menu_tutorial: { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(this, TutorialActivity.class); startActivity(intent); return true; } case R.id.menu_donate: { this.showDialog(DIALOG_ID_DONATE); return true; } default: return super.onOptionsItemSelected(item); } }
From source file:it.geosolutions.geocollect.android.map.GeoCollectMapActivity.java
/** * Add controls to the mapView and to the Buttons * // ww w . j a va 2s .c om * @param savedInstanceState */ private void addControls(Bundle savedInstanceState) { String action = getIntent().getAction(); Log.v(TAG, "action: " + action); // Coordinate Control mapView.addControl(new CoordinateControl(mapView, true)); List<MapControl> group = new ArrayList<MapControl>(); // Info Control MapInfoControl ic; if (getIntent().hasExtra(MapsActivity.PARAMETERS.CUSTOM_MAPINFO_CONTROL)) { ic = (MapInfoControl) getIntent().getParcelableExtra(MapsActivity.PARAMETERS.CUSTOM_MAPINFO_CONTROL); ic.activity = this; ic.mapView = mapView; ic.instantiateListener(); } else { ic = new MapInfoControl(mapView, this); } ic.setActivationButton((ImageButton) findViewById(R.id.ButtonInfo)); mapView.addControl(ic); if (!Intent.ACTION_VIEW.equals(action)) { Log.v(TAG, "Adding MarkerControl"); // Marker Control MarkerControl mc = new MarkerControl(mapView); // activation button ImageButton mcbmb = (ImageButton) findViewById(R.id.ButtonMarker); mcbmb.setVisibility(View.VISIBLE); mc.setActivationButton(mcbmb); // info button ImageButton mcib = (ImageButton) findViewById(R.id.marker_info_button); mcib.setVisibility(View.VISIBLE); mc.setInfoButton(mcib); mapView.addControl(mc); group.add(mc); mc.setGroup(group); mc.setMode(MarkerControl.MODE_EDIT); } // My location Control LocationControl lc = new LocationControl(mapView); lc.setActivationButton((ImageButton) findViewById(R.id.ButtonLocation)); mapView.addControl(lc); // create and add group group.add(ic); ic.setGroup(group); // Set modes for controls if (Intent.ACTION_VIEW.equals(action)) { ic.setMode(MapInfoControl.MODE_VIEW); } else if (Intent.ACTION_EDIT.equals(action)) { ic.setMode(MapInfoControl.MODE_EDIT); // Default edit mode } else { ic.setMode(MapInfoControl.MODE_EDIT); } if (savedInstanceState != null) { for (MapControl c : mapView.getControls()) { c.restoreState(savedInstanceState); } } }
From source file:com.money.manager.ex.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // process item Intent intent;//from www . ja v a 2 s.co m // quick-fix convert 'switch' to 'if-else' if (item.getItemId() == android.R.id.home) { if (mDrawer != null) { if (mDrawer.isDrawerOpen(mDrawerLayout)) { mDrawer.closeDrawer(mDrawerLayout); } else { mDrawer.openDrawer(mDrawerLayout); } } } else if (item.getItemId() == R.id.menu_search_transaction) { startActivity(new Intent(this, SearchActivity.class)); } else if (item.getItemId() == R.id.menu_dashboard) { showDashboardFragment(); } else if (item.getItemId() == R.id.menu_sync_dropbox) { startServiceSyncDropbox(); } else if (item.getItemId() == R.id.menu_account) { // manage accounts intent = new Intent(this, AccountListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } else if (item.getItemId() == R.id.menu_category) { // manage category intent = new Intent(this, CategorySubCategoryExpandableListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } else if (item.getItemId() == R.id.menu_payee) { // manage payee intent = new Intent(this, PayeeActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } else if (item.getItemId() == R.id.menu_repeating_transaction) { startActivity(new Intent(this, RepeatingTransactionListActivity.class)); } else if (item.getItemId() == R.id.menu_currency) { intent = new Intent(this, CurrencyFormatsListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } else if (item.getItemId() == R.id.menu_open_database) { pickFile(Environment.getExternalStorageDirectory()); } else if (item.getItemId() == R.id.menu_settings) { startActivity(new Intent(this, PreferencesActivity.class)); } else if (item.getItemId() == R.id.menu_report_where_money_goes) { intent = new Intent(this, CategoriesReportActivity.class); intent.putExtra(CategoriesReportActivity.REPORT_FILTERS, Constants.TRANSACTION_TYPE_WITHDRAWAL); intent.putExtra(CategoriesReportActivity.REPORT_TITLE, item.getTitle()); startActivity(intent); } else if (item.getItemId() == R.id.menu_report_where_money_comes_from) { intent = new Intent(this, CategoriesReportActivity.class); intent.putExtra(CategoriesReportActivity.REPORT_FILTERS, Constants.TRANSACTION_TYPE_DEPOSIT); intent.putExtra(CategoriesReportActivity.REPORT_TITLE, item.getTitle()); startActivity(intent); } else if (item.getItemId() == R.id.menu_report_categories) { startActivity(new Intent(this, CategoriesReportActivity.class)); } else if (item.getItemId() == R.id.menu_report_payees) { startActivity(new Intent(this, PayeesReportActivity.class)); } else if (item.getItemId() == R.id.menu_report_income_vs_expenses) { startActivity(new Intent(this, IncomeVsExpensesActivity.class)); } else if (item.getItemId() == R.id.menu_help) { intent = new Intent(getApplicationContext(), HelpActivity.class); intent.setData(Uri.parse("android.resource://com.money.manager.ex/" + R.raw.help)); startActivity(intent); } else if (item.getItemId() == R.id.menu_about) { // open about activity startActivity(new Intent(this, AboutActivity.class)); } else if (item.getItemId() == R.id.menu_donate) { startActivity(new Intent(this, DonateActivity.class)); } else if (item.getItemId() == R.id.menu_exit) { // close application exitApplication(); } return super.onOptionsItemSelected(item); }
From source file:com.owncloud.android.ui.activity.FileDisplayActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { boolean retval = true; switch (item.getItemId()) { case R.id.action_create_dir: { EditNameDialog dialog = EditNameDialog.newInstance(getString(R.string.uploader_info_dirname), "", -1, -1, this); dialog.show(getSupportFragmentManager(), "createdirdialog"); break;//from w w w . j a v a 2 s . com } case R.id.action_sync_account: { startSynchronization(); break; } case R.id.action_upload: { showDialog(DIALOG_CHOOSE_UPLOAD_SOURCE); break; } case R.id.action_settings: { Intent settingsIntent = new Intent(this, Preferences.class); startActivity(settingsIntent); break; } case R.id.action_create_file: { final String currentDir = getCurrentDir().getRemotePath(); if (!currentDir.contains("Shared")) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Create new file "); alert.setMessage("Please enter the name of the file "); LayoutInflater factor = LayoutInflater.from(getApplicationContext()); final View deleteDialogView = factor.inflate(R.layout.enter_filename_dialog, null); alert.setView(deleteDialogView); final EditText edittext = (EditText) deleteDialogView.findViewById(R.id.filename); //Log.d(TAG, getCurrentDir().getRemotePath()); alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { value = edittext.getText().toString(); Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext()); // Log.d(TAG, "you entre "+str+" "+value); int flag = 0; String[] fspl = value.toString().split("\\."); String taskInput; if (fspl.length == 1) { value = value + ".txt"; } else if (!fspl[fspl.length - 1].equals("txt")) { value = value + ".txt"; } uri = "file:///sdcard/ownCloud/" + account.name + currentDir + value; final File f2 = new File(Environment.getExternalStorageDirectory(), "ownCloud/" + account.name + currentDir); final File f1 = new File(Environment.getExternalStorageDirectory(), "ownCloud/" + account.name + currentDir + value); try { if (!f2.exists()) { f2.mkdirs(); } if (f1.createNewFile()) { Intent intent = new Intent(Intent.ACTION_EDIT); intent.setDataAndType(Uri.parse(uri), "text/plain"); startActivity(intent); flag = 1; } } catch (IOException e) { e.printStackTrace(); } finally { if (flag == 1) { taskInput = f1.getAbsolutePath() + "#" + currentDir + value; new displayFileTask(taskInput).execute(); } } } }); alert.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert.show(); } else { Toast.makeText(getApplicationContext(), "You cannot create files here ", Toast.LENGTH_SHORT).show(); } break; } case R.id.action_friend: { Intent friendsIntent = new Intent(this, TabLayoutActivity.class); startActivity(friendsIntent); break; } case R.id.action_group: { Intent groupIntent = new Intent(this, GroupActivity.class); startActivity(groupIntent); } break; case android.R.id.home: { FileFragment second = getSecondFragment(); OCFile currentDir = getCurrentDir(); if ((currentDir != null && currentDir.getParentId() != 0) || (second != null && second.getFile() != null)) { onBackPressed(); } break; } default: retval = super.onOptionsItemSelected(item); } return retval; }
From source file:org.hfoss.posit.android.api.fragment.FindFragment.java
/** * Save the find which is displayed in the fragment * // w w w . j a v a 2s . c om * @return success of saving the find */ @SuppressWarnings("unchecked") protected boolean saveFind() { Log.i(TAG, "saveFind()"); int rows = 0; Find find = retrieveContentFromView(); prepareForSave(find); // A valid GUID is required if (!isValidGuid(find.getGuid())) { Toast.makeText(getActivity(), "You must provide a valid Id for this Find.", Toast.LENGTH_LONG).show(); return false; } // A name is not always required in derived classes String name = find.getName(); if (name != null && name.equals("")) { // if (find.getName().equals("")){ Toast.makeText(getActivity(), "You must provide a name for this Find.", Toast.LENGTH_LONG).show(); return false; } // Either create a new Find or update the existing Find if (getAction().equals(Intent.ACTION_INSERT)) rows = getHelper().insert(find); else if (getAction().equals(Intent.ACTION_EDIT)) { find.setId(getArguments().getInt(Find.ORM_ID)); find.setStatus(Find.IS_NOT_SYNCED); rows = getHelper().update(find); } else if (getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { // Check if a Find with the same GUID already exists and update it if so Find sameguid = getHelper().getFindByGuid(find.getGuid()); if (sameguid == null) { rows = getHelper().insert(find); } else { find.setId(sameguid.getId()); rows = getHelper().update(find); } } else rows = 0; // Something wrong with intent if (rows > 0) { Log.i(TAG, "Find " + getAction() + " successful: " + find); } else Log.e(TAG, "Find " + getAction() + " not successful: " + find); /** * For each plugin, call its displayFindInViewCallback. */ for (FunctionPlugin plugin : mAddFindMenuPlugins) { Log.i(TAG, "plugin=" + plugin); Class<AddFindPluginCallback> callbackClass = null; Object o; try { View view = getView(); String className = plugin.getAddFindCallbackClass(); if (className != null) { callbackClass = (Class<AddFindPluginCallback>) Class.forName(className); o = (AddFindPluginCallback) callbackClass.newInstance(); ((AddFindPluginCallback) o).afterSaveCallback(getActivity().getApplication(), find, view, rows > 0); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } } return rows > 0; }
From source file:eu.thecoder4.gpl.pleftdroid.EventDetailActivity.java
public void addToCalendar(int i) { ADate ad = adates.get(i);// ww w .ja va 2 s . c om String pd = ad.getD(); String dpart = pd.substring(0, pd.indexOf('T')); String tpart = pd.substring(pd.indexOf('T') + 1); SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar cal = Calendar.getInstance(); Date d = null; try { d = sdf.parse(dpart + " " + tpart); } catch (ParseException e) { e.printStackTrace(); } cal.setTime(d); Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", cal.getTimeInMillis()); intent.putExtra("endTime", cal.getTimeInMillis() + 60 * 60 * 1000); intent.putExtra("title", adesc); startActivity(intent); }
From source file:com.money.manager.ex.common.AllDataListFragment.java
/** * start the activity of transaction management * * @param transId null set if you want to do a new transaction, or transaction id *///w w w . j av a2 s . com private void startEditAccountTransactionActivity(Integer transId) { // create intent, set Account ID Intent intent = new Intent(getActivity(), CheckingTransactionEditActivity.class); // check transId not null if (transId != null) { intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_ID, transId); intent.setAction(Intent.ACTION_EDIT); } else { intent.putExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID, this.AccountId); intent.setAction(Intent.ACTION_INSERT); } // launch activity startActivity(intent); }
From source file:com.maskyn.fileeditorpro.activity.MainActivity.java
/** * Parses the intent// www . j av a 2 s.com */ private void parseIntent(Intent intent) { final String action = intent.getAction(); final String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action) || Intent.ACTION_PICK.equals(action) && type != null) { // Post event //newFileToOpen(new File(intent // .getData().getPath()), ""); Uri uri = intent.getData(); GreatUri newUri = new GreatUri(uri, AccessStorageApi.getPath(this, uri), AccessStorageApi.getName(this, uri)); newFileToOpen(newUri, ""); } else if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { newFileToOpen(new GreatUri(Uri.EMPTY, "", ""), intent.getStringExtra(Intent.EXTRA_TEXT)); } } }
From source file:com.money.manager.ex.account.AccountTransactionListFragment.java
/** * start the activity of transaction management * * @param transId null set if you want to do a new transaction, or transaction id *///w w w . j av a 2 s . c o m private void startCheckingAccountActivity(Integer transId) { // create intent, set Account ID Intent intent = new Intent(getActivity(), CheckingTransactionEditActivity.class); intent.putExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID, mAccountId); // check transId not null if (transId != null) { intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_ID, transId); intent.setAction(Intent.ACTION_EDIT); } else { intent.setAction(Intent.ACTION_INSERT); } // launch activity startActivity(intent); }
From source file:cz.maresmar.sfm.view.MainActivity.java
@Override public boolean onProfileChanged(View view, IProfile profile, boolean current) { switch (view.getId()) { case ADD_USER_DRAWER_ITEM_ID: { Intent intent = new Intent(this, UserListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent);//from ww w. j ava2s. c om return true; } case MANAGE_USERS_DRAWER_ID: { Intent intent = new Intent(this, UserListActivity.class); startActivity(intent); return true; } default: { mSelectedUserId = profile.getIdentifier(); mProfiles.setActiveProfile(profile); // Update other UIs data getSupportLoaderManager().restartLoader(PORTAL_LOADER_ID, null, this); getSupportLoaderManager().restartLoader(CREDENTIAL_LOADER_ID, null, this); getSupportLoaderManager().restartLoader(EDIT_ACTIONS_COUNT_LOADER_ID, null, this); return true; } } }