Java Code Examples for com.pixplicity.easyprefs.library.Prefs#getFloat()
The following examples show how to use
com.pixplicity.easyprefs.library.Prefs#getFloat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigurationManagerImpl.java From mirror with Apache License 2.0 | 5 votes |
@Override public float getFloat(String preferenceKey, float defaultValue) { try { return Prefs.getFloat(preferenceKey, defaultValue); } catch (ClassCastException e) { Timber.e(e, "Error getting the value for %s", preferenceKey); Prefs.remove(preferenceKey); return defaultValue; } }
Example 2
Source File: WorldController.java From tilt-game-android with MIT License | 5 votes |
public WorldController(int width, int height, float scale, float density, Engine engine) { _width = width; _height = height; _scale = scale; _density = density; _engine = engine; // set physics value from preferences if they have been changed BALL_FIX_DEF.density = Prefs.getFloat(PrefKeys.BALL_DENSITY, Physics.BALL_DENSITY); _radToGravity = _scale * (float) (Prefs.getFloat(PrefKeys.GRAVITY_FACTOR, Physics.GRAVITY_FACTOR) / Math.PI); OBSTACLE_FIX_DEF.restitution = Prefs.getFloat(PrefKeys.WALL_ELASTICITY, Physics.WALL_ELASTICITY); _gravityCorrection = Vector2Pool.obtain(Prefs.getFloat(PrefKeys.CALIBRATION_X, 0), Prefs.getFloat(PrefKeys.CALIBRATION_Y, 0)); }
Example 3
Source File: CalibrationActivity.java From tilt-game-android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_calibration); ButterKnife.bind(this); ScreenUtil.setFullScreen(getWindow().getDecorView()); Bundle extras = getIntent().getExtras(); if (extras != null) { _fromActivity = extras.getString(IntentKeys.FROM); } _orientationProvider = GoogleFlipGameApplication.getOrientationProvider(this); if (_orientationProvider != null) { try { _orientationProvider.start(); } catch (Exception e) { // AlertUtils.showAlert(this, R.string.no_sensor_found_message, R.string.no_sensor_found_title, R.string.btn_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Prefs.putFloat(PrefKeys.CALIBRATION_X, 0); Prefs.putFloat(PrefKeys.CALIBRATION_Y, 0); startActivity(new Intent(CalibrationActivity.this, HomeActivity.class)); } }); } } _radToGravity = (float) (Prefs.getFloat(PrefKeys.GRAVITY_FACTOR, Physics.GRAVITY_FACTOR) / Math.PI); }