2016-07-01 15:04:31 +02:00
|
|
|
package com.simplemobiletools.gallery;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
|
|
|
|
public class Config {
|
|
|
|
private SharedPreferences mPrefs;
|
|
|
|
|
|
|
|
public static Config newInstance(Context context) {
|
|
|
|
return new Config(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Config(Context context) {
|
|
|
|
mPrefs = context.getSharedPreferences(Constants.PREFS_KEY, Context.MODE_PRIVATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getIsFirstRun() {
|
|
|
|
return mPrefs.getBoolean(Constants.IS_FIRST_RUN, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIsFirstRun(boolean firstRun) {
|
|
|
|
mPrefs.edit().putBoolean(Constants.IS_FIRST_RUN, firstRun).apply();
|
|
|
|
}
|
2016-07-20 20:46:51 +02:00
|
|
|
|
|
|
|
public boolean getIsDarkTheme() {
|
|
|
|
return mPrefs.getBoolean(Constants.IS_DARK_THEME, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIsDarkTheme(boolean isDarkTheme) {
|
|
|
|
mPrefs.edit().putBoolean(Constants.IS_DARK_THEME, isDarkTheme).apply();
|
|
|
|
}
|
2016-07-24 19:43:12 +02:00
|
|
|
|
|
|
|
public int getSorting() {
|
|
|
|
return mPrefs.getInt(Constants.SORT_ORDER, Constants.SORT_BY_DATE | Constants.SORT_DESCENDING);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSorting(int order) {
|
|
|
|
mPrefs.edit().putInt(Constants.SORT_ORDER, order).apply();
|
|
|
|
}
|
2016-07-01 15:04:31 +02:00
|
|
|
}
|