|
|
@ -28,6 +28,7 @@ import javax.inject.*;
|
|
|
|
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
@Singleton
|
|
|
|
public class Preferences
|
|
|
|
public class Preferences
|
|
|
|
|
|
|
|
implements SharedPreferences.OnSharedPreferenceChangeListener
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private final Context context;
|
|
|
|
private final Context context;
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +40,9 @@ public class Preferences
|
|
|
|
public Preferences(@AppContext Context context)
|
|
|
|
public Preferences(@AppContext Context context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.context = context;
|
|
|
|
this.context = context;
|
|
|
|
|
|
|
|
|
|
|
|
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
prefs.registerOnSharedPreferenceChangeListener(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getDefaultHabitColor(int fallbackColor)
|
|
|
|
public Integer getDefaultHabitColor(int fallbackColor)
|
|
|
@ -55,6 +58,14 @@ public class Preferences
|
|
|
|
return defaultScoreInterval;
|
|
|
|
return defaultScoreInterval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
|
|
|
|
|
|
|
|
String key)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(key.equals("pref_checkmark_reverse_order"))
|
|
|
|
|
|
|
|
shouldReverseCheckmarks = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setDefaultScoreSpinnerPosition(int position)
|
|
|
|
public void setDefaultScoreSpinnerPosition(int position)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
prefs.edit().putInt("pref_score_view_interval", position).apply();
|
|
|
|
prefs.edit().putInt("pref_score_view_interval", position).apply();
|
|
|
|