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:edu.mit.mobile.android.locast.itineraries.ItineraryDetail.java

@Override
public void onItemClick(AdapterView<?> adapter, View v, int position, long id) {

    final Cursor cast = (Cursor) adapter.getItemAtPosition(position);
    final int dratCol = cast.getColumnIndex(Cast._DRAFT);
    final boolean isDraft = !cast.isNull(dratCol) && cast.getInt(dratCol) == 1;

    if (isDraft) {
        startActivity(new Intent(Intent.ACTION_EDIT, ContentUris.withAppendedId(mCastsUri, id)));
    } else {//from w  w  w. j  av a 2s .  co  m
        startActivity(new Intent(Intent.ACTION_VIEW, ContentUris.withAppendedId(mCastsUri, id)));
    }
}

From source file:com.giovanniterlingen.windesheim.view.Adapters.ScheduleAdapter.java

private void showCalendarDialog(final long rowId) {
    Lesson lesson = DatabaseController.getInstance().getSingleLesson(rowId);
    if (lesson != null) {
        String[] startTimeStrings = lesson.getStartTime().split(":");
        String[] endTimeStrings = lesson.getEndTime().split(":");

        Calendar calendar = CalendarController.getInstance().getCalendar();
        calendar.setTime(date);/*from  w  ww.  ja va 2  s.  co m*/

        calendar.set(GregorianCalendar.HOUR_OF_DAY, Integer.parseInt(startTimeStrings[0]));
        calendar.set(GregorianCalendar.MINUTE, Integer.parseInt(startTimeStrings[1]));

        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setType("vnd.android.cursor.item/event");
        intent.putExtra("beginTime", calendar.getTimeInMillis());
        intent.putExtra("allDay", false);

        calendar.set(GregorianCalendar.HOUR_OF_DAY, Integer.parseInt(endTimeStrings[0]));
        calendar.set(GregorianCalendar.MINUTE, Integer.parseInt(endTimeStrings[1]));

        intent.putExtra("endTime", calendar.getTimeInMillis());
        intent.putExtra("title", lesson.getSubject());
        intent.putExtra("eventLocation", lesson.getRoom());

        try {
            activity.startActivity(intent);
        } catch (ActivityNotFoundException e) {
            activity.showSnackbar(activity.getResources().getString(R.string.no_calendar_found));
        }
    }
}

From source file:com.silentcircle.contacts.group.GroupEditorFragment.java

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

    if (savedInstanceState != null) {
        // Just restore from the saved state. No loading.
        onRestoreInstanceState(savedInstanceState);
        if (mStatus == Status.SELECTING_ACCOUNT) {
            // Account select dialog is showing. Don't setup the editor yet.
        } else if (mStatus == Status.LOADING) {
            startGroupMetaDataLoader();/*from w  w  w.  j av  a2 s  . c om*/
        } else {
            setupEditorForAccount();
        }
    } else if (Intent.ACTION_EDIT.equals(mAction)) {
        startGroupMetaDataLoader();
    } else if (Intent.ACTION_INSERT.equals(mAction)) {
        // No Account specified. Let the user choose from a disambiguation dialog.
        selectAccountAndCreateGroup();
    } else {
        throw new IllegalArgumentException("Unknown Action String " + mAction + ". Only support "
                + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT);
    }
}

From source file:it.gulch.linuxday.android.fragments.EventDetailsFragment.java

@SuppressLint("InlinedApi")
private void addToAgenda() {
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra(CalendarContract.Events.TITLE, event.getTitle());
    intent.putExtra(CalendarContract.Events.EVENT_LOCATION, event.getTrack().getRoom().getName());
    String description = event.getEventAbstract();
    if (StringUtils.isBlank(description)) {
        description = event.getDescription();
    }// w ww .  j a  va 2 s  .  co  m
    if (StringUtils.isBlank(description)) {
        description = StringUtils.EMPTY;
    }

    // FIXME
    // Strip HTML
    //description = StringUtils.stripEnd(Html.fromHtml(description).toString(), " ");
    // Add speaker info if available
    if (personsCount > 0) {
        String personsSummary = StringUtils.join(event.getPeople(), ", ");
        description = String.format("%1$s: %2$s\n\n%3$s",
                getResources().getQuantityString(R.plurals.speakers, personsCount), personsSummary,
                description);
    }
    intent.putExtra(CalendarContract.Events.DESCRIPTION, description);
    Date time = event.getStartDate();
    if (time != null) {
        intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, time.getTime());
    }
    time = event.getEndDate();
    if (time != null) {
        intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, time.getTime());
    }
    startActivity(intent);
}

From source file:com.money.manager.ex.account.AccountListFragment.java

/**
 * Start the account management Activity
 *
 * @param accountId is null for a new account, not null for editing accountId account
 *///from w w  w .  j av a  2 s .  c o  m
private void startAccountListEditActivity(Integer accountId) {
    // create intent, set Account ID
    Intent intent = new Intent(getActivity(), AccountEditActivity.class);
    // check accountId not null
    if (accountId != null) {
        intent.putExtra(AccountEditActivity.KEY_ACCOUNT_ID, accountId);
        intent.setAction(Intent.ACTION_EDIT);
    } else {
        intent.setAction(Intent.ACTION_INSERT);
    }
    // launch activity
    startActivity(intent);
}

From source file:org.cyanogenmod.focal.ui.ReviewDrawer.java

private void editInGallery(final int imageId) {
    if (imageId > 0) {
        Intent editIntent = new Intent(Intent.ACTION_EDIT);

        // Get URI
        Uri uri = null;//from www.j a v  a2  s  .  co m
        if (CameraActivity.getCameraMode() == CameraActivity.CAMERA_MODE_VIDEO) {
            uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI.buildUpon().appendPath(Integer.toString(imageId))
                    .build();
        } else {
            uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI.buildUpon().appendPath(Integer.toString(imageId))
                    .build();
        }

        // Start gallery edit activity
        editIntent.setDataAndType(uri, "image/*");
        editIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        Context ctx = getContext();
        if (ctx != null) {
            ctx.startActivity(Intent.createChooser(editIntent, null));
        }
    }
}

From source file:net.reichholf.dreamdroid.fragment.ProfileListFragment.java

/**
 * Opens a <code>ProfileEditActivity</code> for the selected profile
 *//*from www  .j  av a2  s.  c  om*/
private void editProfile() {
    Bundle args = new Bundle();
    args.putString("action", Intent.ACTION_EDIT);
    args.putSerializable("profile", mProfile);

    Fragment f = new ProfileEditFragment();
    f.setArguments(args);
    f.setTargetFragment(this, Statics.REQUEST_EDIT_PROFILE);
    getMultiPaneHandler().showDetails(f, true);
}

From source file:ng.uavp.ch.ngusbterminal.FileSelectFragment.java

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    currentFile = fileList.get(position);

    if (!currentFile.isDirectory()) {
        Intent intent = new Intent(Intent.ACTION_EDIT);
        Uri uri = Uri.parse("file://" + currentFile.getAbsolutePath());
        intent.setDataAndType(uri, "text/plain");
        if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
            startActivity(intent);//from  w w w. j  a v a 2s.c o m
        } else {
            showToast(R.string.err_cannot_edit, Toast.LENGTH_SHORT);
        }
    }
    return false;
}

From source file:info.guardianproject.otr.app.im.app.ContactListActivity.java

Intent getEditAccountIntent(boolean isSignedIn) {
    Uri uri = ContentUris.withAppendedId(Imps.Provider.CONTENT_URI, mProviderId);

    @SuppressWarnings("deprecation")
    Cursor cursor = managedQuery(uri, new String[] { Imps.Provider.CATEGORY }, null, null, null);
    cursor.moveToFirst();/* w  w  w. j av a  2s .co m*/

    Intent intent = new Intent(Intent.ACTION_EDIT,
            ContentUris.withAppendedId(Imps.Account.CONTENT_URI, mAccountId));
    intent.addCategory(cursor.getString(0));
    cursor.close();
    intent.putExtra("isSignedIn", isSignedIn);

    return intent;
}

From source file:com.ktouch.kdc.launcher4.camera.ui.ReviewDrawer.java

private void editInGallery(final int imageId) {
    if (imageId > 0) {
        Intent editIntent = new Intent(Intent.ACTION_EDIT);

        // Get URI
        Uri uri = null;/*w w  w.  ja  v a2  s.  com*/
        if (Gallery.getCameraMode() == Gallery.CAMERA_MODE_VIDEO) {
            uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI.buildUpon().appendPath(Integer.toString(imageId))
                    .build();
        } else {
            uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI.buildUpon().appendPath(Integer.toString(imageId))
                    .build();
        }

        // Start gallery edit activity
        editIntent.setDataAndType(uri, "image/*");
        editIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        Context ctx = getContext();
        if (ctx != null) {
            ctx.startActivity(Intent.createChooser(editIntent, null));
        }
    }
}