package de.beyondsoft.ownchat.data.prefs;

import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

/**
 * Created by imarneanu on 3/2/17.
 */
public class LongPreference extends BasePreference<Long> {

    public LongPreference(@NonNull SharedPreferences preferences, @NonNull String key) {
        this(preferences, key, (long) 0);
    }

    public LongPreference(@NonNull SharedPreferences preferences, @NonNull String key, @Nullable Long defaultValue) {
        super(preferences, key, defaultValue);
    }

    @Override
    public Long get() {
        return mPreferences.getLong(mKey, mDefaultValue);
    }

    @Override
    public void set(Long value) {
        mPreferences.edit().putLong(mKey, value).apply();
    }
}

