pull/63/head
kunfei 5 years ago
parent c10b2b7dee
commit c59477c516
  1. 2
      app/src/main/java/io/legado/app/App.kt
  2. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  3. 2
      app/src/main/java/io/legado/app/service/BaseReadAloudService.kt
  4. 4
      app/src/main/java/io/legado/app/service/help/ReadBook.kt
  5. 6
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  6. 5
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  7. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt
  8. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentSelectActionCallback.kt
  9. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  10. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt
  11. 2
      app/src/main/java/io/legado/app/ui/book/read/page/DataSource.kt
  12. 2
      app/src/main/java/io/legado/app/ui/book/read/page/PageFactory.kt
  13. 12
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  14. 2
      app/src/main/java/io/legado/app/ui/book/read/page/TextChapter.kt
  15. 2
      app/src/main/java/io/legado/app/ui/book/read/page/TextPage.kt
  16. 2
      app/src/main/java/io/legado/app/ui/book/read/page/TextPageFactory.kt
  17. 2
      app/src/main/java/io/legado/app/ui/book/read/page/curl/CurlMesh.java
  18. 2
      app/src/main/java/io/legado/app/ui/book/read/page/curl/CurlPage.kt
  19. 2
      app/src/main/java/io/legado/app/ui/book/read/page/curl/CurlRenderer.kt
  20. 2
      app/src/main/java/io/legado/app/ui/book/read/page/curl/CurlView.kt
  21. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/CoverPageDelegate.kt
  22. 2
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/EventExtensions.kt
  23. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt
  24. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/NoAnimPageDelegate.kt
  25. 6
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt
  26. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/ScrollPageDelegate.kt
  27. 8
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt
  28. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/SlidePageDelegate.kt
  29. 4
      app/src/main/res/layout/activity_book_read.xml
  30. 2
      app/src/main/res/layout/view_book_page.xml

@ -18,7 +18,7 @@ import io.legado.app.help.ActivityHelp
import io.legado.app.help.CrashHandler
import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.ui.widget.page.ChapterProvider
import io.legado.app.ui.book.read.page.ChapterProvider
import io.legado.app.utils.getCompatColor
import io.legado.app.utils.getPrefInt
import io.legado.app.utils.isNightTheme

@ -14,4 +14,5 @@ object PreferKey {
const val processText = "process_text"
const val cleanCache = "cleanCache"
const val lastGroup = "lastGroup"
const val pageAnim = "pageAnim"
}

@ -26,7 +26,7 @@ import io.legado.app.help.MediaHelp
import io.legado.app.receiver.MediaButtonReceiver
import io.legado.app.service.help.ReadBook
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.widget.page.TextChapter
import io.legado.app.ui.book.read.page.TextChapter
import io.legado.app.utils.getPrefBoolean
import io.legado.app.utils.postEvent

@ -11,8 +11,8 @@ import io.legado.app.help.IntentDataHelp
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.model.WebBook
import io.legado.app.service.BaseReadAloudService
import io.legado.app.ui.widget.page.ChapterProvider
import io.legado.app.ui.widget.page.TextChapter
import io.legado.app.ui.book.read.page.ChapterProvider
import io.legado.app.ui.book.read.page.TextChapter
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers.Main

@ -29,14 +29,14 @@ import io.legado.app.service.help.ReadBook
import io.legado.app.ui.book.read.config.*
import io.legado.app.ui.book.read.config.BgTextConfigDialog.Companion.BG_COLOR
import io.legado.app.ui.book.read.config.BgTextConfigDialog.Companion.TEXT_COLOR
import io.legado.app.ui.book.read.page.ChapterProvider
import io.legado.app.ui.book.read.page.PageView
import io.legado.app.ui.book.read.page.delegate.PageDelegate
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
import io.legado.app.ui.changesource.ChangeSourceDialog
import io.legado.app.ui.chapterlist.ChapterListActivity
import io.legado.app.ui.replacerule.ReplaceRuleActivity
import io.legado.app.ui.replacerule.edit.ReplaceEditDialog
import io.legado.app.ui.widget.page.ChapterProvider
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.widget.page.delegate.PageDelegate
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.dialog_download_choice.view.*

@ -11,6 +11,7 @@ import androidx.core.view.get
import androidx.fragment.app.DialogFragment
import io.legado.app.R
import io.legado.app.constant.Bus
import io.legado.app.constant.PreferKey
import io.legado.app.help.ImageLoader
import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.dialogs.selector
@ -66,7 +67,7 @@ class ReadStyleDialog : DialogFragment() {
}
private fun initData() {
requireContext().getPrefInt("pageAnim").let {
requireContext().getPrefInt(PreferKey.pageAnim).let {
if (it >= 0 && it < rg_page_anim.childCount) {
rg_page_anim.check(rg_page_anim[it].id)
}
@ -179,7 +180,7 @@ class ReadStyleDialog : DialogFragment() {
rg_page_anim.onCheckedChange { _, checkedId ->
for (i in 0 until rg_page_anim.childCount) {
if (checkedId == rg_page_anim[i].id) {
requireContext().putPrefInt("pageAnim", i)
requireContext().putPrefInt(PreferKey.pageAnim, i)
val activity = activity
if (activity is ReadBookActivity) {
activity.page_view.upPageAnim(i)

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.text.Spannable
import android.text.SpannableStringBuilder

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.view.ActionMode
import android.view.Menu

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.annotation.SuppressLint
import android.content.Context

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.annotation.SuppressLint
import android.content.Context

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
interface DataSource {
val isScrollDelegate: Boolean

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
abstract class PageFactory<DATA>(protected val dataSource: DataSource) {

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.annotation.SuppressLint
import android.content.Context
@ -6,11 +6,13 @@ import android.graphics.Canvas
import android.util.AttributeSet
import android.view.MotionEvent
import android.widget.FrameLayout
import io.legado.app.constant.PreferKey
import io.legado.app.help.ReadBookConfig
import io.legado.app.service.help.ReadBook
import io.legado.app.ui.widget.page.curl.CurlView
import io.legado.app.ui.widget.page.delegate.*
import io.legado.app.ui.book.read.page.curl.CurlView
import io.legado.app.ui.book.read.page.delegate.*
import io.legado.app.utils.activity
import io.legado.app.utils.getPrefInt
class PageView(context: Context, attrs: AttributeSet) :
FrameLayout(context, attrs),
@ -37,7 +39,7 @@ class PageView(context: Context, attrs: AttributeSet) :
upBg()
setWillNotDraw(false)
pageFactory = TextPageFactory(this)
upPageAnim()
upPageAnim(context.getPrefInt(PreferKey.pageAnim))
curPage?.callBack = this
}
@ -88,7 +90,7 @@ class PageView(context: Context, attrs: AttributeSet) :
}
}
fun upPageAnim(pageAnim: Int = 0) {
fun upPageAnim(pageAnim: Int) {
if (curlView != null) {
removeView(curlView)
curlView = null

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.text.SpannableStringBuilder
import kotlin.math.min

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import android.text.Spannable
import android.text.SpannableStringBuilder

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page
package io.legado.app.ui.book.read.page
import io.legado.app.service.help.ReadBook

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page.curl;
package io.legado.app.ui.book.read.page.curl;
import android.graphics.Bitmap;
import android.graphics.Color;

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page.curl
package io.legado.app.ui.book.read.page.curl
import android.graphics.Bitmap
import android.graphics.Canvas

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page.curl
package io.legado.app.ui.book.read.page.curl
import android.graphics.Color
import android.graphics.PointF

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page.curl
package io.legado.app.ui.book.read.page.curl
import android.content.Context
import android.graphics.PixelFormat

@ -1,9 +1,9 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import android.graphics.Matrix
import android.graphics.drawable.GradientDrawable
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.book.read.page.PageView
class CoverPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) {

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.view.MotionEvent

@ -1,7 +1,7 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.view.MotionEvent
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.book.read.page.PageView
import io.legado.app.utils.screenshot
import kotlin.math.abs

@ -1,7 +1,7 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.book.read.page.PageView
class NoAnimPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) {
override fun onScrollStart() {

@ -1,4 +1,4 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.graphics.Bitmap
import android.graphics.Canvas
@ -9,8 +9,8 @@ import android.widget.Scroller
import androidx.annotation.CallSuper
import androidx.interpolator.view.animation.FastOutLinearInInterpolator
import com.google.android.material.snackbar.Snackbar
import io.legado.app.ui.widget.page.ContentView
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.book.read.page.ContentView
import io.legado.app.ui.book.read.page.PageView
import io.legado.app.utils.screenshot
import io.legado.app.utils.snackbar
import kotlin.math.abs

@ -1,9 +1,9 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import android.graphics.Matrix
import android.view.MotionEvent
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.book.read.page.PageView
import io.legado.app.utils.screenshot
import kotlin.math.abs

@ -1,10 +1,10 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import android.view.MotionEvent
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.widget.page.curl.CurlPage
import io.legado.app.ui.widget.page.curl.CurlView
import io.legado.app.ui.book.read.page.PageView
import io.legado.app.ui.book.read.page.curl.CurlPage
import io.legado.app.ui.book.read.page.curl.CurlView
import io.legado.app.utils.screenshot
import kotlin.math.abs

@ -1,8 +1,8 @@
package io.legado.app.ui.widget.page.delegate
package io.legado.app.ui.book.read.page.delegate
import android.graphics.Canvas
import android.graphics.Matrix
import io.legado.app.ui.widget.page.PageView
import io.legado.app.ui.book.read.page.PageView
class SlidePageDelegate(pageView: PageView) : HorizontalPageDelegate(pageView) {

@ -4,13 +4,13 @@
android:layout_height="match_parent"
android:orientation="vertical">
<io.legado.app.ui.widget.page.ContentView
<io.legado.app.ui.book.read.page.ContentView
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible" />
<io.legado.app.ui.widget.page.PageView
<io.legado.app.ui.book.read.page.PageView
android:id="@+id/page_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

@ -27,7 +27,7 @@
</LinearLayout>
<io.legado.app.ui.widget.page.ContentTextView
<io.legado.app.ui.book.read.page.ContentTextView
android:id="@+id/content_text_view"
android:layout_width="match_parent"
android:layout_height="0dp"

Loading…
Cancel
Save