diff options
Diffstat (limited to 'core-ui/src/main')
10 files changed, 221 insertions, 103 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 3951970..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,11 +1,26 @@ +/* + * 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 import android.os.Bundle -import android.support.annotation.RequiresApi -import android.support.v7.widget.RecyclerView -import android.support.v7.widget.Toolbar import android.transition.TransitionInflater +import androidx.annotation.RequiresApi +import androidx.appcompat.widget.Toolbar +import androidx.recyclerview.widget.RecyclerView import ca.allanwang.kau.internal.KauBaseActivity import ca.allanwang.kau.ui.R import ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout @@ -16,7 +31,7 @@ import kotlinx.android.synthetic.main.kau_elastic_recycler_activity.* * * A generic activity comprised of an ElasticDragDismissFrameLayout, CoordinatorLayout, Toolbar, RecyclerView, and Fab * [ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout] - * [android.support.v7.widget.RecyclerView] + * [androidx.recyclerview.widget.RecyclerView] * * The recyclerview defaults to a linearlayoutmanager, and the adapter is automatically bounded * @@ -39,10 +54,11 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() { setContentView(R.layout.kau_elastic_recycler_activity) setSupportActionBar(kau_toolbar) if (!onCreate(savedInstanceState, configs)) return + 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() } @@ -63,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 5fc3e06..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,13 +1,27 @@ +/* + * 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 android.graphics.Rect -import android.support.v7.widget.CardView import android.util.AttributeSet +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 f6f7864..474d40a 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 5db5eaa..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 android.support.v7.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 f357f79..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 android.support.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/InkPageIndicator.java b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/InkPageIndicator.java index a963556..13381aa 100644 --- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/InkPageIndicator.java +++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/InkPageIndicator.java @@ -27,14 +27,14 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; -import android.support.annotation.ColorInt; -import android.support.v4.view.ViewPager; +import androidx.annotation.ColorInt; import android.util.AttributeSet; import android.view.View; import android.view.animation.Interpolator; import java.util.Arrays; +import androidx.viewpager.widget.ViewPager; import ca.allanwang.kau.ui.R; import ca.allanwang.kau.utils.AnimHolder; import ca.allanwang.kau.utils.ColorUtilsKt; 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 bcd930f..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 android.support.v4.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 +} diff --git a/core-ui/src/main/res-public/layout/kau_elastic_recycler_activity.xml b/core-ui/src/main/res-public/layout/kau_elastic_recycler_activity.xml index 9fbe447..5fc151c 100644 --- a/core-ui/src/main/res-public/layout/kau_elastic_recycler_activity.xml +++ b/core-ui/src/main/res-public/layout/kau_elastic_recycler_activity.xml @@ -7,7 +7,7 @@ app:dragDismissDistance="@dimen/kau_drag_dismiss_distance_large" app:dragDismissScale="0.95"> - <android.support.design.widget.CoordinatorLayout + <androidx.coordinatorlayout.widget.CoordinatorLayout android:id="@+id/kau_coordinator" android:layout_width="match_parent" android:layout_height="match_parent" @@ -15,27 +15,27 @@ android:background="?android:colorBackground" android:orientation="vertical"> - <android.support.design.widget.AppBarLayout + <com.google.android.material.appbar.AppBarLayout android:id="@+id/kau_appbar" android:layout_width="match_parent" android:layout_height="wrap_content"> - <android.support.v7.widget.Toolbar + <androidx.appcompat.widget.Toolbar android:id="@+id/kau_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> - </android.support.design.widget.AppBarLayout> + </com.google.android.material.appbar.AppBarLayout> - <android.support.v7.widget.RecyclerView + <androidx.recyclerview.widget.RecyclerView android:id="@+id/kau_recycler" android:layout_width="match_parent" android:layout_height="match_parent" - app:layoutManager="android.support.v7.widget.LinearLayoutManager" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - <android.support.design.widget.FloatingActionButton + <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/kau_fab" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -47,6 +47,6 @@ app:layout_anchor="@id/kau_recycler" app:layout_anchorGravity="bottom|right|end" /> - </android.support.design.widget.CoordinatorLayout> + </androidx.coordinatorlayout.widget.CoordinatorLayout> </ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout>
\ No newline at end of file diff --git a/core-ui/src/main/res-public/layout/kau_recycler_detached_background.xml b/core-ui/src/main/res-public/layout/kau_recycler_detached_background.xml index 7295d66..2273a20 100644 --- a/core-ui/src/main/res-public/layout/kau_recycler_detached_background.xml +++ b/core-ui/src/main/res-public/layout/kau_recycler_detached_background.xml @@ -15,13 +15,13 @@ <!--defaults to a LinearLayoutManager--> - <android.support.v7.widget.RecyclerView + <androidx.recyclerview.widget.RecyclerView android:id="@+id/kau_recycler_detached" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/kau_spacing_normal" android:scrollbars="vertical" - app:layoutManager="android.support.v7.widget.LinearLayoutManager" /> + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> </FrameLayout> diff --git a/core-ui/src/main/res-public/layout/kau_recycler_textslider.xml b/core-ui/src/main/res-public/layout/kau_recycler_textslider.xml index eacd5be..d048627 100644 --- a/core-ui/src/main/res-public/layout/kau_recycler_textslider.xml +++ b/core-ui/src/main/res-public/layout/kau_recycler_textslider.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/kau_container" android:layout_width="match_parent" android:layout_height="match_parent"> - <android.support.v7.widget.Toolbar + <androidx.appcompat.widget.Toolbar android:id="@+id/kau_toolbar" android:layout_width="0dp" android:layout_height="?attr/actionBarSize" @@ -20,9 +20,9 @@ android:gravity="center" app:animation_type="slide_vertical" /> - </android.support.v7.widget.Toolbar> + </androidx.appcompat.widget.Toolbar> - <android.support.v7.widget.RecyclerView + <androidx.recyclerview.widget.RecyclerView android:id="@+id/kau_recycler" android:layout_width="0dp" android:layout_height="0dp" @@ -31,4 +31,4 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/kau_toolbar" /> -</android.support.constraint.ConstraintLayout> +</androidx.constraintlayout.widget.ConstraintLayout> |