List of usage examples for android.os Bundle getBoolean
public boolean getBoolean(String key)
From source file:com.mirasense.scanditsdk.plugin.FullScreenPickerActivity.java
@SuppressWarnings("deprecation") private void initializeAndStartBarcodeRecognition(JSONObject settings, Bundle options, Bundle overlayOptions) { // Switch to full screen. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); if (options.getBoolean("secure")) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); }// ww w . j a v a 2 s . com ScanSettings scanSettings; if (mLegacyMode) { scanSettings = LegacySettingsParamParser.getSettings(options); } else { try { scanSettings = ScanSettings.createWithJson(settings); } catch (JSONParseException e) { Log.e("ScanditSDK", "Exception when creating settings"); e.printStackTrace(); scanSettings = ScanSettings.create(); } } BarcodePickerWithSearchBar picker = new BarcodePickerWithSearchBar(this, scanSettings); picker.setOnScanListener(this); this.setContentView(picker); mPickerStateMachine = new PickerStateMachine(picker, this); // Set all the UI options. PhonegapParamParser.updatePicker(picker, options, this); // Check buffered torch state and apply if needed. if (sBufferedTorchEnabled.compareAndSet(true, false)) { picker.switchTorchOn(true); } if (mLegacyMode) { assert settings == null; LegacyUIParamParser.updatePickerUI(this, picker, options); } else { UIParamParser.updatePickerUI(picker, overlayOptions); PhonegapParamParser.updatePicker(picker, overlayOptions, this); } mContinuousMode = PhonegapParamParser.shouldRunInContinuousMode(options); mStateBeforeSuspend = PhonegapParamParser.shouldStartInPausedState(options) ? PickerStateMachine.PAUSED : PickerStateMachine.ACTIVE; }
From source file:com.adampmarshall.speedo.LocationActivity.java
/** * This sample demonstrates how to incorporate location based services in * your app and process location updates. The app also shows how to convert * lat/long coordinates to human-readable addresses. *//*from w w w .j a va 2 s .c om*/ @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Restore apps state (if exists) after rotation. if (savedInstanceState != null) { mUseFine = savedInstanceState.getBoolean(KEY_FINE); mUseBoth = savedInstanceState.getBoolean(KEY_BOTH); } else { mUseFine = false; mUseBoth = true; } mSpeed = (TextView) findViewById(R.id.speed); Typeface font = Typeface.createFromAsset(getAssets(), "DS-DIGI.TTF"); mSpeed.setTypeface(font); // The isPresent() helper method is only available on Gingerbread or // above. mGeocoderAvailable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && Geocoder.isPresent(); // Handler for updating text fields on the UI like the lat/long and // address. mHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case UPDATE_SPEED: mSpeed.setText((String) msg.obj); break; } } }; // Get a reference to the LocationManager object. mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mGmeterView = (GmeterView) findViewById(R.id.gmeter); }
From source file:li.barter.fragments.ChatsFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { init(container, savedInstanceState); setHasOptionsMenu(true);/*from w ww . j av a2 s. c o m*/ setActionBarTitle(R.string.chat_fragment_title); final View view = inflater.inflate(R.layout.fragment_chats, container, false); mChatsListView = (ListView) view.findViewById(R.id.list_chats); mChatsAdapter = new ChatsAdapter(getActivity(), null); mChatsListView.setAdapter(mChatsAdapter); mChatsListView.setOnItemClickListener(this); mChatsListView.setOnItemLongClickListener(this); mChatDialogFragment = (SingleChoiceDialogFragment) getFragmentManager() .findFragmentByTag(FragmentTags.DIALOG_CHAT_LONGCLICK); if (savedInstanceState == null) { final Bundle args = getArguments(); if (args != null) { mShouldLoadChat = args.getBoolean(Keys.LOAD_CHAT); if (mShouldLoadChat) { mUserIdToLoad = args.getString(Keys.USER_ID); mPreloadedChatMessage = args.getString(Keys.CHAT_MESSAGE); } if (TextUtils.isEmpty(mUserIdToLoad)) { mShouldLoadChat = false; mPreloadedChatMessage = null; } } } getLoaderManager().restartLoader(Loaders.ALL_CHATS, null, this); return view; }
From source file:com.google.codelabs.appauth.MainActivity.java
private void getAppRestrictions() { RestrictionsManager restrictionsManager = (RestrictionsManager) this .getSystemService(Context.RESTRICTIONS_SERVICE); Bundle appRestrictions = restrictionsManager.getApplicationRestrictions(); // Block user if KEY_RESTRICTIONS_PENDING is true, and save login hint if available if (!appRestrictions.isEmpty()) { if (appRestrictions.getBoolean(UserManager.KEY_RESTRICTIONS_PENDING) != true) { mLoginHint = appRestrictions.getString(LOGIN_HINT); } else {/*from w ww. j a va 2 s.c o m*/ Toast.makeText(this, R.string.restrictions_pending_block_user, Toast.LENGTH_LONG).show(); finish(); } } }
From source file:ch.berta.fabio.fabprogress.FabProgress.java
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; mIsComplete = bundle.getBoolean(STATE_COMPLETE); if (mIsComplete) { fadeOut(false, false);/*from ww w. j av a 2s . co m*/ } else { mAnimState = bundle.getInt(STATE_ANIM); switch (mAnimState) { case ANIM_SHOWING: startProgress(); break; case FINAL_ANIM_SHOWING: startProgress(); startProgressFinalAnimation(); break; } } state = bundle.getParcelable(STATE_SUPER); } super.onRestoreInstanceState(state); }
From source file:es.uniovi.imovil.fcrtrainer.BaseExerciseFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState == null) { return;// ww w. j av a 2s .c o m } mIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING); if (mIsPlaying) { setGameInfoPanelVisibility(View.VISIBLE); mScore = savedInstanceState.getInt(STATE_SCORE); updateScore(); showLevel(); mDurationMs = savedInstanceState.getLong(STATE_DURATION_TIME_MS, DEFAULT_GAME_DURATION_MS); long consumedTime = savedInstanceState.getLong(STATE_CONSUMED_TIME_MS, mDurationMs); mStartMs = System.currentTimeMillis() - consumedTime; printRemainingTime(); mTimerHandler.postDelayed(mUpdateTimeTask, CLOCK_UPDATE_PERIOD_MS); } }
From source file:com.dwdesign.tweetings.fragment.SearchTweetsFragment.java
@Override public Loader<SynchronizedStateSavedList<ParcelableStatus, Long>> newLoaderInstance(final Bundle args) { long account_id = -1, max_id = -1, since_id = -1; String query = null;/* w w w .jav a2 s .co m*/ boolean is_home_tab = false; if (args != null) { account_id = args.getLong(INTENT_KEY_ACCOUNT_ID); max_id = args.getLong(INTENT_KEY_MAX_ID, -1); since_id = args.getLong(INTENT_KEY_SINCE_ID, -1); query = args.getString(INTENT_KEY_QUERY); is_home_tab = args.getBoolean(INTENT_KEY_IS_HOME_TAB); } return new TweetSearchLoader(getActivity(), account_id, query, max_id, since_id, getData(), getClass().getSimpleName(), is_home_tab); }
From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mDismissed = savedInstanceState.getBoolean(EXTRA_DISMISSED); }/* w w w .j a v a 2s.co m*/ }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.ZipFlashingOutputFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mEmulatorView = (EmulatorView) getActivity().findViewById(R.id.terminal); DisplayMetrics metrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); mEmulatorView.setDensity(metrics);/*from w ww . j a v a 2 s.c o m*/ if (savedInstanceState != null) { mIsRunning = savedInstanceState.getBoolean(EXTRA_IS_RUNNING); } }
From source file:com.android.mail.browse.ConversationPagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { super.restoreState(state, loader); if (state != null) { Bundle b = (Bundle) state; b.setClassLoader(loader);//from w w w .ja v a2s.c o m final boolean detached = b.getBoolean(BUNDLE_DETACHED_MODE); setDetachedMode(detached); // save off the bundle in case it later needs to be consulted for fragments-to-kill mRestoredState = b; } LogUtils.d(LOG_TAG, "OUT PagerAdapter.restoreState. this=%s", this); }