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.money.manager.ex.budget.BudgetListFragment.java

private void editBudget(int budgetId) {
    Intent intent = new Intent(getActivity(), BudgetEditActivity.class);
    intent.putExtra(BudgetEditActivity.KEY_BUDGET_ID, budgetId);
    intent.setAction(Intent.ACTION_EDIT);
    //startActivity(intent);
    startActivityForResult(intent, REQUEST_EDIT_BUDGET);
}

From source file:net.reichholf.dreamdroid.helpers.enigma2.Timer.java

/**
 * @param mph - A MultiPaneHandler instance
 * @param timer - A timer (ExtendedHashMap)
 * @param target - The target fragment (after saving/cancellation)
 * @param create - set to true if a new timer should be created instead of editing an existing one
 *///from  ww w.  ja va  2s .c om
public static void edit(MultiPaneHandler mph, ExtendedHashMap timer, Fragment target, boolean create) {
    ExtendedHashMap data = new ExtendedHashMap();

    TimerEditFragment f = new TimerEditFragment();
    Bundle args = new Bundle();
    data.put("timer", timer);
    args.putSerializable(DATA, data);

    String action = create ? DreamDroid.ACTION_CREATE : Intent.ACTION_EDIT;
    args.putString("action", action);

    f.setArguments(args);
    if (target != null) {
        f.setTargetFragment(target, Statics.REQUEST_EDIT_TIMER);
    }
    mph.showDetails(f, true);
}

From source file:org.smap.smapTask.android.activities.TaskAddressActivity.java

public void completeTask(String instancePath, String formPath, long taskId) {

    // Get the provider URI of the instance 
    String where = InstanceColumns.INSTANCE_FILE_PATH + "=?";
    String[] whereArgs = { instancePath };
    Cursor cInstanceProvider = managedQuery(InstanceColumns.CONTENT_URI, null, where, whereArgs, null);
    if (cInstanceProvider.getCount() != 1) {
        Log.e("MainListActivity:completeTask",
                "Unique instance not found: count is:" + cInstanceProvider.getCount());
    } else {/*from ww  w.j  a  va2 s  .  com*/
        cInstanceProvider.moveToFirst();
        Uri instanceUri = ContentUris.withAppendedId(InstanceColumns.CONTENT_URI,
                cInstanceProvider.getLong(cInstanceProvider.getColumnIndex(InstanceColumns._ID)));
        // Start activity to complete form
        Intent i = new Intent(Intent.ACTION_EDIT, instanceUri);

        i.putExtra(FormEntryActivity.KEY_FORMPATH, formPath); // TODO Don't think this is needed
        i.putExtra(FormEntryActivity.KEY_TASK, taskId);
        if (instancePath != null) { // TODO Don't think this is needed
            i.putExtra(FormEntryActivity.KEY_INSTANCEPATH, instancePath);
        }
        startActivity(i);
    }
    cInstanceProvider.close();
}

From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.list.ActivityList.java

@Override
public void openTask(final Uri taskUri, final long listId, final View origin) {
    // Todo change activity
    final Intent intent = new Intent().setAction(Intent.ACTION_EDIT).setClass(this, ActivityEditor.class)
            .setData(taskUri).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
            .putExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, listId);
    // User clicked a task in the list
    // tablet//from ww w  .ja  va  2s  . com
    // todo tablet
    /*if (fragment2 != null) {
    // Set the intent here also so rotations open the same item
    setIntent(intent);
    getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim
            .slide_in_top, R.anim.slide_out_bottom).replace(R.id.fragment2,
            TaskDetailFragment_.getInstance(taskUri)).commitAllowingStateLoss();
    taskHint.setVisibility(View.GONE);
    }
    // phone
    else {*/
    startActivity(intent);
    // }
    //}
}

From source file:org.andstatus.app.account.AccountSettingsActivity.java

private void onAccountSelected(int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        state.builder = MyAccount.Builder.newOrExistingFromAccountName(MyContextHolder.get(),
                data.getStringExtra(IntentExtra.EXTRA_ACCOUNT_NAME.key), TriState.UNKNOWN);
        if (!state.builder.isPersistent()) {
            mIsFinishing = true;//ww w  .j  a  v a 2  s.  co  m
        }
    } else {
        mIsFinishing = true;
    }
    if (!mIsFinishing) {
        MyLog.v(this, "Switching to the selected account");
        MyContextHolder.get().persistentAccounts().setCurrentAccount(state.builder.getAccount());
        state.setAccountAction(Intent.ACTION_EDIT);
        updateScreen();
    } else {
        MyLog.v(this, "No account supplied, finishing");
        finish();
    }
}

From source file:org.hfoss.posit.android.api.fragment.ListFindsFragment.java

/**
 * Puts the items from the DB table into the rows of the view.
 *//* w w w.j av  a 2 s.  c om*/
private void fillList(ListAdapter adapter) {
    setListAdapter(adapter);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            TextView tv = (TextView) view.findViewById(R.id.id);
            int ormId = Integer.parseInt((String) tv.getText());
            Bundle extras = new Bundle();
            extras.putInt(Find.ORM_ID, ormId);
            displayFind(position, Intent.ACTION_EDIT, extras, null);
        }
    });
}

From source file:com.example.android.notepad.NotesList.java

@Override
protected void onListItemClick(ListView 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)) {
        // The caller is waiting for us to return a note selected by
        // the user.  The have clicked on one, so return it now.
        setResult(RESULT_OK, new Intent().setData(uri));
    } else {//from   w  w  w.j a va 2 s. com
        // Launch activity to view/edit the currently selected item
        startActivity(new Intent(Intent.ACTION_EDIT, uri));
    }
}

From source file:com.appjma.appdeployer.AppFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    switch (itemId) {
    case R.id.menu_refresh:
        mDownloadHelper.startDownloading(null, true);
        return true;
    case R.id.menu_edit:
        startActivity(new Intent(Intent.ACTION_EDIT, mUri));
        return true;
    default:/*from  w ww  .j  a va 2  s .c om*/
        return super.onOptionsItemSelected(item);
    }
}

From source file:edu.mit.mobile.android.livingpostcards.CardListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info;
    try {/*from www. java2 s.  c  o m*/
        info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    } catch (final ClassCastException e) {
        Log.e(TAG, "bad menuInfo", e);
        return false;
    }
    final Uri card = ContentUris.withAppendedId(mCards, info.id);

    switch (item.getItemId()) {
    case R.id.share:
        send(mAdapter.getCursor());
        return true;

    case R.id.edit:
        startActivity(new Intent(Intent.ACTION_EDIT, card));
        return true;

    case R.id.delete:
        startActivity(new Intent(Intent.ACTION_DELETE, card));
        return true;
    default:
        return super.onContextItemSelected(item);
    }

}

From source file:net.reichholf.dreamdroid.activities.TimerEditActivity.java

@SuppressWarnings("unchecked")
@Override/*  w w w  . j a v a 2 s .co m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.timer_edit);

    mName = (EditText) findViewById(R.id.EditTextTitle);
    mDescription = (EditText) findViewById(R.id.EditTextDescription);
    mEnabled = (CheckBox) findViewById(R.id.CheckBoxEnabled);
    mAfterevent = (Spinner) findViewById(R.id.SpinnerAfterEvent);
    mLocation = (Spinner) findViewById(R.id.SpinnerLocation);
    mStart = (TextView) findViewById(R.id.TextViewBegin);
    mEnd = (TextView) findViewById(R.id.TextViewEnd);
    mRepeatings = (TextView) findViewById(R.id.TextViewRepeated);
    mService = (TextView) findViewById(R.id.TextViewService);
    mTags = (TextView) findViewById(R.id.TextViewTags);

    mSave = (Button) findViewById(R.id.ButtonSave);
    mCancel = (Button) findViewById(R.id.ButtonCancel);

    // onClickListeners
    registerOnClickListener(mSave, ITEM_SAVE);
    registerOnClickListener(mCancel, ITEM_CANCEL);
    registerOnClickListener(mService, ITEM_PICK_SERVICE);
    registerOnClickListener(mStart, ITEM_PICK_START);
    registerOnClickListener(mEnd, ITEM_PICK_END);
    registerOnClickListener(mRepeatings, ITEM_PICK_REPEATED);
    registerOnClickListener(mTags, ITEM_PICK_TAGS);

    mAfterevent.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
            mTimer.put(Timer.AFTER_EVENT, new Integer(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.LOCATION, DreamDroid.LOCATIONS.get(position));
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
            // TODO implement some nothing-selected-handler for locations
        }
    });

    // Default result of this Activity is RESULT_CANCELED
    setResult(RESULT_CANCELED);

    // Initialize if savedInstanceState won't
    if (savedInstanceState == null) {
        HashMap<String, Object> map = (HashMap<String, Object>) getIntent().getExtras().get(sData);
        ExtendedHashMap data = new ExtendedHashMap();
        data.putAll(map);

        mTimer = new ExtendedHashMap();
        mTimer.putAll((HashMap<String, Object>) data.get("timer"));

        if (getIntent().getAction().equals(Intent.ACTION_EDIT)) {
            mTimerOld = mTimer.clone();
        } else {
            mTimerOld = null;
        }

        mSelectedTags = new ArrayList<String>();

        if (DreamDroid.LOCATIONS.size() == 0 || DreamDroid.TAGS.size() == 0) {
            mGetLocationsAndTagsTask = new GetLocationsAndTagsTask(this);
            mGetLocationsAndTagsTask.execute();
        } else {
            reload();
        }
    }
}