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.clover.sdk.v3.entitlements.Entitlements.java

public boolean isAllowed(String entitlement) {
    Bundle extras = new Bundle();
    extras.putString(EXTRA_ENTITLEMENT, entitlement);
    Bundle result = context.getContentResolver().call(getAuthorityUri(), METHOD_IS_ALLOWED, null, extras);
    if (result == null) {
        return false;
    }/*  w  w w.ja  va  2s.co  m*/
    return result.getBoolean(EXTRA_ALLOWED, false);
}

From source file:com.liferay.tasks.activity.AddTaskActivity.java

protected void initialize(Bundle extras) {
    if (extras == null) {
        return;/*from  w ww  . j  a v  a  2s.  co m*/
    }

    _update = extras.getBoolean(EXTRA_UPDATE, false);
    _task = (TaskModel) extras.getSerializable(EXTRA_TASK);

    if (!_update) {
        return;
    }

    View container = findViewById(R.id.status_bar_container);
    container.setVisibility(View.VISIBLE);

    int progress = _task.getStatus() - 1;
    TextView percentageView = (TextView) findViewById(R.id.percentage);
    percentageView.setText(String.valueOf(progress * 20) + "%");

    OnStatusChangedListener listener = new OnStatusChangedListener(percentageView);

    _titleView.setText(_task.getTitle());
    _seekBar.setProgress(progress);
    _seekBar.setOnSeekBarChangeListener(listener);
}

From source file:com.apptentive.android.sdk.model.Configuration.java

public boolean isMessageCenterEnabled(Context context) {
    try {//from   w w  w  .j a  va2  s  .c  o  m
        if (!isNull(KEY_MESSAGE_CENTER_ENABLED)) {
            return getBoolean(KEY_MESSAGE_CENTER_ENABLED);
        }
    } catch (JSONException e) {
        // Move on.
    }

    try {
        ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                PackageManager.GET_META_DATA);
        Bundle metaData = ai.metaData;
        return metaData.getBoolean(Constants.MANIFEST_KEY_MESSAGE_CENTER_ENABLED,
                Constants.CONFIG_DEFAULT_MESSAGE_CENTER_ENABLED);
    } catch (Exception e) {
        Log.w("Unexpected error while reading default %s manifest setting.", e,
                Constants.MANIFEST_KEY_MESSAGE_CENTER_ENABLED);
    }

    return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_ENABLED;
}

From source file:com.apptentive.android.sdk.model.Configuration.java

public boolean isHideBranding(Context context) {
    try {/*from   ww w  . ja  va2 s.  c  om*/
        if (!isNull(KEY_HIDE_BRANDING)) {
            return getBoolean(KEY_HIDE_BRANDING);
        }
    } catch (JSONException e) {
        // Move on.
    }

    try {
        ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                PackageManager.GET_META_DATA);
        Bundle metaData = ai.metaData;
        return metaData.getBoolean(Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING,
                Constants.CONFIG_DEFAULT_HIDE_BRANDING);
    } catch (Exception e) {
        Log.w("Unexpected error while reading %s manifest setting.", e,
                Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING);
    }

    return Constants.CONFIG_DEFAULT_HIDE_BRANDING;
}

From source file:com.apptentive.android.sdk.model.Configuration.java

public boolean isMessageCenterEmailRequired(Context context) {
    try {/*from w w  w  . j a v  a2s. co  m*/
        JSONObject messageCenter = getMessageCenter();
        if (messageCenter != null) {
            if (!messageCenter.isNull(KEY_MESSAGE_CENTER_EMAIL_REQUIRED)) {
                return messageCenter.getBoolean(KEY_MESSAGE_CENTER_EMAIL_REQUIRED);
            }
        }
    } catch (JSONException e) {
        // Move on.
    }

    try {
        ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(),
                PackageManager.GET_META_DATA);
        Bundle metaData = ai.metaData;
        return metaData.getBoolean(Constants.MANIFEST_KEY_EMAIL_REQUIRED,
                Constants.CONFIG_DEFAULT_MESSAGE_CENTER_EMAIL_REQUIRED);
    } catch (Exception e) {
        Log.w("Unexpected error while reading %s manifest setting.", e, Constants.MANIFEST_KEY_EMAIL_REQUIRED);
    }

    return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_EMAIL_REQUIRED;
}

From source file:com.afwsamples.testdpc.common.ProfileOrParentFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    // Check arguments- see whether we're supposed to run on behalf of the parent profile.
    final Bundle arguments = getArguments();
    if (arguments != null) {
        mParentInstance = arguments.getBoolean(EXTRA_PARENT_PROFILE, false);
    }/*from  ww  w. jav  a 2s .co m*/

    mAdminComponent = DeviceAdminReceiver.getComponentName(getActivity());

    // Get a device policy manager for the current user.
    mDevicePolicyManager = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);

    // Store whether we are the profile owner for faster lookup.
    mProfileOwner = mDevicePolicyManager.isProfileOwnerApp(getActivity().getPackageName());
    mDeviceOwner = mDevicePolicyManager.isDeviceOwnerApp(getActivity().getPackageName());

    if (mParentInstance) {
        mDevicePolicyManager = mDevicePolicyManager.getParentProfileInstance(mAdminComponent);
    }

    // Put at last to make sure all initializations above are done before subclass's
    // onCreatePreferences is called.
    super.onCreate(savedInstanceState);

    // Switch to parent profile if we are running on their behalf.
    // This needs to be called after super.onCreate because preference manager is set up
    // inside super.onCreate.
    if (mParentInstance) {
        final PreferenceManager pm = getPreferenceManager();
        pm.setSharedPreferencesName(pm.getSharedPreferencesName() + TAG_PARENT);
    }
}

From source file:com.android.deskclock.actionbarmenu.SearchMenuItemController.java

public SearchMenuItemController(OnQueryTextListener queryListener, Bundle savedState) {
    mSearchModeChangeListener = new SearchModeChangeListener();
    mQueryListener = queryListener;/*from w  w  w  .  j  a v a  2  s .  c  om*/
    if (savedState != null) {
        mSearchMode = savedState.getBoolean(KEY_SEARCH_MODE, false);
        mQuery = savedState.getString(KEY_SEARCH_QUERY, "");
    }
}

From source file:com.smartx.bill.mepad.mestore.uimgloader.AbsListViewBaseActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    pauseOnScroll = savedInstanceState.getBoolean(STATE_PAUSE_ON_SCROLL, false);
    pauseOnFling = savedInstanceState.getBoolean(STATE_PAUSE_ON_FLING, true);
}

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

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    surveySubmitted = savedInstanceState.getBoolean(KEY_SURVEY_SUBMITTED, false);
}

From source file:app.presentation.foundation.views.BaseActivity.java

private void configureToolbar(Toolbar toolbar, @Nullable AppBarLayout appBarLayout) {
    setSupportActionBar(toolbar);//from w  w w .j a  v  a2  s .  c  o  m
    ActionBar actionBar = getSupportActionBar();
    boolean showToolbar = Behaviour.SHOW_TOOLBAR_AS_DEFAULT;

    if (actionBar != null) {
        Bundle bundle = getIntent().getExtras();

        if (bundle != null) {
            boolean showBackKey = bundle.getBoolean(Behaviour.SHOW_BACK_KEY, Behaviour.SHOW_BACK_AS_DEFAULT);
            showToolbar = bundle.getBoolean(Behaviour.SHOW_TOOLBAR, showToolbar);
            actionBar.setDisplayHomeAsUpEnabled(showBackKey);
            String title = bundle.getString(Behaviour.TITLE_KEY);
            actionBar.setTitle(title);
        } else {
            actionBar.setDisplayHomeAsUpEnabled(Behaviour.SHOW_BACK_AS_DEFAULT);
            actionBar.setTitle(app_name);
        }
    }

    setStatusBarColor();

    if (appBarLayout != null)
        appBarLayout.setVisibility(showToolbar ? View.VISIBLE : View.GONE);
}