Run linter

This commit is contained in:
arkon
2020-02-26 18:03:34 -05:00
parent 58ab06b4f8
commit 043e3784e8
331 changed files with 876 additions and 1075 deletions

View File

@@ -42,5 +42,4 @@ class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: Att
spanCount = count
}
}
}

View File

@@ -37,7 +37,6 @@ class DialogCustomDownloadView @JvmOverloads constructor(context: Context, attrs
addView(inflate(R.layout.download_custom_amount))
}
/**
* Called when view is added
*

View File

@@ -5,8 +5,8 @@ import android.view.ViewGroup
import androidx.drawerlayout.widget.DrawerLayout
class DrawerSwipeCloseListener(
private val drawer: DrawerLayout,
private val navigationView: ViewGroup
private val drawer: DrawerLayout,
private val navigationView: ViewGroup
) : DrawerLayout.SimpleDrawerListener() {
override fun onDrawerOpened(drawerView: View) {

View File

@@ -8,8 +8,8 @@ import com.google.android.material.R
import com.google.android.material.appbar.AppBarLayout
class ElevationAppBarLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null
context: Context,
attrs: AttributeSet? = null
) : AppBarLayout(context, attrs) {
private var origStateAnimator: StateListAnimator? = null
@@ -37,5 +37,4 @@ class ElevationAppBarLayout @JvmOverloads constructor(
addState(IntArray(0), objAnimator)
}
}
}

View File

@@ -17,10 +17,11 @@ import eu.kanade.tachiyomi.util.system.getResourceColor
* inflation and allowing customizable items (multiple selections, custom views, etc).
*/
open class ExtendedNavigationView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0)
: SimpleNavigationView(context, attrs, defStyleAttr) {
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) :
SimpleNavigationView(context, attrs, defStyleAttr) {
/**
* Every item of the nav view. Generic items must belong to this list, custom items could be
@@ -46,15 +47,15 @@ open class ExtendedNavigationView @JvmOverloads constructor(
/**
* A checkbox belonging to a group. The group must handle selections and restrictions.
*/
class CheckboxGroup(resTitle: Int, override val group: Group, checked: Boolean = false)
: Checkbox(resTitle, checked), GroupedItem
class CheckboxGroup(resTitle: Int, override val group: Group, checked: Boolean = false) :
Checkbox(resTitle, checked), GroupedItem
/**
* A radio belonging to a group (a sole radio makes no sense). The group must handle
* selections and restrictions.
*/
class Radio(val resTitle: Int, override val group: Group, var checked: Boolean = false)
: Item(), GroupedItem
class Radio(val resTitle: Int, override val group: Group, var checked: Boolean = false) :
Item(), GroupedItem
/**
* An item with which needs more than two states (selected/deselected).
@@ -83,8 +84,8 @@ open class ExtendedNavigationView @JvmOverloads constructor(
* An item with which needs more than two states (selected/deselected) belonging to a group.
* The group must handle selections and restrictions.
*/
abstract class MultiStateGroup(resTitle: Int, override val group: Group, state: Int = 0)
: MultiState(resTitle, state), GroupedItem
abstract class MultiStateGroup(resTitle: Int, override val group: Group, state: Int = 0) :
MultiState(resTitle, state), GroupedItem
/**
* A multistate item for sorting lists (unselected, ascending, descending).
@@ -105,7 +106,6 @@ open class ExtendedNavigationView @JvmOverloads constructor(
else -> null
}
}
}
}
@@ -153,7 +153,6 @@ open class ExtendedNavigationView @JvmOverloads constructor(
* selections of its items.
*/
fun onItemClicked(item: Item)
}
/**
@@ -232,7 +231,5 @@ open class ExtendedNavigationView @JvmOverloads constructor(
}
abstract fun onItemClicked(item: Item)
}
}

View File

@@ -17,6 +17,5 @@ class IgnoreFirstSpinnerListener(private val block: (Int) -> Unit) : OnItemSelec
}
override fun onNothingSelected(parent: AdapterView<*>?) {
}
}

View File

@@ -20,4 +20,3 @@ class MinMaxNumberPicker @JvmOverloads constructor(context: Context, attrs: Attr
}
}
}

View File

@@ -7,7 +7,6 @@ import android.widget.SeekBar
import eu.kanade.tachiyomi.R
import kotlin.math.abs
class NegativeSeekBar @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
SeekBar(context, attrs) {
@@ -66,5 +65,4 @@ class NegativeSeekBar @JvmOverloads constructor(context: Context, attrs: Attribu
super.onRestoreInstanceState(state)
super.setProgress(origProgress)
}
}

View File

@@ -12,30 +12,30 @@ import androidx.annotation.Dimension
* 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
@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?
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
canvas: Canvas,
text: CharSequence,
start: Int,
end: Int,
x: Float,
top: Int,
y: Int,
bottom: Int,
paint: Paint
) {
val originTextColor = paint.color
@@ -53,5 +53,4 @@ class OutlineSpan(
canvas.drawText(text, start, end, x, y.toFloat(), paint)
}
}

View File

@@ -8,7 +8,6 @@ import android.widget.TextView
import eu.kanade.tachiyomi.R
import java.util.HashMap
class PTSansTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
TextView(context, attrs) {
@@ -43,5 +42,4 @@ class PTSansTextView @JvmOverloads constructor(context: Context, attrs: Attribut
super.onDraw(canvas)
super.onDraw(canvas)
}
}

View File

@@ -22,5 +22,4 @@ class PreCachingLayoutManager(context: Context) : LinearLayoutManager(context) {
}
return DEFAULT_EXTRA_LAYOUT_SPACE
}
}

View File

@@ -31,6 +31,4 @@ abstract class RecyclerViewPagerAdapter : ViewStatePagerAdapter() {
recycleView(view, position)
if (recycle) pool.push(view)
}
}

View File

@@ -64,5 +64,4 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
anim.start()
return true
}
}

View File

@@ -8,4 +8,4 @@ open class SimpleAnimationListener : Animation.AnimationListener {
override fun onAnimationEnd(animation: Animation) {}
override fun onAnimationStart(animation: Animation) {}
}
}

View File

@@ -13,17 +13,18 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.R
import com.google.android.material.internal.ScrimInsetsFrameLayout
import com.google.android.material.textfield.TextInputLayout
import eu.kanade.tachiyomi.R as TR
import eu.kanade.tachiyomi.util.view.inflate
import kotlin.math.min
import eu.kanade.tachiyomi.R as TR
@Suppress("LeakingThis")
@SuppressLint("PrivateResource", "RestrictedApi")
open class SimpleNavigationView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0)
: ScrimInsetsFrameLayout(context, attrs, defStyleAttr) {
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) :
ScrimInsetsFrameLayout(context, attrs, defStyleAttr) {
/**
* Max width of the navigation view.
@@ -83,19 +84,18 @@ open class SimpleNavigationView @JvmOverloads constructor(
/**
* Separator view holder.
*/
class SeparatorHolder(parent: ViewGroup)
: Holder(parent.inflate(R.layout.design_navigation_item_separator))
class SeparatorHolder(parent: ViewGroup) :
Holder(parent.inflate(R.layout.design_navigation_item_separator))
/**
* Header view holder.
*/
class HeaderHolder(parent: ViewGroup)
: Holder(parent.inflate(TR.layout.navigation_view_group)) {
class HeaderHolder(parent: ViewGroup) :
Holder(parent.inflate(TR.layout.navigation_view_group)) {
val title: TextView = itemView.findViewById(TR.id.title)
}
/**
* Clickable view holder.
*/
@@ -108,8 +108,8 @@ open class SimpleNavigationView @JvmOverloads constructor(
/**
* Radio view holder.
*/
class RadioHolder(parent: ViewGroup, listener: View.OnClickListener?)
: ClickableHolder(parent.inflate(TR.layout.navigation_view_radio), listener) {
class RadioHolder(parent: ViewGroup, listener: View.OnClickListener?) :
ClickableHolder(parent.inflate(TR.layout.navigation_view_radio), listener) {
val radio: RadioButton = itemView.findViewById(TR.id.nav_view_item)
}
@@ -117,8 +117,8 @@ open class SimpleNavigationView @JvmOverloads constructor(
/**
* Checkbox view holder.
*/
class CheckboxHolder(parent: ViewGroup, listener: View.OnClickListener?)
: ClickableHolder(parent.inflate(TR.layout.navigation_view_checkbox), listener) {
class CheckboxHolder(parent: ViewGroup, listener: View.OnClickListener?) :
ClickableHolder(parent.inflate(TR.layout.navigation_view_checkbox), listener) {
val check: CheckBox = itemView.findViewById(TR.id.nav_view_item)
}
@@ -126,21 +126,21 @@ open class SimpleNavigationView @JvmOverloads constructor(
/**
* Multi state view holder.
*/
class MultiStateHolder(parent: ViewGroup, listener: View.OnClickListener?)
: ClickableHolder(parent.inflate(TR.layout.navigation_view_checkedtext), listener) {
class MultiStateHolder(parent: ViewGroup, listener: View.OnClickListener?) :
ClickableHolder(parent.inflate(TR.layout.navigation_view_checkedtext), listener) {
val text: CheckedTextView = itemView.findViewById(TR.id.nav_view_item)
}
class SpinnerHolder(parent: ViewGroup, listener: OnClickListener? = null)
: ClickableHolder(parent.inflate(TR.layout.navigation_view_spinner), listener) {
class SpinnerHolder(parent: ViewGroup, listener: OnClickListener? = null) :
ClickableHolder(parent.inflate(TR.layout.navigation_view_spinner), listener) {
val text: TextView = itemView.findViewById(TR.id.nav_view_item_text)
val spinner: Spinner = itemView.findViewById(TR.id.nav_view_item)
}
class EditTextHolder(parent: ViewGroup)
: Holder(parent.inflate(TR.layout.navigation_view_text)) {
class EditTextHolder(parent: ViewGroup) :
Holder(parent.inflate(TR.layout.navigation_view_text)) {
val wrapper: TextInputLayout = itemView.findViewById(TR.id.nav_view_item_wrapper)
val edit: EditText = itemView.findViewById(TR.id.nav_view_item)
@@ -155,5 +155,4 @@ open class SimpleNavigationView @JvmOverloads constructor(
const val VIEW_TYPE_TEXT = 105
const val VIEW_TYPE_LIST = 106
}
}

View File

@@ -21,10 +21,12 @@ import eu.kanade.tachiyomi.util.view.visible
* @param errorDrawableRes the error drawable resource to show.
* @param errorScaleType the scale type for the error drawable, [ScaleType.CENTER] by default.
*/
class StateImageViewTarget(view: ImageView,
val progress: View? = null,
val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp,
val errorScaleType: ScaleType = ScaleType.CENTER) :
class StateImageViewTarget(
view: ImageView,
val progress: View? = null,
val errorDrawableRes: Int = R.drawable.ic_broken_image_grey_24dp,
val errorScaleType: ScaleType = ScaleType.CENTER
) :
ImageViewTarget<Drawable>(view) {

View File

@@ -30,5 +30,4 @@ abstract class ViewPagerAdapter : PagerAdapter() {
interface PositionableView {
val item: Any
}
}

View File

@@ -15,9 +15,9 @@ import kotlinx.android.synthetic.main.pref_item_source.view.login
import kotlinx.android.synthetic.main.pref_item_source.view.login_frame
class LoginCheckBoxPreference @JvmOverloads constructor(
context: Context,
val source: HttpSource,
attrs: AttributeSet? = null
context: Context,
val source: HttpSource,
attrs: AttributeSet? = null
) : CheckBoxPreference(context, attrs) {
init {
@@ -54,5 +54,4 @@ class LoginCheckBoxPreference @JvmOverloads constructor(
public override fun notifyChanged() {
super.notifyChanged()
}
}

View File

@@ -62,7 +62,6 @@ abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController(
}
})
}
}
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
@@ -79,5 +78,4 @@ abstract class LoginDialogPreference(bundle: Bundle? = null) : DialogController(
protected abstract fun checkLogin()
protected abstract fun setCredentialsOnView(view: View)
}

View File

@@ -26,5 +26,4 @@ class LoginPreference @JvmOverloads constructor(context: Context, attrs: Attribu
public override fun notifyChanged() {
super.notifyChanged()
}
}

View File

@@ -68,5 +68,4 @@ class SourceLoginDialog(bundle: Bundle? = null) : LoginDialogPreference(bundle)
interface Listener {
fun loginDialogClosed(source: LoginSource)
}
}

View File

@@ -16,9 +16,10 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.getResourceColor
class SwitchPreferenceCategory @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null)
: PreferenceCategory(
context: Context,
attrs: AttributeSet? = null
) :
PreferenceCategory(
context,
attrs,
R.attr.switchPreferenceCompatStyle),
@@ -121,5 +122,4 @@ class SwitchPreferenceCategory @JvmOverloads constructor(
else
defaultValue as Boolean)
}
}

View File

@@ -60,5 +60,4 @@ class TrackLoginDialog(bundle: Bundle? = null) : LoginDialogPreference(bundle) {
interface Listener {
fun trackLoginDialogClosed(service: TrackService)
}
}

View File

@@ -33,5 +33,4 @@ class TrackLogoutDialog(bundle: Bundle? = null) : DialogController(bundle) {
interface Listener {
fun trackLogoutDialogClosed(service: TrackService)
}
}