2016-04-28 23:17:13 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.util;
|
|
|
|
|
2016-05-13 23:47:47 +02:00
|
|
|
import java.text.ParseException;
|
|
|
|
import java.util.Date;
|
|
|
|
|
2016-04-28 23:17:13 +02:00
|
|
|
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 = "";
|
|
|
|
|
2016-04-28 23:17:13 +02:00
|
|
|
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;
|
|
|
|
}
|
2016-04-28 23:17:13 +02:00
|
|
|
}
|