aboutsummaryrefslogtreecommitdiff
path: root/core-ui/src/main/kotlin/ca
diff options
context:
space:
mode:
Diffstat (limited to 'core-ui/src/main/kotlin/ca')
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt14
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt5
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt3
3 files changed, 10 insertions, 12 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 1dcf14b..20a81e4 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,6 +1,8 @@
package ca.allanwang.kau.ui.activities
+import android.os.Build
import android.os.Bundle
+import android.support.annotation.RequiresApi
import android.support.design.widget.AppBarLayout
import android.support.design.widget.CoordinatorLayout
import android.support.design.widget.FloatingActionButton
@@ -23,7 +25,8 @@ import ca.allanwang.kau.utils.bindView
*
* The exit animation is set to slide out, but the entrance must be defined yourself
*/
-abstract class ElasticRecyclerActivity() : AppCompatActivity() {
+@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
+abstract class ElasticRecyclerActivity : AppCompatActivity() {
val appBar: AppBarLayout by bindView(R.id.kau_appbar)
val toolbar: Toolbar by bindView(R.id.kau_toolbar)
@@ -68,14 +71,5 @@ abstract class ElasticRecyclerActivity() : AppCompatActivity() {
draggableFrame.setOnClickListener { listener() }
}
- fun hideFabOnUpwardsScroll() {
- recycler.addOnScrollListener(object :RecyclerView.OnScrollListener(){
- override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
- if (dy > 0 && fab.isShown) fab.hide()
- else if (dy < 0 && !fab.isShown) fab.show()
- }
- })
- }
-
}
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 2627d13..ebb6397 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,6 +1,7 @@
package ca.allanwang.kau.ui.views
import android.content.Context
+import android.support.v7.widget.AppCompatImageView
import android.util.AttributeSet
import android.widget.ImageView
@@ -8,8 +9,8 @@ import android.widget.ImageView
* Created by Allan Wang on 2017-07-14.
*/
class MeasuredImageView @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0
-) : ImageView(context, attrs, defStyleAttr, defStyleRes), MeasureSpecContract by MeasureSpecDelegate() {
+ context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+) : AppCompatImageView(context, attrs, defStyleAttr), MeasureSpecContract by MeasureSpecDelegate() {
init {
initAttrs(context, attrs)
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 c208210..995ccab 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
@@ -19,6 +19,8 @@ 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.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
@@ -30,6 +32,7 @@ import ca.allanwang.kau.utils.*
* Applies an elasticity factor to reduce movement as you approach the given dismiss distance.
* Optionally also scales down content during drag.
*/
+@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
class ElasticDragDismissFrameLayout @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {