Example usage for android.os Bundle putBoolean

List of usage examples for android.os Bundle putBoolean

Introduction

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

Prototype

public void putBoolean(@Nullable String key, boolean value) 

Source Link

Document

Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:cn.com.hgh.view.SlideSwitch.java

@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putBoolean("isOpen", this.isOpen);
    return bundle;
}

From source file:com.google.android.apps.dashclock.api.ExtensionData.java

/**
 * Serializes the contents of this object to a {@link Bundle}.
 *//* www  .  j a  va 2  s. c  o m*/
public Bundle toBundle() {
    Bundle data = new Bundle();
    data.putBoolean(KEY_VISIBLE, mVisible);
    data.putInt(KEY_ICON, mIcon);
    data.putString(KEY_ICON_URI, (mIconUri == null ? null : mIconUri.toString()));
    data.putString(KEY_STATUS, mStatus);
    data.putString(KEY_EXPANDED_TITLE, mExpandedTitle);
    data.putString(KEY_EXPANDED_BODY, mExpandedBody);
    data.putString(KEY_CLICK_INTENT, (mClickIntent == null) ? null : mClickIntent.toUri(0));
    data.putString(KEY_CONTENT_DESCRIPTION, mContentDescription);
    return data;
}

From source file:com.njlabs.amrita.aid.info.Calender.java

@Override
public void init(Bundle savedInstanceState) {
    setupLayout(R.layout.activity_calender, Color.parseColor("#fe5352"));

    final Calender thisContext = this;

    descriptions = new HashMap<>();
    backgroundColors = new HashMap<>();
    textColors = new HashMap<>();

    SharedPreferences preferences = getSharedPreferences("app_extra", Context.MODE_PRIVATE);
    Boolean AgreeStatus = preferences.getBoolean("calender_agree", false);

    if (!AgreeStatus) {
        AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
        builder.setTitle("Academic Calender").setIcon(R.drawable.ic_action_info_small).setMessage(
                "Red denotes that it's an Exam day. Blue denotes an event (not a Holiday). Whereas Green denotes a Holiday. I'm not resposibile for the accuracy of the dates")
                .setCancelable(false).setPositiveButton("I Agree", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        SharedPreferences preferences = getSharedPreferences("app_extra", Context.MODE_PRIVATE);
                        SharedPreferences.Editor editor = preferences.edit();
                        editor.putBoolean("calender_agree", true);
                        editor.apply();/*  ww  w .j  a va 2s . c om*/
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    }

    caldroidFragment = new CaldroidFragment();

    if (savedInstanceState != null) {
        caldroidFragment.restoreStatesFromKey(savedInstanceState, "CALDROID_SAVED_STATE");
    } else {
        Bundle args = new Bundle();
        Calendar cal = Calendar.getInstance();
        args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
        args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
        args.putBoolean(CaldroidFragment.ENABLE_SWIPE, true);
        caldroidFragment.setArguments(args);
    }

    setCustomResourceForDates();

    FragmentTransaction t = getSupportFragmentManager().beginTransaction();
    t.replace(R.id.calendar, caldroidFragment);
    t.commit();

    final CaldroidListener listener = new CaldroidListener() {
        @Override
        public void onSelectDate(Date date, View view) {
            if (!formatter.format(date).equals("")) {
                String description = descriptions.get(formatter.format(date));
                if (description != null && !description.equals("")) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
                    builder.setMessage(description).setCancelable(true).setPositiveButton("Close",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    dialog.cancel();
                                }
                            });
                    AlertDialog alert = builder.create();
                    alert.show();
                }
            }
        }
    };
    caldroidFragment.setCaldroidListener(listener);
}

From source file:com.hivewallet.androidclient.wallet.AddressBookProvider.java

@Override
public Bundle call(String method, String arg, Bundle extras) {
    if (method.equals(METHOD_INSERT_OR_UPDATE_PHOTO_URI)) {
        if (arg == null)
            return null;

        boolean alreadyPresent = helper.insertOrUpdatePhotoAsset(arg);
        Bundle bundle = new Bundle();
        bundle.putBoolean(PHOTO_URI_PRESENT, alreadyPresent);

        return bundle;
    } else if (method.equals(METHOD_DELETE_STALE_PHOTO_URIS)) {
        ArrayList<String> stalePhotoUris = helper.deleteStalePhotoAssets();
        Bundle bundle = new Bundle();
        bundle.putStringArrayList(STALE_PHOTO_URIS, stalePhotoUris);

        return bundle;
    } else if (method.equals(METHOD_SET_PHOTO_ASSET_AS_PERMANENT)) {
        if (arg == null)
            return null;

        helper.setPhotoAssetAsPermanent(arg, true);
        return null;
    } else {/*from   www  . j  a va2 s  .  c  o  m*/
        throw new UnsupportedOperationException("Unknown method: " + method);
    }
}

From source file:com.frostwire.android.gui.fragments.ImageViewerFragment.java

private Bundle prepareFileBundle(FileDescriptor fd, int offset, boolean inFullScreenMode) {
    Bundle result = new Bundle();
    result.putBundle(EXTRA_FILE_DESCRIPTOR_BUNDLE, fd.toBundle());
    result.putBoolean(EXTRA_IN_FULL_SCREEN_MODE, inFullScreenMode);
    result.putInt(EXTRA_ADAPTER_FILE_OFFSET, offset);
    return result;
}

From source file:com.mirasense.scanditsdk.plugin.FullScreenPickerActivity.java

@Override
public void didScan(ScanSession session) {
    if (sPendingClose.get()) {
        // return if there is a pending close. Otherwise we might deadlock
        return;/*from  w w w  . j  a v a2 s.  c  o  m*/
    }
    Bundle bundle = bundleForScanResult(session);
    if (!mContinuousMode) {
        mPickerStateMachine.switchToNextScanState(PickerStateMachine.PAUSED, session);
        final Intent intent = new Intent();
        bundle.putBoolean("waitForResult", false);
        intent.putExtras(bundle);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                setResult(SCAN, intent);
                finish();
            }
        });
        return;
    }
    int nextState = ResultRelay.relayResult(bundle);
    mPickerStateMachine.switchToNextScanState(nextState, session);
    Marshal.rejectCodes(session, mRejectedCodeIds);
}

From source file:org.anhonesteffort.flock.registration.model.FlockAccount.java

public Bundle toBundle() throws JsonProcessingException {
    Bundle bundle = new Bundle();

    bundle.putString(KEY_ACCOUNT_ID, id);
    bundle.putInt(KEY_VERSION, version);
    bundle.putString(KEY_STRIPE_CUSTOMER_ID, stripeCustomerId);
    bundle.putString(KEY_PASSWORD_SHA512, passwordSha512);
    bundle.putLong(KEY_CREATE_DATE, createDate.getTime());
    bundle.putBoolean(KEY_LAST_STRIPE_CHARGE_FAILED, lastStripeChargeFailed);
    bundle.putBoolean(KEY_AUTO_RENEW_ENABLED, autoRenewEnabled);
    bundle.putInt(KEY_SUBSCRIPTION_PLAN_TYPE, subscriptionPlan.getPlanType());
    bundle.putString(KEY_SUBSCRIPTION_PLAN, subscriptionPlan.serialize());

    return bundle;
}

From source file:com.friedran.appengine.dashboard.client.AppEngineDashboardClient.java

/**
 * Send an authenticated GetApplications request asynchronously and return its results to the given callback.
 */// w  w  w  .  j  a v a2 s  .c om
public void executeGetApplications(final PostExecuteCallback postGetApplicationsCallback) {
    new AuthenticatedRequestTask("https://appengine.google.com/",
            new AuthenticatedRequestTaskBackgroundCallback() {
                @Override
                public Bundle run(final HttpEntity httpResponse) {
                    Bundle result = new Bundle();
                    try {

                        mLastRetrievedApplications = AppEngineParserUtils
                                .getApplicationIDs(httpResponse.getContent());
                        result.putStringArrayList(KEY_APPLICATIONS, mLastRetrievedApplications);
                        result.putBoolean(KEY_RESULT, true);

                    } catch (IOException e) {
                        LogUtils.e("AppEngineDashboardClient", "Failed parsing the GetApplications response",
                                e);
                        result.putBoolean(KEY_RESULT, false);
                    }
                    return result;
                }
            }, postGetApplicationsCallback).executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}

From source file:com.android.deskclock.RingtonePickerDialogFragment.java

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putBoolean(STATE_KEY_REQUESTING_PERMISSION, mRequestingPermission);
    outState.putParcelable(STATE_KEY_SELECTED_RINGTONE_URI, mSelectedRingtoneUri);
}

From source file:com.app.jdy.ui.CashAdvanceActivity.java

private void addEvents() {
    button.setOnClickListener(new OnClickListener() {

        @Override/*from w  w w. j a  v a  2  s.  com*/
        public void onClick(View v) {

            // ????
            if (HttpUtils.isNetworkConnected(CashAdvanceActivity.this)) {

                if (editText.getText().toString().length() == 0) {
                    Toast.makeText(CashAdvanceActivity.this, "?", Toast.LENGTH_SHORT).show();
                } else {

                    // ?
                    int count = 0, start = 0;
                    while ((start = editText.getText().toString().indexOf(".", start)) >= 0) {
                        start += ".".length();
                        count++;
                    }
                    if (count > 1 || editText.getText().toString().indexOf(".") == 0) {
                        Toast.makeText(CashAdvanceActivity.this, "", Toast.LENGTH_SHORT)
                                .show();
                    } else {

                        // ?????
                        BigDecimal judgemoney = null;
                        try {
                            judgemoney = new BigDecimal(editText.getText().toString());
                        } catch (NumberFormatException e) {
                            Toast.makeText(CashAdvanceActivity.this, "",
                                    Toast.LENGTH_SHORT).show();
                            return;
                        }
                        judgemoney = judgemoney.setScale(2, BigDecimal.ROUND_HALF_UP);

                        // ?????
                        String judgecanWithdCash = textView2.getText().toString();

                        if (textView4.getText().toString().equals("?")
                                || textView4.getText().toString().length() == 0
                                || textView3.getText().toString().length() == 0) {
                            Toast.makeText(CashAdvanceActivity.this, "?", Toast.LENGTH_SHORT)
                                    .show();
                        } else if (judgemoney.toString() == "0.00") {
                            Toast.makeText(CashAdvanceActivity.this, "?0?",
                                    Toast.LENGTH_SHORT).show();
                        } else if (judgemoney
                                .compareTo(BigDecimal.valueOf(Double.valueOf(judgecanWithdCash))) == 1) {
                            // BigDecimalcompareTo-1 ? 0
                            // 1
                            Toast.makeText(CashAdvanceActivity.this, "??????",
                                    Toast.LENGTH_LONG).show();
                        } else {
                            editText.setText(judgemoney.toString());

                            withdrawCashDialog = new WithdrawCashDialog(CashAdvanceActivity.this,
                                    R.style.ForwardDialog, judgemoney.toString());
                            withdrawCashDialog.show();
                        }

                    }

                }
            } else {
                // ??
                Toast.makeText(CashAdvanceActivity.this, Constants.NO_INTENT_TIPS, Toast.LENGTH_LONG).show();
            }

        }
    });

    // ??????
    findViewById(R.id.cash_textView5).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(CashAdvanceActivity.this, BankCardActivity.class);

            Bundle bundle = new Bundle();
            bundle.putBoolean("isOk", true);
            intent.putExtras(bundle);
            startActivity(intent);
            finish();
        }
    });

}