// Path: u148/app/src/main/java/com/chenjishi/u148/home/UserInfo.java
// public class UserInfo implements Parcelable {
//     public String icon;
//     public String alias;
//     public String nickname;
//     public String sexStr;
//     public String statusStr;
//     public String id;
//     public String token;
// 
//     public static final Creator<UserInfo> CREATOR = new Creator<UserInfo>() {
//         @Override
//         public UserInfo createFromParcel(Parcel source) {
//             return new UserInfo(source);
//         }
// 
//         @Override
//         public UserInfo[] newArray(int size) {
//             return new UserInfo[size];
//         }
//     };
// 
//     public UserInfo() {
//     }
// 
//     public UserInfo(Parcel in) {
//         icon = in.readString();
//         alias = in.readString();
//         nickname = in.readString();
//         sexStr = in.readString();
//         statusStr = in.readString();
//         id = in.readString();
//         token = in.readString();
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(icon);
//         dest.writeString(alias);
//         dest.writeString(nickname);
//         dest.writeString(sexStr);
//         dest.writeString(statusStr);
//         dest.writeString(id);
//         dest.writeString(token);
//     }
// }
// 
// Path: u148/app/src/main/java/com/chenjishi/u148/utils/Constants.java
// public interface Constants {
// 
//     String KEY_FEED = "feed";
//     String KEY_FEED_LIST = "feed_list";
//     String KEY_FEED_INDEX = "index";
// 
//     int MODE_DAY = 0;
//     int MODE_NIGHT = 1;
// 
//     String EVENT_ARTICLE_SHARE = "ArticleShare";
//     String EVENT_IMAGE_SHARE = "ArticleShare";
// 
//     String PARAM_TITLE = "title";
//     String PARAM_URL = "url";
// 
//     String BASE_URL = "http://api.u148.net/json/";
// 
//     String API_FEED_LIST = BASE_URL + "%1$d/%2$d";
//     String API_ARTICLE = BASE_URL + "article/%1$s";
//     String API_ADD_FAVORITE = BASE_URL + "favourite?id=%1$s&token=%2$s";
//     String API_DELETE_FAVORITE = BASE_URL + "del_favourite?id=%1$s&token=%2$s";
//     String API_LOGIN = BASE_URL + "login";
//     String API_REGISTER = BASE_URL + "register";
//     String API_COMMENTS_GET = BASE_URL + "get_comment/%1$s/%2$d";
//     String API_COMMENT_POST = BASE_URL + "comment";
//     String API_FAVORITE_GET = BASE_URL + "get_favourite/0/%1$d?token=%2$s";
//     String API_UPGRADE = BASE_URL + "version";
//     String API_SEARCH = BASE_URL + "search/%1$d?keyword=%2$s";
//     String XIAO_MI = "http://app.mi.com/details?id=com.chenjishi.u148&ref=search";
// }


import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import com.chenjishi.u148.home.UserInfo;
import com.chenjishi.u148.utils.Constants;
package com.chenjishi.u148;


/**
 * Created by jishichen on 2017/4/14.
 */
public class Config {

    private static final long TWO_DAYS = 2 * 24 * 60 * 60 * 1000;

    private static final String CONFIG_FILE_NAME = "u148_config";

    private static final long VERSION_CHECK_INTERVAL = 24 * 60 * 60 * 1000;

    private static final String KEY_NEXT_TOKEN = "next_from";

    public static final String KEY_UPDATE_TIME = "last_update_time";

    public static final String KEY_CHECK_UPDATE_TIME = "last_check_time";

    public static final String KEY_CHECK_VERSION = "check_version";

    public static final String KEY_VIDEO_UPDATE_TIME = "last_update_time";

    private static final String KEY_CACHE_CLEAR_TIME = "cache_clear_time";
    private static final String KEY_CACHE_UPDATE_TIME = "cache_update_time";

    private static final String KEY_REGISTER_TIME = "register_time";

    private static final String KEY_USER_NAME = "user_name";
    private static final String KEY_USER_SEX = "user_sex";
    private static final String KEY_USER_ICON = "user_icon";
    private static final String KEY_USER_TOKEN = "user_token";

    private static final String KEY_THEME_MODE = "theme_mode";
    private static final String SURPRISE_TITLE = "surprise_title";
    private static final String SURPRISE_DESC = "surprise_desc";

    private Config() {
    }

    public static boolean isLogin(Context ctx) {
        return null != getUser(ctx);
    }

    public static int getThemeMode(Context ctx) {
// Path: u148/app/src/main/java/com/chenjishi/u148/home/UserInfo.java
// public class UserInfo implements Parcelable {
//     public String icon;
//     public String alias;
//     public String nickname;
//     public String sexStr;
//     public String statusStr;
//     public String id;
//     public String token;
// 
//     public static final Creator<UserInfo> CREATOR = new Creator<UserInfo>() {
//         @Override
//         public UserInfo createFromParcel(Parcel source) {
//             return new UserInfo(source);
//         }
// 
//         @Override
//         public UserInfo[] newArray(int size) {
//             return new UserInfo[size];
//         }
//     };
// 
//     public UserInfo() {
//     }
// 
//     public UserInfo(Parcel in) {
//         icon = in.readString();
//         alias = in.readString();
//         nickname = in.readString();
//         sexStr = in.readString();
//         statusStr = in.readString();
//         id = in.readString();
//         token = in.readString();
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(icon);
//         dest.writeString(alias);
//         dest.writeString(nickname);
//         dest.writeString(sexStr);
//         dest.writeString(statusStr);
//         dest.writeString(id);
//         dest.writeString(token);
//     }
// }
// 
// Path: u148/app/src/main/java/com/chenjishi/u148/utils/Constants.java
// public interface Constants {
// 
//     String KEY_FEED = "feed";
//     String KEY_FEED_LIST = "feed_list";
//     String KEY_FEED_INDEX = "index";
// 
//     int MODE_DAY = 0;
//     int MODE_NIGHT = 1;
// 
//     String EVENT_ARTICLE_SHARE = "ArticleShare";
//     String EVENT_IMAGE_SHARE = "ArticleShare";
// 
//     String PARAM_TITLE = "title";
//     String PARAM_URL = "url";
// 
//     String BASE_URL = "http://api.u148.net/json/";
// 
//     String API_FEED_LIST = BASE_URL + "%1$d/%2$d";
//     String API_ARTICLE = BASE_URL + "article/%1$s";
//     String API_ADD_FAVORITE = BASE_URL + "favourite?id=%1$s&token=%2$s";
//     String API_DELETE_FAVORITE = BASE_URL + "del_favourite?id=%1$s&token=%2$s";
//     String API_LOGIN = BASE_URL + "login";
//     String API_REGISTER = BASE_URL + "register";
//     String API_COMMENTS_GET = BASE_URL + "get_comment/%1$s/%2$d";
//     String API_COMMENT_POST = BASE_URL + "comment";
//     String API_FAVORITE_GET = BASE_URL + "get_favourite/0/%1$d?token=%2$s";
//     String API_UPGRADE = BASE_URL + "version";
//     String API_SEARCH = BASE_URL + "search/%1$d?keyword=%2$s";
//     String XIAO_MI = "http://app.mi.com/details?id=com.chenjishi.u148&ref=search";
// }


// Path: u148/app/src/main/java/com/chenjishi/u148/Config.java
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import com.chenjishi.u148.home.UserInfo;
import com.chenjishi.u148.utils.Constants;

package com.chenjishi.u148;


/**
 * Created by jishichen on 2017/4/14.
 */
public class Config {

    private static final long TWO_DAYS = 2 * 24 * 60 * 60 * 1000;

    private static final String CONFIG_FILE_NAME = "u148_config";

    private static final long VERSION_CHECK_INTERVAL = 24 * 60 * 60 * 1000;

    private static final String KEY_NEXT_TOKEN = "next_from";

    public static final String KEY_UPDATE_TIME = "last_update_time";

    public static final String KEY_CHECK_UPDATE_TIME = "last_check_time";

    public static final String KEY_CHECK_VERSION = "check_version";

    public static final String KEY_VIDEO_UPDATE_TIME = "last_update_time";

    private static final String KEY_CACHE_CLEAR_TIME = "cache_clear_time";
    private static final String KEY_CACHE_UPDATE_TIME = "cache_update_time";

    private static final String KEY_REGISTER_TIME = "register_time";

    private static final String KEY_USER_NAME = "user_name";
    private static final String KEY_USER_SEX = "user_sex";
    private static final String KEY_USER_ICON = "user_icon";
    private static final String KEY_USER_TOKEN = "user_token";

    private static final String KEY_THEME_MODE = "theme_mode";
    private static final String SURPRISE_TITLE = "surprise_title";
    private static final String SURPRISE_DESC = "surprise_desc";

    private Config() {
    }

    public static boolean isLogin(Context ctx) {
        return null != getUser(ctx);
    }

    public static int getThemeMode(Context ctx) {
        return getInt(ctx, KEY_THEME_MODE, Constants.MODE_DAY);