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