use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class UnLimit91PornItemDao method loadCurrentDeep.
protected UnLimit91PornItem loadCurrentDeep(Cursor cursor, boolean lock) {
UnLimit91PornItem entity = loadCurrent(cursor, 0, lock);
int offset = getAllColumns().length;
VideoResult videoResult = loadCurrentOther(daoSession.getVideoResultDao(), cursor, offset);
if (videoResult != null) {
entity.setVideoResult(videoResult);
}
return entity;
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class SearchPresenter method searchVideos.
@Override
public void searchVideos(String searchId, String sort, final boolean pullToRefresh) {
String viewType = "basic";
String searchType = "search_videos";
if (pullToRefresh) {
page = 1;
}
dataManager.searchPorn91Videos(viewType, page, searchType, searchId, sort).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(2)).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<SearchView>() {
@Override
public void run(@NonNull SearchView view) {
if (page == 1 && pullToRefresh) {
view.showLoading(pullToRefresh);
}
}
});
}
@Override
public void onSuccess(final List<UnLimit91PornItem> unLimit91PornItems) {
ifViewAttached(new ViewAction<SearchView>() {
@Override
public void run(@NonNull SearchView 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<SearchView>() {
@Override
public void run(@NonNull SearchView view) {
if (page == 1) {
view.showError(msg);
} else {
view.loadMoreFailed();
}
}
});
}
});
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class VideoListFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ArrayList<UnLimit91PornItem> mUnLimit91PornItemList = new ArrayList<>();
mUnLimit91Adapter = new UnLimit91Adapter(R.layout.item_unlimit_91porn, mUnLimit91PornItemList);
skipPageAdapter = new SkipPageAdapter(R.layout.item_skip_page);
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class VideoListFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
unbinder = ButterKnife.bind(this, view);
// Setup contentView == SwipeRefreshView
contentView.setOnRefreshListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(mUnLimit91Adapter);
mUnLimit91Adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
UnLimit91PornItem unLimit91PornItems = (UnLimit91PornItem) adapter.getItem(position);
goToPlayVideo(unLimit91PornItems);
}
});
// 使用缓存的FragmentPagerAdapter之后会导致新方法的加载更多失效,暂时切换回过时api,可正常运行
mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
presenter.loadVideoListData(false, false, category.getCategoryValue(), 0);
}
});
helper = new LoadViewHelper(recyclerView);
helper.setListener(new OnLoadViewListener() {
@Override
public void onRetryClick() {
loadData(false, true, 0);
}
});
// loadData(false);
AppUtils.setColorSchemeColors(context, contentView);
handlerSkipPage();
}
use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.
the class DownloadingFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
unbinder = ButterKnife.bind(this, view);
mUnLimit91PornItemList = new ArrayList<>();
mDownloadAdapter = new DownloadVideoAdapter(R.layout.item_unlimit_91porn_download, mUnLimit91PornItemList);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.getItemAnimator().setChangeDuration(0);
recyclerView.setAdapter(mDownloadAdapter);
mDownloadAdapter.setEmptyView(R.layout.empty_view, recyclerView);
mDownloadAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
UnLimit91PornItem unLimit91PornItem = (UnLimit91PornItem) adapter.getItem(position);
if (unLimit91PornItem == null) {
return;
}
Logger.t(TAG).d("当前状态:" + unLimit91PornItem.getStatus());
if (view.getId() == R.id.iv_download_control) {
if (FileDownloader.getImpl().isServiceConnected()) {
if (unLimit91PornItem.getStatus() == FileDownloadStatus.progress) {
FileDownloader.getImpl().pause(unLimit91PornItem.getDownloadId());
((ImageView) view).setImageResource(R.drawable.start_download);
} else if (unLimit91PornItem.getStatus() == FileDownloadStatus.warn) {
startDownload(unLimit91PornItem, view, true);
} else if (unLimit91PornItem.getStatus() == FileDownloadStatus.paused) {
startDownload(unLimit91PornItem, view, false);
} else if (unLimit91PornItem.getStatus() == FileDownloadStatus.error) {
startDownload(unLimit91PornItem, view, false);
}
}
}
}
});
mDownloadAdapter.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(BaseQuickAdapter adapter, View view, int position) {
final UnLimit91PornItem unLimit91PornItem = (UnLimit91PornItem) adapter.getItem(position);
if (unLimit91PornItem == null)
return false;
new AlertDialog.Builder(context).setMessage("刪除此任务?").setPositiveButton("好的", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
presenter.deleteDownloadingTask(unLimit91PornItem);
presenter.loadDownloadingData();
}
}).show();
return true;
}
});
}
Aggregations