Update linter

This commit is contained in:
arkon
2022-04-08 15:30:30 -04:00
parent 37100f0937
commit f0eb42e72d
192 changed files with 318 additions and 437 deletions
@@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.widget.OutlineSpan
*/
class PageIndicatorTextView(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : AppCompatTextView(context, attrs) {
init {
@@ -431,7 +431,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
setOnClickListener {
popupMenu(
items = ReadingModeType.values().map { it.flagValue to it.stringRes },
selectedItemId = presenter.getMangaReadingMode(resolveDefault = false),
selectedItemId = presenter.getMangaReadingMode(resolveDefault = false)
) {
val newReadingMode = ReadingModeType.fromPreference(itemId)
@@ -485,7 +485,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
popupMenu(
items = OrientationType.values().map { it.flagValue to it.stringRes },
selectedItemId = presenter.manga?.orientationType
?: preferences.defaultOrientationType(),
?: preferences.defaultOrientationType()
) {
val newOrientation = OrientationType.fromPreference(itemId)
@@ -10,7 +10,7 @@ import androidx.core.graphics.toXfermode
class ReaderColorFilterView(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : View(context, attrs) {
private val colorFilterPaint: Paint = Paint()
@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.widget.sheet.BaseBottomSheetDialog
*/
class ReaderPageSheet(
private val activity: ReaderActivity,
private val page: ReaderPage
private val page: ReaderPage,
) : BaseBottomSheetDialog(activity) {
private lateinit var binding: ReaderPageSheetBinding
@@ -273,7 +273,7 @@ class ReaderPresenter(
*/
private fun getLoadObservable(
loader: ChapterLoader,
chapter: ReaderChapter
chapter: ReaderChapter,
): Observable<ViewerChapters> {
return loader.loadChapter(chapter)
.andThen(
@@ -9,7 +9,7 @@ import com.google.android.material.slider.Slider
*/
class ReaderSlider @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : Slider(context, attrs) {
init {
@@ -21,7 +21,7 @@ class ChapterLoader(
private val context: Context,
private val downloadManager: DownloadManager,
private val manga: Manga,
private val source: Source
private val source: Source,
) {
/**
@@ -20,7 +20,7 @@ class DownloadPageLoader(
private val chapter: ReaderChapter,
private val manga: Manga,
private val source: Source,
private val downloadManager: DownloadManager
private val downloadManager: DownloadManager,
) : PageLoader() {
// Needed to open input streams
@@ -26,7 +26,7 @@ import kotlin.math.min
class HttpPageLoader(
private val chapter: ReaderChapter,
private val source: HttpSource,
private val chapterCache: ChapterCache = Injekt.get()
private val chapterCache: ChapterCache = Injekt.get(),
) : PageLoader() {
/**
@@ -169,7 +169,7 @@ class HttpPageLoader(
*/
private class PriorityPage(
val page: ReaderPage,
val priority: Int
val priority: Int,
) : Comparable<PriorityPage> {
companion object {
private val idGenerator = AtomicInteger()
@@ -7,12 +7,12 @@ sealed class ChapterTransition {
class Prev(
override val from: ReaderChapter,
override val to: ReaderChapter?
override val to: ReaderChapter?,
) : ChapterTransition()
class Next(
override val from: ReaderChapter,
override val to: ReaderChapter?
override val to: ReaderChapter?,
) : ChapterTransition()
override fun equals(other: Any?): Boolean {
@@ -7,7 +7,7 @@ open class ReaderPage(
index: Int,
url: String = "",
imageUrl: String? = null,
var stream: (() -> InputStream)? = null
var stream: (() -> InputStream)? = null,
) : Page(index, url, imageUrl, null) {
open lateinit var chapter: ReaderChapter
@@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.ui.reader.model
data class ViewerChapters(
val currChapter: ReaderChapter,
val prevChapter: ReaderChapter?,
val nextChapter: ReaderChapter?
val nextChapter: ReaderChapter?,
) {
fun ref() {
@@ -64,12 +64,12 @@ class ReaderSettingsSheet(
override fun getTabViews() = listOf(
readingModeSettings,
generalSettings,
colorFilterSettings,
colorFilterSettings
)
override fun getTabTitles() = listOf(
R.string.pref_category_reading_mode,
R.string.pref_category_general,
R.string.custom_filter,
R.string.custom_filter
)
}
@@ -14,7 +14,7 @@ import kotlin.math.abs
*/
open class GestureDetectorWithLongTap(
context: Context,
listener: Listener
listener: Listener,
) : GestureDetector(context, listener) {
private val handler = Handler(Looper.getMainLooper())
@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerViewer
class ReaderButton @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = R.attr.materialButtonStyle
defStyleAttr: Int = R.attr.materialButtonStyle,
) : MaterialButton(context, attrs, defStyleAttr) {
var viewer: PagerViewer? = null
@@ -47,7 +47,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
attrs: AttributeSet? = null,
@AttrRes defStyleAttrs: Int = 0,
@StyleRes defStyleRes: Int = 0,
private val isWebtoon: Boolean = false
private val isWebtoon: Boolean = false,
) : FrameLayout(context, attrs, defStyleAttrs, defStyleRes) {
private var pageView: View? = null
@@ -254,7 +254,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
private fun setNonAnimatedImage(
image: Any,
config: Config
config: Config,
) = (pageView as? SubsamplingScaleImageView)?.apply {
setDoubleTapZoomDuration(config.zoomDuration.getSystemScaledDuration())
setMinimumScaleType(config.minimumScaleType)
@@ -326,7 +326,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
private fun setAnimatedImage(
image: Any,
config: Config
config: Config,
) = (pageView as? AppCompatImageView)?.apply {
if (this is PhotoView) {
setZoomTransitionDuration(config.zoomDuration.getSystemScaledDuration())
@@ -19,7 +19,7 @@ import com.google.android.material.progressindicator.CircularProgressIndicator
class ReaderProgressIndicator @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
defStyleAttr: Int = 0,
) : FrameLayout(context, attrs, defStyleAttr) {
private val indicator: CircularProgressIndicator
@@ -82,7 +82,7 @@ abstract class ViewerConfig(preferences: PreferencesHelper, private val scope: C
fun <T> Preference<T>.register(
valueAssignment: (T) -> Unit,
onChanged: (T) -> Unit = {}
onChanged: (T) -> Unit = {},
) {
asFlow()
.onEach { valueAssignment(it) }
@@ -19,7 +19,7 @@ abstract class ViewerNavigation {
data class Region(
val rectF: RectF,
val type: NavigationRegion
val type: NavigationRegion,
) {
fun invert(invertMode: PreferenceValues.TappingInvertMode): Region {
if (invertMode == PreferenceValues.TappingInvertMode.NONE) return this
@@ -27,6 +27,6 @@ class EdgeNavigation : ViewerNavigation() {
Region(
rectF = RectF(0.66f, 0f, 1f, 1f),
type = NavigationRegion.NEXT
),
)
)
}
@@ -23,6 +23,6 @@ class RightAndLeftNavigation : ViewerNavigation() {
Region(
rectF = RectF(0.66f, 0f, 1f, 1f),
type = NavigationRegion.RIGHT
),
)
)
}
@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.GestureDetectorWithLongTap
*/
open class Pager(
context: Context,
isHorizontal: Boolean = true
isHorizontal: Boolean = true,
) : DirectionalViewPager(context, isHorizontal) {
/**
@@ -21,7 +21,7 @@ import uy.kohesive.injekt.api.get
class PagerConfig(
private val viewer: PagerViewer,
scope: CoroutineScope,
preferences: PreferencesHelper = Injekt.get()
preferences: PreferencesHelper = Injekt.get(),
) : ViewerConfig(preferences, scope) {
var theme = preferences.readerTheme().get()
@@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit
class PagerPageHolder(
readerThemedContext: Context,
val viewer: PagerViewer,
val page: ReaderPage
val page: ReaderPage,
) : ReaderPageImageView(readerThemedContext), ViewPagerAdapter.PositionableView {
/**
@@ -227,7 +227,7 @@ class PagerPageHolder(
minimumScaleType = viewer.config.imageScaleType,
cropBorders = viewer.config.imageCropBorders,
zoomStartPosition = viewer.config.imageZoomType,
landscapeZoom = viewer.config.landscapeZoom,
landscapeZoom = viewer.config.landscapeZoom
)
)
if (!isAnimated) {
@@ -27,7 +27,7 @@ import rx.android.schedulers.AndroidSchedulers
class PagerTransitionHolder(
readerThemedContext: Context,
val viewer: PagerViewer,
val transition: ChapterTransition
val transition: ChapterTransition,
) : LinearLayout(readerThemedContext), ViewPagerAdapter.PositionableView {
/**
@@ -171,7 +171,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
val placeAtIndex = when (viewer) {
is L2RPagerViewer,
is VerticalPagerViewer -> currentIndex + 1
is VerticalPagerViewer, -> currentIndex + 1
else -> currentIndex
}
@@ -149,7 +149,7 @@ class WebtoonAdapter(val viewer: WebtoonViewer) : RecyclerView.Adapter<RecyclerV
*/
private class Callback(
private val oldItems: List<Any>,
private val newItems: List<Any>
private val newItems: List<Any>,
) : DiffUtil.Callback() {
/**
@@ -8,7 +8,7 @@ import rx.Subscription
abstract class WebtoonBaseHolder(
view: View,
protected val viewer: WebtoonViewer
protected val viewer: WebtoonViewer,
) : RecyclerView.ViewHolder(view) {
/**
@@ -20,7 +20,7 @@ import uy.kohesive.injekt.api.get
*/
class WebtoonConfig(
scope: CoroutineScope,
preferences: PreferencesHelper = Injekt.get()
preferences: PreferencesHelper = Injekt.get(),
) : ViewerConfig(preferences, scope) {
var themeChangedListener: (() -> Unit)? = null
@@ -71,7 +71,7 @@ class WebtoonFrame(context: Context) : FrameLayout(context) {
e1: MotionEvent?,
e2: MotionEvent?,
velocityX: Float,
velocityY: Float
velocityY: Float,
): Boolean {
return recycler?.zoomFling(velocityX.toInt(), velocityY.toInt()) ?: false
}
@@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit
*/
class WebtoonPageHolder(
private val frame: ReaderPageImageView,
viewer: WebtoonViewer
viewer: WebtoonViewer,
) : WebtoonBaseHolder(frame, viewer) {
/**
@@ -20,7 +20,7 @@ import kotlin.math.abs
open class WebtoonRecyclerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
defStyle: Int = 0,
) : RecyclerView(context, attrs, defStyle) {
private var isZooming = false
@@ -94,7 +94,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
fromX: Float,
toX: Float,
fromY: Float,
toY: Float
toY: Float,
) {
isZooming = true
val animatorSet = AnimatorSet()
@@ -11,7 +11,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
*/
class WebtoonSubsamplingImageView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
attrs: AttributeSet? = null,
) : SubsamplingScaleImageView(context, attrs) {
override fun onTouchEvent(event: MotionEvent): Boolean {
@@ -22,7 +22,7 @@ import rx.android.schedulers.AndroidSchedulers
*/
class WebtoonTransitionHolder(
val layout: LinearLayout,
viewer: WebtoonViewer
viewer: WebtoonViewer,
) : WebtoonBaseHolder(layout, viewer) {
/**
@@ -320,11 +320,13 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
KeyEvent.KEYCODE_DPAD_LEFT,
KeyEvent.KEYCODE_DPAD_UP,
KeyEvent.KEYCODE_PAGE_UP -> if (isUp) scrollUp()
KeyEvent.KEYCODE_PAGE_UP,
-> if (isUp) scrollUp()
KeyEvent.KEYCODE_DPAD_RIGHT,
KeyEvent.KEYCODE_DPAD_DOWN,
KeyEvent.KEYCODE_PAGE_DOWN -> if (isUp) scrollDown()
KeyEvent.KEYCODE_PAGE_DOWN,
-> if (isUp) scrollDown()
else -> return false
}
return true