From 8f2b5ac043f47cc44f43c3788d1377083fb339a2 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 18 Jul 2017 20:16:23 -0700 Subject: Dev 2.1 (#8) * Rewrite animation interfaces * Update changelog * Add scale factor for slide * Remove margins in iitems and replace with decorators * Remove mutable list * Switch cardiitem to use lambdas for click * status * Utils update and imagepicker fixes * Remove stringholder * Add fade in fade out * Increment about version * Rename fromedge to direction in javadocs * More logging * Add logging and docs * Make card icons visible * Update email builder and icon padding * Create elastic recycler activity * Fix card iitem * Add lint check and plurals * Inline all the things * Format and sort xml * Update dependencies and increment version --- about/build.gradle | 2 +- .../ca/allanwang/kau/about/AboutActivityBase.kt | 22 +++++----- .../kotlin/ca/allanwang/kau/about/LibraryIItem.kt | 1 + about/src/main/res/layout/kau_iitem_library.xml | 1 - .../res/transition/kau_about_return_downward.xml | 49 --------------------- .../res/transition/kau_about_return_upwards.xml | 50 ---------------------- about/src/main/res/values/strings_about.xml | 2 +- about/src/main/res/values/styles.xml | 5 +-- 8 files changed, 14 insertions(+), 118 deletions(-) delete mode 100644 about/src/main/res/transition/kau_about_return_downward.xml delete mode 100644 about/src/main/res/transition/kau_about_return_upwards.xml (limited to 'about') diff --git a/about/build.gradle b/about/build.gradle index bb51f9f..6898217 100644 --- a/about/build.gradle +++ b/about/build.gradle @@ -9,7 +9,7 @@ dependencies { compile project(':adapter') compile("com.mikepenz:aboutlibraries:${ABOUT_LIBRARIES}@aar") { - transitive = true + transitive = false } } diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt index 90dbfd3..b3e3e41 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt @@ -13,7 +13,8 @@ import android.view.ViewGroup import ca.allanwang.kau.adapters.FastItemThemedAdapter import ca.allanwang.kau.adapters.ThemableIItemColors import ca.allanwang.kau.adapters.ThemableIItemColorsDelegate -import ca.allanwang.kau.animators.FadeScaleAnimator +import ca.allanwang.kau.animators.FadeScaleAnimatorAdd +import ca.allanwang.kau.animators.KauAnimator import ca.allanwang.kau.iitems.HeaderIItem import ca.allanwang.kau.ui.widgets.ElasticDragDismissFrameLayout import ca.allanwang.kau.ui.widgets.InkPageIndicator @@ -94,12 +95,9 @@ abstract class AboutActivityBase(val rClass: Class<*>?, val configBuilder: Confi indicator.setViewPager(pager) draggableFrame.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this) { override fun onDragDismissed() { - // if we drag dismiss downward then the default reversal of the enter - // transition would slide content upward which looks weird. So reverse it. - if (draggableFrame.translationY > 0) { - window.returnTransition = TransitionInflater.from(this@AboutActivityBase) - .inflateTransition(configs.transitionExitReversed) - } + window.returnTransition = TransitionInflater.from(this@AboutActivityBase) + .inflateTransition(if (draggableFrame.translationY > 0) configs.transitionExitBottom else configs.transitionExitTop) + libRecycler?.stopScroll() finishAfterTransition() } @@ -114,10 +112,9 @@ abstract class AboutActivityBase(val rClass: Class<*>?, val configBuilder: Confi var cutoutForeground: Int? = null var libPageTitleRes: Int = -1 var libPageTitle: String? = string(R.string.kau_about_libraries_intro) //This is in the string by default since it's lower priority - /** - * Transition to be called if the view is dragged down - */ - var transitionExitReversed: Int = R.transition.kau_about_return_downward + + var transitionExitTop: Int = R.transition.kau_exit_slide_top + var transitionExitBottom: Int = R.transition.kau_exit_slide_bottom } /** @@ -174,8 +171,9 @@ abstract class AboutActivityBase(val rClass: Class<*>?, val configBuilder: Confi val v = layoutInflater.inflate(R.layout.kau_recycler_detached_background, parent, false) val recycler = v.findViewById(R.id.kau_recycler_detached) libRecycler = recycler + recycler.withMarginDecoration(16, KAU_BOTTOM) recycler.adapter = libAdapter - recycler.itemAnimator = FadeScaleAnimator(itemDelayFactor = 0.2f).apply { addDuration = 300; interpolator = AnimHolder.decelerateInterpolator(this@AboutActivityBase) } + recycler.itemAnimator = KauAnimator(addAnimator = FadeScaleAnimatorAdd(scaleFactor = 0.7f, itemDelayFactor = 0.2f)).apply { addDuration = 300; interpolator = AnimHolder.decelerateInterpolator(this@AboutActivityBase) } val background = v.findViewById(R.id.kau_recycler_detached_background) if (configs.backgroundColor != null) background.setBackgroundColor(configs.backgroundColor!!.colorToForeground()) doAsync { diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt index b5e2c28..518cd54 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -49,6 +49,7 @@ class LibraryIItem(val lib: Library with(holder) { name.text = lib.libraryName creator.text = lib.author + @Suppress("DEPRECATION") description.text = if (lib.libraryDescription.isBlank()) lib.libraryDescription else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) Html.fromHtml(lib.libraryDescription, Html.FROM_HTML_MODE_LEGACY) diff --git a/about/src/main/res/layout/kau_iitem_library.xml b/about/src/main/res/layout/kau_iitem_library.xml index 1c3de5c..3ad4fb4 100644 --- a/about/src/main/res/layout/kau_iitem_library.xml +++ b/about/src/main/res/layout/kau_iitem_library.xml @@ -5,7 +5,6 @@ android:id="@+id/lib_item_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/kau_padding_normal" android:background="?android:selectableItemBackground" android:clickable="true"> diff --git a/about/src/main/res/transition/kau_about_return_downward.xml b/about/src/main/res/transition/kau_about_return_downward.xml deleted file mode 100644 index b040b1b..0000000 --- a/about/src/main/res/transition/kau_about_return_downward.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/about/src/main/res/transition/kau_about_return_upwards.xml b/about/src/main/res/transition/kau_about_return_upwards.xml deleted file mode 100644 index 64b3f5e..0000000 --- a/about/src/main/res/transition/kau_about_return_upwards.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/about/src/main/res/values/strings_about.xml b/about/src/main/res/values/strings_about.xml index 35ffeb2..f538e59 100644 --- a/about/src/main/res/values/strings_about.xml +++ b/about/src/main/res/values/strings_about.xml @@ -1,5 +1,5 @@ - 1.5 + 2.1 diff --git a/about/src/main/res/values/styles.xml b/about/src/main/res/values/styles.xml index 59b2470..f878950 100644 --- a/about/src/main/res/values/styles.xml +++ b/about/src/main/res/values/styles.xml @@ -1,9 +1,6 @@ - +