aboutsummaryrefslogtreecommitdiff
path: root/core-ui/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-12-24 01:17:31 -0500
committerGitHub <noreply@github.com>2018-12-24 01:17:31 -0500
commitfb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b (patch)
treecc6d67461b6caa256043b9482f7646831d528a08 /core-ui/src/main
parenta380adea1052d39f23c9c4d432a9380ce347d6c4 (diff)
downloadkau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.tar.gz
kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.tar.bz2
kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.zip
Enhancement/ktlint (#179)
* Add spotless dependency * Apply ktlint * Add license headers
Diffstat (limited to 'core-ui/src/main')
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt19
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/BoundedCardView.kt23
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt48
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt24
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt115
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt50
6 files changed, 198 insertions, 81 deletions
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt
index 5b0e97b..aff4d1c 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.ui.activities
import android.os.Build
@@ -43,7 +58,7 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {
kau_draggable.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) {
override fun onDragDismissed() {
window.returnTransition = TransitionInflater.from(this@ElasticRecyclerActivity)
- .inflateTransition(if (kau_draggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
+ .inflateTransition(if (kau_draggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
kau_recycler.stopScroll()
finishAfterTransition()
}
@@ -64,6 +79,4 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {
fun setOutsideTapListener(listener: () -> Unit) {
kau_draggable.setOnClickListener { listener() }
}
-
}
-
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/BoundedCardView.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/BoundedCardView.kt
index 25a05df..9433d17 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/BoundedCardView.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/BoundedCardView.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.ui.views
import android.content.Context
@@ -7,7 +22,6 @@ import androidx.cardview.widget.CardView
import ca.allanwang.kau.ui.R
import ca.allanwang.kau.utils.parentViewGroup
-
/**
* Created by Allan Wang on 2017-06-26.
*
@@ -16,7 +30,9 @@ import ca.allanwang.kau.utils.parentViewGroup
* Defaults to at most the parent's visible height
*/
class BoundedCardView @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
) : CardView(context, attrs, defStyleAttr) {
/**
@@ -48,5 +64,4 @@ class BoundedCardView @JvmOverloads constructor(
val trueHeightMeasureSpec = MeasureSpec.makeMeasureSpec(maxMeasureHeight, MeasureSpec.AT_MOST)
super.onMeasure(widthMeasureSpec, trueHeightMeasureSpec)
}
-
-} \ No newline at end of file
+}
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
index eeaac6e..6da65a3 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
@@ -1,11 +1,11 @@
/*
- * Copyright 2015 Google Inc.
+ * Copyright 2018 Allan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,11 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package ca.allanwang.kau.ui.views
import android.content.Context
-import android.graphics.*
+import android.graphics.Bitmap
+import android.graphics.Canvas
+import android.graphics.Color
+import android.graphics.PorterDuff
+import android.graphics.PorterDuffXfermode
+import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.text.TextPaint
import android.util.AttributeSet
@@ -32,9 +36,13 @@ import ca.allanwang.kau.utils.toBitmap
/**
* A view which punches out some text from an opaque color block, allowing you to see through it.
+ *
+ * Inspired by <a href="https://github.com/nickbutcher/plaid">Plaid</a>
*/
class CutoutView @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
companion object {
@@ -107,8 +115,10 @@ class CutoutView @JvmOverloads constructor(
private fun calculateTextPosition() {
val targetWidth = width / PHI
- textSize = getSingleLineTextSize(text!!, paint, targetWidth, 0f, maxTextSize,
- 0.5f, resources.displayMetrics)
+ textSize = getSingleLineTextSize(
+ text!!, paint, targetWidth, 0f, maxTextSize,
+ 0.5f, resources.displayMetrics
+ )
paint.textSize = textSize
// measuring text is fun :] see: https://chris.banes.me/2014/03/27/measuring-text/
@@ -145,13 +155,15 @@ class CutoutView @JvmOverloads constructor(
* Adapted from https://github.com/grantland/android-autofittextview
*/
- fun getSingleLineTextSize(text: String,
- paint: TextPaint,
- targetWidth: Float,
- low: Float,
- high: Float,
- precision: Float,
- metrics: DisplayMetrics): Float {
+ fun getSingleLineTextSize(
+ text: String,
+ paint: TextPaint,
+ targetWidth: Float,
+ low: Float,
+ high: Float,
+ precision: Float,
+ metrics: DisplayMetrics
+ ): Float {
val mid = (low + high) / 2.0f
paint.textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid, metrics)
@@ -180,7 +192,12 @@ class CutoutView @JvmOverloads constructor(
cutoutCanvas.drawText(text!!, cutoutX, cutoutY, paint)
}
TYPE_DRAWABLE -> {
- cutoutCanvas.drawBitmap(drawable!!.toBitmap(bitmapScaling, Bitmap.Config.ALPHA_8), cutoutX, cutoutY, paint)
+ cutoutCanvas.drawBitmap(
+ drawable!!.toBitmap(bitmapScaling, Bitmap.Config.ALPHA_8),
+ cutoutX,
+ cutoutY,
+ paint
+ )
}
TYPE_EMPTY -> {
// do nothing
@@ -193,5 +210,4 @@ class CutoutView @JvmOverloads constructor(
}
override fun hasOverlappingRendering(): Boolean = true
-
}
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt
index 5cb4329..ef95ed3 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt
@@ -1,14 +1,31 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.ui.views
import android.content.Context
-import androidx.appcompat.widget.AppCompatImageView
import android.util.AttributeSet
+import androidx.appcompat.widget.AppCompatImageView
/**
* Created by Allan Wang on 2017-07-14.
*/
class MeasuredImageView @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
) : AppCompatImageView(context, attrs, defStyleAttr), MeasureSpecContract by MeasureSpecDelegate() {
init {
@@ -19,5 +36,4 @@ class MeasuredImageView @JvmOverloads constructor(
val result = onMeasure(this, widthMeasureSpec, heightMeasureSpec)
super.onMeasure(result.first, result.second)
}
-
-} \ No newline at end of file
+}
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt
index b89373e..f4578f2 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt
@@ -1,11 +1,11 @@
/*
- * Copyright 2015 Google Inc.
+ * Copyright 2018 Allan Wang
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,22 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package ca.allanwang.kau.ui.widgets
import android.app.Activity
import android.content.Context
import android.graphics.Color
import android.os.Build
-import androidx.annotation.RequiresApi
import android.transition.TransitionInflater
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
+import androidx.annotation.RequiresApi
import ca.allanwang.kau.logging.KL
import ca.allanwang.kau.ui.R
-import ca.allanwang.kau.utils.*
+import ca.allanwang.kau.utils.AnimHolder
+import ca.allanwang.kau.utils.dimen
+import ca.allanwang.kau.utils.dpToPx
+import ca.allanwang.kau.utils.isNavBarOnBottom
+import ca.allanwang.kau.utils.navigationBarColor
+import ca.allanwang.kau.utils.scaleXY
+import ca.allanwang.kau.utils.statusBarColor
+import ca.allanwang.kau.utils.withAlpha
/**
* A [FrameLayout] which responds to nested scrolls to create drag-dismissable layouts.
@@ -37,7 +43,10 @@ import ca.allanwang.kau.utils.*
*/
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
class ElasticDragDismissFrameLayout @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0,
+ defStyleRes: Int = 0
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
// configurable attribs
@@ -62,8 +71,11 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
init {
if (attrs != null) {
val a = getContext().obtainStyledAttributes(attrs, R.styleable.ElasticDragDismissFrameLayout, 0, 0)
- dragDismissDistance = a.getDimensionPixelSize(R.styleable.ElasticDragDismissFrameLayout_dragDismissDistance, Int.MAX_VALUE).toFloat()
- dragDismissFraction = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragDismissFraction, dragDismissFraction)
+ dragDismissDistance =
+ a.getDimensionPixelSize(R.styleable.ElasticDragDismissFrameLayout_dragDismissDistance, Int.MAX_VALUE)
+ .toFloat()
+ dragDismissFraction =
+ a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragDismissFraction, dragDismissFraction)
dragDismissScale = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragDismissScale, dragDismissScale)
dragElacticity = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragElasticity, dragElacticity)
a.recycle()
@@ -74,27 +86,27 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
/**
* Called for each drag event.
-
- * @param elasticOffset Indicating the drag offset with elasticity applied i.e. may
- * * exceed 1.
- * *
+ * @param elasticOffset Indicating the drag offset with elasticity applied i.e. may exceed 1.
+ *
* @param elasticOffsetPixels The elastically scaled drag distance in pixels.
- * *
- * @param rawOffset Value from [0, 1] indicating the raw drag offset i.e.
- * * without elasticity applied. A value of 1 indicates that the
- * * dismiss distance has been reached.
- * *
- * @param rawOffsetPixels The raw distance the user has dragged
+ *
+ * @param rawOffset Value from [0, 1] indicating the raw drag offset i.e. without elasticity applied.
+ * A value of 1 indicates that the dismiss distance has been reached.
+ *
+ * @param rawOffsetPixels The raw distance the user has dragged
*/
- internal open fun onDrag(elasticOffset: Float, elasticOffsetPixels: Float,
- rawOffset: Float, rawOffsetPixels: Float) {
+ internal open fun onDrag(
+ elasticOffset: Float,
+ elasticOffsetPixels: Float,
+ rawOffset: Float,
+ rawOffsetPixels: Float
+ ) {
}
/**
* Called when dragging is released and has exceeded the threshold dismiss distance.
*/
internal open fun onDragDismissed() {}
-
}
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
@@ -114,8 +126,13 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
}
}
- override fun onNestedScroll(target: View, dxConsumed: Int, dyConsumed: Int,
- dxUnconsumed: Int, dyUnconsumed: Int) {
+ override fun onNestedScroll(
+ target: View,
+ dxConsumed: Int,
+ dyConsumed: Int,
+ dxUnconsumed: Int,
+ dyUnconsumed: Int
+ ) {
dragScale(dyUnconsumed)
}
@@ -129,12 +146,12 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
scaleXY = 1f
} else {
animate()
- .translationY(0f)
- .scaleXY(1f)
- .setDuration(200L)
- .setInterpolator(AnimHolder.fastOutSlowInInterpolator(context))
- .setListener(null)
- .start()
+ .translationY(0f)
+ .scaleXY(1f)
+ .setDuration(200L)
+ .setInterpolator(AnimHolder.fastOutSlowInInterpolator(context))
+ .setListener(null)
+ .start()
}
totalDrag = 0f
@@ -201,15 +218,23 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
translationY = 0f
scaleXY = 1f
}
- dispatchDragCallback(dragFraction, dragTo,
- Math.min(1f, Math.abs(totalDrag) / dragDismissDistance), totalDrag)
+ dispatchDragCallback(
+ dragFraction, dragTo,
+ Math.min(1f, Math.abs(totalDrag) / dragDismissDistance), totalDrag
+ )
}
- private fun dispatchDragCallback(elasticOffset: Float, elasticOffsetPixels: Float,
- rawOffset: Float, rawOffsetPixels: Float) {
+ private fun dispatchDragCallback(
+ elasticOffset: Float,
+ elasticOffsetPixels: Float,
+ rawOffset: Float,
+ rawOffsetPixels: Float
+ ) {
callbacks.forEach {
- it.onDrag(elasticOffset, elasticOffsetPixels,
- rawOffset, rawOffsetPixels)
+ it.onDrag(
+ elasticOffset, elasticOffsetPixels,
+ rawOffset, rawOffsetPixels
+ )
}
}
@@ -227,8 +252,12 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
private val navBarAlpha: Int = Color.alpha(activity.navigationBarColor)
private val fadeNavBar: Boolean = activity.isNavBarOnBottom
- public override fun onDrag(elasticOffset: Float, elasticOffsetPixels: Float,
- rawOffset: Float, rawOffsetPixels: Float) {
+ public override fun onDrag(
+ elasticOffset: Float,
+ elasticOffsetPixels: Float,
+ rawOffset: Float,
+ rawOffsetPixels: Float
+ ) {
if (elasticOffsetPixels > 0) {
// dragging downward, fade the status bar in proportion
activity.statusBarColor = activity.statusBarColor.withAlpha(((1f - rawOffset) * statusBarAlpha).toInt())
@@ -238,7 +267,8 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
activity.navigationBarColor = activity.navigationBarColor.withAlpha(navBarAlpha)
} else if (fadeNavBar) {
// dragging upward, fade the navigation bar in proportion
- activity.navigationBarColor = activity.navigationBarColor.withAlpha(((1f - rawOffset) * navBarAlpha).toInt())
+ activity.navigationBarColor =
+ activity.navigationBarColor.withAlpha(((1f - rawOffset) * navBarAlpha).toInt())
}
}
@@ -247,15 +277,18 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor(
}
}
- fun addExitListener(activity: Activity, transitionBottom: Int = R.transition.kau_exit_slide_bottom, transitionTop: Int = R.transition.kau_exit_slide_top) {
+ fun addExitListener(
+ activity: Activity,
+ transitionBottom: Int = R.transition.kau_exit_slide_bottom,
+ transitionTop: Int = R.transition.kau_exit_slide_top
+ ) {
addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(activity) {
override fun onDragDismissed() {
KL.v { "New transition" }
activity.window.returnTransition = TransitionInflater.from(activity)
- .inflateTransition(if (translationY > 0) transitionBottom else transitionTop)
+ .inflateTransition(if (translationY > 0) transitionBottom else transitionTop)
activity.finishAfterTransition()
}
})
}
-
}
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt
index a53ee9d..51f7ab9 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/TextSlider.kt
@@ -1,8 +1,22 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.ui.widgets
import android.content.Context
import android.graphics.Color
-import androidx.core.widget.TextViewCompat
import android.text.TextUtils
import android.util.AttributeSet
import android.view.Gravity
@@ -10,8 +24,10 @@ import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.widget.TextSwitcher
import android.widget.TextView
+import androidx.core.widget.TextViewCompat
import ca.allanwang.kau.ui.R
-import java.util.*
+import java.util.EmptyStackException
+import java.util.Stack
/**
* Created by Allan Wang on 2017-06-21.
@@ -19,7 +35,9 @@ import java.util.*
* Text switcher with global text color and embedded sliding animations
* Also has a stack to keep track of title changes
*/
-class TextSlider @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null
+class TextSlider @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null
) : TextSwitcher(context, attrs) {
val titleStack: Stack<CharSequence?> = Stack()
@@ -28,20 +46,26 @@ class TextSlider @JvmOverloads constructor(context: Context, attrs: AttributeSet
* Holds a mapping of animation types to their respective animations
*/
val animationMap = mapOf(
- ANIMATION_NONE to null,
- ANIMATION_SLIDE_HORIZONTAL to AnimationBundle(
- R.anim.kau_slide_in_right, R.anim.kau_slide_out_left,
- R.anim.kau_slide_in_left, R.anim.kau_slide_out_right),
- ANIMATION_SLIDE_VERTICAL to AnimationBundle(
- R.anim.kau_slide_in_bottom, R.anim.kau_slide_out_top,
- R.anim.kau_slide_in_top, R.anim.kau_slide_out_bottom
- )
+ ANIMATION_NONE to null,
+ ANIMATION_SLIDE_HORIZONTAL to AnimationBundle(
+ R.anim.kau_slide_in_right, R.anim.kau_slide_out_left,
+ R.anim.kau_slide_in_left, R.anim.kau_slide_out_right
+ ),
+ ANIMATION_SLIDE_VERTICAL to AnimationBundle(
+ R.anim.kau_slide_in_bottom, R.anim.kau_slide_out_top,
+ R.anim.kau_slide_in_top, R.anim.kau_slide_out_bottom
+ )
)
/**
* Holds lazy instances of the animations
*/
- inner class AnimationBundle(private val nextIn: Int, private val nextOut: Int, private val prevIn: Int, private val prevOut: Int) {
+ inner class AnimationBundle(
+ private val nextIn: Int,
+ private val nextOut: Int,
+ private val prevIn: Int,
+ private val prevOut: Int
+ ) {
val NEXT_IN: Animation by lazy { AnimationUtils.loadAnimation(context, nextIn) }
val NEXT_OUT: Animation by lazy { AnimationUtils.loadAnimation(context, nextOut) }
val PREV_IN: Animation by lazy { AnimationUtils.loadAnimation(context, prevIn) }
@@ -122,4 +146,4 @@ class TextSlider @JvmOverloads constructor(context: Context, attrs: AttributeSet
}
}
}
-} \ No newline at end of file
+}