Beispiel #1
0
        public void onItemClick(int position)
        {
            Recommend.RecommendBooks books = mAdapter.getItem(position);

            if (books.path.EndsWith(Constant.SUFFIX_TXT))
            {
                // TXT
                new AlertDialog.Builder(this)
                .SetTitle("提示")
                .SetMessage(Java.Lang.String.Format(GetString(
                                                        Resource.String.book_detail_is_joined_the_book_shelf), books.title))
                .SetPositiveButton("确定", (sender, e) =>
                {
                    // 拷贝到缓存目录
                    FileUtils.fileChannelCopy(new File(books.path),
                                              new File(FileUtils.getChapterPath(books._id, 1)));
                    // 加入书架
                    if (CollectionsManager.getInstance().add(books))
                    {
                        mRecyclerView.showTipViewAndDelayClose(Java.Lang.String.Format(GetString(
                                                                                           Resource.String.book_detail_has_joined_the_book_shelf), books.title));
                        // 通知
                        EventManager.refreshCollectionList();
                    }
                    else
                    {
                        mRecyclerView.showTipViewAndDelayClose("书籍已存在");
                    }
                    var dialog = sender as AlertDialog;
                    dialog?.Dismiss();
                })
                .SetNegativeButton("取消", (sender, e) =>
                {
                    var dialog = sender as AlertDialog;
                    dialog?.Dismiss();
                })
                .Show();
            }
            else if (books.path.EndsWith(Constant.SUFFIX_PDF))
            {
                // PDF
                // TODO: ReadPDFActivity.start(this, books.path);
                ToastUtils.showSingleToast("等待开发中");
            }
            else if (books.path.EndsWith(Constant.SUFFIX_EPUB))
            {
                // EPub
                // TODO: ReadEPubActivity.start(this, books.path);
                ToastUtils.showSingleToast("等待开发中");
            }
            else if (books.path.EndsWith(Constant.SUFFIX_CHM))
            {
                // CHM
                // TODO: ReadCHMActivity.start(this, books.path);
                ToastUtils.showSingleToast("等待开发中");
            }
        }
Beispiel #2
0
 protected void loaddingError()
 {
     if (mAdapter.getCount() < 1)
     { // 说明缓存也没有加载,那就显示errorview,如果有缓存,即使刷新失败也不显示error
         mAdapter.clear();
     }
     mAdapter.pauseMore();
     mRecyclerView.setRefreshing(false);
     mRecyclerView.showTipViewAndDelayClose("似乎没有网络哦");
 }