|
|
@ -24,6 +24,7 @@ import android.preference.*;
|
|
|
|
|
|
|
|
|
|
|
|
import org.isoron.uhabits.*;
|
|
|
|
import org.isoron.uhabits.*;
|
|
|
|
import org.isoron.uhabits.activities.*;
|
|
|
|
import org.isoron.uhabits.activities.*;
|
|
|
|
|
|
|
|
import org.isoron.uhabits.models.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
@ -61,6 +62,21 @@ public class Preferences
|
|
|
|
return prefs.getInt("pref_default_habit_palette_color", fallbackColor);
|
|
|
|
return prefs.getInt("pref_default_habit_palette_color", fallbackColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HabitList.Order getDefaultOrder()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
String name = prefs.getString("pref_default_order", "BY_POSITION");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return HabitList.Order.valueOf(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (IllegalArgumentException e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setDefaultOrder(HabitList.Order.BY_POSITION);
|
|
|
|
|
|
|
|
return HabitList.Order.BY_POSITION;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getDefaultScoreSpinnerPosition()
|
|
|
|
public int getDefaultScoreSpinnerPosition()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int defaultScoreInterval = prefs.getInt("pref_score_view_interval", 1);
|
|
|
|
int defaultScoreInterval = prefs.getInt("pref_score_view_interval", 1);
|
|
|
@ -69,6 +85,11 @@ public class Preferences
|
|
|
|
return defaultScoreInterval;
|
|
|
|
return defaultScoreInterval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setDefaultOrder(HabitList.Order order)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
prefs.edit().putString("pref_default_order", order.name()).apply();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|