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:net.openid.appauth.AuthorizationManagementActivity.java

private void extractState(Bundle state) {
    if (state == null) {
        Logger.warn("No stored state - unable to handle response");
        finish();/*from w ww .  j  a  va  2 s.c  o m*/
        return;
    }

    mAuthIntent = state.getParcelable(KEY_AUTH_INTENT);
    mAuthorizationStarted = state.getBoolean(KEY_AUTHORIZATION_STARTED, false);
    try {
        String authRequestJson = state.getString(KEY_AUTH_REQUEST, null);
        mAuthRequest = authRequestJson != null ? AuthorizationRequest.jsonDeserialize(authRequestJson) : null;
    } catch (JSONException ex) {
        throw new IllegalStateException("Unable to deserialize authorization request", ex);
    }
    mCompleteIntent = state.getParcelable(KEY_COMPLETE_INTENT);
    mCancelIntent = state.getParcelable(KEY_CANCEL_INTENT);
}

From source file:com.android.managedprovisioning.DeviceOwnerProvisioningActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (DEBUG)//from   ww  w.j av a  2  s  .c  o m
        ProvisionLogger.logd("Device owner provisioning activity ONCREATE");

    if (savedInstanceState != null) {
        mCancelDialogShown = savedInstanceState.getBoolean(KEY_CANCEL_DIALOG_SHOWN, false);
        mPendingProvisioningIntents = savedInstanceState.getParcelableArrayList(KEY_PENDING_INTENTS);
    }

    // Setup the UI.
    initializeLayoutParams(R.layout.progress, R.string.setup_work_device, true);
    configureNavigationButtons(NEXT_BUTTON_EMPTY_LABEL, View.INVISIBLE, View.VISIBLE);
    setTitle(R.string.setup_device_progress);

    mProgressTextView = (TextView) findViewById(R.id.prog_text);
    if (mCancelDialogShown)
        showCancelResetDialog();

    // Setup broadcast receiver for feedback from service.
    mServiceMessageReceiver = new ServiceMessageReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(DeviceOwnerProvisioningService.ACTION_PROVISIONING_SUCCESS);
    filter.addAction(DeviceOwnerProvisioningService.ACTION_PROVISIONING_ERROR);
    filter.addAction(DeviceOwnerProvisioningService.ACTION_PROGRESS_UPDATE);
    LocalBroadcastManager.getInstance(this).registerReceiver(mServiceMessageReceiver, filter);

    // Load the ProvisioningParams (from message in Intent).
    mParams = (ProvisioningParams) getIntent().getParcelableExtra(ProvisioningParams.EXTRA_PROVISIONING_PARAMS);
    if (mParams != null) {
        maybeSetLogoAndMainColor(mParams.mainColor);
    }
    startDeviceOwnerProvisioningService();
}

From source file:com.mindmeapp.extensions.ExtensionData.java

/**
 * Deserializes the given {@link Bundle} representation of extension data, populating this
 * object.//from  w  w w . j  a  v  a 2s  . c  om
 */
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.mStatusToDisplay = src.getString(KEY_STATUS_TO_DISPLAY);
    this.mStatusToSpeak = src.getString(KEY_STATUS_TO_SPEAK);
    this.mLanguageToSpeak = (Locale) src.getSerializable(KEY_LANGUAGE_TO_SPEAK);
    this.mViewsToDisplay = src.getParcelable(KEY_VIEWS_TO_DISPLAY);
    this.mContentDescription = src.getString(KEY_CONTENT_DESCRIPTION);
    this.mBackground = src.getInt(KEY_BACKGROUND);
    String backgroundUriString = src.getString(KEY_BACKGROUND_URI);
    this.mBackgroundUri = TextUtils.isEmpty(backgroundUriString) ? null : Uri.parse(backgroundUriString);
}

From source file:com.apptentive.android.sdk.module.engagement.interaction.fragment.ApptentiveBaseFragment.java

public boolean isShownAsModalDialog() {
    Bundle bundle = getArguments();

    if (bundle != null) {
        return bundle.getBoolean(Constants.FragmentConfigKeys.MODAL, false);
    }//from w w  w.  j av a2 s.  c  o m
    return false;
}

From source file:com.eutectoid.dosomething.picker.FriendPickerFragment.java

@Override
public void setSettingsFromBundle(Bundle inState) {
    super.setSettingsFromBundle(inState);
    if (inState != null) {
        if (inState.containsKey(USER_ID_BUNDLE_KEY)) {
            setUserId(inState.getString(USER_ID_BUNDLE_KEY));
        }//  ww  w .j a  v a  2s  . c  om
        setMultiSelect(inState.getBoolean(MULTI_SELECT_BUNDLE_KEY, multiSelect));
        if (inState.containsKey(FRIEND_PICKER_TYPE_KEY)) {
            try {
                friendPickerType = FriendPickerType.valueOf(inState.getString(FRIEND_PICKER_TYPE_KEY));
            } catch (Exception e) {
                // NOOP
            }
        }
    }
}

From source file:com.cellbots.eyes.EyesActivity.java

/** Called when the activity is first created. */
@Override//from w  w  w  . j a  v a  2s . co  m
public void onCreate(Bundle savedInstanceState) {
    Log.e("remote eyes", "started");
    super.onCreate(savedInstanceState);

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(
            PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE | PowerManager.ACQUIRE_CAUSES_WAKEUP,
            "Cellbot Eyes");
    mWakeLock.acquire();

    mTorchMode = false;

    out = new ByteArrayOutputStream();

    if ((getIntent() != null) && (getIntent().getData() != null)) {
        putUrl = getIntent().getData().toString();
        server = putUrl.replace("http://", "");
        server = server.substring(0, server.indexOf("/"));
        Bundle extras = getIntent().getExtras();
        if ((extras != null) && (extras.getBoolean("TORCH", false))) {
            mTorchMode = true;
        }
    } else {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        putUrl = prefs.getString("REMOTE_EYES_PUT_URL", "");
        Log.e("prefs", putUrl);
        if (putUrl.length() < 1) {
            Intent i = new Intent();
            i.setClass(this, PrefsActivity.class);
            startActivity(i);
            finish();
            return;
        } else {
            server = putUrl.replace("http://", "");
            server = server.substring(0, server.indexOf("/"));
        }
    }

    resetConnection();
    mHttpState = new HttpState();

    setContentView(R.layout.eyes_main);
    mPreview = (SurfaceView) findViewById(R.id.eyes_preview);
    mHolder = mPreview.getHolder();
    mHolder.addCallback(this);
    mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

    mPreview.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            setTorchMode(!mTorchMode);
        }
    });

    mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            boolean useTorch = intent.getBooleanExtra("TORCH", false);
            boolean shouldTakePicture = intent.getBooleanExtra("PICTURE", false);
            setTorchMode(useTorch);
            setTakePicture(shouldTakePicture);
        }
    };

    this.registerReceiver(mReceiver, new IntentFilter(EyesActivity.EYES_COMMAND));

    mFrame = (FrameLayout) findViewById(R.id.eyes_frame);
    mWebView = new WebView(this);
    mWebView.getSettings().setJavaScriptEnabled(true);
    // Use this if you want to load content locally
    // mWebView.loadUrl("content://com.cellbot.localpersonas/default/index.html");
    mWebView.loadUrl("http://personabots.appspot.com/expressions/tuby");

    mFrame.addView(mWebView);
}

From source file:com.androidzeitgeist.dashwatch.dashclock.ExtensionManager.java

/**
 * Returns a listing of all available (installed) extensions.
 *//*from w  w w  . java  2s.  c  om*/
public List<ExtensionListing> getAvailableExtensions() {
    List<ExtensionListing> availableExtensions = new ArrayList<ExtensionListing>();
    PackageManager pm = mApplicationContext.getPackageManager();
    List<ResolveInfo> resolveInfos = pm.queryIntentServices(new Intent(DashClockExtension.ACTION_EXTENSION),
            PackageManager.GET_META_DATA);
    for (ResolveInfo resolveInfo : resolveInfos) {
        ExtensionListing listing = new ExtensionListing();
        listing.componentName = new ComponentName(resolveInfo.serviceInfo.packageName,
                resolveInfo.serviceInfo.name);
        listing.title = resolveInfo.loadLabel(pm).toString();
        Bundle metaData = resolveInfo.serviceInfo.metaData;
        if (metaData != null) {
            listing.protocolVersion = metaData.getInt("protocolVersion");
            listing.worldReadable = metaData.getBoolean("worldReadable", false);
            listing.description = metaData.getString("description");
            String settingsActivity = metaData.getString("settingsActivity");
            if (!TextUtils.isEmpty(settingsActivity)) {
                listing.settingsActivity = ComponentName
                        .unflattenFromString(resolveInfo.serviceInfo.packageName + "/" + settingsActivity);
            }
        }

        listing.icon = resolveInfo.loadIcon(pm);
        availableExtensions.add(listing);
    }

    return availableExtensions;
}

From source file:cmu.cconfs.instantMessage.activities.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//from ww w .  jav a2s .c om
    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);
    rl_switch_chatroom_leave = (RelativeLayout) getView().findViewById(R.id.rl_switch_chatroom_owner_leave);

    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);

    iv_switch_room_owner_leave_allow = (ImageView) getView()
            .findViewById(R.id.iv_switch_chatroom_owner_leave_allow);
    iv_switch_room_owner_leave_disallow = (ImageView) getView()
            .findViewById(R.id.iv_switch_chatroom_owner_leave_not_allow);

    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);
    userProfileContainer = (LinearLayout) getView().findViewById(R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(R.id.ll_set_push_nick);

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.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);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);

    chatOptions = EMChatManager.getInstance().getChatOptions();

    model = (IMHXSDKModel) HXSDKHelper.getInstance().getModel();

    // ????
    // the vibrate and sound notification are allowed or not?
    if (model.getSettingMsgNotification()) {
        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);
    }

    // ?
    // sound notification is switched on or not?
    if (model.getSettingMsgSound()) {
        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);
    }

    // ?
    // vibrate notification is switched on or not?
    if (model.getSettingMsgVibrate()) {
        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);
    }

    // ?
    // the speaker is switched on or not?
    if (model.getSettingMsgSpeaker()) {
        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);
    }

    // ???owner leave
    if (model.isChatroomOwnerLeaveAllowed()) {
        iv_switch_room_owner_leave_allow.setVisibility(View.VISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_room_owner_leave_allow.setVisibility(View.INVISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.VISIBLE);
    }
}

From source file:com.andrewshu.android.reddit.reddits.PickSubredditActivity.java

private void addFakeSubredditsUnlessSuppressed() {
    // Insert special reddits (front page, all) into subreddits list, unless suppressed by Intent extras
    Bundle extras = getIntent().getExtras();
    boolean addFakeSubreddits = false;
    if (extras != null) {
        boolean shouldHideFakeSubreddits = extras.getBoolean(Constants.EXTRA_HIDE_FAKE_SUBREDDITS_STRING,
                false);//from  www. ja  v  a2  s . c  om
        if (!shouldHideFakeSubreddits) {
            addFakeSubreddits = true;
        }
    } else {
        addFakeSubreddits = true;
    }
    if (addFakeSubreddits) {
        mSubredditsList.addAll(0, Arrays.asList(FAKE_SUBREDDITS));
    }
}

From source file:cn.ucai.foraging.activity.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//from   w ww  .j  a va2s.  c o m
    rl_switch_notification = (RelativeLayout) getView()
            .findViewById(cn.ucai.foraging.R.id.rl_switch_notification);
    rl_switch_sound = (RelativeLayout) getView().findViewById(cn.ucai.foraging.R.id.rl_switch_sound);
    rl_switch_vibrate = (RelativeLayout) getView().findViewById(cn.ucai.foraging.R.id.rl_switch_vibrate);
    rl_switch_speaker = (RelativeLayout) getView().findViewById(cn.ucai.foraging.R.id.rl_switch_speaker);
    rl_switch_chatroom_leave = (RelativeLayout) getView()
            .findViewById(cn.ucai.foraging.R.id.rl_switch_chatroom_owner_leave);

    iv_switch_open_notification = (ImageView) getView()
            .findViewById(cn.ucai.foraging.R.id.iv_switch_open_notification);
    iv_switch_close_notification = (ImageView) getView()
            .findViewById(cn.ucai.foraging.R.id.iv_switch_close_notification);
    iv_switch_open_sound = (ImageView) getView().findViewById(cn.ucai.foraging.R.id.iv_switch_open_sound);
    iv_switch_close_sound = (ImageView) getView().findViewById(cn.ucai.foraging.R.id.iv_switch_close_sound);
    iv_switch_open_vibrate = (ImageView) getView().findViewById(cn.ucai.foraging.R.id.iv_switch_open_vibrate);
    iv_switch_close_vibrate = (ImageView) getView().findViewById(cn.ucai.foraging.R.id.iv_switch_close_vibrate);
    iv_switch_open_speaker = (ImageView) getView().findViewById(cn.ucai.foraging.R.id.iv_switch_open_speaker);
    iv_switch_close_speaker = (ImageView) getView().findViewById(cn.ucai.foraging.R.id.iv_switch_close_speaker);

    iv_switch_room_owner_leave_allow = (ImageView) getView()
            .findViewById(cn.ucai.foraging.R.id.iv_switch_chatroom_owner_leave_allow);
    iv_switch_room_owner_leave_disallow = (ImageView) getView()
            .findViewById(cn.ucai.foraging.R.id.iv_switch_chatroom_owner_leave_not_allow);

    logoutBtn = (Button) getView().findViewById(cn.ucai.foraging.R.id.btn_logout);
    if (!TextUtils.isEmpty(EMChatManager.getInstance().getCurrentUser())) {
        logoutBtn.setText(getString(cn.ucai.foraging.R.string.button_logout) + "("
                + EMChatManager.getInstance().getCurrentUser() + ")");
    }

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

    blacklistContainer = (LinearLayout) getView().findViewById(cn.ucai.foraging.R.id.ll_black_list);
    userProfileContainer = (LinearLayout) getView().findViewById(cn.ucai.foraging.R.id.ll_user_profile);
    llDiagnose = (LinearLayout) getView().findViewById(cn.ucai.foraging.R.id.ll_diagnose);
    pushNick = (LinearLayout) getView().findViewById(cn.ucai.foraging.R.id.ll_set_push_nick);

    blacklistContainer.setOnClickListener(this);
    userProfileContainer.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);
    pushNick.setOnClickListener(this);
    rl_switch_chatroom_leave.setOnClickListener(this);

    chatOptions = EMChatManager.getInstance().getChatOptions();

    model = (DemoHXSDKModel) HXSDKHelper.getInstance().getModel();

    // ????
    // the vibrate and sound notification are allowed or not?
    if (model.getSettingMsgNotification()) {
        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);
    }

    // ?
    // sound notification is switched on or not?
    if (model.getSettingMsgSound()) {
        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);
    }

    // ?
    // vibrate notification is switched on or not?
    if (model.getSettingMsgVibrate()) {
        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);
    }

    // ?
    // the speaker is switched on or not?
    if (model.getSettingMsgSpeaker()) {
        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);
    }

    // ???owner leave
    if (model.isChatroomOwnerLeaveAllowed()) {
        iv_switch_room_owner_leave_allow.setVisibility(View.VISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.INVISIBLE);
    } else {
        iv_switch_room_owner_leave_allow.setVisibility(View.INVISIBLE);
        iv_switch_room_owner_leave_disallow.setVisibility(View.VISIBLE);
    }
}