List of usage examples for android.content Intent ACTION_INSERT_OR_EDIT
String ACTION_INSERT_OR_EDIT
To view the source code for android.content Intent ACTION_INSERT_OR_EDIT.
Click Source Link
From source file:org.gnucash.android.ui.transaction.TransactionsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(findViewById(android.R.id.content).getWindowToken(), 0); FragmentManager fm = getSupportFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStack();/*w w w . j av a2 s . co m*/ } else { AccountsActivity.start(this); finish(); } return true; case R.id.menu_favorite_account: AccountsDbAdapter accountsDbAdapter = new AccountsDbAdapter(this); boolean isFavorite = accountsDbAdapter.isFavoriteAccount(mAccountId); //toggle favorite preference accountsDbAdapter.updateAccount(mAccountId, DatabaseHelper.KEY_FAVORITE, isFavorite ? "0" : "1"); accountsDbAdapter.close(); supportInvalidateOptionsMenu(); return true; case R.id.menu_edit_account: Intent editAccountIntent = new Intent(this, AccountsActivity.class); editAccountIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); editAccountIntent.putExtra(UxArgument.SELECTED_ACCOUNT_ID, mAccountId); startActivityForResult(editAccountIntent, AccountsActivity.REQUEST_EDIT_ACCOUNT); return true; default: return false; } }
From source file:com.android.mms.rcs.FavoriteDetailAdapter.java
private static void mergeVcardDetail(Context context, ArrayList<PropertyNode> propList) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); ArrayList<ContentValues> phoneValue = new ArrayList<ContentValues>(); for (PropertyNode propertyNode : propList) { if ("FN".equals(propertyNode.propName)) { if (!TextUtils.isEmpty(propertyNode.propValue)) { intent.putExtra(ContactsContract.Intents.Insert.NAME, propertyNode.propValue); }//from ww w . ja va 2 s. co m } else if ("TEL".equals(propertyNode.propName)) { if (!TextUtils.isEmpty(propertyNode.propValue)) { ContentValues value = new ContentValues(); value.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE); value.put(Phone.TYPE, RcsUtils.getVcardNumberType(propertyNode)); value.put(Phone.NUMBER, propertyNode.propValue); phoneValue.add(value); } } else if ("ADR".equals(propertyNode.propName)) { if (!TextUtils.isEmpty(propertyNode.propValue)) { intent.putExtra(ContactsContract.Intents.Insert.POSTAL, propertyNode.propValue); intent.putExtra(ContactsContract.Intents.Insert.POSTAL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK); } } else if ("ORG".equals(propertyNode.propName)) { if (!TextUtils.isEmpty(propertyNode.propValue)) { intent.putExtra(ContactsContract.Intents.Insert.COMPANY, propertyNode.propValue); } } else if ("TITLE".equals(propertyNode.propName)) { if (!TextUtils.isEmpty(propertyNode.propValue)) { intent.putExtra(ContactsContract.Intents.Insert.JOB_TITLE, propertyNode.propValue); } } } if (phoneValue.size() > 0) { intent.putParcelableArrayListExtra(Insert.DATA, phoneValue); } intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); context.startActivity(intent); }
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
private boolean isActionInsertOrEdit() { return TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, getIntent().getAction()); }
From source file:org.gnucash.android.ui.transaction.TransactionsActivity.java
/** * Opens a dialog fragment to create a new account which is a sub account of the current account * @param v View which triggered this callback *//* ww w .j ava 2s .c o m*/ public void onNewAccountClick(View v) { Intent addAccountIntent = new Intent(this, AccountsActivity.class); addAccountIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); addAccountIntent.putExtra(UxArgument.PARENT_ACCOUNT_ID, mAccountId); startActivityForResult(addAccountIntent, AccountsActivity.REQUEST_EDIT_ACCOUNT); }
From source file:org.gnucash.android.ui.transaction.TransactionsActivity.java
@Override public void createNewTransaction(long accountRowId) { Intent createTransactionIntent = new Intent(this.getApplicationContext(), TransactionsActivity.class); createTransactionIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); createTransactionIntent.putExtra(UxArgument.SELECTED_ACCOUNT_ID, accountRowId); startActivity(createTransactionIntent); }
From source file:org.gnucash.android.ui.transaction.TransactionsActivity.java
@Override public void editTransaction(long transactionId) { Intent createTransactionIntent = new Intent(this.getApplicationContext(), TransactionsActivity.class); createTransactionIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); createTransactionIntent.putExtra(UxArgument.SELECTED_ACCOUNT_ID, mAccountId); createTransactionIntent.putExtra(UxArgument.SELECTED_TRANSACTION_ID, transactionId); startActivity(createTransactionIntent); }
From source file:com.android.mms.ui.ConversationList.java
public static Intent createAddContactIntent(String address) { // address must be a single recipient Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); if (Mms.isEmailAddress(address)) { intent.putExtra(ContactsContract.Intents.Insert.EMAIL, address); } else {//from w w w. jav a 2 s . c om intent.putExtra(ContactsContract.Intents.Insert.PHONE, address); intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE); } intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); return intent; }
From source file:org.hfoss.posit.android.api.fragment.FindFragment.java
/** * Retrieves values from the View fields and stores them in a Find instance. * This method is invoked from the Save menu item. It also marks the find * 'unsynced' so it will be updated to the server. * //from w ww . j av a 2s .c o m * @return a new Find object with data from the view. */ protected Find retrieveContentFromView() { // Get the appropriate find class from the plug-in // manager and make an instance of it Class<Find> findClass = FindPluginManager.mFindPlugin.getmFindClass(); Find find = null; if (getAction().equals(Intent.ACTION_EDIT) || getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { find = mFind; } else { try { find = findClass.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } } // Set GUID // NOTE: Some derived finds may not have a GUID field. But the Guid must // be // set anyway because it used as the Find ID by the Posit server. if (mGuidRealTV != null) { find.setGuid(mGuidRealTV.getText().toString()); } else { find.setGuid(UUID.randomUUID().toString()); } // Set Time if (mTimeTV != null) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); String value = mTimeTV.getText().toString(); if (value.length() == 10) { dateFormat = new SimpleDateFormat("yyyy/MM/dd"); } try { find.setTime(dateFormat.parse(value)); } catch (ParseException e) { e.printStackTrace(); } } // Set Name if (mNameET != null) { find.setName(mNameET.getText().toString()); } // Set Description if (mDescriptionET != null) { find.setDescription(mDescriptionET.getText().toString()); } // Set Longitude and Latitude if (mLatitudeTV != null && mLongitudeTV != null) { if (mGeoTagEnabled && (!mLatitudeTV.getText().equals("Getting latitude...") && !mLongitudeTV.getText().equals("Getting longitude..."))) { find.setLatitude(Double.parseDouble(mLatitudeTV.getText().toString())); find.setLongitude(Double.parseDouble(mLongitudeTV.getText().toString())); } else { find.setLatitude(0); find.setLongitude(0); } } if (mAdhocTV != null) { find.setIs_adhoc(Integer.parseInt((String) mAdhocTV.getText())); } // Set Project ID SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int projectId = prefs.getInt(getString(R.string.projectPref), 0); find.setProject_id(projectId); // Mark the find unsynced // find.setSynced(Find.NOT_SYNCED); return find; }
From source file:com.songcode.materialnotes.ui.NotesListActivity.java
private void createNewNote() { ActivityOptionsCompat optionsCompat = TransitionHelper.makeOptionsCompat(this); Intent intent = new Intent(this, NoteEditActivity.class); intent.setAction(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId); BitmapUtil.storeBitmapInIntent(BitmapUtil.createBitmap(findViewById(R.id.drawer_layout)), intent); ActivityCompat.startActivityForResult(this, intent, REQUEST_CODE_NEW_NODE, optionsCompat.toBundle()); }
From source file:org.gnucash.android.ui.account.AccountFormFragment.java
/** * Finishes the fragment appropriately.// w w w .ja v a 2s . c o m * Depends on how the fragment was loaded, it might have a backstack or not */ private void finishFragment() { InputMethodManager imm = (InputMethodManager) getSherlockActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mNameEditText.getWindowToken(), 0); final String action = getActivity().getIntent().getAction(); if (action != null && action.equals(Intent.ACTION_INSERT_OR_EDIT)) { getActivity().setResult(Activity.RESULT_OK); getActivity().finish(); } else { getSherlockActivity().getSupportFragmentManager().popBackStack(); } }