Example usage for android.os Bundle EMPTY

List of usage examples for android.os Bundle EMPTY

Introduction

In this page you can find the example usage for android.os Bundle EMPTY.

Prototype

Bundle EMPTY

To view the source code for android.os Bundle EMPTY.

Click Source Link

Usage

From source file:ua.org.gdg.devfest.iosched.ui.HomeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_refresh:
        triggerRefresh();//from  w ww .  j  a v a2 s.c o m
        return true;

    case R.id.menu_search:
        if (!UIUtils.hasHoneycomb()) {
            startSearch(null, false, Bundle.EMPTY, false);
            return true;
        }
        break;

    case R.id.menu_about:
        HelpUtils.showAbout(this);
        return true;

    case R.id.menu_wifi:
        WiFiUtils.showWiFiDialog(this);
        return true;

    case R.id.menu_settings:
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.conferenceengineer.android.iosched.ui.HomeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_refresh:
        triggerRefresh();//from w w  w.  ja v  a2 s .c  o m
        return true;

    case R.id.menu_search:
        if (!UIUtils.hasHoneycomb()) {
            startSearch(null, false, Bundle.EMPTY, false);
            return true;
        }
        break;

    case R.id.menu_feedback:
        Intent feedbackIntent = new Intent(Intent.ACTION_VIEW);
        feedbackIntent.setData(Uri.parse(Config.FEEDBACK_URL));
        startActivity(feedbackIntent);
        return true;

    case R.id.menu_about:
        HelpUtils.showAbout(this);
        return true;

    case R.id.menu_wifi:
        WiFiUtils.showWiFiDialog(this);
        return true;

    case R.id.menu_settings:
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:org.thoughtcrime.securesms.conversation.ConversationFragment.java

private void initializeListAdapter() {
    if (this.recipient != null && this.threadId != -1) {
        ConversationAdapter adapter = new ConversationAdapter(getActivity(), GlideApp.with(this), locale,
                selectionClickListener, null, this.recipient);
        list.setAdapter(adapter);//  w w w  . j  ava 2  s.  c o m
        list.addItemDecoration(new StickyHeaderDecoration(adapter, false, false));

        setLastSeen(lastSeen);
        getLoaderManager().restartLoader(0, Bundle.EMPTY, this);
    }
}

From source file:tv.ouya.sample.game.OptionsActivity.java

private void requestPurchase(final Options.Level level)
        throws GeneralSecurityException, JSONException, UnsupportedEncodingException {
    final String productId = getProductIdForLevel(level);

    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");

    // This is an ID that allows you to associate a successful purchase with
    // it's original request. The server does nothing with this string except
    // pass it back to you, so it only needs to be unique within this instance
    // of your app to allow you to pair responses with requests.
    String uniqueId = Long.toHexString(sr.nextLong());

    JSONObject purchaseRequest = new JSONObject();
    purchaseRequest.put("uuid", uniqueId);
    purchaseRequest.put("identifier", productId);
    purchaseRequest.put("testing", "true"); // This value is only needed for testing, not setting it results in a live purchase
    String purchaseRequestJson = purchaseRequest.toString();

    byte[] keyBytes = new byte[16];
    sr.nextBytes(keyBytes);/*from   w w w  . j  ava 2  s  .c o m*/
    SecretKey key = new SecretKeySpec(keyBytes, "AES");

    byte[] ivBytes = new byte[16];
    sr.nextBytes(ivBytes);
    IvParameterSpec iv = new IvParameterSpec(ivBytes);

    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC");
    cipher.init(Cipher.ENCRYPT_MODE, key, iv);
    byte[] payload = cipher.doFinal(purchaseRequestJson.getBytes("UTF-8"));

    cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
    cipher.init(Cipher.ENCRYPT_MODE, mPublicKey);
    byte[] encryptedKey = cipher.doFinal(keyBytes);

    Purchasable purchasable = new Purchasable(productId, Base64.encodeToString(encryptedKey, Base64.NO_WRAP),
            Base64.encodeToString(ivBytes, Base64.NO_WRAP), Base64.encodeToString(payload, Base64.NO_WRAP));

    synchronized (mOutstandingPurchaseRequests) {
        mOutstandingPurchaseRequests.put(uniqueId, productId);
    }
    mOuyaFacade.requestPurchase(purchasable, new OuyaResponseListener<String>() {
        @Override
        public void onSuccess(String result) {
            String responseProductId;
            try {
                OuyaEncryptionHelper helper = new OuyaEncryptionHelper();

                JSONObject response = new JSONObject(result);
                String responseUUID = helper.decryptPurchaseResponse(response, mPublicKey);
                synchronized (mOutstandingPurchaseRequests) {
                    responseProductId = mOutstandingPurchaseRequests.remove(responseUUID);
                }
                if (responseProductId == null || !responseProductId.equals(productId)) {
                    onFailure(OuyaErrorCodes.THROW_DURING_ON_SUCCESS,
                            "Purchased product is not the same as purchase request product", Bundle.EMPTY);
                    return;
                }
            } catch (JSONException e) {
                onFailure(OuyaErrorCodes.THROW_DURING_ON_SUCCESS, e.getMessage(), Bundle.EMPTY);
                return;
            } catch (ParseException e) {
                onFailure(OuyaErrorCodes.THROW_DURING_ON_SUCCESS, e.getMessage(), Bundle.EMPTY);
                return;
            } catch (IOException e) {
                onFailure(OuyaErrorCodes.THROW_DURING_ON_SUCCESS, e.getMessage(), Bundle.EMPTY);
                return;
            } catch (GeneralSecurityException e) {
                onFailure(OuyaErrorCodes.THROW_DURING_ON_SUCCESS, e.getMessage(), Bundle.EMPTY);
                return;
            }

            if (responseProductId.equals(getProductIdForLevel(level))) {
                setNeedsPurchaseText(levelToRadioButton.get(level), false);
                Toast.makeText(OptionsActivity.this, "Level purchased!", Toast.LENGTH_LONG).show();
            }
        }

        @Override
        public void onFailure(int errorCode, String errorMessage, Bundle optionalData) {
            levelToRadioButton.get(FREEDOM).setChecked(true);
            Toast.makeText(OptionsActivity.this,
                    "Error making purchase!\n\nError " + errorCode + "\n" + errorMessage + ")",
                    Toast.LENGTH_LONG).show();

        }

        @Override
        public void onCancel() {
            levelToRadioButton.get(FREEDOM).setChecked(true);
            Toast.makeText(OptionsActivity.this, "You cancelled the purchase!", Toast.LENGTH_LONG).show();
        }
    });
}

From source file:nuclei.media.MediaService.java

@Override
public void onSpeedSet(float speed) {
    MediaProvider.getInstance().setAudioSpeed(speed);
    mSession.sendSessionEvent(createSpeedEvent(speed), Bundle.EMPTY);
}

From source file:nuclei.media.MediaService.java

@Override
public void onAutoContinueSet(boolean autoContinue) {
    mPlaybackManager.setAutoContinue(autoContinue);
    mSessionExtras.putBoolean(EXTRA_AUTO_CONTINUE, autoContinue);
    mSession.setExtras(mSessionExtras);//from w w  w .  ja  v a2  s.  com
    mSession.sendSessionEvent(createAutoContinueEvent(autoContinue), Bundle.EMPTY);
}

From source file:net.abcdroid.devfest12.ui.HomeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_refresh:
        triggerRefresh();/*from   ww  w  .  j  a v  a  2 s  . c  om*/
        return true;

    case R.id.menu_search:
        if (!UIUtils.hasHoneycomb()) {
            startSearch(null, false, Bundle.EMPTY, false);
            return true;
        }
        break;

    case R.id.menu_about:
        HelpUtils.showAbout(this);
        return true;

    case R.id.menu_sign_out:
        AccountUtils.signOut(this);
        finish();
        return true;

    case R.id.menu_beam:
        Intent beamIntent = new Intent(this, BeamActivity.class);
        startActivity(beamIntent);
        return true;

    }
    return super.onOptionsItemSelected(item);
}

From source file:dev.drsoran.moloko.util.UIUtils.java

public final static void showAboutMolokoDialog(FragmentActivity fragActivity) {
    final DialogFragment dialog = AboutMolokoDialogFragment.newInstance(Bundle.EMPTY);
    dialog.show(fragActivity.getSupportFragmentManager(), String.valueOf(R.id.frag_about_moloko));
}

From source file:com.ntsync.android.sync.shared.SyncUtils.java

/**
 * Create a new Account and activate the automatic sync
 * /*from  ww w . j a v a  2s  .  co  m*/
 * @param account
 *            null is not allowed
 * @param accountManager
 *            null is not allowed
 * @param password
 *            null is not allowed
 */
public static boolean createAccount(Context context, final Account account, AccountManager accountManager,
        String password) {
    boolean added = accountManager.addAccountExplicitly(account, password, null);
    if (added) {
        List<PeriodicSync> syncs = ContentResolver.getPeriodicSyncs(account, ContactsContract.AUTHORITY);
        if (syncs != null) {
            // Remove default syncs.
            for (PeriodicSync periodicSync : syncs) {
                ContentResolver.removePeriodicSync(account, ContactsContract.AUTHORITY, periodicSync.extras);
            }
        }
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
        int synctime;
        try {
            synctime = settings.getInt("pref_synctime", DEFAULT_SYNCINTERVAL);
        } catch (ClassCastException e) {
            LogHelper.logI(TAG, "Invalid SyncTime-Settingvalue", e);
            synctime = DEFAULT_SYNCINTERVAL;
        }
        if (synctime != 0) {
            addPeriodicSync(ContactsContract.AUTHORITY, Bundle.EMPTY, synctime, context);
        }

        // Set contacts sync for this account.
        ContentResolver.setSyncAutomatically(account, ContactsContract.AUTHORITY, true);
    } else {
        LogHelper.logI(TAG, "Account " + account.name + " is already available.");
    }
    return added;
}

From source file:com.jasonmheim.rollout.station.CoreContentProvider.java

private void setSyncPeriod(double periodInMinutes) {
    Log.i("Rollout", "Data update period in minutes: " + periodInMinutes);
    ContentResolver.addPeriodicSync(ACCOUNT, AUTHORITY, Bundle.EMPTY,
            (long) (periodInMinutes * Constants.SECONDS_PER_MINUTE));
}