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:de.grobox.liberario.utils.TransportrUtils.java
static public void intoCalendar(Context context, Trip trip) { Intent intent = new Intent(Intent.ACTION_EDIT).setType("vnd.android.cursor.item/event") .putExtra("beginTime", trip.getFirstDepartureTime().getTime()) .putExtra("endTime", trip.getLastArrivalTime().getTime()) .putExtra("title", trip.from.name + " " + trip.to.name) .putExtra("description", TransportrUtils.tripToString(context, trip)); if (trip.from.place != null) intent.putExtra("eventLocation", trip.from.place); context.startActivity(intent);//from w w w. j ava 2 s . co m }
From source file:org.cgnet.swara.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_feed_edit); setResult(RESULT_CANCELED);/*from ww w. j a v a2 s. com*/ Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); 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 tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } 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 (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); 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:com.carlrice.reader.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_edit); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*w ww .j a va2 s . c om*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); setResult(RESULT_CANCELED); Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); 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 tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, Constants.EMPTY_CURSOR); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startSupportActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); 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:net.fred.feedex.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_edit); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);// w ww . j a v a 2 s . c o m getSupportActionBar().setDisplayHomeAsUpEnabled(true); setResult(RESULT_CANCELED); Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); 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 tabWidget = findViewById(android.R.id.tabs); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); mUrlEditText.setText(intent.getDataString()); } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); mFiltersCursorAdapter = new FiltersCursorAdapter(this, Constants.EMPTY_CURSOR); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startSupportActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor != null && cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); if (cursor.getInt(3) == 1) { // if it's a group, we cannot edit it finish(); } } else { UiUtils.showMessage(EditFeedActivity.this, R.string.error); finish(); } if (cursor != null) { cursor.close(); } } } }
From source file:com.jecelyin.editor.v2.ui.MainActivity.java
private boolean processIntentImpl() throws Throwable { Intent intent = getIntent();/*from w w w . j av a 2 s .c o m*/ L.d("intent=" + intent); if (intent == null) return true; //pass hint String action = intent.getAction(); // action == null if change theme if (action == null || Intent.ACTION_MAIN.equals(action)) { return true; } if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action)) { if (intent.getScheme().equals("content")) { InputStream attachment = getContentResolver().openInputStream(intent.getData()); String text = IOUtils.toString(attachment); openText(text); return true; } else if (intent.getScheme().equals("file")) { Uri mUri = intent.getData(); String file = mUri != null ? mUri.getPath() : null; if (!TextUtils.isEmpty(file)) { openFile(file); return true; } } } else if (Intent.ACTION_SEND.equals(action) && intent.getExtras() != null) { Bundle extras = intent.getExtras(); CharSequence text = extras.getCharSequence(Intent.EXTRA_TEXT); if (text != null) { openText(text); return true; } else { Object stream = extras.get(Intent.EXTRA_STREAM); if (stream != null && stream instanceof Uri) { openFile(((Uri) stream).getPath()); return true; } } } return false; }
From source file:com.money.manager.ex.settings.PerDatabaseFragment.java
private void showCurrencyChangeNotification() { new MaterialDialog.Builder(getActivity()).title(R.string.base_currency_changed) .content(R.string.base_currency_change_notification).positiveText(android.R.string.ok) .neutralText(R.string.open_currencies).onNeutral(new MaterialDialog.SingleButtonCallback() { @Override//www . j ava2 s.c o m public void onClick(MaterialDialog dialog, DialogAction which) { Intent intent = new Intent(getActivity(), CurrencyListActivity.class); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } }).show(); }
From source file:edu.mit.mobile.android.livingpostcards.CameraActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.capture: capture();//from ww w. j a v a2s . com break; case R.id.done: setResult(RESULT_OK); finish(); // when a new card is added, show the editor immediately afterward. if (mCard != null && Intent.ACTION_INSERT.equals(getIntent().getAction())) { startActivity(new Intent(Intent.ACTION_EDIT, mCard)); } break; } }
From source file:com.example.android.contactslist.ui.chartActivity.ContactDetailChartFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // When "edit" menu option selected case R.id.menu_edit_contact: // Standard system edit contact intent Intent intent = new Intent(Intent.ACTION_EDIT, mContactUri); // Because of an issue in Android 4.0 (API level 14), clicking Done or Back in the // People app doesn't return the user to your app; instead, it displays the People // app's contact list. A workaround, introduced in Android 4.0.3 (API level 15) is // to set a special flag in the extended data for the Intent you send to the People // app. The issue is does not appear in versions prior to Android 4.0. You can use // the flag with any version of the People app; if the workaround isn't needed, // the flag is ignored. intent.putExtra("finishActivityOnSaveCompleted", true); // Start the edit activity startActivity(intent);//from ww w .j a v a2s .co m return true; default: // Display the fragment as the main content. Intent launchPreferencesIntent = new Intent().setClass(getActivity(), UserPreferencesActivity.class); // Make it a subactivity so we know when it returns startActivity(launchPreferencesIntent); } return super.onOptionsItemSelected(item); }
From source file:com.intel.xdk.contacts.Contacts.java
public void editContact(String contactId) { if (busy == true) { String js = "javascript: var e = document.createEvent('Events');e.initEvent('intel.xdk.contacts.busy',true,true);e.success=false;e.message='busy';document.dispatchEvent(e);"; injectJS(js);/*from www . java 2s. co m*/ return; } try { //Determine if Contact ID exists Uri res = null; Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, contactId); try { res = ContactsContract.Contacts.lookupContact(activity.getContentResolver(), lookupUri); } catch (Exception e) { e.printStackTrace(); } if (res != null) { busy = true; Intent intent = new Intent(Intent.ACTION_EDIT); contactBeingEdited = contactId; intent.setType(ContactsContract.Contacts.CONTENT_TYPE); intent.setData(res); //launch activity cordova.setActivityResultCallback(this); activity.startActivityForResult(intent, CONTACT_EDIT_RESULT); //activity.setLaunchedChildActivity(true); } else { contactBeingEdited = ""; String errjs1 = String.format( "var e = document.createEvent('Events');e.initEvent('intel.xdk.contacts.edit',true,true);e.success=false;e.error='contact not found';e.contactid='%s';document.dispatchEvent(e);", contactId); injectJS("javascript: " + errjs1); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:nl.privacybarometer.privacyvandaag.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed_edit); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from ww w. jav a 2s.co m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); setResult(RESULT_CANCELED); Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mCookieNameEditText = (EditText) findViewById(R.id.feed_cookiename); mCookieValueEditText = (EditText) findViewById(R.id.feed_cookievalue); mKeepTime = (Spinner) findViewById(R.id.settings_keep_times); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } String[] selectedValues = getResources().getStringArray(R.array.settings_keep_time_values); mKeepTime.setSelection(selectedValues.length - 1); } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, Constants.EMPTY_CURSOR); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startSupportActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mNameEditText.setText(cursor.getString(0)); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); mCookieNameEditText.setText(cursor.getString(3)); mCookieValueEditText.setText(cursor.getString(4)); Integer intDate = cursor.getInt(5); String[] selectedValues = getResources().getStringArray(R.array.settings_keep_time_values); int index = Arrays.asList(selectedValues).indexOf(String.valueOf(intDate)); mKeepTime.setSelection(index >= 0 ? index : selectedValues.length - 1); cursor.close(); } else { cursor.close(); Toast.makeText(EditFeedActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); finish(); } } } }