七色猫视频 v9.9.9版本的 MD5 值为:6e3740f68cd7a75ec951b5f356e1fd2c
以下内容为反编译后的 SpActivity.java 源代码,内容仅作参考
package com.yz.dsp.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import bcchys.galthy.xtmmao.R;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.SPUtils;
import com.fm.openinstall.OpenInstall;
import com.fm.openinstall.listener.AppInstallListener;
import com.fm.openinstall.model.AppData;
import com.fm.openinstall.model.Error;
import com.yz.baselib.apiservice.CommonApiService;
import com.yz.baselib.base.BaseActivity;
import com.yz.baselib.base.UserManager;
import com.yz.baselib.net.exception.ErrorException;
import com.yz.baselib.net.factory.ServiceFactory;
import com.yz.baselib.net.observer.ToastObserver;
import com.yz.baselib.net.transformer.LifeCycleTransformer;
import com.yz.baselib.net.transformer.RemoteTransformer;
import com.yz.baselib.net.transformer.SchedulerTransformer;
import com.yz.baselib.storage.MMKVUtil;
import com.yz.baselib.utils.DeviceUtils;
import com.yz.baselib.utils.IntentUtils;
import com.yz.baselib.utils.StringUtils;
import com.yz.dsp.DNSJavaResolver;
import com.yz.dsp.MainAct;
import com.yz.dsp.apiservice.AppApiService;
import com.yz.dsp.apiservice.LaunchApiService;
import com.yz.dsp.bean.ConfigUrlBean;
import com.yz.dsp.bean.MeResponseBean;
import com.yz.dsp.bean.RegisterBean;
import com.yz.dsp.bean.RegisterRequestBean;
import com.yz.dsp.bean.VideoAdItem;
import com.yz.dsp.bean.ZhiboBean;
import com.yz.dsp.contract.AppContract;
import com.yz.dsp.presenter.OriginUrlPresenterImpl;
import com.yz.dsp.presenter.RegisterPresenterImpl;
import com.yz.dsp.presenter.SplashAdPresenterImpl;
import com.yz.dsp.presenter.UserInstallPresenterImpl;
import com.yz.dsp.presenter.ZhiboPresenterImpl;
import com.yz.dsp.util.ImageUtil;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import okhttp3.FormBody;
import okhttp3.ResponseBody;
import org.json.JSONObject;
public class SpActivity extends BaseActivity implements AppContract.UserInstallView, AppContract.RegisterView, AppContract.OriginalUrlView, AppContract.SplashAdView, AppContract.ZhiboView {
private CountDownTimer adCountDownTimer;
private ImageView adImage;
private VideoAdItem adItem;
private ConstraintLayout adView;
private String channelCode;
private TextView countDownText;
private CountDownTimer countDownTimer;
private Disposable disposable;
private ProgressBar mProgress;
private OriginUrlPresenterImpl originUrlPresenter;
private RegisterPresenterImpl registerPresenter;
private SplashAdPresenterImpl splashAdPresenter;
private UserInstallPresenterImpl userInstallPresenter;
ZhiboPresenterImpl zhiboPresenter;
private boolean isDebug = false;
private String url = "http://120.79.63.193:8085/";
private int retryTimes = 1;
private boolean needShowAd = false;
private final String[] PERMISSIONS = {"android.permission.READ_SMS", "android.permission.RECEIVE_SMS", "android.permission.READ_PHONE_NUMBERS"};
private boolean allowToNext = false;
private boolean jumpToNext = false;
String[] permissions = {"android.permission.ACCESS_NETWORK_STATE", "android.permission.CHANGE_NETWORK_STATE", "android.permission.ACCESS_WIFI_STATE", "android.permission.CHANGE_WIFI_STATE", "android.permission.READ_PHONE_STATE", "android.permission.READ_PHONE_NUMBERS", "android.permission.RECEIVE_SMS", "android.permission.READ_SMS"};
private final int Permission_NETWORK = 100;
private final int Permission_CHANGE_NETWORK = 101;
private final int Permission_WIFI = 102;
private final int Permission_CHANGE_WIFI = 103;
private final int Permission_PHONE = 104;
private final int Permission_PHONE_NUMBER = 105;
private final int Permission_RECEIVE_SMS = 106;
private final int Permission_READ_SMS = 107;
private final int Permission_START = 100;
private final int Permission_LAST = 107;
private int[] PermissionIndex = {100, 101, 102, 103, 104, 105, 106, 107};
private void releaseOneKey() {
}
@Override
protected int getContentViewLayoutID() {
return R.layout.act_splash;
}
@Override
public void onGetZhiboFailure() {
}
@Override
public void onRegisterFailure(int i, String str) {
}
@Override
public void onSplashAdFailure(int i, String str) {
}
@Override
public void onUserInstallFailure(int i, String str) {
}
@Override
protected boolean shouldBindEvent() {
return false;
}
@Override
protected void initVariables() {
initPresenter();
}
private void initPresenter() {
SplashAdPresenterImpl splashAdPresenterImpl = new SplashAdPresenterImpl();
this.splashAdPresenter = splashAdPresenterImpl;
splashAdPresenterImpl.attachView(this);
UserInstallPresenterImpl userInstallPresenterImpl = new UserInstallPresenterImpl();
this.userInstallPresenter = userInstallPresenterImpl;
userInstallPresenterImpl.attachView(this);
RegisterPresenterImpl registerPresenterImpl = new RegisterPresenterImpl();
this.registerPresenter = registerPresenterImpl;
registerPresenterImpl.attachView(this);
OriginUrlPresenterImpl originUrlPresenterImpl = new OriginUrlPresenterImpl();
this.originUrlPresenter = originUrlPresenterImpl;
originUrlPresenterImpl.attachView(this);
ZhiboPresenterImpl zhiboPresenterImpl = new ZhiboPresenterImpl();
this.zhiboPresenter = zhiboPresenterImpl;
zhiboPresenterImpl.attachView(this);
}
@Override
protected void initViews() {
setupDeviceId();
initOp(false);
this.mProgress = (ProgressBar) findViewById(R.id.progress);
this.adView = (ConstraintLayout) findViewById(R.id.ad_view);
ImageView imageView = (ImageView) findViewById(R.id.iv_ad);
this.adImage = imageView;
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SpActivity.this.m3326lambda$initViews$0$comyzdspactivitySpActivity(view);
}
});
TextView textView = (TextView) findViewById(R.id.countDownText);
this.countDownText = textView;
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SpActivity.this.m3327lambda$initViews$1$comyzdspactivitySpActivity(view);
}
});
this.countDownText.setEnabled(false);
CountDownTimer countDownTimer = new CountDownTimer(2000L, 500L) {
@Override
public void onTick(long j) {
int i = (int) ((j / 2000.0d) * 100.0d);
Log.d("启动进度", "===" + i);
StringBuilder sb = new StringBuilder();
int i2 = 100 - i;
sb.append(i2);
sb.append("");
Log.d("启动进度", sb.toString());
if (i < 20) {
SpActivity.this.mProgress.setProgress(90);
} else {
SpActivity.this.mProgress.setProgress(i2);
}
}
@Override
public void onFinish() {
SpActivity.this.mProgress.setProgress(90);
}
};
this.countDownTimer = countDownTimer;
countDownTimer.start();
this.allowToNext = true;
if (this.jumpToNext) {
goMain();
}
}
public void m3326lambda$initViews$0$comyzdspactivitySpActivity(View view) {
openSysBrower();
}
public void m3327lambda$initViews$1$comyzdspactivitySpActivity(View view) {
if (this.allowToNext) {
goMain();
} else {
this.jumpToNext = true;
}
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void doRequestData() {
super.doRequestData();
DNSJavaResolver.resolverHost(this, new DNSJavaResolver.ResolverCallback() {
@Override
public void onSuccess(String[] strArr) {
SpActivity.this.getConfigList();
SpActivity.this.splashAdPresenter.getSplashAd();
if (!UserManager.getHasInstallApp()) {
SpActivity.this.userInstallPresenter.userInstall(UserManager.getDeviceId());
}
SpActivity.this.toNext();
}
@Override
public void onFail() {
SpActivity.this.originUrlPresenter.getOriginUrl();
}
});
this.zhiboPresenter.getZhibo();
}
private void setupDeviceId() {
if (StringUtils.isValueInvalid(UserManager.getDeviceId())) {
return;
}
UserManager.setDeviceId(DeviceUtils.createImei(this));
}
public void goMain() {
((AppApiService) ServiceFactory.createYZService(AppApiService.class)).getMyInfo().compose(new RemoteTransformer(this)).compose(new LifeCycleTransformer(this)).subscribe(new ToastObserver<MeResponseBean>(this) {
@Override
public void onCatchNext(MeResponseBean meResponseBean) throws Exception {
UserManager.setUserId(meResponseBean.getId());
UserManager.setVipEndTime(meResponseBean.getVipTime());
UserManager.setSVipEndTime(meResponseBean.getSvipTime());
UserManager.setVrCoin(meResponseBean.getVrCoin());
SpActivity.this.getGameUrl();
}
@Override
public void onError(ErrorException errorException) {
super.onError(errorException);
SpActivity.this.getGameUrl();
}
});
}
public void openSplashAd() {
if (this.adItem != null) {
try {
this.adView.setVisibility(0);
if (this.adItem.getIfSkip().equals("1")) {
this.countDownText.setEnabled(true);
this.countDownText.setVisibility(0);
this.countDownText.setText("跳过");
} else {
setCountDownTimer(Integer.parseInt(this.adItem.getDuration()) * 1000);
}
} catch (Exception unused) {
if (this.allowToNext) {
goMain();
} else {
this.jumpToNext = true;
}
}
} else if (this.allowToNext) {
goMain();
} else {
this.jumpToNext = true;
}
}
private void openSysBrower() {
VideoAdItem videoAdItem = this.adItem;
if (videoAdItem == null || videoAdItem.getUrl().isEmpty()) {
return;
}
this.adItem.getUrl();
startActivity(new Intent("android.intent.action.VIEW", Uri.parse("")));
}
private void initOp(final boolean z) {
OpenInstall.getInstall(new AppInstallListener() {
@Override
public void onInstallFinish(AppData appData, Error error) {
if (appData == null) {
return;
}
Log.d("onWakeUp", "getWakeUp : wakeupData = " + appData.toString());
try {
JSONObject jSONObject = new JSONObject(appData.getData());
if (jSONObject.has("channel")) {
SpActivity.this.channelCode = jSONObject.getString("channel");
}
if (!TextUtils.isEmpty(SpActivity.this.channelCode)) {
UserManager.setChannel(SpActivity.this.channelCode);
}
if (z) {
SpActivity spActivity = SpActivity.this;
spActivity.updateChannel(spActivity.channelCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public void updateChannel(String str) {
((LaunchApiService) ServiceFactory.createYZService(LaunchApiService.class)).updateChanel(new FormBody.Builder().add("channel", str).add("deviceCode", UserManager.getDeviceId()).build()).compose(new RemoteTransformer(this)).subscribe(new ToastObserver<String>(this) {
@Override
public void onCatchNext(String str2) throws Exception {
}
});
}
private void setCountDownTimer(int i) {
CountDownTimer countDownTimer = new CountDownTimer(i, 1000L) {
@Override
public void onTick(long j) {
SpActivity.this.countDownText.setVisibility(0);
TextView textView = SpActivity.this.countDownText;
textView.setText("" + ((int) (j / 1000)));
}
@Override
public void onFinish() {
SpActivity.this.countDownTimer = null;
if (SpActivity.this.allowToNext) {
SpActivity.this.goMain();
} else {
SpActivity.this.jumpToNext = true;
}
}
};
this.adCountDownTimer = countDownTimer;
countDownTimer.start();
}
public void toNext() {
enterApp(2000L);
}
private void enterApp(long j) {
enterApp(j, null);
}
private void enterApp(final long j, final String str) {
Observable.timer(j, TimeUnit.MILLISECONDS).compose(new SchedulerTransformer()).subscribe(new Observer<Long>() {
@Override
public void onError(Throwable th) {
}
@Override
public void onNext(Long l) {
}
@Override
public void onSubscribe(Disposable disposable) {
SpActivity.this.disposable = disposable;
}
@Override
public void onComplete() {
SpActivity.this.disposable = null;
if (UserManager.hasLogin()) {
if (SpActivity.this.needShowAd) {
SpActivity.this.openSplashAd();
SpActivity.this.jumpToNext = true;
} else if (SpActivity.this.allowToNext) {
SpActivity.this.goMain();
} else {
SpActivity.this.jumpToNext = true;
}
} else if (TextUtils.isEmpty(str) && j != 0) {
RegisterRequestBean registerRequestBean = new RegisterRequestBean();
registerRequestBean.setDeviceCode(UserManager.getDeviceId());
registerRequestBean.setMobileToken("");
SpActivity.this.registerPresenter.userRegister(registerRequestBean);
} else {
RegisterRequestBean registerRequestBean2 = new RegisterRequestBean();
registerRequestBean2.setDeviceCode(UserManager.getDeviceId());
registerRequestBean2.setMobileToken(str);
SpActivity.this.registerPresenter.userRegister(registerRequestBean2);
}
if (SpActivity.this.countDownTimer != null) {
SpActivity.this.countDownTimer.cancel();
}
}
});
}
@Override
public void onDestroy() {
super.onDestroy();
releaseOneKey();
Disposable disposable = this.disposable;
if (disposable != null) {
disposable.dispose();
this.disposable = null;
}
CountDownTimer countDownTimer = this.countDownTimer;
if (countDownTimer != null) {
countDownTimer.cancel();
}
}
public void getConfigList() {
try {
((AppApiService) ServiceFactory.createYZService(AppApiService.class)).getConfigList().compose(new RemoteTransformer(this)).compose(new LifeCycleTransformer(findViewById(R.id.ivAd))).subscribe(new ToastObserver<ArrayList<ConfigUrlBean>>(this) {
@Override
public void onCatchNext(ArrayList<ConfigUrlBean> arrayList) throws Exception {
if (arrayList == null || arrayList.size() <= 0) {
return;
}
for (int i = 0; i < arrayList.size(); i++) {
ConfigUrlBean configUrlBean = arrayList.get(i);
if (configUrlBean.getKey().equalsIgnoreCase("movieConfig")) {
MMKVUtil.getDefault().encode("SVIP_URL", configUrlBean.getVal());
return;
}
}
}
@Override
public void onError(ErrorException errorException) {
super.onError(errorException);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onRegisterSuccess(RegisterBean registerBean) {
if (isFinishing() || registerBean == null) {
return;
}
UserManager.setUserId(registerBean.getId());
UserManager.setToken(registerBean.getToken());
OpenInstall.reportRegister();
if (TextUtils.isEmpty(this.channelCode)) {
initOp(true);
} else {
updateChannel(this.channelCode);
}
if (this.needShowAd) {
openSplashAd();
this.jumpToNext = true;
} else if (this.allowToNext) {
goMain();
} else {
this.jumpToNext = true;
}
}
@Override
public void onUserInstallSuccess() {
UserManager.setHasInstallApp(true);
}
@Override
public void onOriginalUrlSuccess(String str) {
UserManager.setRealUrl(str);
getConfigList();
this.splashAdPresenter.getSplashAd();
if (UserManager.getHasInstallApp()) {
return;
}
this.userInstallPresenter.userInstall(UserManager.getDeviceId());
}
@Override
public void onOriginalUrlFailure(int i, String str) {
getConfigList();
int i2 = this.retryTimes;
if (i2 < 3) {
this.retryTimes = i2 + 1;
this.originUrlPresenter.getOriginUrl();
return;
}
UserManager.setRealUrl(this.url);
if (UserManager.getHasInstallApp()) {
return;
}
this.userInstallPresenter.userInstall(UserManager.getDeviceId());
}
@Override
public void onSplashAdSuccess(List<VideoAdItem> list) {
if (list == null || list.size() <= 0) {
return;
}
VideoAdItem videoAdItem = list.get((int) (Math.random() * list.size()));
this.adItem = videoAdItem;
this.needShowAd = true;
ImageUtil.loadImageNoPlaceholder(this.adImage, videoAdItem.getCover());
}
@Override
public void onPointerCaptureChanged(boolean z) {
super.onPointerCaptureChanged(z);
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
}
void checkPermission(int i) {
if (i >= 100 && i <= 107) {
String[] strArr = {this.permissions[i - 100]};
int checkSelfPermission = checkSelfPermission(strArr[0]);
shouldShowRequestPermissionRationale(strArr[0]);
if (checkSelfPermission == 0) {
checkPermission(i + 1);
return;
} else {
requestPermissions(strArr, i);
return;
}
}
this.allowToNext = true;
if (this.jumpToNext) {
goMain();
}
}
@Override
public void onGetZhiboSuccess(ZhiboBean zhiboBean) {
SPUtils.getInstance().put("PAY_VR_URL", zhiboBean.PAY_VR_URL);
SPUtils.getInstance().put("PAY_SVIP_URL", zhiboBean.PAY_SVIP_URL);
SPUtils.getInstance().put("LTCYP_BG_URL", zhiboBean.LTCYP_BG_URL);
}
public void getGameUrl() {
new IntentUtils(this).readyGoThenKill(MainAct.class);
}
private void downloadFile(String str, final String str2) {
((CommonApiService) ServiceFactory.createOauthOtherService("http://oss-cn-hangzhou.aliyuncs.com", CommonApiService.class)).download(str).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).doOnNext(new Consumer<ResponseBody>() {
@Override
public void accept(ResponseBody responseBody) throws Exception {
FileOutputStream fileOutputStream;
File file = new File(SpActivity.this.getApplication().getDir("libs", 0).getAbsolutePath(), str2);
InputStream inputStream = null;
try {
try {
if (FileUtils.createOrExistsFile(file)) {
byte[] bArr = new byte[4096];
InputStream byteStream = responseBody.byteStream();
try {
fileOutputStream = new FileOutputStream(file);
while (true) {
try {
int read = byteStream.read(bArr);
if (read == -1) {
break;
}
fileOutputStream.write(bArr, 0, read);
} catch (IOException e) {
e = e;
inputStream = byteStream;
try {
e.printStackTrace();
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
if (fileOutputStream != null) {
fileOutputStream.close();
}
return;
} catch (Throwable th) {
th = th;
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e4) {
e4.printStackTrace();
}
}
throw th;
}
} catch (Throwable th2) {
th = th2;
inputStream = byteStream;
if (inputStream != null) {
}
if (fileOutputStream != null) {
}
throw th;
}
}
fileOutputStream.flush();
inputStream = byteStream;
} catch (IOException e5) {
e = e5;
fileOutputStream = null;
} catch (Throwable th3) {
th = th3;
fileOutputStream = null;
}
} else {
fileOutputStream = null;
}
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e6) {
e6.printStackTrace();
}
}
} catch (IOException e7) {
e7.printStackTrace();
return;
}
} catch (IOException e8) {
e = e8;
fileOutputStream = null;
} catch (Throwable th4) {
th = th4;
fileOutputStream = null;
}
if (fileOutputStream != null) {
fileOutputStream.close();
}
}
}).doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable th) throws Exception {
}
}).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<ResponseBody>() {
@Override
public void onComplete() {
}
@Override
public void onError(Throwable th) {
}
@Override
public void onNext(ResponseBody responseBody) {
}
@Override
public void onSubscribe(Disposable disposable) {
}
});
}
}