优化
This commit is contained in:
@@ -430,7 +430,6 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangaBinding, ReadMangaViewMode
|
|||||||
|
|
||||||
override fun colorFilter(config: MangaColorFilterConfig) {
|
override fun colorFilter(config: MangaColorFilterConfig) {
|
||||||
mAdapter.setMangaImageColorFilter(config)
|
mAdapter.setMangaImageColorFilter(config)
|
||||||
mAdapter.notifyItemChanged(ReadManga.durChapterPos)
|
|
||||||
updateWindowBrightness(config.l)
|
updateWindowBrightness(config.l)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,6 +544,7 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangaBinding, ReadMangaViewMode
|
|||||||
}
|
}
|
||||||
|
|
||||||
R.id.menu_manga_color_filter -> {
|
R.id.menu_manga_color_filter -> {
|
||||||
|
binding.mangaMenu.runMenuOut()
|
||||||
MangaColorFilterDialog().show(supportFragmentManager, "MangaColorFilterDialog")
|
MangaColorFilterDialog().show(supportFragmentManager, "MangaColorFilterDialog")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,4 @@ data class MangaColorFilterConfig(
|
|||||||
var b: Int = 0,
|
var b: Int = 0,
|
||||||
var a: Int = 0,
|
var a: Int = 0,
|
||||||
var l: Int = 0
|
var l: Int = 0
|
||||||
) :
|
) : Parcelable
|
||||||
Parcelable
|
|
||||||
@@ -4,7 +4,7 @@ import android.content.DialogInterface
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.SeekBar
|
import android.view.WindowManager
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.base.BaseDialogFragment
|
import io.legado.app.base.BaseDialogFragment
|
||||||
import io.legado.app.databinding.DialogMangaColorFilterBinding
|
import io.legado.app.databinding.DialogMangaColorFilterBinding
|
||||||
@@ -23,100 +23,48 @@ class MangaColorFilterDialog : BaseDialogFragment(R.layout.dialog_manga_color_fi
|
|||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||||
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
binding.seekA.progress = mConfig.a
|
initData()
|
||||||
binding.seekBrightness.progress = mConfig.l
|
initView()
|
||||||
binding.seekB.progress = mConfig.b
|
}
|
||||||
binding.seekG.progress = mConfig.g
|
|
||||||
binding.seekR.progress = mConfig.r
|
private fun initData() {
|
||||||
binding.seekBrightness.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
binding.run {
|
||||||
override fun onProgressChanged(
|
dsbBrightness.progress = mConfig.l
|
||||||
seekBar: SeekBar?,
|
dsbR.progress = mConfig.r
|
||||||
progress: Int,
|
dsbG.progress = mConfig.g
|
||||||
fromUser: Boolean
|
dsbB.progress = mConfig.b
|
||||||
) {
|
dsbA.progress = mConfig.a
|
||||||
mConfig.l = progress
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
binding.run {
|
||||||
|
dsbBrightness.onChanged = {
|
||||||
|
mConfig.l = it
|
||||||
ReadManga.mCallback?.colorFilter(mConfig)
|
ReadManga.mCallback?.colorFilter(mConfig)
|
||||||
}
|
}
|
||||||
|
dsbR.onChanged = {
|
||||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
mConfig.r = it
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
binding.seekR.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
||||||
override fun onProgressChanged(
|
|
||||||
seekBar: SeekBar?,
|
|
||||||
progress: Int,
|
|
||||||
fromUser: Boolean
|
|
||||||
) {
|
|
||||||
mConfig.r = progress
|
|
||||||
ReadManga.mCallback?.colorFilter(mConfig)
|
ReadManga.mCallback?.colorFilter(mConfig)
|
||||||
}
|
}
|
||||||
|
dsbG.onChanged = {
|
||||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
mConfig.g = it
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
binding.seekG.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
||||||
override fun onProgressChanged(
|
|
||||||
seekBar: SeekBar?,
|
|
||||||
progress: Int,
|
|
||||||
fromUser: Boolean
|
|
||||||
) {
|
|
||||||
mConfig.g = progress
|
|
||||||
ReadManga.mCallback?.colorFilter(mConfig)
|
ReadManga.mCallback?.colorFilter(mConfig)
|
||||||
}
|
}
|
||||||
|
dsbB.onChanged = {
|
||||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
mConfig.b = it
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
binding.seekB.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
||||||
override fun onProgressChanged(
|
|
||||||
seekBar: SeekBar?,
|
|
||||||
progress: Int,
|
|
||||||
fromUser: Boolean
|
|
||||||
) {
|
|
||||||
mConfig.b = progress
|
|
||||||
ReadManga.mCallback?.colorFilter(mConfig)
|
ReadManga.mCallback?.colorFilter(mConfig)
|
||||||
}
|
}
|
||||||
|
dsbA.onChanged = {
|
||||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
mConfig.a = it
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
binding.seekA.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
||||||
override fun onProgressChanged(
|
|
||||||
seekBar: SeekBar?,
|
|
||||||
progress: Int,
|
|
||||||
fromUser: Boolean
|
|
||||||
) {
|
|
||||||
mConfig.a = progress
|
|
||||||
ReadManga.mCallback?.colorFilter(mConfig)
|
ReadManga.mCallback?.colorFilter(mConfig)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDismiss(dialog: DialogInterface) {
|
override fun onDismiss(dialog: DialogInterface) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.legado.app.ui.book.manga.recyclerview
|
package io.legado.app.ui.book.manga.recyclerview
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.ColorMatrix
|
import android.graphics.ColorMatrix
|
||||||
import android.graphics.ColorMatrixColorFilter
|
import android.graphics.ColorMatrixColorFilter
|
||||||
@@ -230,7 +231,9 @@ class MangaAdapter(private val context: Context) :
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
fun setMangaImageColorFilter(config: MangaColorFilterConfig) {
|
fun setMangaImageColorFilter(config: MangaColorFilterConfig) {
|
||||||
mConfig = config
|
mConfig = config
|
||||||
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
@@ -12,104 +13,44 @@
|
|||||||
<io.legado.app.ui.widget.text.AccentTextView
|
<io.legado.app.ui.widget.text.AccentTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
android:text="滤镜"
|
android:text="滤镜"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<TextView
|
<io.legado.app.ui.widget.DetailSeekBar
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/dsb_brightness"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:text="@string/brightness"
|
|
||||||
android:textColor="@color/primaryText"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.theme.view.ThemeSeekBar
|
|
||||||
android:id="@+id/seek_brightness"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:max="255" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
app:max="255"
|
||||||
android:text="R"
|
app:title="@string/brightness" />
|
||||||
android:textColor="@color/primaryText"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.theme.view.ThemeSeekBar
|
<io.legado.app.ui.widget.DetailSeekBar
|
||||||
android:id="@+id/seek_R"
|
android:id="@+id/dsb_r"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:max="255" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
app:max="255"
|
||||||
android:text="G"
|
app:title="R" />
|
||||||
android:textColor="@color/primaryText"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.theme.view.ThemeSeekBar
|
<io.legado.app.ui.widget.DetailSeekBar
|
||||||
android:id="@+id/seek_g"
|
android:id="@+id/dsb_g"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:max="255" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
app:max="255"
|
||||||
android:text="B"
|
app:title="G" />
|
||||||
android:textColor="@color/primaryText"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.theme.view.ThemeSeekBar
|
<io.legado.app.ui.widget.DetailSeekBar
|
||||||
android:id="@+id/seek_b"
|
android:id="@+id/dsb_b"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:max="255" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
app:max="255"
|
||||||
android:text="A"
|
app:title="B" />
|
||||||
android:textColor="@color/primaryText"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<io.legado.app.lib.theme.view.ThemeSeekBar
|
<io.legado.app.ui.widget.DetailSeekBar
|
||||||
android:id="@+id/seek_a"
|
android:id="@+id/dsb_a"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="25dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
app:max="255"
|
||||||
android:layout_marginStart="16dp"
|
app:title="A" />
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:max="255" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user