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

org.solovyev.android.prefs.LongPreference 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:07 PM
 */
public class LongPreference extends AbstractPreference {

	public LongPreference(@NotNull String key, @Nullable Long defaultValue) {
		super(key, defaultValue);
	}

	@Override
	protected Long getPersistedValue(@NotNull SharedPreferences preferences) {
		return preferences.getLong(getKey(), -1);
	}

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy