Fix warnings and enable locales-config auto-generating
parent
edb91c46d4
commit
c874d73c04
@ -1,37 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.core.util
|
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
|
|
||||||
|
|
||||||
class LoggingAdapterDataObserver(
|
|
||||||
private val tag: String,
|
|
||||||
) : AdapterDataObserver() {
|
|
||||||
|
|
||||||
override fun onChanged() {
|
|
||||||
Log.d(tag, "onChanged()")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeChanged(positionStart: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeChanged(positionStart=$positionStart, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeChanged(positionStart: Int, itemCount: Int, payload: Any?) {
|
|
||||||
Log.d(tag, "onItemRangeChanged(positionStart=$positionStart, itemCount=$itemCount, payload=$payload)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeInserted(positionStart=$positionStart, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeRemoved(positionStart=$positionStart, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemRangeMoved(fromPosition: Int, toPosition: Int, itemCount: Int) {
|
|
||||||
Log.d(tag, "onItemRangeMoved(fromPosition=$fromPosition, toPosition=$toPosition, itemCount=$itemCount)")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStateRestorationPolicyChanged() {
|
|
||||||
Log.d(tag, "onStateRestorationPolicyChanged()")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.core.ui.dialog
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.view.View
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
|
||||||
|
|
||||||
class AppBottomSheetDialog(context: Context, theme: Int) : BottomSheetDialog(context, theme) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* https://github.com/material-components/material-components-android/issues/2582
|
|
||||||
*/
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
override fun onAttachedToWindow() {
|
|
||||||
val window = window
|
|
||||||
val initialSystemUiVisibility = window?.decorView?.systemUiVisibility ?: 0
|
|
||||||
super.onAttachedToWindow()
|
|
||||||
if (window != null) {
|
|
||||||
// If the navigation bar is translucent at all, the BottomSheet should be edge to edge
|
|
||||||
val drawEdgeToEdge = edgeToEdgeEnabled && Color.alpha(window.navigationBarColor) < 0xFF
|
|
||||||
if (drawEdgeToEdge) {
|
|
||||||
// Copied from super.onAttachedToWindow:
|
|
||||||
val edgeToEdgeFlags = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
// Fix super-class's window flag bug by respecting the initial system UI visibility:
|
|
||||||
window.decorView.systemUiVisibility = edgeToEdgeFlags or initialSystemUiVisibility
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,87 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.core.ui.list.decor
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Paint
|
|
||||||
import android.graphics.Rect
|
|
||||||
import android.view.View
|
|
||||||
import androidx.core.content.res.getColorOrThrow
|
|
||||||
import androidx.core.view.children
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.google.android.material.R as materialR
|
|
||||||
|
|
||||||
@SuppressLint("PrivateResource")
|
|
||||||
abstract class AbstractDividerItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
|
|
||||||
|
|
||||||
private val bounds = Rect()
|
|
||||||
private val thickness: Int
|
|
||||||
private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
|
|
||||||
|
|
||||||
init {
|
|
||||||
paint.style = Paint.Style.FILL
|
|
||||||
val ta = context.obtainStyledAttributes(
|
|
||||||
null,
|
|
||||||
materialR.styleable.MaterialDivider,
|
|
||||||
materialR.attr.materialDividerStyle,
|
|
||||||
materialR.style.Widget_Material3_MaterialDivider,
|
|
||||||
)
|
|
||||||
paint.color = ta.getColorOrThrow(materialR.styleable.MaterialDivider_dividerColor)
|
|
||||||
thickness = ta.getDimensionPixelSize(
|
|
||||||
materialR.styleable.MaterialDivider_dividerThickness,
|
|
||||||
context.resources.getDimensionPixelSize(materialR.dimen.material_divider_thickness),
|
|
||||||
)
|
|
||||||
ta.recycle()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun getItemOffsets(
|
|
||||||
outRect: Rect,
|
|
||||||
view: View,
|
|
||||||
parent: RecyclerView,
|
|
||||||
state: RecyclerView.State,
|
|
||||||
) {
|
|
||||||
outRect.set(0, thickness, 0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO implement for horizontal lists on demand
|
|
||||||
override fun onDraw(canvas: Canvas, parent: RecyclerView, s: RecyclerView.State) {
|
|
||||||
if (parent.layoutManager == null || thickness == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
canvas.save()
|
|
||||||
val left: Float
|
|
||||||
val right: Float
|
|
||||||
if (parent.clipToPadding) {
|
|
||||||
left = parent.paddingLeft.toFloat()
|
|
||||||
right = (parent.width - parent.paddingRight).toFloat()
|
|
||||||
canvas.clipRect(
|
|
||||||
left,
|
|
||||||
parent.paddingTop.toFloat(),
|
|
||||||
right,
|
|
||||||
(parent.height - parent.paddingBottom).toFloat(),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
left = 0f
|
|
||||||
right = parent.width.toFloat()
|
|
||||||
}
|
|
||||||
|
|
||||||
var previous: RecyclerView.ViewHolder? = null
|
|
||||||
for (child in parent.children) {
|
|
||||||
val holder = parent.getChildViewHolder(child)
|
|
||||||
if (previous != null && shouldDrawDivider(previous, holder)) {
|
|
||||||
parent.getDecoratedBoundsWithMargins(child, bounds)
|
|
||||||
val top: Float = bounds.top + child.translationY
|
|
||||||
val bottom: Float = top + thickness
|
|
||||||
canvas.drawRect(left, top, right, bottom, paint)
|
|
||||||
}
|
|
||||||
previous = holder
|
|
||||||
}
|
|
||||||
canvas.restore()
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract fun shouldDrawDivider(
|
|
||||||
above: RecyclerView.ViewHolder,
|
|
||||||
below: RecyclerView.ViewHolder,
|
|
||||||
): Boolean
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
package org.koitharu.kotatsu.details.ui.adapter
|
|
||||||
|
|
||||||
import com.hannesdorfmann.adapterdelegates4.ListDelegationAdapter
|
|
||||||
import org.koitharu.kotatsu.core.ui.list.OnListItemClickListener
|
|
||||||
import org.koitharu.kotatsu.details.ui.model.MangaBranch
|
|
||||||
|
|
||||||
class BranchesAdapter(
|
|
||||||
list: List<MangaBranch>,
|
|
||||||
listener: OnListItemClickListener<MangaBranch>,
|
|
||||||
) : ListDelegationAdapter<List<MangaBranch>>() {
|
|
||||||
|
|
||||||
init {
|
|
||||||
delegatesManager.addDelegate(branchAD(listener))
|
|
||||||
items = list
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
unqualifiedResLocale=en-US
|
||||||
@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<locale-config
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<locale android:name="en" />
|
|
||||||
<locale android:name="ar" />
|
|
||||||
<locale android:name="be" />
|
|
||||||
<locale android:name="bn" />
|
|
||||||
<locale android:name="de" />
|
|
||||||
<locale android:name="el" />
|
|
||||||
<locale android:name="es" />
|
|
||||||
<locale android:name="fa" />
|
|
||||||
<locale android:name="fi" />
|
|
||||||
<locale android:name="fr" />
|
|
||||||
<locale android:name="in" />
|
|
||||||
<locale android:name="it" />
|
|
||||||
<locale android:name="ja" />
|
|
||||||
<locale android:name="nb-NO" />
|
|
||||||
<locale android:name="pl" />
|
|
||||||
<locale android:name="pt" />
|
|
||||||
<locale android:name="pt-BR" />
|
|
||||||
<locale android:name="ru" />
|
|
||||||
<locale android:name="si" />
|
|
||||||
<locale android:name="sr" />
|
|
||||||
<locale android:name="sv" />
|
|
||||||
<locale android:name="tr" />
|
|
||||||
<locale android:name="uk" />
|
|
||||||
<locale android:name="zh-CN" />
|
|
||||||
<locale android:name="zh-TW" />
|
|
||||||
<locale android:name="fil" />
|
|
||||||
<locale android:name="hi" />
|
|
||||||
<locale android:name="kk" />
|
|
||||||
<locale android:name="ko" />
|
|
||||||
<locale android:name="ne" />
|
|
||||||
<locale android:name="nn" />
|
|
||||||
<locale android:name="vi" />
|
|
||||||
</locale-config>
|
|
||||||
Loading…
Reference in New Issue