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:org.brandroid.openmanager.activities.OpenExplorer.java
/** * Returns true if the Intent was "Handled" * @param intent Input Intent//w w w .ja va 2 s .c o m */ public boolean handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { OpenPath searchIn = new OpenFile("/"); Bundle bundle = intent.getBundleExtra(SearchManager.APP_DATA); if (bundle != null && bundle.containsKey("path")) try { searchIn = FileManager.getOpenCache(bundle.getString("path"), false, null); } catch (IOException e) { searchIn = new OpenFile(bundle.getString("path")); } String query = intent.getStringExtra(SearchManager.QUERY); Logger.LogDebug("ACTION_SEARCH for \"" + query + "\" in " + searchIn); SearchResultsFragment srf = SearchResultsFragment.getInstance(searchIn, query); if (mViewPagerEnabled && mViewPagerAdapter != null) { mViewPagerAdapter.add(srf); setViewPageAdapter(mViewPagerAdapter, true); setCurrentItem(mViewPagerAdapter.getCount() - 1, true); } else { getSupportFragmentManager().beginTransaction().replace(R.id.content_frag, srf).commit(); } } else if ((Intent.ACTION_VIEW.equals(intent.getAction()) || Intent.ACTION_EDIT.equals(intent.getAction())) && intent.getData() != null) { OpenPath path = FileManager.getOpenCache(intent.getDataString(), this); if (editFile(path)) return true; } else if (intent.hasExtra("state")) { Bundle state = intent.getBundleExtra("state"); onRestoreInstanceState(state); } return false; }
From source file:com.silentcircle.contacts.editor.ContactEditorFragment.java
public void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded, Uri contactLookupUri) { if (hadChanges) { if (saveSucceeded) { if (saveMode != SaveMode.JOIN) { Toast.makeText(mContext, R.string.contactSavedToast, Toast.LENGTH_SHORT).show(); }/*from w w w. ja va 2 s. c o m*/ } else { Toast.makeText(mContext, R.string.contactSavedErrorToast, Toast.LENGTH_LONG).show(); } } switch (saveMode) { case SaveMode.CLOSE: case SaveMode.HOME: final Intent resultIntent; if (saveSucceeded && contactLookupUri != null) { final String requestAuthority = mLookupUri == null ? null : mLookupUri.getAuthority(); resultIntent = new Intent(); resultIntent.setAction(Intent.ACTION_VIEW); // Otherwise pass back a lookup-style Uri resultIntent.setData(contactLookupUri); } else { resultIntent = null; } // It is already saved, so prevent that it is saved again mStatus = Status.CLOSING; if (mListener != null) mListener.onSaveFinished(resultIntent); break; case SaveMode.RELOAD: case SaveMode.JOIN: if (saveSucceeded && contactLookupUri != null) { // // If it was a JOIN, we are now ready to bring up the join activity. // if (saveMode == SaveMode.JOIN && hasValidState()) { // showJoinAggregateActivity(contactLookupUri); // } // If this was in INSERT, we are changing into an EDIT now. // If it already was an EDIT, we are changing to the new Uri now mState = null; load(Intent.ACTION_EDIT, contactLookupUri, null); mStatus = Status.LOADING; getLoaderManager().restartLoader(LOADER_DATA, null, mDataLoaderListener); } break; case SaveMode.SPLIT: mStatus = Status.CLOSING; if (mListener != null) { mListener.onContactSplit(contactLookupUri); } else { Log.d(TAG, "No listener registered, can not call onSplitFinished"); } break; } }
From source file:com.android.gallery3d.app.PhotoPage.java
private void launchPhotoEditor() { /// M: [BUG.ADD] abort editing photo if loading fail @{ if (mModel != null && mModel.getLoadingState(0) == PhotoView.Model.LOADING_FAIL) { Log.i(TAG, "<launchPhotoEditor> abort editing photo if loading fail!"); Toast.makeText(mActivity, mActivity.getString(R.string.cannot_load_image), Toast.LENGTH_SHORT).show(); return;//from w w w .j a va 2 s . c om } /// @} MediaItem current = mModel.getMediaItem(0); if (current == null || (current.getSupportedOperations() & MediaObject.SUPPORT_EDIT) == 0) { return; } Intent intent = new Intent(ACTION_NEXTGEN_EDIT); /// M: [BUG.MODIFY] create new task when launch photo editor from camera // gallery and photo editor use same task stack @{ /* intent.setDataAndType(current.getContentUri(), current.getMimeType()) .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); */ intent.setDataAndType(current.getContentUri(), current.getMimeType()) .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); /// @} if (mActivity.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY) .size() == 0) { intent.setAction(Intent.ACTION_EDIT); } intent.putExtra(FilterShowActivity.LAUNCH_FULLSCREEN, mActivity.isFullscreen()); /// M: [FEATURE.ADD] @{ // for special image, no need to delete origin image when save, such as continuous shot ExtItem extItem = current.getExtItem(); if (extItem != null && !extItem.isDeleteOriginFileAfterEdit()) { // if current photo is last image in continuous shot group, not // set NEED_SAVE_AS as true if (mModel instanceof PhotoDataAdapter) { int size = ((PhotoDataAdapter) mModel).getTotalCount(); MediaData md = current.getMediaData(); if (size == 1 && md.mediaType == MediaData.MediaType.NORMAL && md.subType == MediaData.SubType.CONSHOT) { intent.putExtra(FilterShowActivity.NEED_SAVE_AS, false); Log.i(TAG, "<launchPhotoEditor> edit the last image in continuous shot group," + " not set NEED_SAVE_AS as true"); } else { intent.putExtra(FilterShowActivity.NEED_SAVE_AS, true); } } else { intent.putExtra(FilterShowActivity.NEED_SAVE_AS, true); } } /// @} /// M: [BUG.MODIFY] @{ // Make ChooserActivity and GalleryActivity in different tasks. /* * ((Activity)mActivity).startActivityForResult(Intent.createChooser(intent * , null), REQUEST_EDIT); */ ((Activity) mActivity).startActivityForResult( Intent.createChooser(intent, null).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), REQUEST_EDIT); /// @} overrideTransitionToEditor(); }
From source file:com.android.gallery3d.app.PhotoPage.java
private void launchSimpleEditor() { MediaItem current = mModel.getMediaItem(0); if (current == null || (current.getSupportedOperations() & MediaObject.SUPPORT_EDIT) == 0) { return;//from w w w . jav a2 s.c o m } Intent intent = new Intent(ACTION_SIMPLE_EDIT); intent.setDataAndType(current.getContentUri(), current.getMimeType()) .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); if (mActivity.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY) .size() == 0) { intent.setAction(Intent.ACTION_EDIT); } intent.putExtra(FilterShowActivity.LAUNCH_FULLSCREEN, mActivity.isFullscreen()); ((Activity) mActivity).startActivityForResult(Intent.createChooser(intent, null), REQUEST_EDIT); overrideTransitionToEditor(); }
From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java
@Override public void chooseForm(Uri formUri) { Intent i = new Intent(Intent.ACTION_EDIT, formUri, this, MainMenuActivity.class); startActivityForResult(i, INTERNAL_ACTIVITY_CODE); }
From source file:com.ringdroid.RingdroidEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {//from w w w .j a v a 2 s . c o m Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName(this, "com.ringdroid.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Ringdroid", "Couldn't open Choose Contact window"); } }
From source file:mobi.omegacentauri.ptimer.PTimerEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {//from ww w . ja v a2 s.co m Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName("mobi.omegacentauri.ptimer", "mobi.omegacentauri.ptimer.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Ringdroid", "Couldn't open Choose Contact window"); } }
From source file:com.tct.mail.ui.AbstractActivityController.java
public void changeAccount(Account account) { LogUtils.d(LOG_TAG, "AAC.changeAccount(%s)", account); // Is the account or account settings different from the existing account? final boolean firstLoad = mAccount == null; final boolean accountChanged = firstLoad || !account.uri.equals(mAccount.uri); // If nothing has changed, return early without wasting any more time. if (!accountChanged && !account.settingsDiffer(mAccount)) { return;//from w w w . ja va2 s . c o m } // We also don't want to do anything if the new account is null if (account == null) { LogUtils.e(LOG_TAG, "AAC.changeAccount(null) called."); return; } final String emailAddress = account.getEmailAddress(); mHandler.post(new Runnable() { @Override public void run() { MailActivity.setNfcMessage(emailAddress); } }); if (accountChanged) { commitDestructiveActions(false); } Analytics.getInstance().setCustomDimension(Analytics.CD_INDEX_ACCOUNT_TYPE, AnalyticsUtils.getAccountTypeForAccount(emailAddress)); // Change the account here setAccount(account); // And carry out associated actions. cancelRefreshTask(); if (accountChanged) { loadAccountInbox(); } // Check if we need to force setting up an account before proceeding. if (mAccount != null && !Uri.EMPTY.equals(mAccount.settings.setupIntentUri)) { // Launch the intent! final Intent intent = new Intent(Intent.ACTION_EDIT); intent.setPackage(mContext.getPackageName()); intent.setData(mAccount.settings.setupIntentUri); mActivity.startActivity(intent); } }
From source file:com.nononsenseapps.notepad.ActivityMain.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override/* w w w . j av a 2 s . co m*/ public void onFragmentInteraction(final Uri taskUri, final long listId, final View origin) { final Intent intent = new Intent().setAction(Intent.ACTION_EDIT).setClass(this, ActivityMain_.class) .setData(taskUri).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) .putExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, listId); // User clicked a task in the list // tablet if (fragment2 != null) { // Set the intent here also so rotations open the same item setIntent(intent); getSupportFragmentManager().beginTransaction() .setCustomAnimations(R.anim.slide_in_top, R.anim.slide_out_bottom) .replace(R.id.fragment2, TaskDetailFragment_.getInstance(taskUri)).commitAllowingStateLoss(); taskHint.setVisibility(View.GONE); } // phone else { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN // && origin != null) { // Log.d("nononsenseapps animation", "Animating"); // //intent.putExtra(ANIMATEEXIT, true); // startActivity( // intent, // ActivityOptions.makeCustomAnimation(this, // R.anim.activity_slide_in_left, // R.anim.activity_slide_out_left).toBundle()); // } // else { Log.d("nononsenseapps animation", "Not animating"); startActivity(intent); // } } }
From source file:com.SpeechEd.SpeechEdEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {//w ww . jav a2 s . c om Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName("com.SpeechEd", "com.SpeechEd.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Speech-Ed", "Couldn't open Choose Contact window"); } }