diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-22 16:08:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-22 16:08:08 -0700 |
commit | 61d87976e8b29ed25061ae98743a6cf4f4274542 (patch) | |
tree | fa4d9bca5fe1b9478ba2f1cc1e6c7d8d18bf15ce /core-ui/src | |
parent | 8f2b5ac043f47cc44f43c3788d1377083fb339a2 (diff) | |
download | kau-61d87976e8b29ed25061ae98743a6cf4f4274542.tar.gz kau-61d87976e8b29ed25061ae98743a6cf4f4274542.tar.bz2 kau-61d87976e8b29ed25061ae98743a6cf4f4274542.zip |
Support sdk 19 where possible and add image picker (#10)3.0
* Fix plural
* Switch to long
* Test plural again
* Comment
* Major update to image picker and view utils
* Make image activity full screen
* Update min sdk and prefix
* Lower sdk requirement and make string private
* Bring kpref activity to sdk 19
Diffstat (limited to 'core-ui/src')
-rw-r--r-- | core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt | 14 | ||||
-rw-r--r-- | core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/MeasuredImageView.kt | 5 | ||||
-rw-r--r-- | core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt | 3 | ||||
-rw-r--r-- | core-ui/src/main/res-public/values-v21/styles.xml (renamed from core-ui/src/main/res/values/styles.xml) | 6 | ||||
-rw-r--r-- | core-ui/src/main/res-public/values/colors.xml | 4 | ||||
-rw-r--r-- | core-ui/src/main/res-public/values/public.xml | 8 | ||||
-rw-r--r-- | core-ui/src/main/res-public/values/styles.xml | 19 | ||||
-rw-r--r-- | core-ui/src/main/res/drawable/kau_selectable_white.xml | 6 | ||||
-rw-r--r-- | core-ui/src/main/res/values/colors.xml | 6 | ||||
-rw-r--r-- | core-ui/src/main/res/values/strings.xml | 4 |
10 files changed, 41 insertions, 34 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) { diff --git a/core-ui/src/main/res/values/styles.xml b/core-ui/src/main/res-public/values-v21/styles.xml index dfbb6d3..fe2c9bf 100644 --- a/core-ui/src/main/res/values/styles.xml +++ b/core-ui/src/main/res-public/values-v21/styles.xml @@ -1,7 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="no"?> <resources> - <style name="Kau" parent="Theme.AppCompat.NoActionBar"/> - <style name="Kau.Translucent"> <item name="android:windowBackground">@color/kau_shadow_overlay</item> <item name="android:colorBackgroundCacheHint">@null</item> @@ -12,10 +10,6 @@ <item name="android:windowDrawsSystemBarBackgrounds">true</item> </style> - <style name="Kau.Translucent.NoAnimation"> - <item name="android:windowAnimationStyle">@null</item> - </style> - <style name="Kau.Translucent.SlideBottom"> <item name="android:windowEnterTransition">@transition/kau_enter_slide_bottom</item> <item name="android:windowReturnTransition">@transition/kau_exit_slide_bottom</item> diff --git a/core-ui/src/main/res-public/values/colors.xml b/core-ui/src/main/res-public/values/colors.xml new file mode 100644 index 0000000..82bf172 --- /dev/null +++ b/core-ui/src/main/res-public/values/colors.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<resources> + <color name="kau_shadow_overlay">#80000000</color> +</resources> diff --git a/core-ui/src/main/res-public/values/public.xml b/core-ui/src/main/res-public/values/public.xml new file mode 100644 index 0000000..59e34a6 --- /dev/null +++ b/core-ui/src/main/res-public/values/public.xml @@ -0,0 +1,8 @@ +<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_shadow_overlay' type='color' /> + <public name='Kau.Translucent' type='style' /> + <public name='Kau.Translucent.NoAnimation' type='style' /> + <public name='Kau.Translucent.SlideBottom' type='style' /> + <public name='Kau.Translucent.SlideTop' type='style' /> +</resources>
\ No newline at end of file diff --git a/core-ui/src/main/res-public/values/styles.xml b/core-ui/src/main/res-public/values/styles.xml new file mode 100644 index 0000000..583ede7 --- /dev/null +++ b/core-ui/src/main/res-public/values/styles.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<resources> + <style name="Kau.Translucent"> + <item name="android:windowBackground">@color/kau_shadow_overlay</item> + <item name="android:colorBackgroundCacheHint">@null</item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowIsFloating">false</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Kau.Translucent.NoAnimation"> + <item name="android:windowAnimationStyle">@null</item> + </style> + + <style name="Kau.Translucent.SlideBottom" /> + + <style name="Kau.Translucent.SlideTop" /> +</resources> diff --git a/core-ui/src/main/res/drawable/kau_selectable_white.xml b/core-ui/src/main/res/drawable/kau_selectable_white.xml deleted file mode 100644 index 942f149..0000000 --- a/core-ui/src/main/res/drawable/kau_selectable_white.xml +++ /dev/null @@ -1,6 +0,0 @@ -<ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="#40ffffff"> - <item android:id="@android:id/mask"> - <color android:color="@android:color/white" /> - </item> -</ripple>
\ No newline at end of file diff --git a/core-ui/src/main/res/values/colors.xml b/core-ui/src/main/res/values/colors.xml deleted file mode 100644 index 273d6f1..0000000 --- a/core-ui/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<resources> - <color name="kau_about_page_indicator_dark">#80ffffff</color> - <color name="kau_about_page_indicator_dark_selected">#fff</color> - <color name="kau_shadow_overlay">#80000000</color> -</resources> diff --git a/core-ui/src/main/res/values/strings.xml b/core-ui/src/main/res/values/strings.xml deleted file mode 100644 index 80e6233..0000000 --- a/core-ui/src/main/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="kau_blurrable_imageview">Blurrable ImageView</string> -</resources>
\ No newline at end of file |