Move Preferences to their own package

pull/157/head
Alinson S. Xavier 9 years ago
parent 05aa5b1172
commit c262adbe85

@ -26,6 +26,7 @@ import android.support.annotation.*;
import android.support.test.*; import android.support.test.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.tasks.*; import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;
import org.junit.*; import org.junit.*;

@ -25,6 +25,7 @@ import org.isoron.uhabits.intents.*;
import org.isoron.uhabits.io.*; import org.isoron.uhabits.io.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.models.sqlite.*; import org.isoron.uhabits.models.sqlite.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.receivers.*; import org.isoron.uhabits.receivers.*;
import org.isoron.uhabits.tasks.*; import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;

@ -22,7 +22,7 @@ package org.isoron.uhabits.activities;
import android.support.annotation.*; import android.support.annotation.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import javax.inject.*; import javax.inject.*;

@ -32,7 +32,7 @@ import org.isoron.uhabits.activities.*;
import org.isoron.uhabits.activities.common.dialogs.*; import org.isoron.uhabits.activities.common.dialogs.*;
import org.isoron.uhabits.commands.*; import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import java.util.*; import java.util.*;

@ -28,6 +28,7 @@ import org.isoron.uhabits.activities.habits.list.controllers.*;
import org.isoron.uhabits.activities.habits.list.model.*; import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.commands.*; import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.tasks.*; import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;
import org.isoron.uhabits.widgets.*; import org.isoron.uhabits.widgets.*;

@ -26,7 +26,7 @@ import org.isoron.uhabits.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.activities.*; import org.isoron.uhabits.activities.*;
import org.isoron.uhabits.activities.habits.list.model.*; import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import javax.inject.*; import javax.inject.*;

@ -25,7 +25,7 @@ import com.google.auto.factory.*;
import org.isoron.uhabits.activities.habits.list.views.*; import org.isoron.uhabits.activities.habits.list.views.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
@AutoFactory @AutoFactory
public class CheckmarkButtonController public class CheckmarkButtonController

@ -23,6 +23,7 @@ import android.support.annotation.*;
import com.google.auto.factory.*; import com.google.auto.factory.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;
/** /**

@ -28,6 +28,7 @@ import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.habits.list.*; import org.isoron.uhabits.activities.habits.list.*;
import org.isoron.uhabits.activities.habits.list.controllers.*; import org.isoron.uhabits.activities.habits.list.controllers.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;
public class CheckmarkPanelView extends LinearLayout public class CheckmarkPanelView extends LinearLayout

@ -26,6 +26,7 @@ import android.view.*;
import android.widget.*; import android.widget.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;
import java.util.*; import java.util.*;

@ -27,6 +27,7 @@ import android.widget.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.common.views.*; import org.isoron.uhabits.activities.common.views.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.tasks.*; import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;

@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.isoron.uhabits.utils; package org.isoron.uhabits.preferences;
import android.content.*; import android.content.*;
import android.preference.*; import android.preference.*;
@ -59,24 +59,6 @@ public class Preferences
return defaultScoreInterval; return defaultScoreInterval;
} }
public int getTheme()
{
return prefs.getInt("pref_theme", ThemeSwitcher.THEME_LIGHT);
}
public boolean isPureBlackEnabled()
{
return prefs.getBoolean("pref_pure_black", false);
}
@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();
@ -122,6 +104,16 @@ public class Preferences
prefs.edit().putBoolean("pref_show_completed", showCompleted).apply(); prefs.edit().putBoolean("pref_show_completed", showCompleted).apply();
} }
public int getTheme()
{
return prefs.getInt("pref_theme", ThemeSwitcher.THEME_LIGHT);
}
public void setTheme(int theme)
{
prefs.edit().putInt("pref_theme", theme).apply();
}
public void incrementLaunchCount() public void incrementLaunchCount()
{ {
int count = prefs.getInt("launch_count", 0); int count = prefs.getInt("launch_count", 0);
@ -143,14 +135,22 @@ public class Preferences
prefs.edit().putBoolean("pref_first_run", isFirstRun).apply(); prefs.edit().putBoolean("pref_first_run", isFirstRun).apply();
} }
public boolean isPureBlackEnabled()
{
return prefs.getBoolean("pref_pure_black", false);
}
public boolean isShortToggleEnabled() public boolean isShortToggleEnabled()
{ {
return prefs.getBoolean("pref_short_toggle", false); return prefs.getBoolean("pref_short_toggle", false);
} }
public void setShortToggleEnabled(boolean enabled) @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key)
{ {
prefs.edit().putBoolean("pref_short_toggle", enabled).apply(); if (key.equals("pref_checkmark_reverse_order"))
shouldReverseCheckmarks = null;
} }
public void setDefaultHabitColor(int color) public void setDefaultHabitColor(int color)
@ -167,11 +167,6 @@ public class Preferences
.apply(); .apply();
} }
public void setTheme(int theme)
{
prefs.edit().putInt("pref_theme", theme).apply();
}
public boolean shouldReverseCheckmarks() public boolean shouldReverseCheckmarks()
{ {
if (shouldReverseCheckmarks == null) shouldReverseCheckmarks = if (shouldReverseCheckmarks == null) shouldReverseCheckmarks =

@ -17,7 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.isoron.uhabits.utils; package org.isoron.uhabits.preferences;
import android.content.*; import android.content.*;
import android.preference.*; import android.preference.*;

@ -28,7 +28,7 @@ import android.widget.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.intents.*; import org.isoron.uhabits.intents.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import static android.os.Build.VERSION.*; import static android.os.Build.VERSION.*;
import static android.os.Build.VERSION_CODES.*; import static android.os.Build.VERSION_CODES.*;

@ -27,7 +27,7 @@ import android.widget.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import static android.os.Build.VERSION.*; import static android.os.Build.VERSION.*;
import static android.os.Build.VERSION_CODES.*; import static android.os.Build.VERSION_CODES.*;

@ -27,7 +27,7 @@ import android.widget.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import java.util.*; import java.util.*;

@ -28,6 +28,7 @@ import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.common.views.*; import org.isoron.uhabits.activities.common.views.*;
import org.isoron.uhabits.activities.habits.show.views.*; import org.isoron.uhabits.activities.habits.show.views.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.utils.*;
import org.isoron.uhabits.widgets.views.*; import org.isoron.uhabits.widgets.views.*;

@ -22,7 +22,7 @@ package org.isoron.uhabits.activities.habits.list.controllers;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.habits.list.views.*; import org.isoron.uhabits.activities.habits.list.views.*;
import org.isoron.uhabits.models.*; import org.isoron.uhabits.models.*;
import org.isoron.uhabits.utils.*; import org.isoron.uhabits.preferences.*;
import org.junit.*; import org.junit.*;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;

Loading…
Cancel
Save