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:bander.notepad.NoteListAppCompat.java
public void onItemClick(AdapterView<?> l, View v, int position, long id) { Uri uri = ContentUris.withAppendedId(getIntent().getData(), id); String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) { setResult(RESULT_OK, new Intent().setData(uri).setClassName(getApplicationContext().getPackageName(), "bander.notepad.NoteEditAppCompat")); } else {// w ww . jav a2s .c om startActivity(new Intent(Intent.ACTION_EDIT, uri).setClassName(getApplicationContext().getPackageName(), "bander.notepad.NoteEditAppCompat")); } }
From source file:edu.mit.mobile.android.locast.itineraries.ItineraryDetail.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info; try {/*from w ww .j a v a 2 s .c om*/ info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); } catch (final ClassCastException e) { Log.e(TAG, "bad menuInfo", e); return false; } final Uri cast = Cast.getCanonicalUri(this, ContentUris.withAppendedId(mCastsUri, info.id)); switch (item.getItemId()) { case R.id.cast_view: startActivity(new Intent(Intent.ACTION_VIEW, cast)); return true; case R.id.cast_edit: startActivity(new Intent(Intent.ACTION_EDIT, cast)); return true; case R.id.cast_delete: startActivity(new Intent(Intent.ACTION_DELETE, cast)); return true; // case R.id.cast_play: // startActivity(new Intent(CastDetailsActivity.ACTION_PLAY_CAST, cast)); // return true; default: return super.onContextItemSelected(item); } }
From source file:com.jaymullen.TrailJournal.EntryActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = getIntent();/*ww w . j a v a 2s . com*/ String title; if (intent.getData() != null) { mEntryUri = intent.getData(); Cursor c = getContentResolver().query(mEntryUri, HomeActivity.Entries.PROJECTION, null, null, JournalEntry.DEFAULT_SORT); if (c.moveToFirst()) { title = c.getString(HomeActivity.Entries.DATE); setPostType(c.getString(HomeActivity.Entries.TYPE)); mIsPublished = c.getInt(HomeActivity.Entries.IS_PUBLISHED) == 1; setValuesOnPages(c); } else { title = "New Entry"; mIsPublished = false; } c.close(); } else { title = "New Entry"; ContentValues cv = new ContentValues(); cv.put(JournalEntry.JOURNAL_ID, Auth.getInstance(this).getJournalId()); cv.put(JournalEntry.IS_PUBLISHED, 0); mEntryUri = getContentResolver().insert(JournalEntry.CONTENT_URI, cv); getIntent().setData(mEntryUri); mIsPublished = false; } getSupportActionBar().setTitle(title); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); if (savedInstanceState != null) { mWizardModel.load(savedInstanceState.getBundle("model")); } mWizardModel.registerListener(this); mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mPagerAdapter); mStepPagerStrip = (StepPagerStrip) findViewById(R.id.strip); mStepPagerStrip.setOnPageSelectedListener(new StepPagerStrip.OnPageSelectedListener() { @Override public void onPageStripSelected(int position) { position = Math.min(mPagerAdapter.getCount() - 1, position); if (mPager.getCurrentItem() != position) { mPager.setCurrentItem(position); } } }); mNextButton = (Button) findViewById(R.id.next_button); mPrevButton = (Button) findViewById(R.id.prev_button); mSaveButton = (Button) findViewById(R.id.save_button); mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { mStepPagerStrip.setCurrentPage(position); if (mConsumePageSelectedEvent) { mConsumePageSelectedEvent = false; return; } mEditingAfterReview = false; updateBottomBar(); } }); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mPager.getCurrentItem() == mCurrentPageSequence.size()) { if (Auth.getInstance(EntryActivity.this).isLoggedIn()) { DialogFragment dg = new DialogFragment() { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setMessage(R.string.submit_confirm_message) .setPositiveButton(R.string.submit_confirm_button, mPublishListener) .setNegativeButton(android.R.string.cancel, null).create(); } }; dg.show(getSupportFragmentManager(), "publish_entry_dialog"); } else { DialogFragment dg = new DialogFragment() { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setMessage(R.string.login_required_login) .setPositiveButton(R.string.login_confirm_button, mLoginListener) .setNegativeButton(android.R.string.cancel, null).create(); } }; dg.show(getSupportFragmentManager(), "publish_entry_dialog"); } } else { if (mEditingAfterReview) { mPager.setCurrentItem(mPagerAdapter.getCount() - 1); } else { mPager.setCurrentItem(mPager.getCurrentItem() + 1); } } } }); mPrevButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mPager.setCurrentItem(mPager.getCurrentItem() - 1); } }); mSaveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { saveEntry(); } }); onPageTreeChanged(); if (intent.getAction() == Intent.ACTION_EDIT) { mPager.setCurrentItem(mPagerAdapter.getCount() - 1); } updateBottomBar(); }
From source file:com.appnexus.opensdk.utils.W3CEvent.java
@SuppressLint({ "NewApi", "InlinedApi" }) public Intent getInsertIntent() { Intent i;/*from w w w .jav a 2 s .co m*/ boolean nativeMethod = (!useMIME && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH); if (nativeMethod) { i = new Intent(Intent.ACTION_EDIT).setData(CalendarContract.Events.CONTENT_URI); } else { i = new Intent(Intent.ACTION_EDIT).setType("vnd.android.cursor.item/event"); } if (!StringUtil.isEmpty(getDescription())) { if (nativeMethod) { i.putExtra(CalendarContract.Events.TITLE, getDescription()); } else { i.putExtra("title", getDescription()); } } if (!StringUtil.isEmpty(getLocation())) { if (nativeMethod) { i.putExtra(CalendarContract.Events.EVENT_LOCATION, getLocation()); } else { i.putExtra("eventLocation", getLocation()); } } if (!StringUtil.isEmpty(getSummary())) { if (nativeMethod) { i.putExtra(CalendarContract.Events.DESCRIPTION, getSummary()); } else { i.putExtra("description", getSummary()); } } if (!StringUtil.isEmpty(getStart())) { long start = -1; start = millisFromDateString(getStart()); if (start > 0) { if (nativeMethod) { i.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start); } else { i.putExtra("beginTime", start); } } } if (!StringUtil.isEmpty(getEnd())) { long end = -1; end = millisFromDateString(getEnd()); if (end > 0) { if (nativeMethod) { i.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end); } else { i.putExtra("endTime", end); } } } if (!StringUtil.isEmpty(getStatus())) { if (nativeMethod) { i.putExtra(CalendarContract.Events.STATUS, getStatus()); } } if (!StringUtil.isEmpty(getTransparency())) { if (nativeMethod) { i.putExtra(CalendarContract.Events.VISIBLE, !getTransparency().equals("opaque")); } } if (!StringUtil.isEmpty(getReminder())) { long time = millisFromDateString(getReminder()); if (time < 0) { if (nativeMethod) { i.putExtra(CalendarContract.Reminders.MINUTES, Math.abs(time / 60000)); } } else if (!StringUtil.isEmpty(getStart())) { if (nativeMethod) { long tstart = millisFromDateString(getStart()); if (tstart > 0) { i.putExtra(CalendarContract.Reminders.MINUTES, Math.abs((tstart - time) / 60000)); } } } } StringBuilder repeatRuleBuilder = new StringBuilder(""); if (getRecurrence() != null) { String freq = getRecurrence().getFrequency(); if (!StringUtil.isEmpty(freq)) { if (W3C_DAILY.equals(freq)) { repeatRuleBuilder.append("FREQ=DAILY;"); } else if (W3C_WEEKLY.equals(freq)) { repeatRuleBuilder.append("FREQ=WEEKLY;"); } else if (W3C_MONTHLY.equals(freq)) { repeatRuleBuilder.append("FREQ=MONTHLY;"); } else if (W3C_YEARLY.equals(freq)) { repeatRuleBuilder.append("FREQ=YEARLY;"); } else { freq = ""; } } else { freq = ""; } if (getRecurrence().getInterval() > 0) { repeatRuleBuilder.append("INTERVAL="); repeatRuleBuilder.append(getRecurrence().getInterval()); repeatRuleBuilder.append(";"); } if (W3C_WEEKLY.equals(freq) && getRecurrence().getDaysInWeek() != null && getRecurrence().getDaysInWeek().length > 0) { repeatRuleBuilder.append("BYDAY="); for (int j : getRecurrence().getDaysInWeek()) { switch (j) { case 0: repeatRuleBuilder.append("SU,"); break; case 1: repeatRuleBuilder.append("MO,"); break; case 2: repeatRuleBuilder.append("TU,"); break; case 3: repeatRuleBuilder.append("WE,"); break; case 4: repeatRuleBuilder.append("TH,"); break; case 5: repeatRuleBuilder.append("FR,"); break; case 6: repeatRuleBuilder.append("SA,"); break; } } repeatRuleBuilder.setCharAt(repeatRuleBuilder.length() - 1, ';'); } if (W3C_MONTHLY.equals(freq) && getRecurrence().getDaysInMonth() != null && getRecurrence().getDaysInMonth().length > 0) { repeatRuleBuilder.append("BYMONTHDAY="); for (int j : getRecurrence().getDaysInMonth()) { repeatRuleBuilder.append(j); repeatRuleBuilder.append(","); } repeatRuleBuilder.setCharAt(repeatRuleBuilder.length() - 1, ';'); } if (W3C_YEARLY.equals(freq) && getRecurrence().getDaysInYear() != null && getRecurrence().getDaysInYear().length > 0) { repeatRuleBuilder.append("BYYEARDAY="); for (int j : getRecurrence().getDaysInYear()) { repeatRuleBuilder.append(j); repeatRuleBuilder.append(","); } repeatRuleBuilder.setCharAt(repeatRuleBuilder.length() - 1, ';'); } if (W3C_YEARLY.equals(freq) && getRecurrence().getMonthsInYear() != null && getRecurrence().getMonthsInYear().length > 0) { repeatRuleBuilder.append("BYMONTH="); for (int j : getRecurrence().getMonthsInYear()) { repeatRuleBuilder.append(j); repeatRuleBuilder.append(","); } repeatRuleBuilder.setCharAt(repeatRuleBuilder.length() - 1, ';'); } if (W3C_MONTHLY.equals(freq) && getRecurrence().getWeeksInMonth() != null && getRecurrence().getWeeksInMonth().length > 0) { repeatRuleBuilder.append("BYWEEKNO="); for (int j : getRecurrence().getWeeksInMonth()) { repeatRuleBuilder.append(j); repeatRuleBuilder.append(","); } repeatRuleBuilder.setCharAt(repeatRuleBuilder.length() - 1, ';'); } if (!StringUtil.isEmpty(getRecurrence().getExpires())) { repeatRuleBuilder.append("UNTIL="); repeatRuleBuilder.append(getRecurrence().getExpires()); repeatRuleBuilder.append(";"); } if (getRecurrence().getExceptionDates() != null && getRecurrence().getExceptionDates().length > 0) { repeatRuleBuilder.append("EXDATE="); for (String s : getRecurrence().getExceptionDates()) { repeatRuleBuilder.append(s); repeatRuleBuilder.append(","); } repeatRuleBuilder.setCharAt(repeatRuleBuilder.length() - 1, ';'); } if (nativeMethod) { i.putExtra(CalendarContract.Events.RRULE, repeatRuleBuilder.toString()); } else { i.putExtra("rrule", repeatRuleBuilder.toString()); } } return i; }
From source file:net.reichholf.dreamdroid.fragment.TimerEditFragment.java
@SuppressWarnings("unchecked") @Override//ww w . j a v a2 s . c om public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.timer_edit, container, false); mName = (EditText) view.findViewById(R.id.EditTextTitle); mDescription = (EditText) view.findViewById(R.id.EditTextDescription); mEnabled = (CheckBox) view.findViewById(R.id.CheckBoxEnabled); mZap = (CheckBox) view.findViewById(R.id.CheckBoxZap); mAfterevent = (Spinner) view.findViewById(R.id.SpinnerAfterEvent); mLocation = (Spinner) view.findViewById(R.id.SpinnerLocation); mStartDate = (TextView) view.findViewById(R.id.TextViewBeginDate); mStartTime = (TextView) view.findViewById(R.id.TextViewBeginTime); mEndDate = (TextView) view.findViewById(R.id.TextViewEndDate); mEndTime = (TextView) view.findViewById(R.id.TextViewEndTime); mRepeatings = (TextView) view.findViewById(R.id.TextViewRepeated); mService = (TextView) view.findViewById(R.id.TextViewService); mTags = (TextView) view.findViewById(R.id.TextViewTags); // onClickListeners registerOnClickListener(mService, Statics.ITEM_PICK_SERVICE); registerOnClickListener(mStartDate, Statics.ITEM_PICK_BEGIN_DATE); registerOnClickListener(mStartTime, Statics.ITEM_PICK_BEGIN_TIME); registerOnClickListener(mEndDate, Statics.ITEM_PICK_END_DATE); registerOnClickListener(mEndTime, Statics.ITEM_PICK_END_TIME); registerOnClickListener(mRepeatings, Statics.ITEM_PICK_REPEATED); registerOnClickListener(mTags, Statics.ITEM_PICK_TAGS); mAfterevent.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { mTimer.put(Timer.KEY_AFTER_EVENT, Integer.valueOf(position).toString()); } @Override public void onNothingSelected(AdapterView<?> parent) { // Auto is the default mAfterevent.setSelection(Timer.Afterevents.AUTO.intValue()); } }); mLocation.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { mTimer.put(Timer.KEY_LOCATION, DreamDroid.getLocations().get(position)); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO implement some nothing-selected-handler for locations } }); // Initialize if savedInstanceState won't and instance was not retained if (savedInstanceState == null && mTimer == null && mTimerOld == null) { HashMap<String, Object> map = (HashMap<String, Object>) getArguments().get(sData); ExtendedHashMap data = new ExtendedHashMap(); data.putAll(map); mTimer = new ExtendedHashMap(); mTimer.putAll((HashMap<String, Object>) data.get("timer")); if (Intent.ACTION_EDIT.equals(getArguments().get("action"))) { mTimerOld = mTimer.clone(); } else { mTimerOld = null; } mSelectedTags = new ArrayList<>(); if (DreamDroid.getLocations().size() == 0 || DreamDroid.getTags().size() == 0) { mGetLocationsAndTagsTask = new GetLocationsAndTagsTask(); mGetLocationsAndTagsTask.execute(); } else { reload(); } } else if (savedInstanceState != null) { mTimer = savedInstanceState.getParcelable("timer"); mTimerOld = savedInstanceState.getParcelable("timerOld"); mSelectedTags = new ArrayList<>(Arrays.asList(savedInstanceState.getStringArray("selectedTags"))); if (mTimer != null) { reload(); } } else { reload(); } registerFab(R.id.fab_save, view, new View.OnClickListener() { @Override public void onClick(View v) { onItemSelected(Statics.ITEM_SAVE); } }); return view; }
From source file:com.wit.android.support.content.intent.CalendarIntent.java
/** *//*from w w w .j av a 2 s . com*/ @Nullable @Override public Intent buildIntent() { switch (mType) { case TYPE_VIEW: if (checkTime(mBeginTime, "Time isn't valid.")) { final Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon(); builder.appendPath("time"); ContentUris.appendId(builder, mBeginTime); /** * Build the intent. */ return new Intent(Intent.ACTION_VIEW).setData(builder.build()); } break; case TYPE_INSERT_EVENT: if (!checkTime(mBeginTime, "Begin time(" + mBeginTime + ") isn't valid.")) { return null; } if (!checkTime(mEndTime, "End time(" + mEndTime + ") isn't valid.")) { return null; } if (mEndTime <= mBeginTime) { this.logMessage( "End time(" + mEndTime + ") is wrong specified before/at begin time(" + mBeginTime + ")."); return null; } /** * Build the intent. */ final Intent intent = new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, mBeginTime) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, mEndTime) .putExtra(CalendarContract.Events.TITLE, mTitle) .putExtra(CalendarContract.Events.DESCRIPTION, mDescription) .putExtra(CalendarContract.Events.EVENT_LOCATION, mLocation) .putExtra(CalendarContract.Events.AVAILABILITY, mAvailability); // todo: add extra emails. // intent.putExtra(Intent.EXTRA_EMAIL, "rowan@example.com,trevor@example.com"); return intent; case TYPE_EDIT_EVENT: if (checkEventId()) { /** * Build the intent. */ final Intent eventIntent = new Intent(Intent.ACTION_EDIT); eventIntent.setData(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, mEventId)); if (!TextUtils.isEmpty(mTitle)) { eventIntent.putExtra(CalendarContract.Events.TITLE, mTitle); } return eventIntent; } break; case TYPE_VIEW_EVENT: if (checkEventId()) { /** * Build the intent. */ return new Intent(Intent.ACTION_VIEW) .setData(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, mEventId)); } break; } return null; }
From source file:com.Beat.RingdroidEditActivity.java
protected void reset(String path) { String filename = path;/*from w w w. ja v a2 s.c o m*/ try { Intent intent = new Intent(Intent.ACTION_EDIT, Uri.parse(filename)); intent.putExtra("was_get_content_intent", mWasGetContentIntent); //true should be mWasGetContentIntent intent.setClassName("com.Beat", "com.Beat.RingdroidEditActivity"); startActivity(intent); //1 should be REQUEST_CODE_EDIT this.finish(); } catch (Exception e) { return; } }
From source file:com.android.gallery3d.ui.MenuExecutor.java
public void onMenuClicked(int action, ProgressListener listener, boolean waitOnStop, boolean showDialog) { int title;//from w w w .j a va 2s .c o m switch (action) { case R.id.action_select_all: if (mSelectionManager.inSelectAllMode()) { mSelectionManager.deSelectAll(); } else { mSelectionManager.selectAll(); } return; case R.id.action_crop: { Intent intent = getIntentBySingleSelectedPath(CropActivity.CROP_ACTION); ((Activity) mActivity).startActivity(intent); return; } case R.id.action_edit: { Intent intent = getIntentBySingleSelectedPath(Intent.ACTION_EDIT) .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); ((Activity) mActivity).startActivity(Intent.createChooser(intent, null)); return; } case R.id.action_setas: { Intent intent = getIntentBySingleSelectedPath(Intent.ACTION_ATTACH_DATA) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra("mimeType", intent.getType()); Activity activity = mActivity; activity.startActivity(Intent.createChooser(intent, activity.getString(R.string.set_as))); return; } case R.id.action_delete: title = R.string.delete; break; case R.id.action_rotate_cw: title = R.string.rotate_right; break; case R.id.action_rotate_ccw: title = R.string.rotate_left; break; case R.id.action_show_on_map: title = R.string.show_on_map; break; default: return; } startAction(action, title, listener, waitOnStop, showDialog); }
From source file:com.vmihalachi.turboeditor.activity.HomeActivity.java
/** * Parses the intent//from w w w .j a v a 2 s. c o m */ 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 the NewFileOpened Event EventBus.getDefault().postSticky(new NewFileOpened(intent.getData().getPath())); } }
From source file:edu.mit.mobile.android.locast.ver2.itineraries.ItineraryDetail.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info; try {/*from w ww. ja v a 2 s .c o m*/ info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); } catch (final ClassCastException e) { Log.e(TAG, "bad menuInfo", e); return false; } final Uri cast = Cast.getCanonicalUri(this, ContentUris.withAppendedId(mCastsUri, info.id)); switch (item.getItemId()) { case R.id.cast_view: startActivity(new Intent(Intent.ACTION_VIEW, cast)); return true; case R.id.cast_edit: startActivity(new Intent(Intent.ACTION_EDIT, cast)); return true; case R.id.cast_delete: startActivity(new Intent(Intent.ACTION_DELETE, cast)); return true; // case R.id.cast_play: // startActivity(new Intent(CastDetailsActivity.ACTION_PLAY_CAST, cast)); // return true; default: return super.onContextItemSelected(item); } }