List of usage examples for android.os Bundle getBoolean
public boolean getBoolean(String key)
From source file:com.frostwire.android.gui.fragments.ImageViewerFragment.java
private void loadPicture(Bundle stateBundle) { if (stateBundle != null) { Bundle data = stateBundle.getBundle(EXTRA_FILE_DESCRIPTOR_BUNDLE); int position = stateBundle.getInt(ImageViewerFragment.EXTRA_ADAPTER_FILE_OFFSET, -1); if (data != null) { inFullScreenMode = stateBundle.getBoolean(EXTRA_IN_FULL_SCREEN_MODE); updateData(new FileDescriptor(data), position); }/* w w w .j a va 2 s . co m*/ } }
From source file:at.tomtasche.reader.ui.activity.DocumentActivity.java
@Override public Loader<Document> onCreateLoader(int id, Bundle bundle) { boolean limit = true; boolean translatable = false; String password = null;/*w w w . j ava2s.com*/ Uri uri = DocumentLoader.URI_INTRO; if (bundle != null) { uri = bundle.getParcelable(EXTRA_URI); limit = bundle.getBoolean(EXTRA_LIMIT); translatable = bundle.getBoolean(EXTRA_TRANSLATABLE); password = bundle.getString(EXTRA_PASSWORD); } switch (id) { case 0: DocumentLoader documentLoader = new DocumentLoader(this, uri); documentLoader.setPassword(password); documentLoader.setLimit(limit); documentLoader.setTranslatable(translatable); showProgress(documentLoader, false); return documentLoader; case 1: default: UpLoader upLoader = new UpLoader(this, uri); showProgress(upLoader, true); return upLoader; } }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.MbtoolTaskOutputFragment.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 w w .j a v a2s . c o m if (savedInstanceState != null) { mIsRunning = savedInstanceState.getBoolean(EXTRA_IS_RUNNING); } Parcelable[] parcelables = getArguments().getParcelableArray(PARAM_ACTIONS); mActions = Arrays.copyOf(parcelables, parcelables.length, MbtoolAction[].class); int titleResId = -1; int countBackup = 0; int countRestore = 0; int countFlash = 0; for (MbtoolAction a : mActions) { switch (a.getType()) { case ROM_INSTALLER: countFlash++; break; case BACKUP_RESTORE: switch (a.getBackupRestoreParams().getAction()) { case BACKUP: countBackup++; break; case RESTORE: countRestore++; break; } break; } } if (countBackup + countRestore + countFlash > 1) { titleResId = R.string.in_app_flashing_title_flash_files; } else if (countBackup > 0) { titleResId = R.string.in_app_flashing_title_backup_rom; } else if (countRestore > 0) { titleResId = R.string.in_app_flashing_title_restore_rom; } else if (countFlash > 0) { titleResId = R.string.in_app_flashing_title_flash_file; } if (titleResId >= 0) { getActivity().setTitle(titleResId); } }
From source file:com.appsimobile.appsii.module.home.YahooLocationChooserDialogFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AppInjector.inject(this); // first see if we need to show hints Bundle args = getArguments(); mNoHints = args != null && args.getBoolean("no_hints"); mHandler = new Handler(); mRestartLoaderHandler = new Handler(this); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.SignTrainerPassiveFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { Log.d(TAG, "onActivityCreated " + hashCode()); super.onActivityCreated(savedInstanceState); if (null != savedInstanceState) { final Sign parcelledSign = savedInstanceState.getParcelable(KEY_CURRENT_SIGN); if (null != parcelledSign) { this.currentSign = parcelledSign; try { setupVideoView(this.currentSign, SOUND.OFF, CONTROLS.SHOW); } catch (VideoSetupException ex) { handleVideoCouldNotBeLoaded(ex); }/*from w ww .j a va 2s.c o m*/ } final Boolean answerVisible = savedInstanceState.getBoolean(KEY_ANSWER_VISIBLE); Validate.notNull(answerVisible, "AnswerVisible should always be non-null in savedInstance bundle."); if (answerVisible && (null != this.currentSign)) { setVisibility(this.questionViews, View.GONE); setVisibility(this.answerViews, View.VISIBLE); setAnswerTextViews(); } else { setVisibility(this.questionViews, View.VISIBLE); setVisibility(this.answerViews, View.GONE); } } else { this.loadRandomSignTask = new LoadRandomSignTask(getActivity()); this.loadRandomSignTask.execute(this.currentSign); } }
From source file:org.nasa.openspace.gc.geolocation.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./* w w w . ja va 2 s . com*/ */ //@SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.geolocation); // Restore apps state (if exists) after rotation. if (savedInstanceState != null) { mUseFine = savedInstanceState.getBoolean(KEY_FINE); mUseBoth = savedInstanceState.getBoolean(KEY_BOTH); } else { mUseFine = false; mUseBoth = false; } TextView tv1 = (TextView) findViewById(R.id.textView1); TextView tv2 = (TextView) findViewById(R.id.textView2); TextView tv3 = (TextView) findViewById(R.id.fileLocation); ImageView iv1 = (ImageView) findViewById(R.id.imageView1); btnUpload = (Button) findViewById(R.id.btnUpload); tv1.setText("Name : " + Session.name); tv2.setText("Caption :" + Session.caption); iv1.setImageBitmap(Session.image); tv3.setVisibility(View.GONE); //tv3.setText(Session.fileLocation2); mLatLng = (TextView) findViewById(R.id.latlng); mAddress = (TextView) findViewById(R.id.address); // Receive location updates from the fine location provider (gps) only. mFineProviderButton = (Button) findViewById(R.id.provider_fine); // Receive location updates from both the fine (gps) and coarse (network) location // providers. mBothProviderButton = (Button) findViewById(R.id.provider_both); // 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_ADDRESS: mAddress.setText((String) msg.obj); break; case UPDATE_LATLNG: mLatLng.setText((String) msg.obj); String[] res = ((String) msg.obj).split(","); lat = res[0]; longt = res[1]; break; } } }; // Get a reference to the LocationManager object. mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mBothProviderButton.performClick(); btnUpload.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub try { executeMultipartPost(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); }
From source file:com.google.samples.quickstart.signin.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Restore from saved instance state // [START restore_saved_instance_state] if (savedInstanceState != null) { mIsResolving = savedInstanceState.getBoolean(KEY_IS_RESOLVING); mShouldResolve = savedInstanceState.getBoolean(KEY_SHOULD_RESOLVE); }/*from w ww . jav a 2s . c om*/ // [END restore_saved_instance_state] // Set up button click listeners findViewById(R.id.sign_in_button).setOnClickListener(this); findViewById(R.id.sign_out_button).setOnClickListener(this); findViewById(R.id.disconnect_button).setOnClickListener(this); // Large sign-in ((SignInButton) findViewById(R.id.sign_in_button)).setSize(SignInButton.SIZE_WIDE); // Start with sign-in button disabled until sign-in either succeeds or fails findViewById(R.id.sign_in_button).setEnabled(false); // Set up view instances mStatus = (TextView) findViewById(R.id.status); // [START create_google_api_client] // Build GoogleApiClient with access to basic profile mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Plus.API).addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.PLUS_LOGIN)).build(); // [END create_google_api_client] }
From source file:ch.epfl.sweng.team7.hikingapp.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); // Restore from saved instance state // [START restore_saved_instance_state] if (savedInstanceState != null) { mIsResolving = savedInstanceState.getBoolean(KEY_IS_RESOLVING); mShouldResolve = savedInstanceState.getBoolean(KEY_SHOULD_RESOLVE); }// w w w.j a va2 s . c om // [END restore_saved_instance_state] // Set up button click listeners findViewById(R.id.sign_in_button).setOnClickListener(this); // Large sign-in ((SignInButton) findViewById(R.id.sign_in_button)).setSize(SignInButton.SIZE_WIDE); // [START create_google_api_client] // Build GoogleApiClient with access to basic profile sGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Plus.API).addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.EMAIL)).build(); // [END create_google_api_client] sGoogleApiClient.connect(); }
From source file:com.nextgis.firereporter.SettingsSupport.java
public SettingsSupport(Context context, PreferenceScreen screen) { this.screen = screen; this.context = context; // Load the preferences from an XML resource //addPreferencesFromResource(R.xml.preferences); mSendDataIntervalPref = (ListPreference) screen.findPreference(SettingsActivity.KEY_PREF_INTERVAL); if (mSendDataIntervalPref != null) { int index = mSendDataIntervalPref.findIndexOfValue(mSendDataIntervalPref.getValue()); if (index >= 0) { mSendDataIntervalPref.setSummary(mSendDataIntervalPref.getEntries()[index]); } else {/*from w ww. j a v a2 s. c o m*/ mSendDataIntervalPref.setSummary((String) mSendDataIntervalPref.getValue()); } } mSaveBattPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_SERVICE_BATT_SAVE); if (mSaveBattPref != null) mSaveBattPref.setSummary(mSaveBattPref.isChecked() ? R.string.stOn : R.string.stOff); mNotifyLEDPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_NOTIFY_LED); if (mNotifyLEDPref != null) mNotifyLEDPref.setSummary(mNotifyLEDPref.isChecked() ? R.string.stOn : R.string.stOff); mPlaySoundPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_NOTIFY_SOUND); if (mPlaySoundPref != null) mPlaySoundPref.setSummary(mPlaySoundPref.isChecked() ? R.string.stOn : R.string.stOff); mVibroPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_NOTIFY_VIBRO); if (mVibroPref != null) mVibroPref.setSummary(mVibroPref.isChecked() ? R.string.stOn : R.string.stOff); mRowCountPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_ROW_COUNT); if (mRowCountPref != null) mRowCountPref.setSummary((String) mRowCountPref.getText()); mFireSearchRadiusPref = (EditTextPreference) screen .findPreference(SettingsActivity.KEY_PREF_FIRE_SEARCH_RADIUS); if (mFireSearchRadiusPref != null) mFireSearchRadiusPref .setSummary((String) mFireSearchRadiusPref.getText() + " " + context.getString(R.string.km)); mDayIntervalPref = (ListPreference) screen.findPreference(SettingsActivity.KEY_PREF_SEARCH_DAY_INTERVAL); if (mDayIntervalPref != null) { int index = mDayIntervalPref.findIndexOfValue(mDayIntervalPref.getValue()); if (index >= 0) { mDayIntervalPref.setSummary(mDayIntervalPref.getEntries()[index]); } else { mDayIntervalPref.setSummary((String) mDayIntervalPref.getValue()); } } mSearchCurrentDatePref = (CheckBoxPreference) screen .findPreference(SettingsActivity.KEY_PREF_SEARCH_CURR_DAY); if (mSearchCurrentDatePref != null) mSearchCurrentDatePref.setSummary(mSearchCurrentDatePref.isChecked() ? R.string.stSearchCurrentDayOn : R.string.stSearchCurrentDayOff); mNasaServerPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_NASA); if (mNasaServerPref != null) mNasaServerPref.setSummary((String) mNasaServerPref.getText()); mNasaServerUserPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_NASA_USER); if (mNasaServerUserPref != null) mNasaServerUserPref.setSummary((String) mNasaServerUserPref.getText()); mUserServerPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_USER); if (mUserServerPref != null) mUserServerPref.setSummary((String) mUserServerPref.getText()); mUserServerUserPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_USER_USER); if (mUserServerUserPref != null) mUserServerUserPref.setSummary((String) mUserServerUserPref.getText()); mScanServerUserPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_SCAN_USER); if (mScanServerUserPref != null) mScanServerUserPref.setSummary((String) mScanServerUserPref.getText()); mNasaServerPassPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_NASA_PASS); mUserServerPassPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_USER_PASS); mScanServerPassPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_SCAN_PASS); final Preference checkNasaConnPref = (Preference) screen .findPreference(SettingsActivity.KEY_PREF_SRV_NASA_CHECK_CONN); final Preference checkUserConnPref = (Preference) screen .findPreference(SettingsActivity.KEY_PREF_SRV_USER_CHECK_CONN); final Preference checkScanConnPref = (Preference) screen .findPreference(SettingsActivity.KEY_PREF_SRV_SCAN_CHECK_CONN); mReturnHandler = new Handler() { @SuppressLint("NewApi") public void handleMessage(Message msg) { Bundle resultData = msg.getData(); boolean bHaveErr = resultData.getBoolean(GetFiresService.ERROR); int nType = resultData.getInt(GetFiresService.SOURCE); if (bHaveErr) { Toast.makeText(SettingsSupport.this.context, resultData.getString(GetFiresService.ERR_MSG), Toast.LENGTH_LONG).show(); if (nType == 1) {//user checkUserConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkUserConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else if (nType == 2) {//nasa checkNasaConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkNasaConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else if (nType == 3) {//scanex checkScanConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkScanConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } } else { String sData = resultData.getString(GetFiresService.JSON); if (nType == 1) {//user JSONObject jsonMainObject; try { jsonMainObject = new JSONObject(sData); if (jsonMainObject.getBoolean("error")) { String sMsg = jsonMainObject.getString("msg"); Toast.makeText(SettingsSupport.this.context, sMsg, Toast.LENGTH_LONG).show(); checkUserConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkUserConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else { checkUserConnPref.setSummary(R.string.stConnectionSucceeded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkUserConnPref.setIcon(R.drawable.ic_navigation_accept); } } catch (JSONException e) { Toast.makeText(SettingsSupport.this.context, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); checkUserConnPref.setSummary(R.string.sCheckDBConnSummary); } } else if (nType == 2) {//nasa JSONObject jsonMainObject; try { jsonMainObject = new JSONObject(sData); if (jsonMainObject.getBoolean("error")) { String sMsg = jsonMainObject.getString("msg"); Toast.makeText(SettingsSupport.this.context, sMsg, Toast.LENGTH_LONG).show(); checkNasaConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkNasaConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else { checkNasaConnPref.setSummary(R.string.stConnectionSucceeded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkNasaConnPref.setIcon(R.drawable.ic_navigation_accept); } } catch (JSONException e) { Toast.makeText(SettingsSupport.this.context, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); checkNasaConnPref.setSummary(R.string.sCheckDBConnSummary); } } else if (nType == 3) {//scanex if (sData.length() == 0) { String sMsg = "Connect failed"; Toast.makeText(SettingsSupport.this.context, sMsg, Toast.LENGTH_LONG).show(); checkScanConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkScanConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else { checkScanConnPref.setSummary(R.string.stConnectionSucceeded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkScanConnPref.setIcon(R.drawable.ic_navigation_accept); new HttpGetter(SettingsSupport.this.context, 4, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true).execute( "http://fires.kosmosnimki.ru/SAPI/Account/Get/?CallBackName=" + GetFiresService.USER_ID, sData); } } else if (nType == 4) {//scanex detailes try { String sSubData = GetFiresService.removeJsonT(sData); JSONObject rootobj = new JSONObject(sSubData); String sStatus = rootobj.getString("Status"); if (sStatus.equals("OK")) { JSONObject resobj = rootobj.getJSONObject("Result"); String sName = ""; if (!resobj.isNull("FullName")) sName = resobj.getString("FullName"); String sPhone = ""; if (!resobj.isNull("Phone")) sPhone = resobj.getString("Phone"); //add properties if (sPhone.length() > 0) { Preference PhonePref = new Preference(SettingsSupport.this.context); PhonePref.setTitle(R.string.stScanexServerUserPhone); PhonePref.setSummary(sPhone); PhonePref.setOrder(2); SettingsSupport.this.screen.addPreference(PhonePref); } if (sName.length() > 0) { Preference NamePref = new Preference(SettingsSupport.this.context); NamePref.setTitle(R.string.stScanexServerUserFullName); NamePref.setSummary(sName); NamePref.setOrder(2); SettingsSupport.this.screen.addPreference(NamePref); } } else { Toast.makeText(SettingsSupport.this.context, rootobj.getString("ErrorInfo"), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Toast.makeText(SettingsSupport.this.context, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } } } }; }; if (checkNasaConnPref != null) checkNasaConnPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { String sURL = mNasaServerPref.getText() + "?function=test_conn_nasa&user=" + mNasaServerUserPref.getText() + "&pass=" + mNasaServerPassPref.getText(); new HttpGetter(SettingsSupport.this.context, 2, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true) .execute(sURL); return true; } }); if (checkUserConnPref != null) checkUserConnPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { String sURL = mUserServerPref.getText() + "?function=test_conn_user&user=" + mUserServerUserPref.getText() + "&pass=" + mUserServerPassPref.getText(); new HttpGetter(SettingsSupport.this.context, 1, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true) .execute(sURL); return true; } }); if (checkScanConnPref != null) checkScanConnPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { //String sURL = mUserServerPref.getText() + "?function=test_conn_nasa&user=" + mUserServerUserPref.getText() + "&pass=" + mUserServerPassPref.getText(); new ScanexHttpLogin(SettingsSupport.this.context, 3, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true) .execute(mScanServerUserPref.getText(), mScanServerPassPref.getText()); return true; } }); }
From source file:com.mercandalli.android.apps.files.file.text.FileTextActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_file_text); final Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar); if (toolbar != null) { setSupportActionBar(toolbar);//from ww w.j a va2s . c om final ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); } } mEditText = (EditText) findViewById(R.id.txt); mProgressBar = (ProgressBar) findViewById(R.id.circularProgressBar); // Visibility mEditText.setVisibility(View.GONE); mProgressBar.setVisibility(View.VISIBLE); final Bundle extras = getIntent().getExtras(); if (extras == null) { finish(); overridePendingTransition(R.anim.right_in, R.anim.right_out); return; } if (extras.containsKey(EXTRA_MODEL_FILE_ARTICLE_CONTENT_1)) { mInitialText = extras.getString(EXTRA_MODEL_FILE_ARTICLE_CONTENT_1); mEditText.setText(mInitialText); mEditText.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.GONE); } else { mUrl = extras.getString(EXTRA_MODEL_FILE_URL); mIsOnline = extras.getBoolean(EXTRA_MODEL_FILE_ONLINE); if (savedInstanceState == null) { new TaskGet(this, this.mUrl, this).execute(); } else { mProgressBar.setVisibility(View.GONE); } } }