From cdb4bcf5df63482297dd6ab2994ebe4ca6804831 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 18 Aug 2019 12:00:46 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/readbook/ReadBookActivity.kt | 4 ++-- .../java/io/legado/app/ui/widget/page/ContentView.kt | 10 ++++++++++ .../main/java/io/legado/app/ui/widget/page/PageView.kt | 10 +++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt index 46f2fa8b4..fc8c07d49 100644 --- a/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/readbook/ReadBookActivity.kt @@ -237,8 +237,8 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_rea private fun bookLoadFinish() { viewModel.bookData.value?.let { viewModel.loadContent(it, it.durChapterIndex) - viewModel.loadContent(it, it.durChapterIndex + 1) - viewModel.loadContent(it, it.durChapterIndex - 1) +// viewModel.loadContent(it, it.durChapterIndex + 1) +// viewModel.loadContent(it, it.durChapterIndex - 1) } } diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt index 4f8abfa55..c9df8dcd8 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentView.kt @@ -4,6 +4,9 @@ import android.content.Context import android.util.AttributeSet import android.widget.FrameLayout import io.legado.app.R +import io.legado.app.utils.dp +import kotlinx.android.synthetic.main.view_book_page.view.* +import org.jetbrains.anko.horizontalPadding class ContentView : FrameLayout { @@ -16,5 +19,12 @@ class ContentView : FrameLayout { init { inflate(context, R.layout.view_book_page, this) + + page_panel.horizontalPadding = 16.dp + } + + + fun setContent(text: CharSequence?) { + content_text_view.text = text } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt index 8c44b7dd7..f8d08a7e2 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt @@ -7,13 +7,10 @@ import android.graphics.Color import android.util.AttributeSet import android.view.MotionEvent import android.widget.FrameLayout -import io.legado.app.R import io.legado.app.ui.widget.page.delegate.CoverPageDelegate import io.legado.app.ui.widget.page.delegate.PageDelegate -import io.legado.app.utils.dp import kotlinx.android.synthetic.main.view_book_page.view.* import org.jetbrains.anko.backgroundColor -import org.jetbrains.anko.horizontalPadding class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs), PageDelegate.PageInterface { @@ -25,14 +22,13 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att private var nextPage: ContentView? = null init { - inflate(context, R.layout.view_book_page, this) + curPage = ContentView(context) + addView(curPage) setWillNotDraw(false) page_panel.backgroundColor = Color.WHITE - page_panel.horizontalPadding = 16.dp - pageDelegate = CoverPageDelegate(this) } @@ -61,7 +57,7 @@ class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, att fun chapterLoadFinish() { callBack?.textChapter()?.let { - content_text_view.text = it.page(0)?.stringBuilder + curPage?.setContent(it.page(0)?.stringBuilder) } }