// Path: app/src/main/java/com/cxsj/runhdu/constant/Types.java
// public class Types {
//     public final static int TYPE_YEAR = 1000;
//     public final static int TYPE_MONTH = 1001;
//     public final static int TYPE_DATE = 1002;
//     public final static int TYPE_HOUR = 1003;
//     public final static int TYPE_MINUTE = 1004;
//     public final static int TYPE_SECOND = 1005;
//     public final static int TYPE_MONTH_DATE = 1006;
//     public final static int TYPE_CURRENT_TIME = 1007;
//     public final static int TYPE_AM_PM = 1008;
//     public final static int TYPE_CHANGE_PROFILE = 1009;
//     public final static int TYPE_CHANGE_MENU_BG = 1010;
//     public final static int MANUAL_UPDATE = 1011;
//     public final static int AUTO_UPDATE = 1012;
//     public final static int TYPE_SAVE_PROFILE = 1013;
//     public final static int TYPE_STRING_FORM=1014;
// }
// 
// Path: app/src/main/java/com/cxsj/runhdu/constant/URLs.java
// public class URLs {
//     public static final String DOWNLOAD = "http://d1.51gugu.com/170258/RunHDU";
//     public static final String LOGIN = "http://112.74.115.231:8080/CXSJ/Login";
//     public static final String REGISTER="http://112.74.115.231:8080/CXSJ/Register";
//     public static final String GET_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/ReadAll";
//     public static final String UPLOAD_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/Write";
//     public static final String CLEAR_DATA = "http://112.74.115.231:8080/chuangxinshijian/ClearTheTable";
//     public static final String UPDATE_URL = "http://112.74.115.231:8080/chuangxinshijian/VersionCompare";
//     public static final String GET_RUN_TIMES = "http://112.74.115.231:8080/chuangxinshijian/ReadUserNameAndTimesOnly";
//     public static final String UPLOAD_ALL_INFO = "http://112.74.115.231:8080/chuangxinshijian/WriteByJson";
//     public static final String UPLOAD_PROFILE = "http://112.74.115.231:8080/CXSJ/UploadHead";
//     public static final String PROFILE_URL = "http://112.74.115.231:8080/CXSJ/Image/";
//     public static final String FEEDBACK_URL = "http://112.74.115.231:8080/chuangxinshijian/WriteFeedback";
//     public static final String SUNNY_RUN_QUERY_API = "http://hdu.sunnysport.org.cn/api/student/achievements/";
//     public static final String SUNNY_RUN_INFO_API = "http://hdu.sunnysport.org.cn/api/student/info/";
//     public static final String DELETE_ITEM = "http://112.74.115.231:8080/chuangxinshijian/ClearByUserNameAndRunId";
//     public static final String APPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/Apply";
//     public static final String REPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/BeFriend";
//     public static final String GET_FRIEND = "http://112.74.115.231:8080/CXSJ/MyFriends";
//     public static final String DELETE_FRIEND = "http://112.74.115.231:8080/CXSJ/DeleteFriend";
//     public static final String OFF_LINE = "http://112.74.115.231:8080/CXSJ/Xiaxian";
// }


import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.telephony.TelephonyManager;
import android.widget.ImageView;
import android.widget.Toast;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.utils.DistanceUtil;
import com.bumptech.glide.Glide;
import com.bumptech.glide.signature.StringSignature;
import com.cxsj.runhdu.R;
import com.cxsj.runhdu.constant.Types;
import com.cxsj.runhdu.constant.URLs;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
    /**
     * @param d   需要处理的数字
     * @param num 保留位数(只能是1或者2)
     * @return 保留num位小数后的字符串
     */
    public static String formatDecimal(double d, int num) {
        if (num == 2) {
            return String.format("%.2f", d);
        } else {
            return String.format("%.1f", d);
        }

    }

    /**
     * 获取特定类型的时间的字符串表示
     *
     * @param type 获取的时间类型，
     *             Types.TYPE_AM_PM：返回上午/下午/晚上
     *             Types.TYPE_MONTH_DATE：返回日期，例如2月15日
     *             Types.TYPE_CURRENT_TIME：返回时间，例如18：23
     *             其他类型：Calendar.TYPE
     * @return 类型字符串
     */
    @SuppressLint("WrongConstant")
    public static String getTime(int type) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());

        switch (type) {
// Path: app/src/main/java/com/cxsj/runhdu/constant/Types.java
// public class Types {
//     public final static int TYPE_YEAR = 1000;
//     public final static int TYPE_MONTH = 1001;
//     public final static int TYPE_DATE = 1002;
//     public final static int TYPE_HOUR = 1003;
//     public final static int TYPE_MINUTE = 1004;
//     public final static int TYPE_SECOND = 1005;
//     public final static int TYPE_MONTH_DATE = 1006;
//     public final static int TYPE_CURRENT_TIME = 1007;
//     public final static int TYPE_AM_PM = 1008;
//     public final static int TYPE_CHANGE_PROFILE = 1009;
//     public final static int TYPE_CHANGE_MENU_BG = 1010;
//     public final static int MANUAL_UPDATE = 1011;
//     public final static int AUTO_UPDATE = 1012;
//     public final static int TYPE_SAVE_PROFILE = 1013;
//     public final static int TYPE_STRING_FORM=1014;
// }
// 
// Path: app/src/main/java/com/cxsj/runhdu/constant/URLs.java
// public class URLs {
//     public static final String DOWNLOAD = "http://d1.51gugu.com/170258/RunHDU";
//     public static final String LOGIN = "http://112.74.115.231:8080/CXSJ/Login";
//     public static final String REGISTER="http://112.74.115.231:8080/CXSJ/Register";
//     public static final String GET_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/ReadAll";
//     public static final String UPLOAD_RUN_INFO = "http://112.74.115.231:8080/chuangxinshijian/Write";
//     public static final String CLEAR_DATA = "http://112.74.115.231:8080/chuangxinshijian/ClearTheTable";
//     public static final String UPDATE_URL = "http://112.74.115.231:8080/chuangxinshijian/VersionCompare";
//     public static final String GET_RUN_TIMES = "http://112.74.115.231:8080/chuangxinshijian/ReadUserNameAndTimesOnly";
//     public static final String UPLOAD_ALL_INFO = "http://112.74.115.231:8080/chuangxinshijian/WriteByJson";
//     public static final String UPLOAD_PROFILE = "http://112.74.115.231:8080/CXSJ/UploadHead";
//     public static final String PROFILE_URL = "http://112.74.115.231:8080/CXSJ/Image/";
//     public static final String FEEDBACK_URL = "http://112.74.115.231:8080/chuangxinshijian/WriteFeedback";
//     public static final String SUNNY_RUN_QUERY_API = "http://hdu.sunnysport.org.cn/api/student/achievements/";
//     public static final String SUNNY_RUN_INFO_API = "http://hdu.sunnysport.org.cn/api/student/info/";
//     public static final String DELETE_ITEM = "http://112.74.115.231:8080/chuangxinshijian/ClearByUserNameAndRunId";
//     public static final String APPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/Apply";
//     public static final String REPLY_FRIEND = "http://112.74.115.231:8080/CXSJ/BeFriend";
//     public static final String GET_FRIEND = "http://112.74.115.231:8080/CXSJ/MyFriends";
//     public static final String DELETE_FRIEND = "http://112.74.115.231:8080/CXSJ/DeleteFriend";
//     public static final String OFF_LINE = "http://112.74.115.231:8080/CXSJ/Xiaxian";
// }


// Path: app/src/main/java/com/cxsj/runhdu/utils/Utility.java
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.telephony.TelephonyManager;
import android.widget.ImageView;
import android.widget.Toast;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.utils.DistanceUtil;
import com.bumptech.glide.Glide;
import com.bumptech.glide.signature.StringSignature;
import com.cxsj.runhdu.R;
import com.cxsj.runhdu.constant.Types;
import com.cxsj.runhdu.constant.URLs;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;

    /**
     * @param d   需要处理的数字
     * @param num 保留位数(只能是1或者2)
     * @return 保留num位小数后的字符串
     */
    public static String formatDecimal(double d, int num) {
        if (num == 2) {
            return String.format("%.2f", d);
        } else {
            return String.format("%.1f", d);
        }

    }

    /**
     * 获取特定类型的时间的字符串表示
     *
     * @param type 获取的时间类型，
     *             Types.TYPE_AM_PM：返回上午/下午/晚上
     *             Types.TYPE_MONTH_DATE：返回日期，例如2月15日
     *             Types.TYPE_CURRENT_TIME：返回时间，例如18：23
     *             其他类型：Calendar.TYPE
     * @return 类型字符串
     */
    @SuppressLint("WrongConstant")
    public static String getTime(int type) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());

        switch (type) {
            case Types.TYPE_AM_PM: