mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-15 03:49:19 +00:00
Reformated all the code
This commit is contained in:
@ -5,52 +5,52 @@ import android.graphics.ColorFilter
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
open class DrawableWrapper(val drawable: Drawable): Drawable() {
|
||||
init {
|
||||
drawable.callback = object: Callback {
|
||||
override fun invalidateDrawable(who: Drawable) {
|
||||
callback?.invalidateDrawable(who)
|
||||
}
|
||||
open class DrawableWrapper(val drawable: Drawable) : Drawable() {
|
||||
init {
|
||||
drawable.callback = object : Callback {
|
||||
override fun invalidateDrawable(who: Drawable) {
|
||||
callback?.invalidateDrawable(who)
|
||||
}
|
||||
|
||||
override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) {
|
||||
callback?.scheduleDrawable(who, what, `when`)
|
||||
}
|
||||
override fun scheduleDrawable(who: Drawable, what: Runnable, `when`: Long) {
|
||||
callback?.scheduleDrawable(who, what, `when`)
|
||||
}
|
||||
|
||||
override fun unscheduleDrawable(who: Drawable, what: Runnable) {
|
||||
callback?.unscheduleDrawable(who, what)
|
||||
}
|
||||
override fun unscheduleDrawable(who: Drawable, what: Runnable) {
|
||||
callback?.unscheduleDrawable(who, what)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBoundsChange(bounds: Rect) {
|
||||
drawable.bounds = bounds
|
||||
}
|
||||
override fun onBoundsChange(bounds: Rect) {
|
||||
drawable.bounds = bounds
|
||||
}
|
||||
|
||||
override fun getIntrinsicWidth(): Int = drawable.intrinsicWidth
|
||||
override fun getIntrinsicHeight(): Int = drawable.intrinsicHeight
|
||||
override fun getMinimumWidth(): Int = drawable.minimumWidth
|
||||
override fun getMinimumHeight(): Int = drawable.minimumHeight
|
||||
override fun getIntrinsicWidth(): Int = drawable.intrinsicWidth
|
||||
override fun getIntrinsicHeight(): Int = drawable.intrinsicHeight
|
||||
override fun getMinimumWidth(): Int = drawable.minimumWidth
|
||||
override fun getMinimumHeight(): Int = drawable.minimumHeight
|
||||
|
||||
override fun draw(canvas: Canvas) {
|
||||
drawable.draw(canvas)
|
||||
}
|
||||
override fun draw(canvas: Canvas) {
|
||||
drawable.draw(canvas)
|
||||
}
|
||||
|
||||
override fun getAlpha(): Int {
|
||||
return drawable.alpha
|
||||
}
|
||||
override fun getAlpha(): Int {
|
||||
return drawable.alpha
|
||||
}
|
||||
|
||||
override fun setAlpha(alpha: Int) {
|
||||
drawable.alpha = alpha
|
||||
}
|
||||
override fun setAlpha(alpha: Int) {
|
||||
drawable.alpha = alpha
|
||||
}
|
||||
|
||||
override fun getColorFilter(): ColorFilter? {
|
||||
return drawable.colorFilter
|
||||
}
|
||||
override fun getColorFilter(): ColorFilter? {
|
||||
return drawable.colorFilter
|
||||
}
|
||||
|
||||
override fun setColorFilter(colorFilter: ColorFilter?) {
|
||||
drawable.colorFilter = colorFilter
|
||||
}
|
||||
override fun setColorFilter(colorFilter: ColorFilter?) {
|
||||
drawable.colorFilter = colorFilter
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
override fun getOpacity(): Int = drawable.opacity
|
||||
@Suppress("DEPRECATION")
|
||||
override fun getOpacity(): Int = drawable.opacity
|
||||
}
|
||||
|
@ -2,18 +2,20 @@ package com.looker.droidify.graphics
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import kotlin.math.*
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class PaddingDrawable(drawable: Drawable, private val factor: Float): DrawableWrapper(drawable) {
|
||||
override fun getIntrinsicWidth(): Int = (factor * super.getIntrinsicWidth()).roundToInt()
|
||||
override fun getIntrinsicHeight(): Int = (factor * super.getIntrinsicHeight()).roundToInt()
|
||||
class PaddingDrawable(drawable: Drawable, private val factor: Float) : DrawableWrapper(drawable) {
|
||||
override fun getIntrinsicWidth(): Int = (factor * super.getIntrinsicWidth()).roundToInt()
|
||||
override fun getIntrinsicHeight(): Int = (factor * super.getIntrinsicHeight()).roundToInt()
|
||||
|
||||
override fun onBoundsChange(bounds: Rect) {
|
||||
val width = (bounds.width() / factor).roundToInt()
|
||||
val height = (bounds.height() / factor).roundToInt()
|
||||
val left = (bounds.width() - width) / 2
|
||||
val top = (bounds.height() - height) / 2
|
||||
drawable.setBounds(bounds.left + left, bounds.top + top,
|
||||
bounds.left + left + width, bounds.top + top + height)
|
||||
}
|
||||
override fun onBoundsChange(bounds: Rect) {
|
||||
val width = (bounds.width() / factor).roundToInt()
|
||||
val height = (bounds.height() / factor).roundToInt()
|
||||
val left = (bounds.width() - width) / 2
|
||||
val top = (bounds.height() - height) / 2
|
||||
drawable.setBounds(
|
||||
bounds.left + left, bounds.top + top,
|
||||
bounds.left + left + width, bounds.top + top + height
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user