Example usage for android.content Intent ACTION_EDIT

List of usage examples for android.content Intent ACTION_EDIT

Introduction

In this page you can find the example usage for android.content Intent ACTION_EDIT.

Prototype

String ACTION_EDIT

To view the source code for android.content Intent ACTION_EDIT.

Click Source Link

Document

Activity Action: Provide explicit editable access to the given data.

Usage

From source file:dev.drsoran.moloko.activities.NoteEditActivity.java

private void createIntentDependentFragment() {
    final String action = getIntent().getAction();
    if (Intent.ACTION_EDIT.equals(action)) {
        addFragment(NoteEditFragment.class);
    } else if (Intent.ACTION_INSERT.equals(action)) {
        addFragment(NoteAddFragment.class);
    } else {//w ww  . j  ava 2 s  .c  om
        throw new UnsupportedOperationException(
                String.format("Intent action unhandled: %s", getIntent().getAction()));
    }
}

From source file:enterprayz.megatools.Tools.java

public static void openCallendar(Activity activity, Date begin, Date end, String location)
        throws ActivityNotFoundException {
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("beginTime", begin.getTime());
    intent.putExtra("allDay", true);
    intent.putExtra("eventLocation", location);
    intent.putExtra("endTime", end.getTime());
    intent.putExtra("title", "A Test Event from android app");
    activity.startActivity(intent);// www .j  av  a 2 s .  c om
}

From source file:com.deliciousdroid.activity.AddBookmark.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_bookmark);

    Intent intent = getIntent();/*  ww  w  .j av a  2s . c  om*/

    if (Intent.ACTION_SEND.equals(intent.getAction()) && intent.hasExtra(Intent.EXTRA_TEXT)) {
        bookmark = new Bookmark();

        ShareCompat.IntentReader reader = ShareCompat.IntentReader.from(this);

        String url = StringUtils.getUrl(reader.getText().toString());
        bookmark.setUrl(url);

        if (reader.getSubject() != null)
            bookmark.setDescription(reader.getSubject());

        if (url.equals("")) {
            Toast.makeText(this, R.string.add_bookmark_invalid_url, Toast.LENGTH_LONG).show();
        }

        if (intent.hasExtra(Constants.EXTRA_DESCRIPTION)) {
            bookmark.setDescription(intent.getStringExtra(Constants.EXTRA_DESCRIPTION));
        }
        bookmark.setNotes(intent.getStringExtra(Constants.EXTRA_NOTES));
        bookmark.setTagString(intent.getStringExtra(Constants.EXTRA_TAGS));
        bookmark.setShared(!intent.getBooleanExtra(Constants.EXTRA_PRIVATE, privateDefault));

        try {
            Bookmark old = BookmarkManager.GetByUrl(bookmark.getUrl(), this);
            bookmark = old.copy();
        } catch (Exception e) {

        }

    } else if (Intent.ACTION_EDIT.equals(intent.getAction())) {
        int id = Integer.parseInt(intent.getData().getLastPathSegment());
        try {
            bookmark = BookmarkManager.GetById(id, this);
            oldBookmark = bookmark.copy();

            update = true;
        } catch (ContentNotFoundException e) {
            e.printStackTrace();
        }
    }

    if (update)
        setTitle(getString(R.string.add_bookmark_edit_title));
    else
        setTitle(getString(R.string.add_bookmark_add_title));

    frag = (AddBookmarkFragment) getSupportFragmentManager().findFragmentById(R.id.add_bookmark_fragment);
    frag.loadBookmark(bookmark, oldBookmark);
}

From source file:com.wanikani.androidnotifier.ImportActivity.java

protected void checkIntent(Intent intent) {
    String action;//from  ww  w . j ava2  s. com
    Uri uri;

    action = intent.getAction();
    if (action.equals(Intent.ACTION_VIEW) || action.equals(Intent.ACTION_EDIT)) {

        uri = intent.getData();
        if (uri != null && uri.getScheme().equals("file"))
            lview.setText(uri.getPath());
    }
}

From source file:bander.notepad.NoteEditAppCompat.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Setting the theme

    Notepad.setAppCompatThemeFromPreferences(this, "Edit");

    if (savedInstanceState != null) {
        final Object note = savedInstanceState.get(ORIGINAL_NOTE);
        if (note != null)
            mOriginalNote = (Note) note;
    }/* w  w w.  jav  a 2  s  .co m*/

    final Intent intent = getIntent();
    final String action = intent.getAction();
    if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action)) {
        mState = STATE_EDIT;
        mUri = intent.getData();
    } else if (Intent.ACTION_INSERT.equals(action)) {
        mState = STATE_INSERT;
        if (mOriginalNote == null) {
            mUri = getContentResolver().insert(intent.getData(), null);
        } else {
            mUri = mOriginalNote.getUri();
        }

        setResult(RESULT_OK, (new Intent()).setAction(mUri.toString()));
    }

    if (mUri == null) {
        finish();
        return;
    }

    {
        setContentView(R.layout.edit_appcompat);
        SharedPreferences mSettings = PreferenceManager.getDefaultSharedPreferences(this);

        ViewStub stub = (ViewStub) findViewById(R.id.toolbarWrapper);
        if (mSettings.getBoolean("darkAppCompatTheme", false))
            stub.setLayoutResource(R.layout.toolbar_dark);
        else
            stub.setLayoutResource(R.layout.toolbar_light);
        stub.inflate();
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        Notepad.setToolbarColor(this);
        setSupportActionBar(toolbar);

        if (mSettings.getBoolean("darkAppCompatTheme", false)) {
            toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
        } else {
            toolbar.setNavigationIcon(
                    IconTintFactory.setDarkMaterialColor(R.drawable.abc_ic_ab_back_mtrl_am_alpha, this));
        }

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mBodyText = (EditText) findViewById(R.id.body);

    }

}

From source file:com.dev.campus.event.EventViewActivity.java

/**
 * Launches the device's calendar and pre-fills event info
 * @param event the event to add to the calendar
 *///  w  ww. j  a  v  a2  s.c o  m
public void addToCalendar(Event event) {
    //Strip HTML tags and carriage returns for better readability
    String details = Html.fromHtml(event.getDetails()).toString().replace("\n", " ");
    Intent calIntent = new Intent(Intent.ACTION_EDIT);
    calIntent.setType("vnd.android.cursor.item/event");
    calIntent.putExtra(Events.TITLE, event.getTitle());
    calIntent.putExtra(Events.DESCRIPTION, details);
    calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, event.getStartDate().getTime());
    calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, event.getEndDate().getTime());
    startActivity(calIntent);
}

From source file:com.money.manager.ex.currency.list.CurrencyListFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MoneyManagerApplication.getApp().iocComponent.inject(this);

    mAction = getActivity().getIntent().getAction();
    if (mAction.equals(Intent.ACTION_MAIN)) {
        mAction = Intent.ACTION_EDIT;
    }//w w  w .j a  v  a 2s.  c  o  m

    // Filter currencies only if in the standalone Currencies list. Do not filter in pickers.
    mShowOnlyUsedCurrencies = !mAction.equals(Intent.ACTION_PICK);

    loaderCallbacks = initLoaderCallbacks();
}

From source file:de.aw.awlib.preferences.AWPreferencesAllgemein.java

private void copyAndDebugDatabase() throws IOException {
    mApplication.createFiles();/* w  w w.ja  v  a 2 s . com*/
    Intent intent = new Intent(Intent.ACTION_EDIT);
    String databasePath = mApplication.getApplicationDatabasePath();
    File src = mApplication.getDatabasePath(mApplication.theDatenbankname());
    File dest = new File(databasePath + File.separator + mApplication.theDatenbankname());
    dest.delete();
    AWUtils.copyFile(getActivity(), src, dest);
    Uri uri = Uri.parse("sqlite:" + dest.getAbsolutePath());
    intent.setData(uri);
    startActivity(intent);
}

From source file:com.money.manager.ex.assetallocation.AssetClassEditActivity.java

private boolean save() {
    // todo: validate

    boolean result;

    AssetClassEditFragment fragment = getFragment();
    AssetClass assetClass = fragment.assetClass;

    AssetClassRepository repo = new AssetClassRepository(this);
    switch (getIntent().getAction()) {
    case Intent.ACTION_INSERT:
        result = repo.insert(assetClass);
        break;//  w  w  w . j av  a  2s .  c  o  m
    case Intent.ACTION_EDIT:
        result = repo.update(assetClass);
        break;
    default:
        result = false;
    }
    return result;
}

From source file:org.svij.taskwarriorapp.fragments.MenuListFragment.java

public void onTaskButtonClick(View view) {
    switch (view.getId()) {
    case R.id.btnTaskDelete:
        deleteTask(getTaskWithId(selectedItemId));
        break;/*from  w ww .j  a  va  2  s . c om*/
    case R.id.btnTaskModify:
        showAddTaskActivity(getTaskWithId(selectedItemId));
        break;
    case R.id.btnTaskAddReminder:
        Task task = data.getTask(getTaskWithId(selectedItemId));
        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setType("vnd.android.cursor.item/event");
        if (task.getDue() != null) {
            intent.putExtra("beginTime", task.getDue().getTime());
        }
        intent.putExtra("title", task.getDescription());
        startActivity(intent);
        break;
    case R.id.btnTaskDone:
        doneTask(getTaskWithId(selectedItemId));
        break;
    default:
        break;
    }
}