|
|
@@ -26,6 +26,7 @@ import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
|
import org.afinal.simplecache.ApiKey;
|
|
|
@@ -33,6 +34,7 @@ import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
import cn.finalteam.rxgalleryfinal.api.CameraCallBack;
|
|
|
@@ -41,7 +43,9 @@ import cn.finalteam.rxgalleryfinal.utils.CameraUtil;
|
|
|
import cn.finalteam.rxgalleryfinal.utils.MediaUtils;
|
|
|
import io.reactivex.Observable;
|
|
|
import io.reactivex.ObservableOnSubscribe;
|
|
|
+import io.reactivex.ObservableSource;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
+import io.reactivex.functions.Function;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
/**
|
|
|
@@ -146,27 +150,24 @@ public class ActMediaChoose extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public void onGetVideoSuccess() {
|
|
|
- Observable.create((ObservableOnSubscribe<MediaBean>) emitter -> {
|
|
|
- MediaBean mediaBean = null;
|
|
|
- if (filePath != null) {
|
|
|
- mediaBean = MediaUtils.getMediaBeanWithVideo(getApplicationContext(), filePath);
|
|
|
- }
|
|
|
- if (mediaBean == null) {
|
|
|
- emitter.onError(new Throwable(filePath));
|
|
|
- }
|
|
|
- emitter.onNext(mediaBean);
|
|
|
- }).subscribeOn(Schedulers.io())
|
|
|
+ G.showToast("请稍等,加载视频中");
|
|
|
+ Observable.just(1)
|
|
|
+ .delay(1, TimeUnit.SECONDS)
|
|
|
+ .flatMap((Function<Integer, ObservableSource<MediaBean>>) integer -> Observable.just(MediaUtils.getMediaBeanWithVideo(getApplicationContext(), filePath)))
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new AbsObserver<MediaBean>() {
|
|
|
@Override
|
|
|
public void onNext(MediaBean item) {
|
|
|
- Jump2View.getInstance().goActCutVideo(ActMediaChoose.this, Video.from(item));
|
|
|
+ if (!ActMediaChoose.this.isDestroyed())
|
|
|
+ Jump2View.getInstance().goActCutVideo(ActMediaChoose.this, Video.from(item));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(Throwable e) {
|
|
|
if (mAdapter.getItem(0) instanceof IRefresh) {
|
|
|
- refreshData(0);
|
|
|
+ if (!ActMediaChoose.this.isDestroyed())
|
|
|
+ ((IRefresh) mAdapter.getItem(0)).refreshData();
|
|
|
}
|
|
|
}
|
|
|
});
|