mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Move Preferences to their own package
This commit is contained in:
@@ -26,6 +26,7 @@ import android.support.annotation.*;
|
||||
import android.support.test.*;
|
||||
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.tasks.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.junit.*;
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.isoron.uhabits.intents.*;
|
||||
import org.isoron.uhabits.io.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.models.sqlite.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.receivers.*;
|
||||
import org.isoron.uhabits.tasks.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.isoron.uhabits.activities;
|
||||
import android.support.annotation.*;
|
||||
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.isoron.uhabits.activities.*;
|
||||
import org.isoron.uhabits.activities.common.dialogs.*;
|
||||
import org.isoron.uhabits.commands.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
|
||||
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.commands.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.tasks.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.widgets.*;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.activities.*;
|
||||
import org.isoron.uhabits.activities.habits.list.model.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.google.auto.factory.*;
|
||||
|
||||
import org.isoron.uhabits.activities.habits.list.views.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
|
||||
@AutoFactory
|
||||
public class CheckmarkButtonController
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.support.annotation.*;
|
||||
|
||||
import com.google.auto.factory.*;
|
||||
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
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.controllers.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
|
||||
public class CheckmarkPanelView extends LinearLayout
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.widget.*;
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.activities.common.views.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.tasks.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* 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.preference.*;
|
||||
@@ -59,24 +59,6 @@ public class Preferences
|
||||
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)
|
||||
{
|
||||
prefs.edit().putInt("pref_score_view_interval", position).apply();
|
||||
@@ -122,6 +104,16 @@ public class Preferences
|
||||
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()
|
||||
{
|
||||
int count = prefs.getInt("launch_count", 0);
|
||||
@@ -143,14 +135,22 @@ public class Preferences
|
||||
prefs.edit().putBoolean("pref_first_run", isFirstRun).apply();
|
||||
}
|
||||
|
||||
public boolean isPureBlackEnabled()
|
||||
{
|
||||
return prefs.getBoolean("pref_pure_black", false);
|
||||
}
|
||||
|
||||
public boolean isShortToggleEnabled()
|
||||
{
|
||||
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)
|
||||
@@ -167,11 +167,6 @@ public class Preferences
|
||||
.apply();
|
||||
}
|
||||
|
||||
public void setTheme(int theme)
|
||||
{
|
||||
prefs.edit().putInt("pref_theme", theme).apply();
|
||||
}
|
||||
|
||||
public boolean shouldReverseCheckmarks()
|
||||
{
|
||||
if (shouldReverseCheckmarks == null) shouldReverseCheckmarks =
|
||||
@@ -17,7 +17,7 @@
|
||||
* 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.preference.*;
|
||||
@@ -28,7 +28,7 @@ import android.widget.*;
|
||||
|
||||
import org.isoron.uhabits.*;
|
||||
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_CODES.*;
|
||||
|
||||
@@ -27,7 +27,7 @@ import android.widget.*;
|
||||
|
||||
import org.isoron.uhabits.*;
|
||||
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_CODES.*;
|
||||
|
||||
@@ -27,7 +27,7 @@ import android.widget.*;
|
||||
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.activities.common.views.*;
|
||||
import org.isoron.uhabits.activities.habits.show.views.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
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.activities.habits.list.views.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
Reference in New Issue
Block a user