整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 DownloadVideoViewModel.java 源代码,内容仅作参考
package com.ys.resemble.ui.mine;
import android.app.Application;
import android.app.Dialog;
import android.util.Log;
import android.view.LayoutInflater;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableBoolean;
import androidx.databinding.ObservableField;
import com.wholepoint.wpfilms.R;
import com.ys.resemble.app.AppApplication;
import com.ys.resemble.data.AppRepository;
import com.ys.resemble.data.local.VideoDownloadDao;
import com.ys.resemble.databinding.DialogVideoDeleteBinding;
import com.ys.resemble.entity.DownloadInfoEntry;
import com.ys.resemble.entity.table.VideoDownloadEntity;
import com.ys.resemble.util.OkHttp3Util;
import com.ys.resemble.util.RxTimer;
import com.ys.resemble.widgets.dialog.SimpleDialog;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import okhttp3.Response;
public class DownloadVideoViewModel extends BaseViewModel<AppRepository> {
public boolean OooO;
public ObservableBoolean OooO0Oo;
public List<VideoDownloadEntity> OooO0o;
public ObservableField<String> OooO0o0;
public ObservableField<String> OooO0oO;
public ObservableField<String> OooO0oo;
public ObservableField<Boolean> OooOO0;
public ObservableField<Boolean> OooOO0O;
public RxTimer OooOO0o;
public DialogVideoDeleteBinding OooOOO;
public Dialog OooOOO0;
public DownloadVideoActivity OooOOOO;
public oo0O OooOOOo;
public boolean OooOOo;
public o00OOO00 OooOOo0;
public ObservableArrayList<o00OOO00> OooOOoo;
public me.goldze.mvvmhabit.binding.command.OooO00o OooOo;
public me.tatarka.bindingcollectionadapter2.OooO0OO<o00OOO00> OooOo0;
public ObservableArrayList<o00OOO00> OooOo00;
public me.goldze.mvvmhabit.binding.command.OooO00o OooOo0O;
public me.goldze.mvvmhabit.binding.command.OooO00o OooOo0o;
public me.goldze.mvvmhabit.binding.command.OooO00o OooOoO0;
public class OooO00o implements OkHttp3Util.OkHttpCallBack {
final String OooO00o;
OooO00o(String str) {
this.OooO00o = str;
}
@Override
public void onFailure(IOException iOException) {
Log.i("wangyi", "get失败:" + iOException.toString());
}
@Override
public void onSuccess(Response response) {
Log.i("wangyi", "成功");
if (!DownloadVideoViewModel.this.OooOOo) {
VideoDownloadDao.getInstance().deleteHistory(this.OooO00o);
} else {
VideoDownloadDao.getInstance().deleteHistory(this.OooO00o);
}
if (DownloadVideoViewModel.this.OooOo00.size() == 0) {
DownloadVideoViewModel.this.OooOO0.set(Boolean.TRUE);
DownloadVideoViewModel.this.OooOO0O.set(Boolean.FALSE);
}
}
}
public DownloadVideoViewModel(@NonNull Application application, AppRepository appRepository, RxTimer rxTimer, DownloadVideoActivity downloadVideoActivity) {
super(application, appRepository);
this.OooO0Oo = new ObservableBoolean(false);
this.OooO0o0 = new ObservableField<>("全选");
this.OooO0o = new ArrayList();
this.OooO0oO = new ObservableField<>();
this.OooO0oo = new ObservableField<>();
this.OooO = true;
Boolean bool = Boolean.FALSE;
this.OooOO0 = new ObservableField<>(bool);
this.OooOO0O = new ObservableField<>(bool);
this.OooOOo = false;
this.OooOOoo = new ObservableArrayList<>();
this.OooOo00 = new ObservableArrayList<>();
this.OooOo0 = me.tatarka.bindingcollectionadapter2.OooO0OO.OooO0OO(12, R.layout.item_downnloading_video);
this.OooOo0O = new me.goldze.mvvmhabit.binding.command.OooO00o(new BindingAction() {
@Override
public final void call() {
DownloadVideoViewModel.this.OooOOO0();
}
});
this.OooOo0o = new me.goldze.mvvmhabit.binding.command.OooO00o(new BindingAction() {
@Override
public final void call() {
DownloadVideoViewModel.this.OooOOOO();
}
});
this.OooOo = new me.goldze.mvvmhabit.binding.command.OooO00o(new BindingAction() {
@Override
public final void call() {
DownloadVideoViewModel.this.OooOOo0();
}
});
this.OooOoO0 = new me.goldze.mvvmhabit.binding.command.OooO00o(new BindingAction() {
@Override
public final void call() {
DownloadVideoViewModel.this.OooOOoo();
}
});
this.OooOO0o = rxTimer;
this.OooOOOO = downloadVideoActivity;
DialogVideoDeleteBinding dialogVideoDeleteBinding = (DialogVideoDeleteBinding) DataBindingUtil.inflate(LayoutInflater.from(me.goldze.mvvmhabit.utils.o0OoOo0.getContext()), R.layout.dialog_video_delete, null, false);
this.OooOOO = dialogVideoDeleteBinding;
dialogVideoDeleteBinding.setViewModel(this);
ObservableField<String> observableField = this.OooO0oO;
observableField.set("已用" + com.ys.resemble.util.o00000.OooO0O0(application) + ",");
ObservableField<String> observableField2 = this.OooO0oo;
observableField2.set("可用" + com.ys.resemble.util.o00000.OooO0OO(application));
ArrayList<VideoDownloadEntity> queryHistory = VideoDownloadDao.getInstance().queryHistory();
this.OooO0o = queryHistory;
if (queryHistory.size() > 0) {
this.OooOO0.set(bool);
this.OooOO0O.set(Boolean.TRUE);
return;
}
this.OooOO0O.set(bool);
this.OooOO0.set(Boolean.TRUE);
}
public void OooOOO0() {
this.OooOOO0.dismiss();
}
public void OooOOOO() {
this.OooOOO0.dismiss();
if (this.OooOOo) {
OooOO0O(this.OooOOOo.OooO0Oo.get(0).getStreamid());
return;
}
this.OooOo00.remove(this.OooOOo0);
OooOO0O(this.OooOOo0.OooO.getResource());
}
public void OooOOo0() {
if (this.OooO0o0.get().equals("全选")) {
Iterator<o00OOO00> it = this.OooOo00.iterator();
while (it.hasNext()) {
o00OOO00 next = it.next();
next.OooO0O0.set(Boolean.TRUE);
this.OooOOoo.add(next);
}
this.OooO0o0.set("取消全选");
return;
}
Iterator<o00OOO00> it2 = this.OooOo00.iterator();
while (it2.hasNext()) {
it2.next().OooO0O0.set(Boolean.FALSE);
this.OooOOoo.clear();
}
this.OooO0o0.set("全选");
}
public void OooOOoo() {
Iterator<o00OOO00> it = this.OooOOoo.iterator();
while (it.hasNext()) {
o00OOO00 next = it.next();
this.OooOo00.remove(next);
RxTimer rxTimer = next.OooO0OO;
if (rxTimer != null) {
rxTimer.OooO0O0();
next.OooO0OO = null;
}
OooOO0O(next.OooO.getResource());
}
if (this.OooOo00.size() == 0) {
this.OooO0Oo.set(false);
}
}
public void OooOO0(List<DownloadInfoEntry> list, DownloadingAdapter downloadingAdapter) {
if (list.size() > 0 && this.OooO0o.size() > 0) {
if (this.OooO) {
this.OooOO0o.OooO0O0();
if (this.OooOo00.size() > 0) {
for (int i = 0; i < this.OooOo00.size(); i++) {
this.OooOo00.get(i).OooO0OO.OooO0O0();
this.OooOo00.get(i).OooO0Oo.removeCallbacks(this.OooOo00.get(i).OooO0oO);
}
}
boolean z = this.OooOo00.size() <= 0;
int i2 = 0;
boolean z2 = false;
for (int i3 = 0; i3 < list.size(); i3++) {
if (list.get(i3).getDownload_percent() < 100) {
if (!z && i2 < this.OooOo00.size()) {
this.OooOo00.set(i2, new o00OOO00(this, list.get(i3), this.OooO0o, false));
i2++;
} else {
this.OooOo00.add(new o00OOO00(this, list.get(i3), this.OooO0o, false));
}
} else {
for (int i4 = 0; i4 < this.OooO0o.size(); i4++) {
if (list.get(i3).getResource().equals(this.OooO0o.get(i4).getStreamid())) {
VideoDownloadDao.getInstance().updateHistory(1, this.OooO0o.get(i4).getStreamid(), list.get(i3).getDownload_size());
z2 = true;
}
}
}
if (z2) {
this.OooO0o = VideoDownloadDao.getInstance().queryHistory();
me.goldze.mvvmhabit.bus.OooO0O0.OooO00o().OooO0O0(new com.ys.resemble.event.OooOo00(this.OooO0o));
}
}
if (!z) {
while (i2 < this.OooOo00.size()) {
this.OooOo00.remove(i2);
i2++;
}
}
if (this.OooOo00.size() == 0) {
this.OooOO0.set(Boolean.TRUE);
this.OooOO0O.set(Boolean.FALSE);
this.OooOO0o.OooO0O0();
}
}
} else {
this.OooOO0O.set(Boolean.FALSE);
this.OooOO0.set(Boolean.TRUE);
this.OooOO0o.OooO0O0();
this.OooOO0o = null;
VideoDownloadDao.getInstance().clearHistory();
}
this.OooO = false;
}
public void OooOO0O(String str) {
OkHttp3Util.OooO00o("http://127.0.0.1:" + AppApplication.OooO0OO + "/download_control?resource=" + str + "&type=5", new OooO00o(str));
}
public void delete(o00OOO00 o00ooo00) {
this.OooOOo0 = o00ooo00;
this.OooOOo = false;
if (this.OooOOO0 == null) {
this.OooOOO0 = SimpleDialog.OooO00o(this.OooOOOO.getContext(), this.OooOOO.getRoot(), true);
}
this.OooOOO0.show();
}
@Override
public void onDestroy() {
if (this.OooOo00.size() > 0) {
for (int i = 0; i < this.OooOo00.size(); i++) {
this.OooOo00.get(i).OooO0OO.OooO0O0();
this.OooOo00.get(i).OooO0Oo.removeCallbacks(this.OooOo00.get(i).OooO0oO);
}
}
super.onDestroy();
}
}