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:Main.java

public static boolean isUnableToModifyAccounts(Context context) {
    UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
    Bundle restrictions = um.getUserRestrictions();
    return restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false);
}

From source file:Main.java

@SuppressLint("InlinedApi")
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private static boolean hasSyncPermissions(Context context) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2)
        return true;

    UserManager manager = (UserManager) context.getSystemService(Context.USER_SERVICE);
    Bundle userRestrictions = manager.getUserRestrictions();
    return !userRestrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false);
}

From source file:Main.java

static boolean isSharedElementTransition(@Nullable Bundle args) {
    return Build.VERSION.SDK_INT >= SHARED_ELEMENT_TARGET_API && args != null
            && args.getBoolean(IS_SHARED_ELEMENT_TRANSITION, false);
}

From source file:Main.java

public static boolean interceptBooleanParam(Bundle savedInstanceState, Intent intent, String paramName) {
    boolean ret = false;

    if (savedInstanceState != null) {
        ret = savedInstanceState.getBoolean(paramName, false);
    } else {/*from   ww  w .j a  v  a 2s.c o  m*/
        if (intent != null) {
            Bundle incomming = intent.getExtras();
            if (incomming != null) {
                ret = incomming.getBoolean(paramName, false);
            }
        }
    }

    return ret;
}

From source file:androidx.media.MediaUtils2.java

static boolean isDefaultLibraryRootHint(Bundle bundle) {
    return bundle != null && bundle.getBoolean(MediaConstants2.ROOT_EXTRA_DEFAULT, false);
}

From source file:dev.drsoran.moloko.sync.SyncAdapter.java

private static boolean isSettingsOnlySync(Bundle extras) {
    final boolean isSyncSettingsOnly = extras
            .getBoolean(dev.drsoran.moloko.sync.Constants.SYNC_EXTRAS_ONLY_SETTINGS, false);
    return isSyncSettingsOnly;
}

From source file:edu.mit.mobile.android.locast.sync.LocastSyncService.java

/**
 * Convenience method to request a sync.
 *
 * This wraps {@link ContentResolver#requestSync(Account, String, Bundle)}
 * and fills in the necessary extras.//from   ww  w .j a  va 2s .  c  om
 *
 * @param account
 * @param what the uri of the item that needs to be sync'd. can be null
 * @param explicitSync
 *            if true, adds {@link ContentResolver#SYNC_EXTRAS_MANUAL} to
 *            the extras
 * @param extras
 */
public static void startSync(Account account, Uri what, Bundle extras) {

    if (what != null) {
        extras.putString(LocastSyncService.EXTRA_SYNC_URI, what.toString());
    }

    if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false)) {
        if (SYNC_ADAPTER != null) {
            if (DEBUG) {
                Log.d(TAG, "canceling current sync to make room for expedited sync of " + what);
            }
            // only cancel the ongoing sync, to leave the queue untouched.
            SYNC_ADAPTER.cancelCurrentSync();
        }
    }

    if (DEBUG) {
        Log.d(TAG, "requesting sync for " + account + " with extras: " + extras);
    }
    ContentResolver.requestSync(account, MediaProvider.AUTHORITY, extras);
}

From source file:com.androidformenhancer.internal.impl.SimpleDialogSupportFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();
    boolean cancelable = args.getBoolean(ARG_CANCELABLE, true);
    setCancelable(cancelable);/*from ww w .  j a v  a 2s  .  c  o  m*/
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    String title = args.getString(ARG_TITLE);
    if (!TextUtils.isEmpty(title)) {
        builder.setTitle(title);
    }
    String message = args.getString(ARG_MESSAGE);
    if (!TextUtils.isEmpty(message)) {
        builder.setMessage(message);
    }
    builder.setPositiveButton(android.R.string.ok, null);
    return builder.create();
}

From source file:com.android.talkback.CollectionState.java

@Nullable
private static TableItemState getTableItemStateJellyBean(AccessibilityEvent event) {
    if (event == null) {
        return null;
    }/*  ww w  .j  av a 2 s  .  c om*/

    Parcelable parcelable = event.getParcelableData();
    if (parcelable instanceof Bundle) {
        Bundle bundle = (Bundle) parcelable;

        if (bundle.containsKey(EVENT_ROW) || bundle.containsKey(EVENT_COLUMN)) {
            int rowIndex = bundle.getInt(EVENT_ROW, -1);
            int columnIndex = bundle.getInt(EVENT_COLUMN, -1);
            boolean heading = bundle.getBoolean(EVENT_HEADING, false);
            return new TableItemState(heading ? TYPE_INDETERMINATE : TYPE_NONE, null /* rowName */,
                    null /* columnName */, rowIndex, columnIndex, true /* displayIndices */);
        }
    }

    return null;
}

From source file:com.android.talkback.CollectionState.java

@Nullable
private static ListItemState getListItemStateJellyBean(AccessibilityEvent event) {
    if (event == null) {
        return null;
    }/* w  w  w  .  j a  v  a2 s  .  c  om*/

    Parcelable parcelable = event.getParcelableData();
    if (parcelable instanceof Bundle) {
        Bundle bundle = (Bundle) parcelable;

        // There's no reliable way of determining whether a list is vertical or horizontal from
        // the events, so assume that it's a vertical list.
        if (bundle.containsKey(EVENT_ROW)) {
            int rowIndex = bundle.getInt(EVENT_ROW, -1);
            boolean heading = bundle.getBoolean(EVENT_HEADING, false);
            return new ListItemState(heading, rowIndex, true /* displayIndex */);
        }
    }

    return null;
}