use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class DownloadingFragment method update.
@Override
public void update(BaseDownloadTask task) {
Logger.t(TAG).d("updateUnLimit91PornItem(BaseDownloadTask task)");
if (mUnLimit91PornItemList == null || mUnLimit91PornItemList.size() == 0) {
return;
}
UnLimit91PornItem unLimit91PornItem = presenter.findUnLimit91PornItemByDownloadId(task.getId());
if (unLimit91PornItem != null) {
int position = mUnLimit91PornItemList.indexOf(unLimit91PornItem);
Logger.t(TAG).d("position" + position);
if (position >= 0 && position < mUnLimit91PornItemList.size()) {
mUnLimit91PornItemList.set(position, unLimit91PornItem);
mDownloadAdapter.notifyItemChanged(position);
} else {
mUnLimit91PornItemList.add(unLimit91PornItem);
mDownloadAdapter.notifyItemInserted(mUnLimit91PornItemList.size());
}
} else {
presenter.loadDownloadingData();
}
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class DownloadingFragment method complete.
@Override
public void complete(BaseDownloadTask task) {
if (mUnLimit91PornItemList == null || mUnLimit91PornItemList.size() == 0) {
return;
}
Logger.t(TAG).d("已经下载完成了");
UnLimit91PornItem unLimit91PornItem = presenter.findUnLimit91PornItemByDownloadId(task.getId());
if (unLimit91PornItem != null) {
int position = mUnLimit91PornItemList.indexOf(unLimit91PornItem);
if (position >= 0 && position < mUnLimit91PornItemList.size()) {
mUnLimit91PornItemList.remove(position);
mDownloadAdapter.notifyItemRemoved(position);
} else {
presenter.loadDownloadingData();
}
} else {
presenter.loadDownloadingData();
}
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class BasePlayVideo method initData.
private void initData() {
UnLimit91PornItem tmp = dataManager.findUnLimit91PornItemByViewKey(unLimit91PornItem.getViewKey());
if (tmp == null || tmp.getVideoResult() == null) {
presenter.loadVideoUrl(unLimit91PornItem);
} else {
unLimit91PornItem = tmp;
videoplayerContainer.setVisibility(View.VISIBLE);
Logger.t(TAG).d("使用已有播放地址");
// 浏览历史
unLimit91PornItem.setViewHistoryDate(new Date());
dataManager.updateUnLimit91PornItem(unLimit91PornItem);
VideoResult videoResult = unLimit91PornItem.getVideoResult();
setToolBarLayoutInfo(unLimit91PornItem);
playVideo(unLimit91PornItem.getTitle(), videoResult.getVideoUrl(), videoResult.getVideoName(), videoResult.getThumbImgUrl());
// 加载评论
presenter.loadVideoComment(videoResult.getVideoId(), unLimit91PornItem.getViewKey(), true);
}
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class AuthorPresenter method authorVideos.
@Override
public void authorVideos(String uid, final boolean pullToRefresh) {
String type = "public";
if (pullToRefresh) {
page = 1;
cleanCache = true;
}
dataManager.loadPorn91authorVideos(uid, type, page, cleanCache).map(new Function<BaseResult<List<UnLimit91PornItem>>, List<UnLimit91PornItem>>() {
@Override
public List<UnLimit91PornItem> apply(BaseResult<List<UnLimit91PornItem>> baseResult) throws Exception {
if (baseResult.getCode() == BaseResult.ERROR_CODE) {
throw new MessageException(baseResult.getMessage());
}
if (page == 1) {
totalPage = baseResult.getTotalPage();
}
return baseResult.getData();
}
}).retryWhen(new RetryWhenProcess(RetryWhenProcess.PROCESS_TIME)).compose(RxSchedulersHelper.<List<UnLimit91PornItem>>ioMainThread()).compose(provider.<List<UnLimit91PornItem>>bindUntilEvent(Lifecycle.Event.ON_DESTROY)).subscribe(new CallBackWrapper<List<UnLimit91PornItem>>() {
@Override
public void onBegin(Disposable d) {
ifViewAttached(new ViewAction<AuthorView>() {
@Override
public void run(@NonNull AuthorView view) {
if (page == 1 && !pullToRefresh) {
view.showLoading(pullToRefresh);
}
}
});
}
@Override
public void onSuccess(final List<UnLimit91PornItem> unLimit91PornItems) {
ifViewAttached(new ViewAction<AuthorView>() {
@Override
public void run(@NonNull AuthorView view) {
if (page == 1) {
view.setData(unLimit91PornItems);
view.showContent();
} else {
view.loadMoreDataComplete();
view.setMoreData(unLimit91PornItems);
}
if (page >= totalPage) {
view.noMoreData();
} else {
page++;
}
view.showContent();
}
});
}
@Override
public void onError(final String msg, int code) {
ifViewAttached(new ViewAction<AuthorView>() {
@Override
public void run(@NonNull AuthorView view) {
if (page == 1) {
view.showError(msg);
} else {
view.loadMoreFailed();
}
}
});
}
});
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class FavoriteActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_favorite);
ButterKnife.bind(this);
deleteAlertDialog = DialogUtils.initLodingDialog(this, "删除中,请稍后...");
initToolBar(toolbar);
toolbar.setContentInsetStartWithNavigation(0);
// Setup contentView == SwipeRefreshView
contentView.setOnRefreshListener(this);
List<UnLimit91PornItem> mUnLimit91PornItemList = new ArrayList<>();
mUnLimit91Adapter = new FavoriteAdapter(R.layout.item_right_menu_delete, mUnLimit91PornItemList);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(mUnLimit91Adapter);
mUnLimit91Adapter.setEmptyView(R.layout.empty_view, recyclerView);
mUnLimit91Adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
goToPlayVideo((UnLimit91PornItem) adapter.getItem(position));
}
});
mUnLimit91Adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
SwipeItemLayout swipeItemLayout = (SwipeItemLayout) view.getParent();
swipeItemLayout.close();
if (view.getId() == R.id.right_menu_delete) {
UnLimit91PornItem unLimit91PornItem = (UnLimit91PornItem) adapter.getItem(position);
if (unLimit91PornItem == null || unLimit91PornItem.getVideoResult() == null) {
showMessage("信息错误,无法删除", TastyToast.WARNING);
return;
}
presenter.deleteFavorite(unLimit91PornItem.getVideoResult().getVideoId());
}
}
});
mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
presenter.loadRemoteFavoriteData(false);
}
}, recyclerView);
helper = new LoadViewHelper(recyclerView);
helper.setListener(new OnLoadViewListener() {
@Override
public void onRetryClick() {
presenter.loadRemoteFavoriteData(false);
}
});
boolean needRefresh = dataManager.isFavoriteNeedRefresh();
presenter.loadRemoteFavoriteData(needRefresh);
}
Aggregations