Example usage for android.os Bundle getBoolean

List of usage examples for android.os Bundle getBoolean

Introduction

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

Prototype

public boolean getBoolean(String key, boolean defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

From source file:com.actinarium.rhythm.sample.RhythmSandbox.java

public void onRestoreInstanceState(Bundle savedState) {
    if (savedState == null) {
        mOverlayConfig.setText(DEFAULT_SANDBOX_CONFIG);
    } else {// w ww . j  av  a  2s . co  m
        mDoRender = savedState.getBoolean(ARG_RENDER, false);
        if (mDoRender) {
            updatePreview();
        }
    }
}

From source file:com.apptentive.android.sdk.module.engagement.interaction.view.survey.SurveyInteractionView.java

@Override
public void doOnCreate(final Activity activity, Bundle savedInstanceState) {

    if (savedInstanceState != null) {
        surveySubmitted = savedInstanceState.getBoolean(KEY_SURVEY_SUBMITTED, false);
    }//from   w ww  . ja va 2  s . com

    if (interaction == null || surveySubmitted) {
        activity.finish();
        return;
    }

    activity.setContentView(R.layout.apptentive_survey);

    // Hide branding if needed.
    final View branding = activity.findViewById(R.id.apptentive_branding_view);
    if (branding != null) {
        if (Configuration.load(activity).isHideBranding(activity)) {
            branding.setVisibility(View.GONE);
        }
    }

    TextView title = (TextView) activity.findViewById(R.id.title);
    title.setFocusable(true);
    title.setFocusableInTouchMode(true);
    title.setText(interaction.getName());

    String descriptionText = interaction.getDescription();
    if (descriptionText != null) {
        TextView description = (TextView) activity.findViewById(R.id.description);
        description.setText(descriptionText);
        description.setVisibility(View.VISIBLE);
    }

    final Button send = (Button) activity.findViewById(R.id.send);
    send.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Util.hideSoftKeyboard(activity, view);
            surveySubmitted = true;
            if (interaction.isShowSuccessMessage() && interaction.getSuccessMessage() != null) {
                SurveyThankYouDialog dialog = new SurveyThankYouDialog(activity);
                dialog.setMessage(interaction.getSuccessMessage());
                dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialogInterface) {
                        activity.finish();
                    }
                });
                dialog.show();
            } else {
                activity.finish();
            }

            EngagementModule.engageInternal(activity, interaction, EVENT_SUBMIT, data.toString());
            ApptentiveDatabase.getInstance(activity).addPayload(new SurveyResponse(interaction, surveyState));
            Log.d("Survey Submitted.");
            callListener(true);

            cleanup();
        }
    });

    LinearLayout questions = (LinearLayout) activity.findViewById(R.id.questions);
    questions.removeAllViews();

    // Then render all the questions
    for (final Question question : interaction.getQuestions()) {
        if (question.getType() == Question.QUESTION_TYPE_SINGLELINE) {
            TextSurveyQuestionView textQuestionView = new TextSurveyQuestionView(activity, surveyState,
                    (SinglelineQuestion) question);
            textQuestionView.setOnSurveyQuestionAnsweredListener(new OnSurveyQuestionAnsweredListener() {
                public void onAnswered() {
                    sendMetricForQuestion(activity, question);
                    send.setEnabled(isSurveyValid());
                }
            });
            questions.addView(textQuestionView);
        } else if (question.getType() == Question.QUESTION_TYPE_MULTICHOICE) {
            MultichoiceSurveyQuestionView multichoiceQuestionView = new MultichoiceSurveyQuestionView(activity,
                    surveyState, (MultichoiceQuestion) question);
            multichoiceQuestionView.setOnSurveyQuestionAnsweredListener(new OnSurveyQuestionAnsweredListener() {
                public void onAnswered() {
                    sendMetricForQuestion(activity, question);
                    send.setEnabled(isSurveyValid());
                }
            });
            questions.addView(multichoiceQuestionView);
        } else if (question.getType() == Question.QUESTION_TYPE_MULTISELECT) {
            MultiselectSurveyQuestionView multiselectQuestionView = new MultiselectSurveyQuestionView(activity,
                    surveyState, (MultiselectQuestion) question);
            multiselectQuestionView.setOnSurveyQuestionAnsweredListener(new OnSurveyQuestionAnsweredListener() {
                public void onAnswered() {
                    sendMetricForQuestion(activity, question);
                    send.setEnabled(isSurveyValid());
                }
            });
            questions.addView(multiselectQuestionView);
        }
    }

    send.setEnabled(isSurveyValid());

    // Force the top of the survey to be shown first.
    title.requestFocus();
}

From source file:com.grass.caishi.cc.activity.main.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//from  www.  j a v  a  2 s  . com
    dialog = new ProgressDialog(getActivity());
    dialog.setMessage("?...");
    DeviceUuidFactory uuid = new DeviceUuidFactory(getActivity());
    InitView();
    InitData(false);

}

From source file:cn.wjh1119.bestnews.ui.fragment.DetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    //??//w  w  w.  ja v  a 2 s.  com
    Bundle arguments = getArguments();
    if (arguments != null) {
        mUri = arguments.getParcelable(DetailFragment.DETAIL_URI);
        mTransitionAnimation = arguments.getBoolean(DetailFragment.DETAIL_TRANSITION_ANIMATION, false);
    }

    View rootView = inflater.inflate(R.layout.fragment_detail_start, container, false);

    //?reviewFragment?
    Fragment reviewFragment = getChildFragmentManager().findFragmentByTag(REVIEWFRAGMENT_TAG);
    if (reviewFragment == null) {
        Logger.i(LOG_TAG, "add new reviewFragment !!");
        Bundle args = new Bundle();
        args.putParcelable(ReviewFragment.REVIEW_URI, mUri);

        reviewFragment = new ReviewFragment();
        reviewFragment.setArguments(args);

        FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.container_review, reviewFragment, REVIEWFRAGMENT_TAG).commit();
    } else {
        Logger.i(LOG_TAG, "found existing reviewFragment, no need to add it again !!");
    }

    //view
    ButterKnife.bind(this, rootView);

    imageManager = ImageManager.getSingleton(getContext());

    return rootView;
}

From source file:com.appniche.android.sunshine.app.DetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle arguments = getArguments();
    if (arguments != null) {
        mUri = arguments.getParcelable(DetailFragment.DETAIL_URI);
        mTransitionAnimation = arguments.getBoolean(DetailFragment.DETAIL_TRANSITION_ANIMATION, false);
    }//w  ww .  j  a v  a2s .  c o m

    View rootView = inflater.inflate(R.layout.fragment_detail_start, container, false);
    mIconView = (ImageView) rootView.findViewById(R.id.detail_icon);
    mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview);
    mDescriptionView = (TextView) rootView.findViewById(R.id.detail_forecast_textview);
    mHighTempView = (TextView) rootView.findViewById(R.id.detail_high_textview);
    mLowTempView = (TextView) rootView.findViewById(R.id.detail_low_textview);
    mHumidityView = (TextView) rootView.findViewById(R.id.detail_humidity_textview);
    mHumidityLabelView = (TextView) rootView.findViewById(R.id.detail_humidity_label_textview);
    mWindView = (TextView) rootView.findViewById(R.id.detail_wind_textview);
    mWindLabelView = (TextView) rootView.findViewById(R.id.detail_wind_label_textview);
    mPressureView = (TextView) rootView.findViewById(R.id.detail_pressure_textview);
    mPressureLabelView = (TextView) rootView.findViewById(R.id.detail_pressure_label_textview);
    return rootView;
}

From source file:edu.mit.media.funf.probe.Probe.java

private static boolean isDataRequestAcceptingPassiveData(Bundle dataRequest, Parameter[] availableParameters) {
    boolean acceptOpportunisticData = true;
    Parameter opportunisticParameter = Parameter.getAvailableParameter(availableParameters,
            Parameter.Builtin.OPPORTUNISTIC);
    if (opportunisticParameter != null) {
        acceptOpportunisticData = dataRequest.getBoolean(opportunisticParameter.getName(),
                (Boolean) opportunisticParameter.getValue());
    }//from w  w  w  .  j a v a 2  s  .co m
    return acceptOpportunisticData;
}

From source file:com.alboteanu.android.sunshine.app.DetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle arguments = getArguments();
    if (arguments != null) {
        mUri = arguments.getParcelable(DetailFragment.DETAIL_URI);
        mTransitionAnimation = arguments.getBoolean(DetailFragment.DETAIL_TRANSITION_ANIMATION, false);
    }/*from w w w.  j a v  a2s . co  m*/

    View rootView = inflater.inflate(R.layout.fragment_detail_start, container, false);
    //        rootView.setBackgroundColor(Color.TRANSPARENT);
    mIconView = (ImageView) rootView.findViewById(R.id.detail_icon);
    mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview);
    mDescriptionView = (TextView) rootView.findViewById(R.id.detail_forecast_textview);
    mHighTempView = (TextView) rootView.findViewById(R.id.detail_high_textview);
    mLowTempView = (TextView) rootView.findViewById(R.id.detail_low_textview);
    mHumidityView = (TextView) rootView.findViewById(R.id.detail_humidity_textview);
    mHumidityLabelView = (TextView) rootView.findViewById(R.id.detail_humidity_label_textview);
    mWindView = (TextView) rootView.findViewById(R.id.detail_wind_textview);
    mWindLabelView = (TextView) rootView.findViewById(R.id.detail_wind_label_textview);
    mPressureView = (TextView) rootView.findViewById(R.id.detail_pressure_textview);
    mPressureLabelView = (TextView) rootView.findViewById(R.id.detail_pressure_label_textview);
    //        adView = (AdView) rootView.findViewById(R.id.adView_med_rect);

    return rootView;
}

From source file:cn.kangeqiu.kq.activity.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;// w  w  w  .j  a va  2  s .c  o m
    rl_switch_notification = (RelativeLayout) getView().findViewById(R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(R.id.rl_switch_speaker);

    iv_switch_open_notification = (ImageView) getView().findViewById(R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) getView().findViewById(R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) getView().findViewById(R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) getView().findViewById(R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) getView().findViewById(R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) getView().findViewById(R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) getView().findViewById(R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) getView().findViewById(R.id.iv_switch_close_speaker);
    logoutBtn = (Button) getView().findViewById(R.id.btn_logout);
    if (!TextUtils.isEmpty(EMChatManager.getInstance().getCurrentUser())) {
        logoutBtn.setText(
                getString(R.string.button_logout) + "(" + EMChatManager.getInstance().getCurrentUser() + ")");
    }

    textview1 = (TextView) getView().findViewById(R.id.textview1);
    textview2 = (TextView) getView().findViewById(R.id.textview2);

    blacklistContainer = (LinearLayout) getView().findViewById(R.id.ll_black_list);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    blacklistContainer.setOnClickListener(this);
    rl_switch_notification.setOnClickListener(this);
    rl_switch_sound.setOnClickListener(this);
    rl_switch_vibrate.setOnClickListener(this);
    rl_switch_speaker.setOnClickListener(this);
    logoutBtn.setOnClickListener(this);
    llDiagnose.setOnClickListener(this);
    chatOptions = EMChatManager.getInstance().getChatOptions();
    if (chatOptions.getNotificationEnable()) {
        iv_switch_open_notification.setVisibility(View.VISIBLE);
        iv_switch_close_notification.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_notification.setVisibility(View.INVISIBLE);
        iv_switch_close_notification.setVisibility(View.VISIBLE);
    }
    if (chatOptions.getNoticedBySound()) {
        iv_switch_open_sound.setVisibility(View.VISIBLE);
        iv_switch_close_sound.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_sound.setVisibility(View.INVISIBLE);
        iv_switch_close_sound.setVisibility(View.VISIBLE);
    }
    if (chatOptions.getNoticedByVibrate()) {
        iv_switch_open_vibrate.setVisibility(View.VISIBLE);
        iv_switch_close_vibrate.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_vibrate.setVisibility(View.INVISIBLE);
        iv_switch_close_vibrate.setVisibility(View.VISIBLE);
    }

    if (chatOptions.getUseSpeaker()) {
        iv_switch_open_speaker.setVisibility(View.VISIBLE);
        iv_switch_close_speaker.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_open_speaker.setVisibility(View.INVISIBLE);
        iv_switch_close_speaker.setVisibility(View.VISIBLE);
    }

}

From source file:com.android.messaging.ui.conversationlist.ConversationListFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);
    if (VERBOSE) {
        LogUtil.v(LogUtil.BUGLE_TAG, "Attaching List");
    }//from w w w  .  j  av  a  2  s  . c  o  m
    final Bundle arguments = getArguments();
    if (arguments != null) {
        mArchiveMode = arguments.getBoolean(BUNDLE_ARCHIVED_MODE, false);
        mForwardMessageMode = arguments.getBoolean(BUNDLE_FORWARD_MESSAGE_MODE, false);
    }
    mListBinding.bind(DataModel.get().createConversationListData(activity, this, mArchiveMode));
}

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

/**
 * Deserializes the given {@link Bundle} representation of extension data, populating this
 * object.//from  w  ww . j  a  v a  2s. com
 */
public void fromBundle(Bundle src) {
    this.mVisible = src.getBoolean(KEY_VISIBLE, true);
    this.mIcon = src.getInt(KEY_ICON);
    String iconUriString = src.getString(KEY_ICON_URI);
    this.mIconUri = TextUtils.isEmpty(iconUriString) ? null : Uri.parse(iconUriString);
    this.mStatus = src.getString(KEY_STATUS);
    this.mExpandedTitle = src.getString(KEY_EXPANDED_TITLE);
    this.mExpandedBody = src.getString(KEY_EXPANDED_BODY);
    try {
        this.mClickIntent = Intent.parseUri(src.getString(KEY_CLICK_INTENT), 0);
    } catch (URISyntaxException ignored) {
    }
    this.mContentDescription = src.getString(KEY_CONTENT_DESCRIPTION);
}