aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-17 15:20:42 -0700
committerAllan Wang <me@allanwang.ca>2017-06-17 15:20:42 -0700
commit9832aed0ea96312e59ed75c788a1b843f1947a7e (patch)
treeaf424e936418d7d1d4b503ab3c71371d5fc3b55f
parentf2edadc54659bd37ee61825c52c54cc693d63b2a (diff)
downloadkau-9832aed0ea96312e59ed75c788a1b843f1947a7e.tar.gz
kau-9832aed0ea96312e59ed75c788a1b843f1947a7e.tar.bz2
kau-9832aed0ea96312e59ed75c788a1b843f1947a7e.zip
Add animations
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefColorPicker.kt3
-rw-r--r--library/src/main/res/values/styles_animations.xml30
-rw-r--r--sample/src/main/AndroidManifest.xml2
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt2
-rw-r--r--sample/src/main/res/values/styles.xml4
5 files changed, 37 insertions, 4 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefColorPicker.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefColorPicker.kt
index 9917ffb..2ec0a34 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefColorPicker.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefColorPicker.kt
@@ -58,13 +58,12 @@ class KPrefColorPicker(val builder: KPrefColorContract) : KPrefItemBase<Int>(bui
* Default implementation of [KPrefColorContract]
*/
class KPrefColorBuilder(attributes: CoreAttributeContract,
- titleRes: Int,
+ override var titleRes: Int,
getter: () -> Int,
setter: (value: Int) -> Unit
) : KPrefColorContract, BaseContract<Int> by BaseBuilder<Int>(attributes, titleRes, getter, setter),
ColorContract by ColorBuilder() {
override var showPreview: Boolean = true
- override var titleRes: Int = -1
}
override fun getType(): Int = R.id.kau_item_pref_color_picker
diff --git a/library/src/main/res/values/styles_animations.xml b/library/src/main/res/values/styles_animations.xml
new file mode 100644
index 0000000..a991132
--- /dev/null
+++ b/library/src/main/res/values/styles_animations.xml
@@ -0,0 +1,30 @@
+<resources>
+
+ <style name="KauSlideIn" parent="@android:style/Animation.Activity">
+ <item name="android:activityOpenEnterAnimation">@anim/kau_slide_in_right</item>
+ <item name="android:activityCloseEnterAnimation">@anim/kau_slide_in_right</item>
+ <item name="android:taskOpenEnterAnimation">@anim/kau_slide_in_right</item>
+ <item name="android:taskCloseEnterAnimation">@anim/kau_slide_in_right</item>
+ <item name="android:taskToFrontEnterAnimation">@anim/kau_slide_in_right</item>
+ <item name="android:windowEnterAnimation">@anim/kau_slide_in_right</item>
+ </style>
+
+ <style name="KauSlideInSlideOut" parent="@style/KauSlideIn">
+ <item name="android:activityOpenExitAnimation">@anim/kau_slide_out_right</item>
+ <item name="android:activityCloseExitAnimation">@anim/kau_slide_out_right</item>
+ <item name="android:taskOpenExitAnimation">@anim/kau_slide_out_right</item>
+ <item name="android:taskCloseExitAnimation">@anim/kau_slide_out_right</item>
+ <item name="android:taskToFrontExitAnimation">@anim/kau_slide_out_right</item>
+ <item name="android:windowExitAnimation">@anim/kau_slide_out_right</item>
+ </style>
+
+ <style name="KauSlideInFadeOut" parent="@style/KauSlideIn">
+ <item name="android:activityOpenExitAnimation">@anim/kau_fade_out</item>
+ <item name="android:activityCloseExitAnimation">@anim/kau_fade_out</item>
+ <item name="android:taskOpenExitAnimation">@anim/kau_fade_out</item>
+ <item name="android:taskCloseExitAnimation">@anim/kau_fade_out</item>
+ <item name="android:taskToFrontExitAnimation">@anim/kau_fade_out</item>
+ <item name="android:windowExitAnimation">@anim/kau_fade_out</item>
+ </style>
+
+</resources>
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index 03ca52c..b8b54bf 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -21,7 +21,7 @@
</activity>
<activity
android:name=".AnimActivity"
- android:theme="@style/Theme.AppCompat" />
+ android:theme="@style/AppTheme.Slide" />
</application>
</manifest> \ No newline at end of file
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
index cb7c082..a03857a 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -102,7 +102,7 @@ class MainActivity : KPrefActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
- R.id.action_settings -> startActivitySlideIn(AnimActivity::class.java, clearStack = true)
+ R.id.action_settings -> startActivity(AnimActivity::class.java, clearStack = true)
else -> return super.onOptionsItemSelected(item)
}
return true
diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml
index ac2f9c8..781424d 100644
--- a/sample/src/main/res/values/styles.xml
+++ b/sample/src/main/res/values/styles.xml
@@ -16,4 +16,8 @@
<item name="windowNoTitle">true</item>
</style>
+ <style name="AppTheme.Slide" parent="AppTheme">
+ <item name="android:windowAnimationStyle">@style/KauSlideInSlideOut</item>
+ </style>
+
</resources>