use of com.dante.adapter.DownloadVideoAdapter 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;
}
});
}
use of com.dante.adapter.DownloadVideoAdapter in project 91Pop by DanteAndroid.
the class FinishedFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
unbinder = ButterKnife.bind(this, view);
List<UnLimit91PornItem> mUnLimit91PornItemList = new ArrayList<>();
mDownloadAdapter = new DownloadVideoAdapter(R.layout.item_unlimit_91porn_download, mUnLimit91PornItemList);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(mDownloadAdapter);
mDownloadAdapter.setEmptyView(R.layout.empty_view, recyclerView);
mDownloadAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
UnLimit91PornItem unLimit91PornItem = (UnLimit91PornItem) adapter.getItem(position);
openMp4File(unLimit91PornItem);
}
});
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) {
File file = new File(unLimit91PornItem.getDownLoadPath(dataManager));
if (file.exists()) {
showDeleteFileDialog(unLimit91PornItem);
} else {
presenter.deleteDownloadedTask(unLimit91PornItem, false);
presenter.loadFinishedData();
}
}
}).show();
return true;
}
});
presenter.loadFinishedData();
}
Aggregations