整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 o00OOOO0.java 源代码,内容仅作参考
package com.ys.resemble.ui.mine;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.czhj.sdk.common.Constants;
import com.kuaishou.weapon.p0.g;
import com.ss.android.socialbase.downloader.constants.MonitorConstants;
import com.ss.android.socialbase.downloader.utils.DownloadExpSwitchCode;
import com.ys.resemble.entity.UpdateEvent;
import com.ys.resemble.entity.table.VideoDownloadEntity;
import com.ys.resemble.ui.mine.feedback.FeedbackActivity;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.Proxy;
import me.goldze.mvvmhabit.base.BaseApplication;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class o00OOOO0 {
private TextView OooO;
private Context OooO00o;
private Disposable OooO0O0;
private ProgressBar OooO0OO;
private TextView OooO0Oo;
private TextView OooO0o;
private TextView OooO0o0;
private TextView OooO0oO;
private TextView OooO0oo;
private TextView OooOO0;
private LinearLayout OooOO0O;
private View OooOO0o;
private Dialog OooOOOo;
private long OooOOO0 = 0;
private long OooOOO = 0;
private String[] OooOOOO = {g.i, g.j};
public class OooO implements Callback {
final String OooO00o;
final ObservableEmitter OooO0O0;
OooO(String str, ObservableEmitter observableEmitter) {
this.OooO00o = str;
this.OooO0O0 = observableEmitter;
}
@Override
public void onFailure(Call call, IOException iOException) {
o00OOOO0.this.Oooo000(this.OooO00o, this.OooO0O0);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
FileOutputStream fileOutputStream;
byte[] bArr = new byte[2048];
InputStream inputStream = null;
try {
try {
InputStream byteStream = response.body().byteStream();
try {
File Oooo00O = o00OOOO0.this.Oooo00O();
fileOutputStream = new FileOutputStream(Oooo00O);
try {
long contentLength = response.body().contentLength();
o00OOOO0.this.OooOOO = contentLength;
long j = 0;
while (true) {
int read = byteStream.read(bArr);
if (read == -1) {
break;
}
fileOutputStream.write(bArr, 0, read);
j += read;
this.OooO0O0.onNext(Integer.valueOf((int) (((((float) j) * 1.0f) / ((float) contentLength)) * 100.0f)));
o00OOOO0.this.OooOOO0 = j;
}
fileOutputStream.flush();
o00OOOO0 o00oooo0 = o00OOOO0.this;
o00oooo0.Oooo0O0(o00oooo0.OooO00o, Oooo00O);
if (byteStream != null) {
byteStream.close();
}
fileOutputStream.close();
} catch (Exception e) {
e = e;
inputStream = byteStream;
try {
e.printStackTrace();
o00OOOO0.this.Oooo000(this.OooO00o, this.OooO0O0);
if (inputStream != null) {
inputStream.close();
}
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (Throwable th) {
th = th;
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception e2) {
e2.printStackTrace();
throw th;
}
}
if (fileOutputStream != null) {
fileOutputStream.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
inputStream = byteStream;
if (inputStream != null) {
}
if (fileOutputStream != null) {
}
throw th;
}
} catch (Exception e3) {
e = e3;
fileOutputStream = null;
} catch (Throwable th3) {
th = th3;
fileOutputStream = null;
}
} catch (Exception e4) {
e4.printStackTrace();
}
} catch (Exception e5) {
e = e5;
fileOutputStream = null;
} catch (Throwable th4) {
th = th4;
fileOutputStream = null;
}
}
}
public class OooO00o implements Observer<String> {
private Disposable OooO00o;
final boolean OooO0O0;
final Context OooO0OO;
final Activity OooO0Oo;
class OooO implements View.OnClickListener {
final UpdateEvent OooO00o;
OooO(UpdateEvent updateEvent) {
this.OooO00o = updateEvent;
}
@Override
public void onClick(View view) {
if (ContextCompat.checkSelfPermission(BaseApplication.OooO00o(), g.j) != 0) {
OooO00o oooO00o = OooO00o.this;
ActivityCompat.requestPermissions(oooO00o.OooO0Oo, o00OOOO0.this.OooOOOO, 1);
} else if (com.ys.resemble.util.OooOOO0.OooOo0()) {
} else {
o00OOOO0.this.Oooo00o(this.OooO00o.getResult().getUrl(), this.OooO00o.getResult().getForce_upgrade());
}
}
}
class C0495OooO00o extends ClickableSpan {
final String OooO00o;
C0495OooO00o(String str) {
this.OooO00o = str;
}
@Override
public void onClick(@NonNull View view) {
com.ys.resemble.util.OooO0o.OooO00o(OooO00o.this.OooO0OO, this.OooO00o);
}
@Override
public void updateDrawState(@NonNull TextPaint textPaint) {
textPaint.setColor(Color.parseColor("#365899"));
textPaint.setUnderlineText(false);
}
}
class OooO0O0 implements View.OnClickListener {
OooO0O0() {
}
@Override
public void onClick(View view) {
Intent intent = new Intent(OooO00o.this.OooO0OO, FeedbackActivity.class);
intent.putExtra("flag", 2);
OooO00o.this.OooO0OO.startActivity(intent);
}
}
class OooO0OO implements View.OnClickListener {
OooO0OO() {
}
@Override
public void onClick(View view) {
o00OOOO0.this.OooOOOo.dismiss();
}
}
class OooO0o implements View.OnClickListener {
final UpdateEvent OooO00o;
OooO0o(UpdateEvent updateEvent) {
this.OooO00o = updateEvent;
}
@Override
public void onClick(View view) {
if (ContextCompat.checkSelfPermission(BaseApplication.OooO00o(), g.j) != 0) {
OooO00o oooO00o = OooO00o.this;
ActivityCompat.requestPermissions(oooO00o.OooO0Oo, o00OOOO0.this.OooOOOO, 1);
} else if (com.ys.resemble.util.OooOOO0.OooOo0()) {
} else {
o00OOOO0.this.Oooo00o(this.OooO00o.getResult().getUrl(), this.OooO00o.getResult().getForce_upgrade());
}
}
}
OooO00o(boolean z, Context context, Activity activity) {
this.OooO0O0 = z;
this.OooO0OO = context;
this.OooO0Oo = activity;
}
@Override
public void onNext(String str) {
}
@Override
public void onComplete() {
}
@Override
public void onError(Throwable th) {
}
@Override
public void onSubscribe(Disposable disposable) {
this.OooO00o = disposable;
}
}
public class OooO0O0 implements ObservableOnSubscribe<String> {
class OooO00o implements Callback {
final ObservableEmitter OooO00o;
OooO00o(OooO0O0 oooO0O0, ObservableEmitter observableEmitter) {
this.OooO00o = observableEmitter;
}
@Override
public void onFailure(Call call, IOException iOException) {
this.OooO00o.onError(iOException);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.body() != null) {
this.OooO00o.onNext(response.body().string());
}
}
}
OooO0O0(o00OOOO0 o00oooo0) {
}
@Override
public void subscribe(ObservableEmitter<String> observableEmitter) throws Exception {
String str;
OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
if (me.goldze.mvvmhabit.utils.Oooo000.OooO00o(com.ys.resemble.util.o0000.OooOOO())) {
str = "https://u.7rdb9a.cn/api/public/upgrade";
} else {
str = com.ys.resemble.util.o0000.OooOOO() + "api/public/upgrade";
}
MediaType parse = MediaType.parse("application/json; charset=utf-8");
long currentTimeMillis = System.currentTimeMillis();
build.newCall(new Request.Builder().addHeader("app_id", "zhengdianshipin").addHeader("version", "33000").addHeader("sys_platform", "2").addHeader("mob_mfr", Build.MANUFACTURER.toLowerCase()).addHeader("mobmodel", Build.MODEL).addHeader("sysrelease", Build.VERSION.RELEASE).addHeader(MonitorConstants.EXTRA_DEVICE_ID, com.ys.resemble.util.OooOOO0.OooOO0o(BaseApplication.OooO00o())).addHeader("channel_code", com.ys.resemble.util.OooOOO0.OooO(BaseApplication.OooO00o())).addHeader(VideoDownloadEntity.CUR_TIME, currentTimeMillis + "").addHeader(Constants.TOKEN, com.ys.resemble.util.o0000.Oooo()).addHeader("sign", com.ys.resemble.util.OooOOO0.OooOooo(com.ys.resemble.util.OooOOO0.Oooo000(currentTimeMillis + "")).toUpperCase()).post(RequestBody.create(parse, "")).url(str).build()).enqueue(new OooO00o(this, observableEmitter));
}
}
public class OooO0OO implements Observer<Integer> {
final int OooO00o;
OooO0OO(int i) {
this.OooO00o = i;
}
@Override
public void onNext(Integer num) {
o00OOOO0.this.OooO0OO.setProgress(num.intValue());
TextView textView = o00OOOO0.this.OooO0Oo;
textView.setText(num + "/100");
if (num.intValue() == 100) {
if (this.OooO00o != 1) {
o00OOOO0.this.OooOO0O.setVisibility(0);
}
o00OOOO0.this.OooOO0o.setVisibility(0);
o00OOOO0.this.OooO0OO.setVisibility(8);
o00OOOO0.this.OooO0Oo.setVisibility(8);
o00OOOO0.this.OooO0oo.setEnabled(true);
o00OOOO0.this.OooO.setEnabled(true);
}
}
@Override
public void onComplete() {
me.goldze.mvvmhabit.utils.o000oOoO.OooO0OO("服务器异常!请重新下载!");
if (this.OooO00o != 1) {
o00OOOO0.this.OooOO0O.setVisibility(0);
}
o00OOOO0.this.OooOO0o.setVisibility(0);
o00OOOO0.this.OooO0OO.setVisibility(8);
o00OOOO0.this.OooO0Oo.setVisibility(8);
o00OOOO0.this.OooO0oo.setEnabled(true);
o00OOOO0.this.OooO.setEnabled(true);
}
@Override
public void onError(Throwable th) {
me.goldze.mvvmhabit.utils.o000oOoO.OooO0OO("网络异常!请重新下载!");
if (this.OooO00o != 1) {
o00OOOO0.this.OooOO0O.setVisibility(0);
}
o00OOOO0.this.OooOO0o.setVisibility(0);
o00OOOO0.this.OooO0OO.setVisibility(8);
o00OOOO0.this.OooO0Oo.setVisibility(8);
o00OOOO0.this.OooO0oo.setEnabled(true);
o00OOOO0.this.OooO.setEnabled(true);
}
@Override
public void onSubscribe(Disposable disposable) {
o00OOOO0.this.OooO0O0 = disposable;
}
}
public class OooO0o implements ObservableOnSubscribe<Integer> {
final String OooO00o;
OooO0o(String str) {
this.OooO00o = str;
}
@Override
public void subscribe(ObservableEmitter<Integer> observableEmitter) throws Exception {
o00OOOO0.this.Oooo0(this.OooO00o, observableEmitter);
}
}
public class OooOO0 implements Callback {
final String OooO00o;
final ObservableEmitter OooO0O0;
OooOO0(String str, ObservableEmitter observableEmitter) {
this.OooO00o = str;
this.OooO0O0 = observableEmitter;
}
@Override
public void onFailure(Call call, IOException iOException) {
o00OOOO0.this.Oooo000(this.OooO00o, this.OooO0O0);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
RandomAccessFile randomAccessFile;
String absolutePath;
if (response.body() == null) {
o00OOOO0.this.Oooo000(this.OooO00o, this.OooO0O0);
return;
}
byte[] bArr = new byte[2048];
InputStream inputStream = null;
try {
try {
InputStream byteStream = response.body().byteStream();
try {
if (Environment.getExternalStorageState().equals("mounted")) {
absolutePath = BaseApplication.OooO00o().getExternalFilesDir("").getAbsolutePath();
} else {
absolutePath = BaseApplication.OooO00o().getFilesDir().getAbsolutePath();
}
File file = new File(absolutePath, "updateDemo.apk");
randomAccessFile = new RandomAccessFile(file, "rwd");
try {
randomAccessFile.seek(o00OOOO0.this.OooOOO0);
long j = o00OOOO0.this.OooOOO;
long j2 = o00OOOO0.this.OooOOO0;
while (true) {
int read = byteStream.read(bArr);
if (read == -1) {
break;
}
randomAccessFile.write(bArr, 0, read);
j2 += read;
this.OooO0O0.onNext(Integer.valueOf((int) (((((float) j2) * 1.0f) / ((float) j)) * 100.0f)));
o00OOOO0.this.OooOOO0 = j2;
}
o00OOOO0 o00oooo0 = o00OOOO0.this;
o00oooo0.Oooo0O0(o00oooo0.OooO00o, file);
if (byteStream != null) {
byteStream.close();
}
randomAccessFile.close();
} catch (Exception e) {
e = e;
inputStream = byteStream;
try {
e.printStackTrace();
o00OOOO0.this.Oooo000(this.OooO00o, this.OooO0O0);
if (inputStream != null) {
inputStream.close();
}
if (randomAccessFile != null) {
randomAccessFile.close();
}
} catch (Throwable th) {
th = th;
if (inputStream != null) {
try {
inputStream.close();
} catch (Exception e2) {
e2.printStackTrace();
throw th;
}
}
if (randomAccessFile != null) {
randomAccessFile.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
inputStream = byteStream;
if (inputStream != null) {
}
if (randomAccessFile != null) {
}
throw th;
}
} catch (Exception e3) {
e = e3;
randomAccessFile = null;
} catch (Throwable th3) {
th = th3;
randomAccessFile = null;
}
} catch (Exception e4) {
e4.printStackTrace();
}
} catch (Exception e5) {
e = e5;
randomAccessFile = null;
} catch (Throwable th4) {
th = th4;
randomAccessFile = null;
}
}
}
public void Oooo000(String str, ObservableEmitter<Integer> observableEmitter) {
OkHttpClient build = new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build();
Request.Builder url = new Request.Builder().url(str);
build.newCall(url.addHeader("RANGE", "bytes=" + this.OooOOO0 + "-" + this.OooOOO).build()).enqueue(new OooOO0(str, observableEmitter));
}
public File Oooo00O() {
String absolutePath;
if (Environment.getExternalStorageState().equals("mounted")) {
absolutePath = BaseApplication.OooO00o().getExternalFilesDir("").getAbsolutePath();
} else {
absolutePath = BaseApplication.OooO00o().getFilesDir().getAbsolutePath();
}
File file = new File(absolutePath, "updatexiaocao.apk");
if (file.exists()) {
file.delete();
}
try {
file.createNewFile();
return file;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public void Oooo0(String str, ObservableEmitter<Integer> observableEmitter) {
new OkHttpClient.Builder().proxy(Proxy.NO_PROXY).build().newCall(new Request.Builder().url(str).build()).enqueue(new OooO(str, observableEmitter));
}
public void Oooo00o(String str, int i) {
if (me.goldze.mvvmhabit.utils.Oooo000.OooO00o(str)) {
me.goldze.mvvmhabit.utils.o000oOoO.OooO0OO("下载链接为空");
return;
}
this.OooO.setEnabled(false);
this.OooO0oo.setEnabled(false);
this.OooOO0O.setVisibility(8);
this.OooOO0o.setVisibility(8);
this.OooO0OO.setVisibility(0);
this.OooO0Oo.setVisibility(0);
Observable.create(new OooO0o(str)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new OooO0OO(i));
}
public void Oooo0O0(Context context, File file) {
if (context == null) {
return;
}
Uri uriForFile = FileProvider.getUriForFile(context, BaseApplication.OooO00o().getPackageName() + ".fileProvider", file);
Intent intent = new Intent("android.intent.action.VIEW");
intent.setFlags(DownloadExpSwitchCode.BUGFIX_GETPACKAGEINFO_BY_UNZIP);
if (Build.VERSION.SDK_INT >= 24) {
intent.addFlags(3);
intent.setDataAndType(uriForFile, "application/vnd.android.package-archive");
intent.setClipData(ClipData.newRawUri("output", uriForFile));
} else {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
}
context.startActivity(intent);
}
public void Oooo0OO(Context context, Activity activity, boolean z) {
this.OooO00o = context;
Observable.create(new OooO0O0(this)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new OooO00o(z, context, activity));
}
}