|
@@ -21,6 +21,7 @@ import android.widget.TextView;
|
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
|
|
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
|
|
|
import com.kfzs.duanduan.utils.ApkUtils;
|
|
import com.kfzs.duanduan.utils.ApkUtils;
|
|
|
|
|
+import com.sheep.gamegroup.absBase.AbsObserver;
|
|
|
import com.sheep.gamegroup.model.entity.AppInfo;
|
|
import com.sheep.gamegroup.model.entity.AppInfo;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
@@ -50,13 +51,13 @@ import java.util.Calendar;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
import java.util.Locale;
|
|
|
|
|
|
|
|
|
|
+import io.reactivex.Observable;
|
|
|
|
|
+import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
|
|
+import io.reactivex.functions.Function;
|
|
|
|
|
+import io.reactivex.schedulers.Schedulers;
|
|
|
import okhttp3.Call;
|
|
import okhttp3.Call;
|
|
|
import okhttp3.Response;
|
|
import okhttp3.Response;
|
|
|
-import rx.Observable;
|
|
|
|
|
-import rx.android.schedulers.AndroidSchedulers;
|
|
|
|
|
import rx.functions.Action1;
|
|
import rx.functions.Action1;
|
|
|
-import rx.functions.Func1;
|
|
|
|
|
-import rx.schedulers.Schedulers;
|
|
|
|
|
|
|
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.UPGRADE_DIALOG_BT;
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.UPGRADE_DIALOG_BT;
|
|
|
|
|
|
|
@@ -115,11 +116,11 @@ public class SysAppUtil {
|
|
|
return DataUtil.getInstance().isNewSmallSheep();
|
|
return DataUtil.getInstance().isNewSmallSheep();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static void clearCache(final Action1<Object> action1) {
|
|
|
|
|
|
|
+ public static void clearCache(final AbsObserver<Object> action1) {
|
|
|
Observable.just(1)
|
|
Observable.just(1)
|
|
|
- .map(new Func1<Integer, Integer>() {
|
|
|
|
|
|
|
+ .map(new Function<Integer, Integer>() {
|
|
|
@Override
|
|
@Override
|
|
|
- public Integer call(Integer integer) {
|
|
|
|
|
|
|
+ public Integer apply(Integer integer) throws Exception {
|
|
|
Glide.get(SheepApp.getInstance()).clearDiskCache();//清理图片
|
|
Glide.get(SheepApp.getInstance()).clearDiskCache();//清理图片
|
|
|
ClassFileHelper.getInstance().clearDir();//清理下载文件
|
|
ClassFileHelper.getInstance().clearDir();//清理下载文件
|
|
|
DataUtil.getInstance().clearScreenShots();//清除所有截图
|
|
DataUtil.getInstance().clearScreenShots();//清除所有截图
|
|
@@ -128,17 +129,7 @@ public class SysAppUtil {
|
|
|
})
|
|
})
|
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new Action1<Integer>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void call(Integer integer) {
|
|
|
|
|
- action1.call(integer);
|
|
|
|
|
- }
|
|
|
|
|
- }, new Action1<Throwable>() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void call(Throwable throwable) {
|
|
|
|
|
- action1.call(throwable);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .subscribe(action1);
|
|
|
}
|
|
}
|
|
|
public static String getAppCacheSize() {
|
|
public static String getAppCacheSize() {
|
|
|
try {
|
|
try {
|
|
@@ -270,11 +261,11 @@ public class SysAppUtil {
|
|
|
return TextUtils.isEmpty(sb) ? "Dalvik/2.1.0 (Linux; U; Android 5.1.1; letv x501 Build/LMY48Z)" : sb.toString();
|
|
return TextUtils.isEmpty(sb) ? "Dalvik/2.1.0 (Linux; U; Android 5.1.1; letv x501 Build/LMY48Z)" : sb.toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static void checkNet(Action1<Integer> action1) {
|
|
|
|
|
|
|
+ public static void checkNet(AbsObserver<Integer> action1) {
|
|
|
Observable.just(1)
|
|
Observable.just(1)
|
|
|
- .map(new Func1<Integer, Integer>() {
|
|
|
|
|
|
|
+ .map(new Function<Integer, Integer>() {
|
|
|
@Override
|
|
@Override
|
|
|
- public Integer call(Integer integer) {
|
|
|
|
|
|
|
+ public Integer apply(Integer integer) throws Exception {
|
|
|
int result;
|
|
int result;
|
|
|
try {
|
|
try {
|
|
|
Response response = OkHttpUtils.get().url("http://www.baidu.com").build().execute();
|
|
Response response = OkHttpUtils.get().url("http://www.baidu.com").build().execute();
|