Remove some dead code
(cherry picked from commit 3125d7870699ccca8371023c7cb1eb040a590a7e)
This commit is contained in:
parent
51752f497f
commit
d8c3952790
@ -4,6 +4,10 @@ import android.content.Context
|
|||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.annotation.AttrRes
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||||
@ -12,7 +16,6 @@ import eu.davidea.viewholders.FlexibleViewHolder
|
|||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.databinding.ReaderChapterItemBinding
|
import eu.kanade.tachiyomi.databinding.ReaderChapterItemBinding
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
|
||||||
import exh.source.isEhBasedManga
|
import exh.source.isEhBasedManga
|
||||||
import tachiyomi.domain.chapter.model.Chapter
|
import tachiyomi.domain.chapter.model.Chapter
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
@ -119,3 +122,12 @@ class ReaderChapterItem(val chapter: Chapter, val manga: Manga, val isCurrent: B
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun ImageView.setVectorCompat(@DrawableRes drawable: Int, @AttrRes tint: Int? = null) {
|
||||||
|
val vector = AppCompatResources.getDrawable(context, drawable)
|
||||||
|
if (tint != null) {
|
||||||
|
vector?.mutate()
|
||||||
|
vector?.setTint(context.getResourceColor(tint))
|
||||||
|
}
|
||||||
|
setImageDrawable(vector)
|
||||||
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.util.view
|
|
||||||
|
|
||||||
import android.widget.ImageView
|
|
||||||
import androidx.annotation.AttrRes
|
|
||||||
import androidx.annotation.DrawableRes
|
|
||||||
import androidx.appcompat.content.res.AppCompatResources
|
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a vector on a [ImageView].
|
|
||||||
*
|
|
||||||
* @param drawable id of drawable resource
|
|
||||||
*/
|
|
||||||
fun ImageView.setVectorCompat(@DrawableRes drawable: Int, @AttrRes tint: Int? = null) {
|
|
||||||
val vector = AppCompatResources.getDrawable(context, drawable)
|
|
||||||
if (tint != null) {
|
|
||||||
vector?.mutate()
|
|
||||||
vector?.setTint(context.getResourceColor(tint))
|
|
||||||
}
|
|
||||||
setImageDrawable(vector)
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.util.view
|
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.annotation.LayoutRes
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extension method to inflate a view directly from its parent.
|
|
||||||
* @param layout the layout to inflate.
|
|
||||||
* @param attachToRoot whether to attach the view to the root or not. Defaults to false.
|
|
||||||
*/
|
|
||||||
fun ViewGroup.inflate(@LayoutRes layout: Int, attachToRoot: Boolean = false): View {
|
|
||||||
return LayoutInflater.from(context).inflate(layout, this, attachToRoot)
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.widget
|
|
||||||
|
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Paint
|
|
||||||
import android.text.style.ReplacementSpan
|
|
||||||
import androidx.annotation.ColorInt
|
|
||||||
import androidx.annotation.Dimension
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Source: https://github.com/santaevpavel
|
|
||||||
*
|
|
||||||
* A class that draws the outlines of a text when given a stroke color and stroke width.
|
|
||||||
*/
|
|
||||||
class OutlineSpan(
|
|
||||||
@ColorInt private val strokeColor: Int,
|
|
||||||
@Dimension private val strokeWidth: Float,
|
|
||||||
) : ReplacementSpan() {
|
|
||||||
|
|
||||||
override fun getSize(
|
|
||||||
paint: Paint,
|
|
||||||
text: CharSequence,
|
|
||||||
start: Int,
|
|
||||||
end: Int,
|
|
||||||
fm: Paint.FontMetricsInt?,
|
|
||||||
): Int {
|
|
||||||
return paint.measureText(text.toString().substring(start until end)).toInt()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun draw(
|
|
||||||
canvas: Canvas,
|
|
||||||
text: CharSequence,
|
|
||||||
start: Int,
|
|
||||||
end: Int,
|
|
||||||
x: Float,
|
|
||||||
top: Int,
|
|
||||||
y: Int,
|
|
||||||
bottom: Int,
|
|
||||||
paint: Paint,
|
|
||||||
) {
|
|
||||||
val originTextColor = paint.color
|
|
||||||
|
|
||||||
paint.apply {
|
|
||||||
color = strokeColor
|
|
||||||
style = Paint.Style.STROKE
|
|
||||||
this.strokeWidth = this@OutlineSpan.strokeWidth
|
|
||||||
}
|
|
||||||
canvas.drawText(text, start, end, x, y.toFloat(), paint)
|
|
||||||
|
|
||||||
paint.apply {
|
|
||||||
color = originTextColor
|
|
||||||
style = Paint.Style.FILL
|
|
||||||
}
|
|
||||||
|
|
||||||
canvas.drawText(text, start, end, x, y.toFloat(), paint)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.widget
|
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
|
||||||
import tachiyomi.domain.manga.model.TriStateFilter
|
|
||||||
|
|
||||||
fun Int.toTriStateFilter(): TriStateFilter {
|
|
||||||
return when (this) {
|
|
||||||
Filter.TriState.STATE_IGNORE -> TriStateFilter.DISABLED
|
|
||||||
Filter.TriState.STATE_INCLUDE -> TriStateFilter.ENABLED_IS
|
|
||||||
Filter.TriState.STATE_EXCLUDE -> TriStateFilter.ENABLED_NOT
|
|
||||||
else -> throw IllegalStateException("Unknown TriState state: $this")
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user