aboutsummaryrefslogtreecommitdiff
path: root/core-ui/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-09-09 11:59:24 -0400
committerGitHub <noreply@github.com>2018-09-09 11:59:24 -0400
commitd540934915da26ab2cec4c897e973be35e0bfe24 (patch)
tree6f114d080c168381266a0d5d3a40b685e28b8e9a /core-ui/src/main
parent718a51ed00a0a5c3dc7a655e617308e82da65d1a (diff)
downloadkau-d540934915da26ab2cec4c897e973be35e0bfe24.tar.gz
kau-d540934915da26ab2cec4c897e973be35e0bfe24.tar.bz2
kau-d540934915da26ab2cec4c897e973be35e0bfe24.zip
Clean up kotterknife (#161)
* Remove bindview implementations internally * Remove more bindView calls * Make config private in ElasticRecyclerActivity * Fix recyclerview * Update adapter * Improve swipe destroy and add direction to swipe finish
Diffstat (limited to 'core-ui/src/main')
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt25
-rw-r--r--core-ui/src/main/res-public/values/public.xml2
2 files changed, 10 insertions, 17 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 4510744..3951970 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
@@ -3,16 +3,13 @@ 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
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.Toolbar
import android.transition.TransitionInflater
import ca.allanwang.kau.internal.KauBaseActivity
import ca.allanwang.kau.ui.R
import ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout
-import ca.allanwang.kau.utils.bindView
+import kotlinx.android.synthetic.main.kau_elastic_recycler_activity.*
/**
* Created by Allan Wang on 2017-07-17.
@@ -28,13 +25,9 @@ import ca.allanwang.kau.utils.bindView
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
abstract class ElasticRecyclerActivity : KauBaseActivity() {
- val appBar: AppBarLayout by bindView(R.id.kau_appbar)
- val toolbar: Toolbar by bindView(R.id.kau_toolbar)
- val coordinator: CoordinatorLayout by bindView(R.id.kau_coordinator)
- val draggableFrame: ElasticDragDismissFrameLayout by bindView(R.id.kau_draggable)
- val recycler: RecyclerView by bindView(R.id.kau_recycler)
- val fab: FloatingActionButton by bindView(R.id.kau_fab)
- val configs = Configs()
+ private val configs = Configs()
+ protected val toolbar: Toolbar get() = kau_toolbar
+ protected val recycler: RecyclerView get() = kau_recycler
class Configs {
var exitTransitionBottom = R.transition.kau_exit_slide_bottom
@@ -44,13 +37,13 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {
final override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.kau_elastic_recycler_activity)
- setSupportActionBar(toolbar)
+ setSupportActionBar(kau_toolbar)
if (!onCreate(savedInstanceState, configs)) return
- draggableFrame.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) {
+ kau_draggable.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) {
override fun onDragDismissed() {
window.returnTransition = TransitionInflater.from(this@ElasticRecyclerActivity)
- .inflateTransition(if (draggableFrame.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
- recycler.stopScroll()
+ .inflateTransition(if (kau_draggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
+ kau_recycler.stopScroll()
finishAfterTransition()
}
})
@@ -68,7 +61,7 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {
* Receive actions when the a click event is received outside of the coordinator
*/
fun setOutsideTapListener(listener: () -> Unit) {
- draggableFrame.setOnClickListener { listener() }
+ kau_draggable.setOnClickListener { listener() }
}
}
diff --git a/core-ui/src/main/res-public/values/public.xml b/core-ui/src/main/res-public/values/public.xml
index f46b3eb..193e088 100644
--- a/core-ui/src/main/res-public/values/public.xml
+++ b/core-ui/src/main/res-public/values/public.xml
@@ -1,7 +1,7 @@
<resources xmlns:tools='http://schemas.android.com/tools' tools:ignore='ResourceName'>
<!-- AUTO-GENERATED FILE. DO NOT MODIFY. public.xml is generated by the generatepublicxml gradle task -->
- <public name='kau_recycler_detached_background' type='layout' />
<public name='kau_elastic_recycler_activity' type='layout' />
+ <public name='kau_recycler_detached_background' type='layout' />
<public name='kau_recycler_textslider' type='layout' />
<public name='Kau.Translucent' type='style' />
<public name='Kau.Translucent.NoAnimation' type='style' />