Files
Xuewang365OSLenovo/app/src/main/java/com/uiui/zyos/push/PushManager.java
tongtongstudio 7ba8603363 version:1.8.7
fix:
update:去掉butterknife
2024-08-28 15:24:57 +08:00

69 lines
2.0 KiB
Java

package com.uiui.zyos.push;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import com.uiui.zyos.disklrucache.CacheHelper;
import com.uiui.zyos.network.NetInterfaceManager;
import com.hjq.toast.Toaster;
public class PushManager {
private static final String TAG = "PushManager";
public static final String SET_ALARMCLOCK = "zuoyeos.action.change.alarmclaock";
@SuppressLint("StaticFieldLeak")
private static PushManager sInstance;
private Context mContext;
private ContentResolver mResolver;
private CacheHelper mCacheHelper;
private PushManager(Context context) {
if (context == null) {
throw new RuntimeException("Context is NULL");
}
this.mContext = context;
this.mResolver = context.getContentResolver();
this.mCacheHelper = new CacheHelper(context);
}
public static void init(Context context) {
if (sInstance == null) {
sInstance = new PushManager(context);
}
}
public static PushManager getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init PushManager first");
}
return sInstance;
}
//闹钟
private static final String JIGUANG_ALARM_CLOCK = "57";
/*网课模式*/
private static final String ONLINE_COURSE_MODE = "71";
public void setPushContent(String title, String extras) {
switch (title) {
case JIGUANG_ALARM_CLOCK:
Toaster.debugShow("收到推送消息: 设置闹钟");
NetInterfaceManager.getInstance().getAlarmClock();
Intent intent = new Intent(SET_ALARMCLOCK);
mContext.sendBroadcast(intent);
break;
case ONLINE_COURSE_MODE:
Toaster.debugShow("收到推送消息: 网课模式");
NetInterfaceManager.getInstance().getCloudLessonSettings();
break;
default:
}
}
}