整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 DownloadCompleteViewModel.java 源代码,内容仅作参考
package com.ys.resemble.ui.mine;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
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.entity.table.VideoDownloadEntity;
import com.ys.resemble.util.OkHttp3Util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import okhttp3.Response;
public class DownloadCompleteViewModel extends BaseViewModel<AppRepository> {
public ObservableArrayList<oo0O> OooO;
public ObservableField<String> OooO0Oo;
public ObservableBoolean OooO0o;
public ObservableField<String> OooO0o0;
public ObservableField<String> OooO0oO;
public ObservableField<Boolean> OooO0oo;
public ObservableArrayList<oo0O> OooOO0;
public me.tatarka.bindingcollectionadapter2.OooO0OO<oo0O> 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) {
me.goldze.mvvmhabit.utils.OooOO0.OooO0Oo("wangyi", "get失败:" + iOException.toString());
}
@Override
public void onSuccess(Response response) {
me.goldze.mvvmhabit.utils.OooOO0.OooO0Oo("wangyi", "成功");
VideoDownloadDao.getInstance().deleteHistory(this.OooO00o);
if (DownloadCompleteViewModel.this.OooOO0.size() == 0) {
DownloadCompleteViewModel.this.OooO0oo.set(Boolean.TRUE);
}
}
}
public DownloadCompleteViewModel(@NonNull Application application, AppRepository appRepository) {
super(application, appRepository);
this.OooO0Oo = new ObservableField<>();
this.OooO0o0 = new ObservableField<>();
this.OooO0o = new ObservableBoolean(false);
this.OooO0oO = new ObservableField<>("全选");
this.OooO0oo = new ObservableField<>(Boolean.TRUE);
this.OooO = new ObservableArrayList<>();
this.OooOO0 = new ObservableArrayList<>();
this.OooOO0O = me.tatarka.bindingcollectionadapter2.OooO0OO.OooO0OO(12, R.layout.item_downnload_complete_video);
this.OooOO0o = new me.goldze.mvvmhabit.binding.command.OooO00o(new BindingAction() {
@Override
public final void call() {
DownloadCompleteViewModel.this.OooOOO0();
}
});
this.OooOOO0 = new me.goldze.mvvmhabit.binding.command.OooO00o(new BindingAction() {
@Override
public final void call() {
DownloadCompleteViewModel.this.OooOOOO();
}
});
ObservableField<String> observableField = this.OooO0Oo;
observableField.set("已用" + com.ys.resemble.util.o00000.OooO0O0(application) + ",");
ObservableField<String> observableField2 = this.OooO0o0;
observableField2.set("可用" + com.ys.resemble.util.o00000.OooO0OO(application));
}
public void OooOOO0() {
if (this.OooO0oO.get().equals("全选")) {
Iterator<oo0O> it = this.OooOO0.iterator();
while (it.hasNext()) {
oo0O next = it.next();
next.OooO0O0.set(Boolean.TRUE);
this.OooO.add(next);
}
this.OooO0oO.set("取消全选");
return;
}
Iterator<oo0O> it2 = this.OooOO0.iterator();
while (it2.hasNext()) {
it2.next().OooO0O0.set(Boolean.FALSE);
this.OooO.clear();
}
this.OooO0oO.set("全选");
}
public void OooOOOO() {
Iterator<oo0O> it = this.OooO.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
oo0O next = it.next();
this.OooOO0.remove(next);
if (next.OooO0Oo.size() > 1) {
for (int i = 0; i < next.OooO0Oo.size(); i++) {
OooOO0O(next.OooO0Oo.get(i).getStreamid());
}
} else {
OooOO0O(next.OooO0Oo.get(0).getStreamid());
}
}
if (this.OooOO0.size() == 0) {
this.OooO0o.set(false);
}
}
@RequiresApi(api = 24)
public void OooOO0(List<VideoDownloadEntity> list) {
this.OooO0oo.set(Boolean.FALSE);
for (int i = 0; i < list.size(); i++) {
for (int size = list.size() - 1; size > i; size--) {
if (list.get(i).getStreamid().equals(list.get(size).getStreamid())) {
list.remove(size);
}
}
}
ArrayList<VideoDownloadEntity> arrayList = new ArrayList();
this.OooOO0.clear();
for (int i2 = 0; i2 < list.size(); i2++) {
if (list.get(i2).getComplete() == 1) {
arrayList.add(list.get(i2));
}
}
if (arrayList.size() > 0) {
HashMap hashMap = new HashMap();
for (VideoDownloadEntity videoDownloadEntity : arrayList) {
List list2 = (List) hashMap.get(Integer.valueOf(videoDownloadEntity.getId()));
if (list2 == null) {
list2 = new ArrayList();
hashMap.put(Integer.valueOf(videoDownloadEntity.getId()), list2);
}
list2.add(videoDownloadEntity);
}
for (Map.Entry entry : hashMap.entrySet()) {
this.OooOO0.add(new oo0O(this, (List) entry.getValue()));
}
}
}
public void OooOO0O(String str) {
OkHttp3Util.OooO00o("http://127.0.0.1:" + AppApplication.OooO0OO + "/download_control?resource=" + str + "&type=5", new OooO00o(str));
}
}