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:com.appunite.helpers.EditFragment.java

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

    Intent intent = getActivity().getIntent();
    String action = intent.getAction();

    mDiscard = false;//from  ww w  .j  av a2 s.  c o  m

    if (savedInstanceState != null) {
        mUri = savedInstanceState.getParcelable(STATE_URI);
        checkState(mUri != null);
        mIsEdit = savedInstanceState.getBoolean(STATE_IS_EDIT);
    } else if (Intent.ACTION_INSERT.equals(action) || Intent.ACTION_INSERT_OR_EDIT.equals(action)) {
        mUri = intent.getData();
        if (mUri == null) {
            mUri = getInsertionUri();
        }
        checkArgument(mUri != null);
        mIsEdit = false;
    } else if (Intent.ACTION_EDIT.equals(action)) {
        mUri = intent.getData();
        checkArgument(mUri != null);
        mIsEdit = true;
    } else {
        throw new IllegalArgumentException("Unknown action: " + action);
    }
}

From source file:com.commonsware.android.tte.DocumentStorageService.java

@Override
protected void onHandleIntent(Intent intent) {
    if (Intent.ACTION_OPEN_DOCUMENT.equals(intent.getAction())) {
        load(intent.getData());/*from  ww  w  . java2  s .c o  m*/
    } else if (Intent.ACTION_EDIT.equals(intent.getAction())) {
        save(intent.getData(), intent.getStringExtra(Intent.EXTRA_TEXT),
                intent.getBooleanExtra(EXTRA_CLOSING, false));
    }
}

From source file:com.bangz.shotrecorder.RecordDetailActivity.java

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

    setContentView(R.layout.record_detail);

    final Intent intent = getIntent();

    final String action = intent.getAction();

    if (Intent.ACTION_EDIT.equals(action)) {

        mUri = intent.getData();/*from  ww w . j  a va  2  s. c  o m*/

    } else {
        Log.e(TAG, "Unknown Action, exiting");
        finish();
        return;
    }

    ActionBar bar = getSupportActionBar();
    bar.setDisplayHomeAsUpEnabled(true);

    ImageView imageView = (ImageView) findViewById(R.id.imgEditDescript);
    imageView.setOnClickListener(this);

    FragmentManager fm = getSupportFragmentManager();
    SplitListFragment splitfragment = (SplitListFragment) fm.findFragmentById(R.id.splitlist);
    mSplitAdapter = new SplitArrayAdapter(this, mManager.getSplits());
    splitfragment.setListAdapter(mSplitAdapter);

    LoaderManager lm = getSupportLoaderManager();
    lm.initLoader(1, null, this);
}

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

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

    Intent intent = getIntent();//from   w  w  w.  j a v  a2 s.  c o  m

    if (Intent.ACTION_SEND.equals(intent.getAction()) && intent.hasExtra(Intent.EXTRA_TEXT)) {

        // we don't need to ask for an account if the intent was generated internally
        if (!intent.hasExtra(Constants.EXTRA_INTERNAL)
                || !intent.getBooleanExtra(Constants.EXTRA_INTERNAL, true))
            requestAccount();

        bookmark = new Bookmark();

        loadBookmarkFromShareIntent();

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

        findExistingBookmark();

    } 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);
    frag.setUsername(app.getUsername());
}

From source file:org.linphone.compatibility.ApiFivePlus.java

public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) {
    Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI);
    Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
    intent.setData(contactUri);//from  www  .  j av  a  2s . c  om

    // VoIP field not available, we store the address in the IM field
    intent.putExtra(ContactsContract.Intents.Insert.IM_HANDLE, sipUri);
    intent.putExtra(ContactsContract.Intents.Insert.IM_PROTOCOL, "sip");

    return intent;
}

From source file:com.example.easyvoice.MessageDetail.java

@Override
protected void onStart() {
    super.onStart();
    Log.d(getClass().getSimpleName(), "onStart");

    String action = getIntent().getAction();
    String data = getIntent().getDataString();

    if (action.equalsIgnoreCase(Intent.ACTION_EDIT)) {
        Log.d(getClass().getSimpleName(), "parsing uri, data is " + data);

        Uri uri = Uri.parse(data);//  w w w  . j a  v a2 s  . c o  m
        String qp = uri.getQueryParameter("msgid");
        msgId = Integer.parseInt(qp);

        Log.d(getClass().getSimpleName(), "Loading msg " + qp);

        LoadMessage(msgId);

        saveBtn.setText(getString(R.string.update_button));
        //         saveBtn.setOnClickListener (new View.OnClickListener() {
        //            public void onClick(View v) {                 // Perform action on click             }
        //               onUpdate(v);
        //            }
        //         });
    }

    Log.i(getClass().getSimpleName(), "onStart, action is " + action + ", data is " + data);
}

From source file:de.fahrgemeinschaft.MainActivity.java

@Override
public void onClick(View v) {
    Ride r = main.ride;/*from  w w  w . j a v a  2 s .co m*/
    switch (v.getId()) {
    case R.id.btn_selberfahren:
        Uri uri = r.type(Ride.OFFER).dep(setNowTime(r.getDep())).mode(Ride.Mode.CAR).seats(3).store(this);
        startActivity(new Intent(Intent.ACTION_EDIT, uri));
        overridePendingTransition(R.anim.slide_in_bottom, R.anim.slide_out_top);
        break;
    case R.id.btn_mitfahren:
        if (main.ride.getFrom() == null && main.ride.getTo() == null) {
            Crouton.makeText(this, getString(R.string.incomplete), Style.INFO).show();
            return;
        }
        r.type(Ride.SEARCH).dep(setMorningTime(r.getDep())).arr(r.getDep() + TWO_DAYS).store(this);
        startService(new Intent(this, ConnectorService.class).setAction(ConnectorService.SEARCH));
        results.load(r.toUri(), SEARCH);
        showFragment(results, getString(R.string.results), R.anim.slide_in_right, R.anim.slide_out_right);
        break;
    }
}

From source file:com.commonsware.android.tte.MainActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    if (Intent.ACTION_EDIT.equals(intent.getAction())) {
        openEditor(intent.getData());//  www  .j a va2s  .c  o  m
    }
}

From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.editor.ActivityEditor.java

long getNoteId(@NonNull final Intent intent) {
    long retval = -1;
    if (intent.getData() != null && (Intent.ACTION_EDIT.equals(intent.getAction())
            || Intent.ACTION_VIEW.equals(intent.getAction()))) {
        if (intent.getData().getPath().startsWith(TaskList.URI.getPath())) {
            // Find it in the extras. See DashClock extension for an example
            retval = intent.getLongExtra(Task.TABLE_NAME, -1);
        } else if ((intent.getData().getPath().startsWith(LegacyDBHelper.NotePad.Notes.PATH_VISIBLE_NOTES)
                || intent.getData().getPath().startsWith(LegacyDBHelper.NotePad.Notes.PATH_NOTES)
                || intent.getData().getPath().startsWith(Task.URI.getPath()))) {
            retval = Long.parseLong(intent.getData().getLastPathSegment());
        }//  www  .  j  a va  2  s. c om
    }
    return retval;
}

From source file:com.epsi.plugins.cordova.CafeBazaar.java

public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {

    if (action.equals("display-app")) {
        try {/*w  w  w.  j  ava2s .co m*/
            JSONObject arg_object = args.getJSONObject(0);
            String app = arg_object.getString("app");
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("bazaar://details?id=" + app));
            intent.setPackage("com.farsitel.bazaar");
            this.cordova.getActivity().startActivity(intent);
            callbackContext.success("success");
            return true;
        } catch (Exception e) {
            System.err.println("Exception: " + e.getMessage());
            callbackContext.error(e.getMessage());
            return false;
        }
    }

    if (action.equals("rate-app")) {
        try {
            JSONObject arg_object = args.getJSONObject(0);
            String app = arg_object.getString("app");
            Intent intent = new Intent(Intent.ACTION_EDIT);
            intent.setData(Uri.parse("bazaar://details?id=" + app));
            intent.setPackage("com.farsitel.bazaar");
            this.cordova.getActivity().startActivity(intent);
            callbackContext.success("success");
            return true;
        } catch (Exception e) {
            System.err.println("Exception: " + e.getMessage());
            callbackContext.error(e.getMessage());
            return false;
        }
    }

    if (action.equals("disp-developer")) {
        try {
            JSONObject arg_object = args.getJSONObject(0);
            String developer = arg_object.getString("developer");
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("bazaar://collection?slug=by_author&aid=" + developer));
            intent.setPackage("com.farsitel.bazaar");
            this.cordova.getActivity().startActivity(intent);
            callbackContext.success("success");
            return true;
        } catch (Exception e) {
            System.err.println("Exception: " + e.getMessage());
            callbackContext.error(e.getMessage());
            return false;
        }
    }

    //callbackContext.error("false command");
    return true;

}