Java Code Examples for com.pixplicity.easyprefs.library.Prefs#putFloat()

The following examples show how to use com.pixplicity.easyprefs.library.Prefs#putFloat() . 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: CalibrationActivity.java    From tilt-game-android with MIT License 5 votes vote down vote up
private void calculateAverageGravity() {
    Vector2 gravity = Vector2Pool.obtain();

    for (int i = 10; i < _gravityPoints.size(); i++) {
        gravity.add(_gravityPoints.get(i));
    }
    gravity.mul(-1.0f / _gravityPoints.size());

    Prefs.putFloat(PrefKeys.CALIBRATION_X, gravity.x);
    Prefs.putFloat(PrefKeys.CALIBRATION_Y, gravity.y);
}
 
Example 2
Source File: FloatPrefSeekBarController.java    From tilt-game-android with MIT License 5 votes vote down vote up
public void initValues(float minValue, float maxValue, float defaultValue) {
    _minValue = minValue;
    _maxValue = maxValue;
    _defaultValue = defaultValue;

    if (!Prefs.contains(_prefsKey)) {
        Prefs.putFloat(_prefsKey, defaultValue);
    }

    _seekBar.setProgress(getProgress());

    updateLabel();
}
 
Example 3
Source File: FloatPrefSeekBarController.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    updateLabel();
    Prefs.putFloat(_prefsKey, getValue());
}