Example usage for android.content Intent ACTION_INSERT

List of usage examples for android.content Intent ACTION_INSERT

Introduction

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

Prototype

String ACTION_INSERT

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

Click Source Link

Document

Activity Action: Insert an empty item into the given container.

Usage

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

public void showSetupAccountForm(String providerType, String username, String token, boolean createAccount,
        String formTitle, boolean hideTor) {
    long providerId = helper.createAdditionalProvider(providerType);//xmpp
    mApp.resetProviderSettings(); //clear cached provider list

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_INSERT);

    intent.setData(ContentUris.withAppendedId(Imps.Provider.CONTENT_URI, providerId));
    intent.addCategory(ImApp.IMPS_CATEGORY);

    if (username != null)
        intent.putExtra("newuser", username);

    if (token != null)
        intent.putExtra("newpass", token);

    if (formTitle != null)
        intent.putExtra("title", formTitle);

    intent.putExtra("hideTor", hideTor);

    intent.putExtra("register", createAccount);

    startActivityForResult(intent, REQUEST_CREATE_ACCOUNT);
}

From source file:org.klnusbaum.udj.PlayerListFragment.java

public void joinPlayer(Player toJoin, String password) {
    Log.d(TAG, "Joining Player with id: " + toJoin.getId());
    am.setUserData(account, Constants.PLAYER_STATE_DATA, String.valueOf(Constants.JOINING_PLAYER));
    showProgress();// w  ww  .  j av  a2 s .  c  o m
    Intent joinPlayerIntent = new Intent(Intent.ACTION_INSERT, Constants.PLAYER_URI, getActivity(),
            PlayerCommService.class);
    joinPlayerIntent.putExtra(Constants.PLAYER_ID_EXTRA, toJoin.getId());
    joinPlayerIntent.putExtra(Constants.PLAYER_NAME_EXTRA, toJoin.getName());
    joinPlayerIntent.putExtra(Constants.PLAYER_OWNER_EXTRA, toJoin.getOwner().getUsername());
    joinPlayerIntent.putExtra(Constants.PLAYER_OWNER_ID_EXTRA, toJoin.getOwner().getId());
    joinPlayerIntent.putExtra(Constants.PLAYER_LAT_EXTRA, toJoin.getLatitude());
    joinPlayerIntent.putExtra(Constants.PLAYER_LONG_EXTRA, toJoin.getLongitude());
    joinPlayerIntent.putExtra(Constants.ACCOUNT_EXTRA, account);
    if (!password.equals("")) {
        joinPlayerIntent.putExtra(Constants.PLAYER_PASSWORD_EXTRA, password);
    }
    getActivity().startService(joinPlayerIntent);
}

From source file:org.gnucash.android.test.ui.AccountsActivityTest.java

public void testIntentAccountCreation() {
    Intent intent = new Intent(Intent.ACTION_INSERT);
    intent.putExtra(Intent.EXTRA_TITLE, "Intent Account");
    intent.putExtra(Intent.EXTRA_UID, "intent-account");
    intent.putExtra(Account.EXTRA_CURRENCY_CODE, "EUR");
    intent.setType(Account.MIME_TYPE);//from w w w.  j a  v a 2s. c o m
    getActivity().sendBroadcast(intent);

    //give time for the account to be created
    synchronized (mSolo) {
        try {
            mSolo.wait(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    AccountsDbAdapter dbAdapter = new AccountsDbAdapter(getActivity());
    Account account = dbAdapter.getAccount("intent-account");
    dbAdapter.close();
    assertNotNull(account);
    assertEquals("Intent Account", account.getName());
    assertEquals("intent-account", account.getUID());
    assertEquals("EUR", account.getCurrency().getCurrencyCode());
}

From source file:com.stoyanr.feeder.activity.ChannelsActivity.java

private void addChannel() {
    Log.d(TAG, "Adding new channel");
    Uri uri = ContentManager.getChannelsUri();
    startActivity(new Intent(Intent.ACTION_INSERT, uri));
}

From source file:org.klnusbaum.udj.EventListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    am.setUserData(account, Constants.EVENT_STATE_DATA, String.valueOf(Constants.JOINING_EVENT));
    showProgress();/*  w ww.j a va 2s  .c o  m*/
    Intent joinEventIntent = new Intent(Intent.ACTION_INSERT, Constants.EVENT_URI, getActivity(),
            EventCommService.class);
    Event toJoin = (Event) eventAdapter.getItem(position);
    joinEventIntent.putExtra(Constants.EVENT_ID_EXTRA, toJoin.getEventId());
    joinEventIntent.putExtra(Constants.EVENT_NAME_EXTRA, toJoin.getName());
    joinEventIntent.putExtra(Constants.EVENT_HOSTNAME_EXTRA, toJoin.getHostName());
    joinEventIntent.putExtra(Constants.EVENT_HOST_ID_EXTRA, toJoin.getHostId());
    joinEventIntent.putExtra(Constants.EVENT_LAT_EXTRA, toJoin.getLatitude());
    joinEventIntent.putExtra(Constants.EVENT_LONG_EXTRA, toJoin.getLongitude());
    joinEventIntent.putExtra(Constants.ACCOUNT_EXTRA, account);
    getActivity().startService(joinEventIntent);
}

From source file:com.misczak.joinmybridge.PhoneBookFragment.java

public void showCardOverFlowMenu(View v, Bridge b) {

    final Bridge bridgeCard = b;
    final View view = v;

    PopupMenu popup = new PopupMenu(getActivity(), view);
    popup.setOnMenuItemClickListener(new android.support.v7.widget.PopupMenu.OnMenuItemClickListener() {

        @Override//from www . j  a  v  a 2  s  .com
        public boolean onMenuItemClick(MenuItem item) {

            switch (item.getItemId()) {

            case R.id.menu_item_modify_bridge:

                Intent modifyIntent = new Intent(getActivity(), BridgeActivity.class);
                modifyIntent.putExtra(BridgeFragment.EXTRA_BRIDGE_ID, bridgeCard.getBridgeId());
                startActivity(modifyIntent);
                return true;

            case R.id.menu_item_export_bridge:
                Intent exportIntent = new Intent(Intent.ACTION_INSERT);
                exportIntent.setType(ContactsContract.Contacts.CONTENT_TYPE);

                if (!bridgeCard.getBridgeName().equals(BridgeFragment.DEFAULT_FIELD)) {
                    exportIntent.putExtra(ContactsContract.Intents.Insert.NAME, bridgeCard.getBridgeName());
                }

                exportIntent.putExtra(ContactsContract.Intents.Insert.PHONE, getNumberExtra(bridgeCard));
                getActivity().startActivity(exportIntent);

            default:
                return false;
            }
        }

    });
    popup.inflate(R.menu.bridge_card_overflow);
    popup.show();
}

From source file:edu.cens.loci.ui.PlaceListActivity.java

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {

    Intent intent;/*from   w w w .j a  v  a 2  s .c  om*/
    Bundle extras;

    switch (mMode) {
    case MODE_VIEW:
        //Log.i(TAG, "onListItemClick : position=" + position + ", id=" + id);
        if ((mFilterState & FILTER_STATE_SUGGESTED) != 0) {
            if (position == 0) {
                intent = new Intent(Constants.Intents.UI.ACTION_VIEW_SUGGESTED_GPS_PLACES);
                Toast.makeText(this, "Not supported yet", Toast.LENGTH_SHORT).show();
                return;
            } else {
                intent = new Intent(Intent.ACTION_VIEW, getSelectedUri(position - 1));
            }
        } else {
            intent = new Intent(Intent.ACTION_VIEW, getSelectedUri(position));
        }
        startActivity(intent);
        break;
    case MODE_INSERT:
        extras = getIntent().getExtras();
        if (position == 0) {
            intent = new Intent(Intent.ACTION_INSERT, Places.CONTENT_URI);
            if (extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_KEY)
                    && extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY)) {
                String wifiJson = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_KEY);
                String timestamp = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY);
                intent.putExtra(Insert.WIFI_FINTERPRINT, wifiJson);
                intent.putExtra(Insert.TIME, timestamp);
            }
            //intent = new Intent(Intent.ACTION_EDIT, getSelectedUri(position));
        } else {
            intent = new Intent(Intent.ACTION_EDIT, getSelectedUri(position - 1));
            if (extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_KEY)
                    && extras.containsKey(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY)) {
                String wifiJson = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_KEY);
                String timestamp = getIntent().getExtras().getString(UI.LIST_ORDER_EXTRA_WIFI_TIME_KEY);
                intent.putExtra(Insert.WIFI_FINTERPRINT, wifiJson);
                intent.putExtra(Insert.TIME, timestamp);
            }
        }
        //extras = getIntent().getExtras();
        //if (extras != null) 
        //   intent.putExtras(extras);

        startActivityForResult(intent, SUBACTIVITY_NEW_PLACE);
        break;
    case MODE_REGISTER_SUGGESTED:
        extras = getIntent().getExtras();
        if (position == 0) {
            intent = new Intent(Intents.UI.ACTION_CREATE_FROM_SUGGESTED_PLACE, getIntent().getData());
        } else {
            //intent = new Intent(Intents.UI.ACTION_ADDTO_FROM_SUGESTED_PLACE, getIntent().getData());
            //extras.putLong(Intents.UI.SELECTED_PLACE_ID_EXTRA_KEY, getSelectedPlaceId(position-1));
            intent = new Intent(Intents.UI.ACTION_ADDTO_FROM_SUGESTED_PLACE, getSelectedUri(position - 1));
            extras.putLong(Intents.UI.SELECTED_PLACE_ID_EXTRA_KEY, ContentUris.parseId(getIntent().getData()));
        }
        if (extras != null)
            intent.putExtras(extras);

        startActivityForResult(intent, SUBACTIVITY_NEW_PLACE);
        break;
    case MODE_PICK:
        final Uri uri = getSelectedUri(position);
        intent = new Intent();
        setResult(RESULT_OK, intent.setData(uri));
        finish();
        break;
    }

}

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();/* w  ww .  java  2s .c o m*/
        } 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:info.guardianproject.otr.app.im.app.AccountWizardActivity.java

public void createBurnerAccount() {

    OrbotHelper oh = new OrbotHelper(this);
    if (!oh.isOrbotInstalled()) {
        oh.promptToInstall(this);
        return;//from   w w  w .  j a v  a 2 s  . com
    } else if (!oh.isOrbotRunning()) {
        oh.requestOrbotStart(this);
        return;
    }

    //need to generate proper IMA url for account setup
    String regUser = java.util.UUID.randomUUID().toString().substring(0, 10).replace('-', 'a');
    String regPass = UUID.randomUUID().toString().substring(0, 16);
    String regDomain = "jabber.calyxinstitute.org";
    Uri uriAccountData = Uri.parse("ima://" + regUser + ':' + regPass + '@' + regDomain);

    Intent intent = new Intent(this, AccountActivity.class);
    intent.setAction(Intent.ACTION_INSERT);
    intent.setData(uriAccountData);
    intent.putExtra("useTor", true);
    startActivityForResult(intent, REQUEST_CREATE_ACCOUNT);

}

From source file:ai.api.sample.MainActivity.java

public synchronized void createCalendarEvent() {

    Calendar beginTime = Calendar.getInstance();
    beginTime.set(2017, 4, 6, 10, 15);/*from  w w w . j a  v a  2 s  .c o m*/
    Calendar endTime = Calendar.getInstance();
    endTime.set(2017, 4, 6, 10, 30);
    Intent intent = new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI)
            .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis())
            .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis())
            .putExtra(CalendarContract.Events.TITLE, "Reminder")
            .putExtra(CalendarContract.Events.DESCRIPTION, "Group class")
            .putExtra(CalendarContract.Events.EVENT_LOCATION, "The gym")
            .putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY)
            .putExtra(Intent.EXTRA_EMAIL, "15.amangupta@gmail.com");
    startActivity(intent);

}