package de.beyondsoft.ownchat.data.prefs;

import com.securepreferences.SecurePreferences;

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

/**
 * Created by Rares Teodorescu on 27/03/2017.
 */
public class BooleanPreference extends BasePreference<Boolean> {

    BooleanPreference(@NonNull SharedPreferences preferences, @NonNull String key) {
        this(preferences, key, false);
    }

    BooleanPreference(SharedPreferences preferences, String key, Boolean defaultValue) {
        super(preferences, key, defaultValue);
    }

    BooleanPreference(SecurePreferences preferences, String key, Boolean defaultValue) {
        super(preferences, key, defaultValue);
    }

    @Override
    public Boolean get() {
        return mPreferences.getBoolean(mKey, mDefaultValue);
    }

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