1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-12 21:19:25 +01:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GBPrefs.java

46 lines
1.2 KiB
Java
Raw Normal View History

package nodomain.freeyourgadget.gadgetbridge.util;
2016-05-13 23:47:47 +02:00
import java.text.ParseException;
import java.util.Date;
public class GBPrefs {
public static final String AUTO_RECONNECT = "general_autocreconnect";
public static boolean AUTO_RECONNECT_DEFAULT = true;
2016-05-13 23:47:47 +02:00
public static final String USER_NAME = "mi_user_alias";
public static final String USER_NAME_DEFAULT = "gadgetbridge-user";
private static final String USER_BIRTHDAY = "";
private final Prefs mPrefs;
public GBPrefs(Prefs prefs) {
mPrefs = prefs;
}
public boolean getAutoReconnect() {
return mPrefs.getBoolean(AUTO_RECONNECT, AUTO_RECONNECT_DEFAULT);
}
2016-05-13 23:47:47 +02:00
public String getUserName() {
return mPrefs.getString(USER_NAME, USER_NAME_DEFAULT);
}
public Date getUserBirthday() {
String date = mPrefs.getString(USER_BIRTHDAY, null);
if (date == null) {
return null;
}
try {
return DateTimeUtils.dayFromString(date);
} catch (ParseException ex) {
GB.log("Error parsing date: " + date, GB.ERROR, ex);
return null;
}
}
public int getUserSex() {
return 0;
}
}