aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-05 14:49:47 -0700
committerGitHub <noreply@github.com>2017-08-05 14:49:47 -0700
commitc707d42b311f96cbabc1971f98598c8b8922ba16 (patch)
tree3c592c2a8bdd2fb759e3632adf038b5d7cecfabb /sample/src/main
parentbafc1996d803862d30a2c7d0c402d30c79c4f647 (diff)
downloadkau-c707d42b311f96cbabc1971f98598c8b8922ba16.tar.gz
kau-c707d42b311f96cbabc1971f98598c8b8922ba16.tar.bz2
kau-c707d42b311f96cbabc1971f98598c8b8922ba16.zip
Swipe (#24)
* Test emulator * Update readme * Update fastadapter and about listing * Make faq parser asynchronous * Modularize about panels * Add basis for faq * Test and finalize the faq panel * Update readme * Update changelog * Remove emulator for now * Update sample * Change back to manual versioning to avoid suggestion errors * Add awesome-kt banner * Fix faq background color * Fix merge conflicts 2 * Add waffle badge * Update readme * Fix lint * Create FileUtils and NotificationUtils * Remove frost hardcode * Fix simple date * Update swipe to use weak references * Initializing test dependencies * Update to gradle 4.1 * Fix lint warnings * Drop back down and fix errors * Finalize swipe with example * Finalize weak reference and ordering * Update test code * Make loggers inline
Diffstat (limited to 'sample/src/main')
-rw-r--r--sample/src/main/AndroidManifest.xml3
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt5
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt75
-rw-r--r--sample/src/main/res/layout/activity_swipe.xml74
-rw-r--r--sample/src/main/res/values/strings.xml1
-rw-r--r--sample/src/main/res/values/styles.xml5
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml12
7 files changed, 171 insertions, 4 deletions
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index a3bbf45..ee6cc86 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -26,6 +26,9 @@
android:name=".AnimActivity"
android:theme="@style/Kau.Translucent" />
<activity
+ android:name=".SwipeActivity"
+ android:theme="@style/Kau.Translucent" />
+ <activity
android:name=".AboutActivity"
android:theme="@style/Kau.About" />
<activity
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 62ca8a3..51b8530 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -14,6 +14,7 @@ import ca.allanwang.kau.mediapicker.kauOnMediaPickerResult
import ca.allanwang.kau.searchview.SearchItem
import ca.allanwang.kau.searchview.SearchView
import ca.allanwang.kau.searchview.bindSearchView
+import ca.allanwang.kau.swipe.SWIPE_EDGE_LEFT
import ca.allanwang.kau.ui.views.RippleCanvas
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.navigationBarColor
@@ -164,8 +165,8 @@ class MainActivity : KPrefActivity() {
descRes = R.string.sub_item_desc
}
- plainText(R.string.image_showcase) {
- onClick = { _, _, _ -> kauLaunchMediaPicker(ImagePickerActivity::class.java, REQUEST_MEDIA); false }
+ plainText(R.string.swipe_showcase) {
+ onClick = { _, _, _ -> startActivityWithEdge(SWIPE_EDGE_LEFT); false }
}
plainText(R.string.video_overlay_showcase) {
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt
new file mode 100644
index 0000000..cba9ccd
--- /dev/null
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt
@@ -0,0 +1,75 @@
+package ca.allanwang.kau.sample
+
+import android.app.Activity
+import android.os.Bundle
+import android.support.v7.widget.Toolbar
+import android.view.ViewGroup
+import android.widget.Button
+import ca.allanwang.kau.internal.KauBaseActivity
+import ca.allanwang.kau.swipe.*
+import ca.allanwang.kau.utils.*
+
+/**
+ * Created by Allan Wang on 2017-08-05.
+ */
+private const val SWIPE_EDGE = "swipe_edge"
+
+fun Activity.startActivityWithEdge(flag: Int) {
+ startActivity(SwipeActivity::class.java) {
+ putExtra(SWIPE_EDGE, flag)
+ }
+}
+
+class SwipeActivity : KauBaseActivity() {
+
+ val toolbar: Toolbar by bindView(R.id.swipe_toolbar)
+ val container: ViewGroup by bindView(R.id.swipe_container)
+ val directions: List<Button> by bindViews(R.id.swipe_from_left, R.id.swipe_from_right, R.id.swipe_from_top, R.id.swipe_from_bottom)
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_swipe)
+ directions.forEach {
+ val swipeEdge = when (it.id) {
+ R.id.swipe_from_left -> SWIPE_EDGE_LEFT
+ R.id.swipe_from_right -> SWIPE_EDGE_RIGHT
+ R.id.swipe_from_top -> SWIPE_EDGE_TOP
+ R.id.swipe_from_bottom -> SWIPE_EDGE_BOTTOM
+ else -> -1
+ }
+ it.setOnClickListener { startActivityWithEdge(swipeEdge) }
+ }
+ val flag = intent.getIntExtra(SWIPE_EDGE, -1)
+ kauSwipeOnCreate {
+ edgeFlag = flag
+ }
+ toolbar.title = when (flag) {
+ SWIPE_EDGE_LEFT -> "Left Edge Swipe"
+ SWIPE_EDGE_RIGHT -> "Right Edge Swipe"
+ SWIPE_EDGE_TOP -> "Top Edge Swipe"
+ SWIPE_EDGE_BOTTOM -> "Bottom Edge Swipe"
+ else -> "Invalid Edge Swipe"
+ }
+ setSupportActionBar(toolbar)
+ val headerColor = rndColor.darken(0.6f)
+ toolbar.setBackgroundColor(headerColor)
+ statusBarColor = headerColor
+ val bg = headerColor.darken(0.2f)
+ container.setBackgroundColor(bg)
+ navigationBarColor = bg
+ }
+
+ override fun onPostCreate(savedInstanceState: Bundle?) {
+ super.onPostCreate(savedInstanceState)
+ kauSwipeOnPostCreate()
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ kauSwipeOnDestroy()
+ }
+
+ override fun onBackPressed() {
+ kauSwipeFinish()
+ }
+} \ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_swipe.xml b/sample/src/main/res/layout/activity_swipe.xml
new file mode 100644
index 0000000..c65bebc
--- /dev/null
+++ b/sample/src/main/res/layout/activity_swipe.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/swipe_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".SwipeActivity"
+ tools:ignore="HardcodedText">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/swipe_toolbar"
+ android:layout_width="0dp"
+ android:layout_height="?attr/actionBarSize"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <Button
+ android:id="@+id/swipe_from_left"
+ style="@style/ClearButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="With left"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.25"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/swipe_toolbar"
+ app:layout_constraintVertical_bias="0.5" />
+
+ <Button
+ android:id="@+id/swipe_from_right"
+ style="@style/ClearButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="With right"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.75"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/swipe_toolbar"
+ app:layout_constraintVertical_bias="0.5" />
+
+
+ <Button
+ android:id="@+id/swipe_from_top"
+ style="@style/ClearButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="With top"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/swipe_toolbar"
+ app:layout_constraintVertical_bias="0.25" />
+
+
+ <Button
+ android:id="@+id/swipe_from_bottom"
+ style="@style/ClearButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="With bottom"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/swipe_toolbar"
+ app:layout_constraintVertical_bias="0.75" />
+
+
+</android.support.constraint.ConstraintLayout> \ No newline at end of file
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index 11a897a..086b27b 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -19,6 +19,7 @@
<string name="sub_item_desc">Press this to view the next subset of preferences</string>
<string name="your_email">your.email@here.com</string>
<string name="your_subject">Your subject</string>
+ <string name="swipe_showcase">Swipe Showcase</string>
<string name="image_showcase">Image Showcase</string>
<string name="video_overlay_showcase">Video Overlay Showcase</string>
<string name="adapter_showcase">Adapter Showcase</string>
diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml
index 15c1745..e488cec 100644
--- a/sample/src/main/res/values/styles.xml
+++ b/sample/src/main/res/values/styles.xml
@@ -23,4 +23,9 @@
<item name="android:windowAnimationStyle">@style/KauSlideInSlideOutRight</item>
</style>
+ <style name="ClearButton">
+ <item name="android:background">?android:selectableItemBackground</item>
+ <item name="android:padding">@dimen/kau_padding_normal</item>
+ </style>
+
</resources>
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index df6ec2b..d505bcf 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -6,10 +6,18 @@
<item text="" />
-->
+ <version title="v3.2.4"/>
+ <item text=":core: Fix FAQ background" />
+ <item text=":core: Create FileUtils" />
+ <item text=":core: Create NotificationUtils" />
+ <item text=":core-ui: Move reactive libs to :searchview:" />
+ <item text="" />
+ <item text="" />
+
<version title="v3.2.3"/>
<item text=":about: Modularize everything" />
- <item text=":about: Create faq panel" />
- <item text=":core: Create faq parser" />
+ <item text=":about: Create FAQ panel" />
+ <item text=":core: Create FAQ parser" />
<item text=":core: Create collapsible view delegate" />
<item text=":mediapicker: Allow for prefetching by default for videos" />