|
@@ -8,10 +8,13 @@ import com.sheep.gamegroup.module.plugin.model.Plugin;
|
|
|
import com.sheep.gamegroup.module.plugin.util.SheepPluginUtil;
|
|
import com.sheep.gamegroup.module.plugin.util.SheepPluginUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
import com.sheep.gamegroup.util.LogUtil;
|
|
|
|
|
+import com.sheep.gamegroup.util.Md5Util;
|
|
|
import com.sheep.gamegroup.util.PreferenceUtils;
|
|
import com.sheep.gamegroup.util.PreferenceUtils;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
|
+
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
import rx.functions.Action1;
|
|
import rx.functions.Action1;
|
|
@@ -67,13 +70,14 @@ public class SkinUtil {
|
|
|
.subscribe(new AbsObserver<Plugin>() {
|
|
.subscribe(new AbsObserver<Plugin>() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onNext(Plugin plugin) {
|
|
public void onNext(Plugin plugin) {
|
|
|
- if(!SheepPluginUtil.getFile(plugin).exists()){//检查文件是否存在
|
|
|
|
|
|
|
+ File file = SheepPluginUtil.getFile(plugin);
|
|
|
|
|
+ if(!file.exists()){//检查文件是否存在
|
|
|
action1.call(null);
|
|
action1.call(null);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- Object md5 = DataUtil.getInstance().getData(SheepPluginUtil.getKey(plugin));
|
|
|
|
|
|
|
+ String md5 = Md5Util.getFileMD5(file);
|
|
|
String skinName = SheepPluginUtil.getFileName(curPlugin);
|
|
String skinName = SheepPluginUtil.getFileName(curPlugin);
|
|
|
- if(curSkinMd5 != null && md5 instanceof String && TextUtils.equals(md5.toString(), curSkinMd5)){//已经加载皮肤
|
|
|
|
|
|
|
+ if(curSkinMd5 != null && TextUtils.equals(md5, curSkinMd5)){//已经加载皮肤
|
|
|
action1.call(null);
|
|
action1.call(null);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -87,8 +91,7 @@ public class SkinUtil {
|
|
|
@Override
|
|
@Override
|
|
|
public void onSuccess() {
|
|
public void onSuccess() {
|
|
|
LogUtil.println(SkinUtil.class.getSimpleName(), "changeSkin", "loadSkin", skinName, "onSuccess");
|
|
LogUtil.println(SkinUtil.class.getSimpleName(), "changeSkin", "loadSkin", skinName, "onSuccess");
|
|
|
- if(md5 instanceof String)
|
|
|
|
|
- PreferenceUtils.setPrefString(SheepApp.getInstance(), KEY_CUR_SKIN_MD5, md5.toString());
|
|
|
|
|
|
|
+ PreferenceUtils.setPrefString(SheepApp.getInstance(), KEY_CUR_SKIN_MD5, md5);
|
|
|
action1.call(null);
|
|
action1.call(null);
|
|
|
}
|
|
}
|
|
|
|
|
|