parent
							
								
									f2a98582f1
								
							
						
					
					
						commit
						932ba08c3f
					
				@ -1,134 +0,0 @@ | 
				
			||||
package xyz.fycz.myreader.ui.bookinfo; | 
				
			||||
 | 
				
			||||
import android.content.Intent; | 
				
			||||
import android.graphics.drawable.Drawable; | 
				
			||||
import android.os.Bundle; | 
				
			||||
import androidx.core.content.ContextCompat; | 
				
			||||
import android.widget.*; | 
				
			||||
 | 
				
			||||
import xyz.fycz.myreader.R; | 
				
			||||
import xyz.fycz.myreader.base.BaseActivity; | 
				
			||||
 | 
				
			||||
import butterknife.ButterKnife; | 
				
			||||
import butterknife.BindView; | 
				
			||||
import xyz.fycz.myreader.common.APPCONST; | 
				
			||||
 | 
				
			||||
public class BookInfoActivity extends BaseActivity { | 
				
			||||
 | 
				
			||||
    @BindView(R.id.ll_title_back) | 
				
			||||
    LinearLayout llTitleBack; | 
				
			||||
    @BindView(R.id.tv_title_text) | 
				
			||||
    TextView tvTitleText; | 
				
			||||
    @BindView(R.id.system_title) | 
				
			||||
    LinearLayout systemTitle; | 
				
			||||
    @BindView(R.id.iv_book_img) | 
				
			||||
    ImageView ivBookImg; | 
				
			||||
    @BindView(R.id.tv_book_name) | 
				
			||||
    TextView tvBookName; | 
				
			||||
    @BindView(R.id.tv_book_author) | 
				
			||||
    TextView tvBookAuthor; | 
				
			||||
    @BindView(R.id.tv_book_type) | 
				
			||||
    TextView tvBookType; | 
				
			||||
    @BindView(R.id.tv_book_desc) | 
				
			||||
    TextView tvBookDesc; | 
				
			||||
    @BindView(R.id.btn_add_bookcase) | 
				
			||||
    Button btnAddBookcase; | 
				
			||||
    @BindView(R.id.btn_read_book) | 
				
			||||
    Button btnReadBook; | 
				
			||||
    @BindView(R.id.tv_book_newest_chapter) | 
				
			||||
    TextView tvBookNewestChapter; | 
				
			||||
    @BindView(R.id.tv_disclaimer) | 
				
			||||
    TextView tvDisclaimer; | 
				
			||||
    @BindView(R.id.tv_book_source) | 
				
			||||
    TextView tvBookSource; | 
				
			||||
    @BindView(R.id.btn_change_source) | 
				
			||||
    Button btnChangeSource; | 
				
			||||
    @BindView(R.id.pb_loading) | 
				
			||||
    ProgressBar pbLoading; | 
				
			||||
 | 
				
			||||
    private BookInfoPresenter mBookInfoPresenter; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    protected void onCreate(Bundle savedInstanceState) { | 
				
			||||
        super.onCreate(savedInstanceState); | 
				
			||||
        setContentView(R.layout.activity_book_info); | 
				
			||||
        ButterKnife.bind(this); | 
				
			||||
        setStatusBar(R.color.sys_line); | 
				
			||||
        mBookInfoPresenter = new BookInfoPresenter(this); | 
				
			||||
        mBookInfoPresenter.start(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 
				
			||||
        if (requestCode == APPCONST.REQUEST_READ) { | 
				
			||||
            if (data == null) { | 
				
			||||
                return; | 
				
			||||
            } | 
				
			||||
            boolean isCollected = data.getBooleanExtra(APPCONST.RESULT_IS_COLLECTED, false); | 
				
			||||
            if (isCollected) { | 
				
			||||
                getBtnAddBookcase().setText("移除书籍"); | 
				
			||||
                getBtnReadBook().setText("继续阅读"); | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public LinearLayout getLlTitleBack() { | 
				
			||||
        return llTitleBack; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvTitleText() { | 
				
			||||
        return tvTitleText; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public LinearLayout getSystemTitle() { | 
				
			||||
        return systemTitle; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public ImageView getIvBookImg() { | 
				
			||||
        return ivBookImg; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvBookName() { | 
				
			||||
        return tvBookName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvBookAuthor() { | 
				
			||||
        return tvBookAuthor; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvBookType() { | 
				
			||||
        return tvBookType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvBookDesc() { | 
				
			||||
        return tvBookDesc; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Button getBtnAddBookcase() { | 
				
			||||
        return btnAddBookcase; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Button getBtnReadBook() { | 
				
			||||
        return btnReadBook; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvBookNewestChapter() { | 
				
			||||
        return tvBookNewestChapter; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvDisclaimer() { | 
				
			||||
        return tvDisclaimer; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public TextView getTvBookSource() { | 
				
			||||
        return tvBookSource; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Button getBtnChangeSource() { | 
				
			||||
        return btnChangeSource; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public ProgressBar getPbLoading() { | 
				
			||||
        return pbLoading; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -1,282 +0,0 @@ | 
				
			||||
package xyz.fycz.myreader.ui.bookinfo; | 
				
			||||
 | 
				
			||||
import android.annotation.SuppressLint; | 
				
			||||
import android.content.DialogInterface; | 
				
			||||
import android.content.Intent; | 
				
			||||
import android.os.Handler; | 
				
			||||
import android.os.Message; | 
				
			||||
import android.view.View; | 
				
			||||
 | 
				
			||||
import androidx.appcompat.app.AlertDialog; | 
				
			||||
 | 
				
			||||
import com.bumptech.glide.Glide; | 
				
			||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; | 
				
			||||
import com.bumptech.glide.request.RequestOptions; | 
				
			||||
 | 
				
			||||
import java.io.BufferedReader; | 
				
			||||
import java.io.IOException; | 
				
			||||
import java.io.InputStreamReader; | 
				
			||||
import java.util.ArrayList; | 
				
			||||
 | 
				
			||||
import xyz.fycz.myreader.R; | 
				
			||||
import xyz.fycz.myreader.base.BasePresenter; | 
				
			||||
import xyz.fycz.myreader.callback.ResultCallback; | 
				
			||||
import xyz.fycz.myreader.common.APPCONST; | 
				
			||||
import xyz.fycz.myreader.crawler.BookInfoCrawler; | 
				
			||||
import xyz.fycz.myreader.crawler.ReadCrawler; | 
				
			||||
import xyz.fycz.myreader.crawler.ReadCrawlerUtil; | 
				
			||||
import xyz.fycz.myreader.creator.ChangeSourceDialog; | 
				
			||||
import xyz.fycz.myreader.creator.DialogCreator; | 
				
			||||
import xyz.fycz.myreader.enums.BookSource; | 
				
			||||
import xyz.fycz.myreader.greendao.entity.Book; | 
				
			||||
import xyz.fycz.myreader.greendao.service.BookService; | 
				
			||||
import xyz.fycz.myreader.ui.read.ReadActivity; | 
				
			||||
import xyz.fycz.myreader.util.StringHelper; | 
				
			||||
import xyz.fycz.myreader.util.TextHelper; | 
				
			||||
import xyz.fycz.myreader.util.utils.NetworkUtils; | 
				
			||||
import xyz.fycz.myreader.webapi.CommonApi; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
public class BookInfoPresenter implements BasePresenter { | 
				
			||||
 | 
				
			||||
    private BookInfoActivity mBookInfoActivity; | 
				
			||||
    private Book mBook; | 
				
			||||
    private ArrayList<Book> aBooks; | 
				
			||||
    private BookService mBookService; | 
				
			||||
    private ReadCrawler mReadCrawler; | 
				
			||||
 | 
				
			||||
    @SuppressLint("HandlerLeak") | 
				
			||||
    private Handler mHandler = new Handler() { | 
				
			||||
        @Override | 
				
			||||
        public void handleMessage(Message msg) { | 
				
			||||
            switch (msg.what) { | 
				
			||||
                case 1: | 
				
			||||
                    initBookInfo(); | 
				
			||||
                    break; | 
				
			||||
                case 2: | 
				
			||||
                    createChangeSourceDia(); | 
				
			||||
                    break; | 
				
			||||
                case 3: | 
				
			||||
                    mBookInfoActivity.getPbLoading().setVisibility(View.GONE); | 
				
			||||
                    DialogCreator.createTipDialog(mBookInfoActivity, "未搜索到该书籍,书源加载失败!"); | 
				
			||||
                    break; | 
				
			||||
                case 4: | 
				
			||||
                    initOtherInfo(); | 
				
			||||
                    break; | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
    }; | 
				
			||||
 | 
				
			||||
    public BookInfoPresenter(BookInfoActivity bookInfoActivity) { | 
				
			||||
        mBookInfoActivity = bookInfoActivity; | 
				
			||||
        mBookService = BookService.getInstance(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void start() { | 
				
			||||
        aBooks = (ArrayList<Book>) mBookInfoActivity.getIntent().getSerializableExtra(APPCONST.SEARCH_BOOK_BEAN); | 
				
			||||
        if (aBooks != null) { | 
				
			||||
            mBook = aBooks.get(0); | 
				
			||||
        } else { | 
				
			||||
            mBook = (Book) mBookInfoActivity.getIntent().getSerializableExtra(APPCONST.BOOK); | 
				
			||||
        } | 
				
			||||
        init(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    private void init() { | 
				
			||||
        mBookInfoActivity.getBtnChangeSource().setOnClickListener(v -> { | 
				
			||||
            if (!NetworkUtils.isNetWorkAvailable()){ | 
				
			||||
                TextHelper.showText("无网络连接!"); | 
				
			||||
                return; | 
				
			||||
            } | 
				
			||||
            mBookInfoActivity.getPbLoading().setVisibility(View.VISIBLE); | 
				
			||||
            if (aBooks == null) { | 
				
			||||
                ChangeSourceDialog csd = new ChangeSourceDialog(mBookInfoActivity, mBook); | 
				
			||||
                csd.init(new ResultCallback() { | 
				
			||||
                    @Override | 
				
			||||
                    public void onFinish(Object o, int code) { | 
				
			||||
                        aBooks = (ArrayList<Book>) o; | 
				
			||||
                        mHandler.sendMessage(mHandler.obtainMessage(2)); | 
				
			||||
                    } | 
				
			||||
 | 
				
			||||
                    @Override | 
				
			||||
                    public void onError(Exception e) { | 
				
			||||
                        mHandler.sendMessage(mHandler.obtainMessage(3)); | 
				
			||||
                    } | 
				
			||||
                }); | 
				
			||||
            } else { | 
				
			||||
                createChangeSourceDia(); | 
				
			||||
            } | 
				
			||||
        }); | 
				
			||||
        mBookInfoActivity.getTvDisclaimer().setOnClickListener(v -> DialogCreator.createAssetTipDialog(mBookInfoActivity, "免责声明", "disclaimer.fy")); | 
				
			||||
        if (isBookCollected()) { | 
				
			||||
            mBookInfoActivity.getBtnAddBookcase().setText("移除书籍"); | 
				
			||||
            mBookInfoActivity.getBtnReadBook().setText("继续阅读"); | 
				
			||||
        } else { | 
				
			||||
            mBookInfoActivity.getBtnAddBookcase().setText("加入书架"); | 
				
			||||
            mBookInfoActivity.getBtnReadBook().setText("开始阅读"); | 
				
			||||
        } | 
				
			||||
        mBookInfoActivity.getLlTitleBack().setOnClickListener(new View.OnClickListener() { | 
				
			||||
            @Override | 
				
			||||
            public void onClick(View view) { | 
				
			||||
                mBookInfoActivity.finish(); | 
				
			||||
            } | 
				
			||||
        }); | 
				
			||||
        mBookInfoActivity.getBtnAddBookcase().setOnClickListener(new View.OnClickListener() { | 
				
			||||
            @Override | 
				
			||||
            public void onClick(View view) { | 
				
			||||
                if (!isBookCollected()) { | 
				
			||||
                    mBookService.addBook(mBook); | 
				
			||||
                    TextHelper.showText("成功加入书架"); | 
				
			||||
                    mBookInfoActivity.getBtnAddBookcase().setText("移除书籍"); | 
				
			||||
                } else { | 
				
			||||
                    mBookService.deleteBookById(mBook.getId()); | 
				
			||||
                    TextHelper.showText("成功移除书籍"); | 
				
			||||
                    mBookInfoActivity.getBtnAddBookcase().setText("加入书架"); | 
				
			||||
                    mBookInfoActivity.getBtnReadBook().setText("开始阅读"); | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
            } | 
				
			||||
        }); | 
				
			||||
        mReadCrawler = ReadCrawlerUtil.getReadCrawler(mBook.getSource()); | 
				
			||||
        mBookInfoActivity.getBtnReadBook().setOnClickListener(view -> { | 
				
			||||
            final boolean isCollected; | 
				
			||||
            if (isBookCollected()) { | 
				
			||||
                isCollected = true; | 
				
			||||
            } else { | 
				
			||||
                mBookService.addBook(mBook); | 
				
			||||
                isCollected = false; | 
				
			||||
                CommonApi.getBookChapters(mBook.getChapterUrl(), mReadCrawler, new ResultCallback() { | 
				
			||||
                    @Override | 
				
			||||
                    public void onFinish(Object o, int code) { | 
				
			||||
                        mBookService.updateEntity(mBook); | 
				
			||||
                    } | 
				
			||||
 | 
				
			||||
                    @Override | 
				
			||||
                    public void onError(Exception e) { | 
				
			||||
                    } | 
				
			||||
                }); | 
				
			||||
            } | 
				
			||||
            Intent intent = new Intent(mBookInfoActivity, ReadActivity.class); | 
				
			||||
            intent.putExtra(APPCONST.BOOK, mBook); | 
				
			||||
            intent.putExtra("isCollected", isCollected); | 
				
			||||
            mBookInfoActivity.startActivityForResult(intent, APPCONST.REQUEST_READ); | 
				
			||||
        }); | 
				
			||||
        initBookInfo(); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @SuppressLint("SetTextI18n") | 
				
			||||
    private void initBookInfo() { | 
				
			||||
        mBookInfoActivity.getTvTitleText().setText(mBook.getName()); | 
				
			||||
        mBookInfoActivity.getTvBookAuthor().setText(mBook.getAuthor()); | 
				
			||||
        if (StringHelper.isEmpty(mBook.getImgUrl())) { | 
				
			||||
            mBook.setImgUrl(""); | 
				
			||||
        } | 
				
			||||
        assert mBook.getNewestChapterTitle() != null; | 
				
			||||
        mBookInfoActivity.getTvBookNewestChapter().setText("最新章节:" + mBook.getNewestChapterTitle().replace("最近更新 ", "")); | 
				
			||||
        mBookInfoActivity.getTvBookDesc().setText(""); | 
				
			||||
        mBookInfoActivity.getTvBookType().setText(""); | 
				
			||||
        mBookInfoActivity.getTvBookName().setText(mBook.getName()); | 
				
			||||
        if (!"null".equals(mBook.getSource())) { | 
				
			||||
            mBookInfoActivity.getTvBookSource().setText("书源:" + BookSource.fromString(mBook.getSource()).text); | 
				
			||||
        } | 
				
			||||
        ReadCrawler rc = ReadCrawlerUtil.getReadCrawler(mBook.getSource()); | 
				
			||||
        if (rc instanceof BookInfoCrawler && StringHelper.isEmpty(mBook.getImgUrl())) { | 
				
			||||
            BookInfoCrawler bic = (BookInfoCrawler) rc; | 
				
			||||
            CommonApi.getBookInfo(mBook, bic, new ResultCallback() { | 
				
			||||
                @Override | 
				
			||||
                public void onFinish(Object o, int code) { | 
				
			||||
                    mHandler.sendMessage(mHandler.obtainMessage(4)); | 
				
			||||
                } | 
				
			||||
 | 
				
			||||
                @Override | 
				
			||||
                public void onError(Exception e) { | 
				
			||||
 | 
				
			||||
                } | 
				
			||||
            }); | 
				
			||||
        } else { | 
				
			||||
            initOtherInfo(); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    private void initOtherInfo() { | 
				
			||||
        mBookInfoActivity.getTvBookDesc().setText(mBook.getDesc()); | 
				
			||||
        mBookInfoActivity.getTvBookType().setText(mBook.getType()); | 
				
			||||
        Glide.with(mBookInfoActivity) | 
				
			||||
                .load(mBook.getImgUrl()) | 
				
			||||
                .error(R.mipmap.no_image) | 
				
			||||
                .placeholder(R.mipmap.no_image) | 
				
			||||
                //设置圆角
 | 
				
			||||
                .apply(RequestOptions.bitmapTransform(new RoundedCorners(8))) | 
				
			||||
                .into(mBookInfoActivity.getIvBookImg()); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    private boolean isBookCollected() { | 
				
			||||
        Book book = mBookService.findBookByAuthorAndName(mBook.getName(), mBook.getAuthor()); | 
				
			||||
        if (book == null) { | 
				
			||||
            return false; | 
				
			||||
        } else { | 
				
			||||
            mBook = book; | 
				
			||||
            return true; | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    private void createChangeSourceDia() { | 
				
			||||
        if (aBooks == null){ | 
				
			||||
            mHandler.sendMessage(mHandler.obtainMessage(3)); | 
				
			||||
            return; | 
				
			||||
        } | 
				
			||||
        mBookInfoActivity.getPbLoading().setVisibility(View.GONE); | 
				
			||||
        CharSequence[] sources = new CharSequence[aBooks.size()]; | 
				
			||||
        int checkedItem = 0; | 
				
			||||
        for (int i = 0; i < sources.length; i++) { | 
				
			||||
            sources[i] = BookSource.fromString(aBooks.get(i).getSource()).text | 
				
			||||
                    + "\n" + aBooks.get(i).getNewestChapterTitle(); | 
				
			||||
            if (sources[i].equals(BookSource.fromString(mBook.getSource()).text | 
				
			||||
                    + "\n" + aBooks.get(i).getNewestChapterTitle())) { | 
				
			||||
                checkedItem = i; | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
        final int finalCheckedItem = checkedItem; | 
				
			||||
        AlertDialog dialog = new AlertDialog.Builder(mBookInfoActivity) | 
				
			||||
                .setTitle("切换书源") | 
				
			||||
                .setCancelable(true) | 
				
			||||
                .setSingleChoiceItems(sources, checkedItem, (dialog1, which) -> { | 
				
			||||
                    boolean isBookCollected = isBookCollected(); | 
				
			||||
//                        mBookService.deleteBook(mBook);
 | 
				
			||||
                    if (finalCheckedItem == which) { | 
				
			||||
                        dialog1.dismiss(); | 
				
			||||
                        return; | 
				
			||||
                    } | 
				
			||||
                    Book book = aBooks.get(which); | 
				
			||||
                    Book bookTem = new Book(mBook); | 
				
			||||
                    bookTem.setChapterUrl(book.getChapterUrl()); | 
				
			||||
                    bookTem.setImgUrl(book.getImgUrl()); | 
				
			||||
                    bookTem.setType(book.getType()); | 
				
			||||
                    bookTem.setDesc(book.getDesc()); | 
				
			||||
                    bookTem.setSource(book.getSource()); | 
				
			||||
                    if (isBookCollected) { | 
				
			||||
                        mBookService.updateBook(mBook, bookTem); | 
				
			||||
                    } | 
				
			||||
                    mBook = bookTem; | 
				
			||||
                    mHandler.sendMessage(mHandler.obtainMessage(1)); | 
				
			||||
                    if (isBookCollected) { | 
				
			||||
                        DialogCreator.createTipDialog(mBookInfoActivity, | 
				
			||||
                                "换源成功,由于不同书源的章节数量不一定相同,故换源后历史章节可能出错!"); | 
				
			||||
                    } | 
				
			||||
                    dialog1.dismiss(); | 
				
			||||
                }).create(); | 
				
			||||
        dialog.show(); | 
				
			||||
                    /*try { | 
				
			||||
                        Field mAlert = AlertDialog.class.getDeclaredField("mAlert"); | 
				
			||||
                        mAlert.setAccessible(true); | 
				
			||||
                        Object mAlertController = mAlert.get(dialog); | 
				
			||||
                        Field mMessage = mAlertController.getClass().getDeclaredField("mMessageView"); | 
				
			||||
                        mMessage.setAccessible(true); | 
				
			||||
                        TextView mMessageView = (TextView) mMessage.get(mAlertController); | 
				
			||||
                        mMessageView.setTextSize(5); | 
				
			||||
                    } catch (IllegalAccessException | NoSuchFieldException e) { | 
				
			||||
                        e.printStackTrace(); | 
				
			||||
                    }*/ | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,36 @@ | 
				
			||||
package xyz.fycz.myreader.ui.bookinfo; | 
				
			||||
 | 
				
			||||
import android.widget.TextView; | 
				
			||||
import xyz.fycz.myreader.R; | 
				
			||||
import xyz.fycz.myreader.base.ViewHolderImpl; | 
				
			||||
import xyz.fycz.myreader.greendao.entity.Chapter; | 
				
			||||
import xyz.fycz.myreader.greendao.service.ChapterService; | 
				
			||||
 | 
				
			||||
import java.io.File; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author fengyue | 
				
			||||
 * @date 2020/8/17 15:07 | 
				
			||||
 */ | 
				
			||||
public class CatalogHolder extends ViewHolderImpl<Chapter> { | 
				
			||||
    private TextView tvTitle; | 
				
			||||
    @Override | 
				
			||||
    protected int getItemLayoutId() { | 
				
			||||
        return R.layout.listview_chapter_title_item; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void initView() { | 
				
			||||
        tvTitle = findById(R.id.tv_chapter_title); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void onBind(Chapter data, int pos) { | 
				
			||||
        if (ChapterService.isChapterCached(data.getBookId(), data.getTitle())) { | 
				
			||||
            tvTitle.setCompoundDrawablesWithIntrinsicBounds(getContext().getResources().getDrawable(R.drawable.selector_category_load), null, null, null); | 
				
			||||
        } else { | 
				
			||||
            tvTitle.setCompoundDrawablesWithIntrinsicBounds(getContext().getResources().getDrawable(R.drawable.selector_category_unload), null, null, null); | 
				
			||||
        } | 
				
			||||
        tvTitle.setText(data.getTitle()); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,16 @@ | 
				
			||||
package xyz.fycz.myreader.ui.bookinfo; | 
				
			||||
 | 
				
			||||
import xyz.fycz.myreader.base.IViewHolder; | 
				
			||||
import xyz.fycz.myreader.base.adapter.BaseListAdapter; | 
				
			||||
import xyz.fycz.myreader.greendao.entity.Chapter; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author fengyue | 
				
			||||
 * @date 2020/8/17 15:06 | 
				
			||||
 */ | 
				
			||||
public class DetailCatalogAdapter extends BaseListAdapter<Chapter> { | 
				
			||||
    @Override | 
				
			||||
    protected IViewHolder<Chapter> createViewHolder(int viewType) { | 
				
			||||
        return new CatalogHolder(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -1,213 +0,0 @@ | 
				
			||||
<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 
				
			||||
    xmlns:app="http://schemas.android.com/apk/res-auto" | 
				
			||||
    xmlns:tools="http://schemas.android.com/tools" | 
				
			||||
                android:layout_width="match_parent" | 
				
			||||
                android:layout_height="match_parent" | 
				
			||||
                android:background="@color/sys_bg2" | 
				
			||||
                android:fitsSystemWindows="true" | 
				
			||||
                tools:context="xyz.fycz.myreader.ui.bookinfo.BookInfoActivity"> | 
				
			||||
    <LinearLayout | 
				
			||||
            android:layout_width="match_parent" | 
				
			||||
            android:layout_height="match_parent" | 
				
			||||
            android:orientation="vertical"> | 
				
			||||
        <include layout="@layout/title_base"/> | 
				
			||||
        <ScrollView | 
				
			||||
                android:layout_width="match_parent" | 
				
			||||
                android:layout_height="match_parent" | 
				
			||||
                android:layout_weight="1"> | 
				
			||||
            <LinearLayout | 
				
			||||
                    android:layout_width="match_parent" | 
				
			||||
                    android:layout_height="wrap_content" | 
				
			||||
                    android:orientation="vertical"> | 
				
			||||
                <LinearLayout | 
				
			||||
                        android:layout_width="match_parent" | 
				
			||||
                        android:layout_height="wrap_content" | 
				
			||||
                        android:orientation="horizontal" | 
				
			||||
                        android:padding="10dp"> | 
				
			||||
 | 
				
			||||
                    <ImageView | 
				
			||||
                            android:id="@+id/iv_book_img" | 
				
			||||
                            android:layout_width="80dp" | 
				
			||||
                            android:layout_height="120dp" | 
				
			||||
                            android:scaleType="fitXY" | 
				
			||||
                            app:srcCompat="@mipmap/default_cover"/> | 
				
			||||
 | 
				
			||||
                    <RelativeLayout | 
				
			||||
                            android:layout_width="match_parent" | 
				
			||||
                            android:layout_height="match_parent" | 
				
			||||
                            android:layout_marginLeft="5dp" | 
				
			||||
                            android:padding="3dp"> | 
				
			||||
 | 
				
			||||
                        <LinearLayout | 
				
			||||
                                android:layout_width="match_parent" | 
				
			||||
                                android:layout_height="match_parent" | 
				
			||||
                                android:orientation="vertical"> | 
				
			||||
 | 
				
			||||
                            <TextView | 
				
			||||
                                    android:id="@+id/tv_book_name" | 
				
			||||
                                    android:layout_width="wrap_content" | 
				
			||||
                                    android:layout_height="wrap_content" | 
				
			||||
                                    android:layout_marginTop="5dp" | 
				
			||||
                                    android:text="bookname" | 
				
			||||
                                    android:textSize="18sp" | 
				
			||||
                                    android:maxLines="1" | 
				
			||||
                                    android:textColor="@color/black"/> | 
				
			||||
 | 
				
			||||
                            <LinearLayout | 
				
			||||
                                    android:layout_width="match_parent" | 
				
			||||
                                    android:layout_height="wrap_content" | 
				
			||||
                                    android:orientation="horizontal" | 
				
			||||
                                    android:layout_alignParentBottom="true" | 
				
			||||
                                    android:paddingTop="5dp" | 
				
			||||
                                    android:paddingBottom="5dp"> | 
				
			||||
 | 
				
			||||
 | 
				
			||||
                                <TextView | 
				
			||||
                                        android:id="@+id/tv_book_author" | 
				
			||||
                                        android:layout_width="wrap_content" | 
				
			||||
                                        android:layout_height="wrap_content" | 
				
			||||
                                        android:text="author" | 
				
			||||
                                        android:maxLines="1" | 
				
			||||
                                        android:textSize="14sp" | 
				
			||||
                                        android:textColor="@color/title_black"/> | 
				
			||||
 | 
				
			||||
                                <TextView | 
				
			||||
                                        android:layout_width="wrap_content" | 
				
			||||
                                        android:layout_height="wrap_content" | 
				
			||||
                                        android:text=" | " | 
				
			||||
                                        android:textColor="@color/title_black"/> | 
				
			||||
 | 
				
			||||
                                <TextView | 
				
			||||
                                        android:id="@+id/tv_book_type" | 
				
			||||
                                        android:layout_width="wrap_content" | 
				
			||||
                                        android:layout_height="wrap_content" | 
				
			||||
                                        android:text="type" | 
				
			||||
                                        android:maxLines="1" | 
				
			||||
                                        android:textSize="14sp" | 
				
			||||
                                        android:textColor="@color/title_black"/> | 
				
			||||
 | 
				
			||||
                            </LinearLayout> | 
				
			||||
 | 
				
			||||
                            <TextView | 
				
			||||
                                    android:id="@+id/tv_book_newest_chapter" | 
				
			||||
                                    android:layout_width="wrap_content" | 
				
			||||
                                    android:layout_height="wrap_content" | 
				
			||||
                                    android:text="newestChapter" | 
				
			||||
                                    android:maxLines="2" | 
				
			||||
                                    android:textSize="14sp" | 
				
			||||
                                    android:textColor="@color/title_black"/> | 
				
			||||
                            <LinearLayout | 
				
			||||
                                    android:layout_width="match_parent" | 
				
			||||
                                    android:layout_height="wrap_content" | 
				
			||||
                                    android:orientation="horizontal"> | 
				
			||||
                                <TextView | 
				
			||||
                                        android:id="@+id/tv_book_source" | 
				
			||||
                                        android:layout_width="wrap_content" | 
				
			||||
                                        android:layout_height="wrap_content" | 
				
			||||
                                        android:text="bookSource" | 
				
			||||
                                        android:paddingTop="4dp" | 
				
			||||
                                        android:maxLines="1" | 
				
			||||
                                        android:textSize="14sp" | 
				
			||||
                                        android:textColor="@color/title_black"/> | 
				
			||||
                                <Button | 
				
			||||
                                        android:id="@+id/btn_change_source" | 
				
			||||
                                        android:layout_width="30dp" | 
				
			||||
                                        android:layout_height="16dp" | 
				
			||||
                                        android:layout_marginStart="10dp" | 
				
			||||
                                        android:textColor="@color/white" | 
				
			||||
                                        android:background="@color/colorAccent" | 
				
			||||
                                        android:text="@string/change_source" | 
				
			||||
                                        android:textSize="12sp"> | 
				
			||||
                                </Button> | 
				
			||||
                            </LinearLayout> | 
				
			||||
 | 
				
			||||
                        </LinearLayout> | 
				
			||||
 | 
				
			||||
                    </RelativeLayout> | 
				
			||||
 | 
				
			||||
                </LinearLayout> | 
				
			||||
 | 
				
			||||
 | 
				
			||||
                <LinearLayout | 
				
			||||
                        android:layout_width="match_parent" | 
				
			||||
                        android:layout_height="wrap_content" | 
				
			||||
                        android:padding="10dp" | 
				
			||||
                        android:orientation="vertical"> | 
				
			||||
 | 
				
			||||
                    <TextView | 
				
			||||
                            android:layout_width="wrap_content" | 
				
			||||
                            android:layout_height="wrap_content" | 
				
			||||
                            android:text="简介" | 
				
			||||
                            android:textColor="@color/black" | 
				
			||||
                            android:textSize="16sp"/> | 
				
			||||
 | 
				
			||||
                    <TextView | 
				
			||||
                            android:id="@+id/tv_book_desc" | 
				
			||||
                            android:layout_marginTop="5dp" | 
				
			||||
                            android:layout_width="wrap_content" | 
				
			||||
                            android:layout_height="wrap_content" | 
				
			||||
                            android:lineSpacingMultiplier="1.2" | 
				
			||||
                            android:textSize="16sp" | 
				
			||||
                            android:text="desc" | 
				
			||||
                            android:textColor="@color/title_black"/> | 
				
			||||
                    <LinearLayout | 
				
			||||
                            android:layout_width="match_parent" | 
				
			||||
                            android:layout_height="wrap_content" | 
				
			||||
                            android:padding="10dp" | 
				
			||||
                            android:orientation="vertical"> | 
				
			||||
                        <TextView | 
				
			||||
                                android:layout_marginTop="5dp" | 
				
			||||
                                android:layout_width="wrap_content" | 
				
			||||
                                android:layout_height="wrap_content" | 
				
			||||
                                android:lineSpacingMultiplier="1.2" | 
				
			||||
                                android:textSize="14sp" | 
				
			||||
                                android:text="@string/statement" | 
				
			||||
                                android:textColor="@color/title_black" | 
				
			||||
                        /> | 
				
			||||
                        <TextView | 
				
			||||
                                android:id="@+id/tv_disclaimer" | 
				
			||||
                                android:layout_width="wrap_content" | 
				
			||||
                                android:layout_height="wrap_content" | 
				
			||||
                                android:layout_marginTop="10dp" | 
				
			||||
                                android:text="@string/disclaimer" | 
				
			||||
                                android:textColor="#2196F3" | 
				
			||||
                                android:textSize="14sp"/> | 
				
			||||
                    </LinearLayout> | 
				
			||||
                </LinearLayout> | 
				
			||||
 | 
				
			||||
 | 
				
			||||
            </LinearLayout> | 
				
			||||
 | 
				
			||||
        </ScrollView> | 
				
			||||
        <LinearLayout | 
				
			||||
                android:layout_width="match_parent" | 
				
			||||
                android:layout_height="wrap_content" | 
				
			||||
                android:layout_alignParentBottom="true" | 
				
			||||
                android:layout_marginTop="5dp"> | 
				
			||||
 | 
				
			||||
            <Button | 
				
			||||
                    android:id="@+id/btn_add_bookcase" | 
				
			||||
                    android:layout_width="match_parent" | 
				
			||||
                    android:layout_height="wrap_content" | 
				
			||||
                    android:layout_weight="1" | 
				
			||||
                    android:textSize="16sp" | 
				
			||||
                    android:text="加入书架"/> | 
				
			||||
 | 
				
			||||
            <Button | 
				
			||||
                    android:id="@+id/btn_read_book" | 
				
			||||
                    android:layout_width="match_parent" | 
				
			||||
                    android:layout_height="wrap_content" | 
				
			||||
                    android:layout_weight="1" | 
				
			||||
                    android:textSize="16sp" | 
				
			||||
                    android:text="立即阅读"/> | 
				
			||||
 | 
				
			||||
        </LinearLayout> | 
				
			||||
    </LinearLayout> | 
				
			||||
    <ProgressBar | 
				
			||||
            android:id="@+id/pb_loading" | 
				
			||||
            android:layout_width="wrap_content" | 
				
			||||
            android:layout_height="wrap_content" | 
				
			||||
            android:layout_centerInParent="true" | 
				
			||||
            android:visibility="gone"/> | 
				
			||||
</RelativeLayout> | 
				
			||||
@ -1,2 +1,2 @@ | 
				
			||||
#Sat Aug 15 23:51:09 CST 2020 | 
				
			||||
#Mon Aug 17 18:44:13 CST 2020 | 
				
			||||
VERSION_CODE=142 | 
				
			||||
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue