All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.solovyev.android.prefs.FloatPreference Maven / Gradle / Ivy

There is a newer version: 1.1.18
Show newest version
/*
 * Copyright (c) 2009-2011. Created by serso aka se.solovyev.
 * For more information, please, contact [email protected]
 * or visit http://se.solovyev.org
 */

package org.solovyev.android.prefs;

import android.content.SharedPreferences;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * User: serso
 * Date: 12/25/11
 * Time: 1:08 PM
 */
public class FloatPreference extends AbstractPreference {

	protected FloatPreference(@NotNull String key, @Nullable Float defaultValue) {
		super(key, defaultValue);
	}

	@Override
	protected Float getPersistedValue(@NotNull SharedPreferences preferences) {
		return preferences.getFloat(getKey(), -1f);
	}

	@Override
	protected void putPersistedValue(@NotNull SharedPreferences.Editor editor, @NotNull Float value) {
		editor.putFloat(getKey(), value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy