Example usage for android.content Intent EXTRA_UID

List of usage examples for android.content Intent EXTRA_UID

Introduction

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

Prototype

String EXTRA_UID

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

Click Source Link

Document

Used as an int extra field in android.content.Intent#ACTION_UID_REMOVED intents to supply the uid the package had been assigned.

Usage

From source file:com.newcell.calltext.ui.account.AccountsEditListFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) {

        if (requestCode == CHOOSE_WIZARD) {
            // Wizard has been chosen, now create an account
            String wizardId = data.getStringExtra(WizardUtils.ID);
            Toast.makeText(getActivity(), "wizardId::" + wizardId, Toast.LENGTH_LONG).show();
            if (wizardId != null) {
                showDetails(SipProfile.INVALID_ID, wizardId);
            }//from ww  w  .j  a v  a 2  s .co  m
        } else if (requestCode == CHANGE_WIZARD) {
            // Change wizard done for this account.
            String wizardId = data.getStringExtra(WizardUtils.ID);
            long accountId = data.getLongExtra(Intent.EXTRA_UID, SipProfile.INVALID_ID);

            if (wizardId != null && accountId != SipProfile.INVALID_ID) {
                ContentValues cv = new ContentValues();
                cv.put(SipProfile.FIELD_WIZARD, wizardId);
                getActivity().getContentResolver().update(
                        ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, accountId), cv, null, null);

            }

        }
    }

}

From source file:com.abcvoipsip.ui.account.AccountsEditListFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    final SipProfile account = profileFromContextMenuInfo(item.getMenuInfo());
    if (account == null) {
        // For some reason the requested item isn't available, do nothing
        return super.onContextItemSelected(item);
    }//  w  ww .ja v a2 s  .  c  om

    switch (item.getItemId()) {
    case MENU_ITEM_DELETE: {
        getActivity().getContentResolver()
                .delete(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, account.id), null, null);
        return true;
    }
    case MENU_ITEM_MODIFY: {
        showDetails(account.id, account.wizard);
        return true;
    }
    case MENU_ITEM_ACTIVATE: {
        ContentValues cv = new ContentValues();
        cv.put(SipProfile.FIELD_ACTIVE, !account.active);
        getActivity().getContentResolver()
                .update(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, account.id), cv, null, null);
        return true;
    }
    case MENU_ITEM_WIZARD: {
        Intent it = new Intent(getActivity(), WizardChooser.class);
        it.putExtra(Intent.EXTRA_UID, account.id);
        startActivityForResult(it, CHANGE_WIZARD);
        return true;
    }
    }
    return super.onContextItemSelected(item);

}

From source file:com.csipsimple.ui.account.AccountsEditListFragment.java

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
    final SipProfile account = profileFromContextMenuInfo(item.getMenuInfo());
    if (account == null) {
        // For some reason the requested item isn't available, do nothing
        return super.onContextItemSelected(item);
    }//w  w  w  .jav a 2  s  .  c  o  m

    switch (item.getItemId()) {
    case MENU_ITEM_DELETE: {
        getActivity().getContentResolver()
                .delete(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, account.id), null, null);
        return true;
    }
    case MENU_ITEM_MODIFY: {
        showDetails(account.id, account.wizard);
        return true;
    }
    case MENU_ITEM_ACTIVATE: {
        ContentValues cv = new ContentValues();
        cv.put(SipProfile.FIELD_ACTIVE, !account.active);
        getActivity().getContentResolver()
                .update(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, account.id), cv, null, null);
        return true;
    }
    case MENU_ITEM_WIZARD: {
        Intent it = new Intent(getActivity(), WizardChooser.class);
        it.putExtra(Intent.EXTRA_UID, account.id);
        startActivityForResult(it, CHANGE_WIZARD);
        return true;
    }
    }
    return super.onContextItemSelected(item);

}

From source file:com.songcode.materialnotes.ui.NotesListActivity.java

private void openNode(NoteItemData data, View animStartView) {
    ActivityOptionsCompat optionsCompat = TransitionHelper.makeOptionsCompat(this,
            Pair.create(animStartView, "target_anim_view"));
    Intent intent = new Intent(this, NoteEditActivity.class);
    intent.setAction(Intent.ACTION_VIEW);
    intent.putExtra(Intent.EXTRA_UID, data.getId());
    BitmapUtil.storeBitmapInIntent(BitmapUtil.createBitmap(findViewById(R.id.drawer_layout)), intent);
    ActivityCompat.startActivityForResult(this, intent, REQUEST_CODE_OPEN_NODE, optionsCompat.toBundle());
}

From source file:com.songcode.materialnotes.ui.NoteEditActivity.java

private void sendToDesktop() {
    /**/* ww  w  .  ja v a 2  s. com*/
     * Before send message to home, we should make sure that current
     * editing note is exists in databases. So, for new note, firstly
     * save it
     */
    if (!mWorkingNote.existInDatabase()) {
        saveNote();
    }

    if (mWorkingNote.getNoteId() > 0) {
        Intent sender = new Intent();
        Intent shortcutIntent = new Intent(this, NoteEditActivity.class);
        shortcutIntent.setAction(Intent.ACTION_VIEW);
        shortcutIntent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId());
        sender.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
        sender.putExtra(Intent.EXTRA_SHORTCUT_NAME, makeShortcutIconTitle(mWorkingNote.getContent()));
        sender.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                Intent.ShortcutIconResource.fromContext(this, R.drawable.icon_app));
        sender.putExtra("duplicate", true);
        sender.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
        showToast(R.string.info_note_enter_desktop);
        sendBroadcast(sender);
    } else {
        /**
         * There is the condition that user has input nothing (the note is
         * not worthy saving), we have no note id, remind the user that he
         * should input something
         */
        Log.e(TAG, "Send to desktop error");
        showToast(R.string.error_note_empty_for_send_to_desktop);
    }
}