// PLVLSStatusBarLayout.java
private void initView() {
// 创建了文档管理弹层页面
pptListLayout = new PLVLSPptListLayout(getContext());
}
private void processSelectDocument() {
if (pptListLayout != null) {
// 点击状态栏上面的文档图标时,调用open打开文档管理弹层
pptListLayout.open();
}
}
// PLVLSPptListLayout.java
public void open() {
// 打开弹层时,初始化弹层视图
initViewByShowType();
}
private void initViewByShowType() {
// 请求更新数据
requestUpdateData();
}
/**
* 根据显示样式,向Presenter请求更新列表数据
*/
private void requestUpdateData() {
if (showViewType == PLVLSPptViewType.COVER) {
// 向Presenter请求更新PPT文档列表数据
PLVDocumentPresenter.getInstance().requestGetPptCoverList();
} else if (showViewType == PLVLSPptViewType.PAGE) {
PLVDocumentPresenter.getInstance().requestGetPptPageList(currentAutoId);
}
}
// PLVLSPptListLayout.java
// MVP - View 回调实现
mvpView = new PLVAbsDocumentView() {
@Override
public void onPptCoverList(@Nullable PLVSPPTInfo pptInfo) {
processPptCoverList(pptInfo);
}
}
// PLVLSPptListLayout.java
// 设置列表项长按点击监听
pptListAdapter.setOnPptItemLongClickListener(new PLVLSPptListViewHolder.OnPptItemLongClickListener() {
@Override
public void onLongClick(View view, final int id, final String fileId) {
if (pptListAdapter.getRealViewType() != PLVLSPptViewType.COVER) {
return;
}
if (documentDeleteArrow != null) {
// 设置删除确认箭头的点击回调
documentDeleteArrow.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// 点击删除箭头后 弹窗提示是否删除
documentDeleteConfirmDialog
.setRightBtnListener(new OnClickListener() {
@Override
public void onClick(View v) {
// 点击确认后,调用Presenter删除文档
PLVDocumentPresenter.getInstance().deleteDocument(fileId);
documentDeleteConfirmDialog.hide();
}
})
.show();
}
});
// 显示删除确认箭头
documentDeleteArrow.showAtLocation(view);
}
}
});