package com.xwad.os.jxw; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.text.TextUtils; import android.util.Log; import com.xwad.os.utils.OpenApkUtils; import java.text.SimpleDateFormat; import java.util.Date; public class Util { public static String getDate() { return new SimpleDateFormat("yyyyMMdd").format(new Date()); } public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] allNetworkInfo = connectivityManager.getAllNetworkInfo(); boolean wifiConnected = false; boolean mobileConnected = false; for (NetworkInfo networkInfo : allNetworkInfo) { String typeName = networkInfo.getTypeName(); if (typeName.equalsIgnoreCase("WIFI") && networkInfo.isConnected()) { wifiConnected = true; } if (typeName.equalsIgnoreCase("MOBILE") && networkInfo.isConnected()) { mobileConnected = true; } } return wifiConnected || mobileConnected; } public static void insertData(Context context, String str, String str2, long j, String str3, String str4, String str5, String str6) { Log.e("成长计划--埋点", str3); // Uri parse = Uri.parse("content://com.jxw.maidain.StudyDetailsProvider/insert"); // ContentValues contentValues = new ContentValues(); // contentValues.put("appId", "com.jxw.launcher"); // contentValues.put("subjectType", str6); // contentValues.put("eventType", str2); // contentValues.put("metricsValue", Long.valueOf(j)); // contentValues.put("recordTime", Long.valueOf(System.currentTimeMillis())); // contentValues.put("deviceType", "pb"); // contentValues.put("recordMsg", str5); // contentValues.put("eventId", str); // contentValues.put("subjectName", str3); // contentValues.put("subjectId", str4); // try { // context.getContentResolver().insert(parse, contentValues); // } catch (Exception unused) { // // } } public static void downloadClickListener(Context context, String str, String str2, String str3, String str4) { OpenApkUtils.getInstance().openJxwApp("" + str + "," + str2 + "," + str3 + "," + str.substring(str.lastIndexOf(".") + 1) + "," + str4); } public static String checkGrade(String str) { if (TextUtils.isEmpty(str)) { return "初中"; } switch (str) { case "一年级": case "二年级": case "三年级": case "四年级": case "五年级": case "六年级": return "小学"; case "初中六年级": case "七年级": case "八年级": case "九年级": return "初中"; case "高一": case "高二": case "高三": return "高中"; default: return "初中"; } } }