aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-12-24 01:17:31 -0500
committerGitHub <noreply@github.com>2018-12-24 01:17:31 -0500
commitfb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b (patch)
treecc6d67461b6caa256043b9482f7646831d528a08 /sample/src/main/kotlin
parenta380adea1052d39f23c9c4d432a9380ce347d6c4 (diff)
downloadkau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.tar.gz
kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.tar.bz2
kau-fb90c4a4ab23f2fd246c29c1dde4d6e155a2e38b.zip
Enhancement/ktlint (#179)
* Add spotless dependency * Apply ktlint * Add license headers
Diffstat (limited to 'sample/src/main/kotlin')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt17
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt23
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt30
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt20
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt139
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt28
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt21
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt17
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt35
9 files changed, 247 insertions, 83 deletions
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
index 78f31ae..928070e 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import ca.allanwang.kau.about.AboutActivityBase
@@ -24,4 +39,4 @@ class AboutActivity : AboutActivityBase(R.string::class.java, {
descRes = R.string.about_kau
})
}
-} \ No newline at end of file
+}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
index ada60ca..a11a672 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.os.Bundle
@@ -17,7 +32,8 @@ class AdapterActivity : ElasticRecyclerActivity() {
override fun onCreate(savedInstanceState: Bundle?, configs: Configs): Boolean {
val adapter = ItemAdapter<IItem<*, *>>()
recycler.adapter = fastAdapter(adapter)
- adapter.add(listOf(
+ adapter.add(
+ listOf(
CardIItem {
titleRes = R.string.kau_text_copied
descRes = R.string.kau_lorem_ipsum
@@ -43,8 +59,9 @@ class AdapterActivity : ElasticRecyclerActivity() {
titleRes = R.string.kau_text_copied
button = "Test"
buttonClick = { toast("HI") }
- }))
+ })
+ )
setOutsideTapListener { finishAfterTransition() }
return true
}
-} \ No newline at end of file
+}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
index c0f928f..349e3d1 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.os.Bundle
@@ -10,7 +25,11 @@ import ca.allanwang.kau.permissions.kauRequestPermissions
import ca.allanwang.kau.swipe.SWIPE_EDGE_LEFT
import ca.allanwang.kau.swipe.kauSwipeOnCreate
import ca.allanwang.kau.swipe.kauSwipeOnDestroy
-import ca.allanwang.kau.utils.*
+import ca.allanwang.kau.utils.fullLinearRecycler
+import ca.allanwang.kau.utils.startActivity
+import ca.allanwang.kau.utils.toast
+import ca.allanwang.kau.utils.withAlpha
+import ca.allanwang.kau.utils.withSlideOut
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
/**
@@ -27,9 +46,9 @@ class AnimActivity : KauBaseActivity() {
setContentView(fullLinearRecycler(adapter).apply { setBackgroundColor(KPrefSample.bgColor.withAlpha(255)) })
adapter.add(listOf(
- PERMISSION_ACCESS_COARSE_LOCATION,
- PERMISSION_ACCESS_FINE_LOCATION,
- PERMISSION_CAMERA
+ PERMISSION_ACCESS_COARSE_LOCATION,
+ PERMISSION_ACCESS_FINE_LOCATION,
+ PERMISSION_CAMERA
).map { PermissionCheckbox(it) })
adapter.withOnClickListener { _, _, item, _ ->
KL.d { "Perm Click" }
@@ -54,5 +73,4 @@ class AnimActivity : KauBaseActivity() {
withSlideOut(this@AnimActivity)
})
}
-
-} \ No newline at end of file
+}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
index 0c243e4..0f20880 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.graphics.Color
@@ -8,7 +23,7 @@ import ca.allanwang.kau.kpref.kpref
* Created by Allan Wang on 2017-06-07.
*/
object KPrefSample : KPref() {
- var version: Int by kpref("version", -1)
+ var version: Int by kpref("version", -1)
var textColor: Int by kpref("TEXT_COLOR", Color.WHITE)
var accentColor: Int by kpref("ACCENT_COLOR", 0xffff8900.toInt())
var bgColor: Int by kpref("BG_COLOR", 0xff303030.toInt())
@@ -19,5 +34,4 @@ object KPrefSample : KPref() {
var seekbar: Int by kpref("seekbar", 20)
var time12: Int by kpref("time_12", 315)
var time24: Int by kpref("time_24", 2220)
-
-} \ 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 6cd9776..25b5c16 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.content.Context
@@ -17,11 +32,15 @@ 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.*
+import ca.allanwang.kau.utils.materialDialog
+import ca.allanwang.kau.utils.navigationBarColor
+import ca.allanwang.kau.utils.startActivity
+import ca.allanwang.kau.utils.string
+import ca.allanwang.kau.utils.toast
+import ca.allanwang.kau.utils.withSceneTransitionAnimation
import ca.allanwang.kau.xml.showChangelog
import com.mikepenz.google_material_typeface_library.GoogleMaterial
-
class MainActivity : KPrefActivity() {
var searchView: SearchView? = null
@@ -30,51 +49,53 @@ class MainActivity : KPrefActivity() {
//some of the most common english words for show
val wordBank: List<String> by lazy {
- listOf("the", "name", "of", "very", "to", "through",
- "and", "just", "a", "form", "in", "much", "is", "great", "it", "think", "you", "say",
- "that", "help", "he", "low", "was", "line", "for", "before", "on", "turn", "are", "cause",
- "with", "same", "as", "mean", "I", "differ", "his", "move", "they", "right", "be", "boy",
- "at", "old", "one", "too", "have", "does", "this", "tell", "from", "sentence", "or", "set",
- "had", "three", "by", "want", "hot", "air", "but", "well", "some", "also", "what", "play",
- "there", "small", "we", "end", "can", "put", "out", "home", "other", "read", "were", "hand",
- "all", "port", "your", "large", "when", "spell", "up", "add", "use", "even", "word", "land",
- "how", "here", "said", "must", "an", "big", "each", "high", "she", "such", "which", "follow",
- "do", "act", "their", "why", "time", "ask", "if", "men", "will", "change", "way", "went",
- "about", "light", "many", "kind", "then", "off", "them", "need", "would", "house", "write",
- "picture", "like", "try", "so", "us", "these", "again", "her", "animal", "long", "point",
- "make", "mother", "thing", "world", "see", "near", "him", "build", "two", "self", "has",
- "earth", "look", "father", "more", "head", "day", "stand", "could", "own", "go", "page",
- "come", "should", "did", "country", "my", "found", "sound", "answer", "no", "school", "most",
- "grow", "number", "study", "who", "still", "over", "learn", "know", "plant", "water", "cover",
- "than", "food", "call", "sun", "first", "four", "people", "thought", "may", "let", "down", "keep",
- "side", "eye", "been", "never", "now", "last", "find", "door", "any", "between", "new", "city",
- "work", "tree", "part", "cross", "take", "since", "get", "hard", "place", "start", "made",
- "might", "live", "story", "where", "saw", "after", "far", "back", "sea", "little", "draw",
- "only", "left", "round", "late", "man", "run", "year", "don't", "came", "while", "show",
- "press", "every", "close", "good", "night", "me", "real", "give", "life", "our", "few", "under",
- "stopRankWordRankWord", "open", "ten", "seem", "simple", "together", "several", "next",
- "vowel", "white", "toward", "children", "war", "begin", "lay", "got", "against", "walk", "pattern",
- "example", "slow", "ease", "center", "paper", "love", "often", "person", "always", "money",
- "music", "serve", "those", "appear", "both", "road", "mark", "map", "book", "science", "letter",
- "rule", "until", "govern", "mile", "pull", "river", "cold", "car", "notice", "feet", "voice",
- "care", "fall", "second", "power", "group", "town", "carry", "fine", "took", "certain", "rain",
- "fly", "eat", "unit", "room", "lead", "friend", "cry", "began", "dark", "idea", "machine",
- "fish", "note", "mountain", "wait", "north", "plan", "once", "figure", "base", "star", "hear",
- "box", "horse", "noun", "cut", "field", "sure", "rest", "watch", "correct", "color", "able",
- "face", "pound", "wood", "done", "main", "beauty", "enough", "drive", "plain", "stood", "girl",
- "contain", "usual", "front", "young", "teach", "ready", "week", "above", "final", "ever", "gave",
- "red", "green", "list", "oh", "though", "quick", "feel", "develop", "talk", "sleep", "bird",
- "warm", "soon", "free", "body", "minute", "dog", "strong", "family", "special", "direct", "mind",
- "pose", "behind", "leave", "clear", "song", "tail", "measure", "produce", "state", "fact", "product",
- "street", "black", "inch", "short", "lot", "numeral", "nothing", "class", "course", "wind", "stay",
- "question", "wheel", "happen", "full", "complete", "force", "ship", "blue", "area", "object", "half",
- "decide", "rock", "surface", "order", "deep", "fire", "moon", "south", "island", "problem", "foot",
- "piece", "yet", "told", "busy", "knew", "test", "pass", "record", "farm", "boat", "top", "common",
- "whole", "gold", "king", "possible", "size", "plane", "heard", "age", "best", "dry", "hour", "wonder",
- "better", "laugh", "true.", "thousand", "during", "ago", "hundred", "ran", "am", "check", "remember",
- "game", "step", "shape", "early", "yes", "hold", "hot", "west", "miss", "ground", "brought", "interest",
- "heat", "reach", "snow", "fast", "bed", "five", "bring", "sing", "sit", "listen", "perhaps", "six",
- "fill", "table", "east", "travel", "weight", "less", "language", "morning", "among")
+ listOf(
+ "the", "name", "of", "very", "to", "through",
+ "and", "just", "a", "form", "in", "much", "is", "great", "it", "think", "you", "say",
+ "that", "help", "he", "low", "was", "line", "for", "before", "on", "turn", "are", "cause",
+ "with", "same", "as", "mean", "I", "differ", "his", "move", "they", "right", "be", "boy",
+ "at", "old", "one", "too", "have", "does", "this", "tell", "from", "sentence", "or", "set",
+ "had", "three", "by", "want", "hot", "air", "but", "well", "some", "also", "what", "play",
+ "there", "small", "we", "end", "can", "put", "out", "home", "other", "read", "were", "hand",
+ "all", "port", "your", "large", "when", "spell", "up", "add", "use", "even", "word", "land",
+ "how", "here", "said", "must", "an", "big", "each", "high", "she", "such", "which", "follow",
+ "do", "act", "their", "why", "time", "ask", "if", "men", "will", "change", "way", "went",
+ "about", "light", "many", "kind", "then", "off", "them", "need", "would", "house", "write",
+ "picture", "like", "try", "so", "us", "these", "again", "her", "animal", "long", "point",
+ "make", "mother", "thing", "world", "see", "near", "him", "build", "two", "self", "has",
+ "earth", "look", "father", "more", "head", "day", "stand", "could", "own", "go", "page",
+ "come", "should", "did", "country", "my", "found", "sound", "answer", "no", "school", "most",
+ "grow", "number", "study", "who", "still", "over", "learn", "know", "plant", "water", "cover",
+ "than", "food", "call", "sun", "first", "four", "people", "thought", "may", "let", "down", "keep",
+ "side", "eye", "been", "never", "now", "last", "find", "door", "any", "between", "new", "city",
+ "work", "tree", "part", "cross", "take", "since", "get", "hard", "place", "start", "made",
+ "might", "live", "story", "where", "saw", "after", "far", "back", "sea", "little", "draw",
+ "only", "left", "round", "late", "man", "run", "year", "don't", "came", "while", "show",
+ "press", "every", "close", "good", "night", "me", "real", "give", "life", "our", "few", "under",
+ "stopRankWordRankWord", "open", "ten", "seem", "simple", "together", "several", "next",
+ "vowel", "white", "toward", "children", "war", "begin", "lay", "got", "against", "walk", "pattern",
+ "example", "slow", "ease", "center", "paper", "love", "often", "person", "always", "money",
+ "music", "serve", "those", "appear", "both", "road", "mark", "map", "book", "science", "letter",
+ "rule", "until", "govern", "mile", "pull", "river", "cold", "car", "notice", "feet", "voice",
+ "care", "fall", "second", "power", "group", "town", "carry", "fine", "took", "certain", "rain",
+ "fly", "eat", "unit", "room", "lead", "friend", "cry", "began", "dark", "idea", "machine",
+ "fish", "note", "mountain", "wait", "north", "plan", "once", "figure", "base", "star", "hear",
+ "box", "horse", "noun", "cut", "field", "sure", "rest", "watch", "correct", "color", "able",
+ "face", "pound", "wood", "done", "main", "beauty", "enough", "drive", "plain", "stood", "girl",
+ "contain", "usual", "front", "young", "teach", "ready", "week", "above", "final", "ever", "gave",
+ "red", "green", "list", "oh", "though", "quick", "feel", "develop", "talk", "sleep", "bird",
+ "warm", "soon", "free", "body", "minute", "dog", "strong", "family", "special", "direct", "mind",
+ "pose", "behind", "leave", "clear", "song", "tail", "measure", "produce", "state", "fact", "product",
+ "street", "black", "inch", "short", "lot", "numeral", "nothing", "class", "course", "wind", "stay",
+ "question", "wheel", "happen", "full", "complete", "force", "ship", "blue", "area", "object", "half",
+ "decide", "rock", "surface", "order", "deep", "fire", "moon", "south", "island", "problem", "foot",
+ "piece", "yet", "told", "busy", "knew", "test", "pass", "record", "farm", "boat", "top", "common",
+ "whole", "gold", "king", "possible", "size", "plane", "heard", "age", "best", "dry", "hour", "wonder",
+ "better", "laugh", "true.", "thousand", "during", "ago", "hundred", "ran", "am", "check", "remember",
+ "game", "step", "shape", "early", "yes", "hold", "hot", "west", "miss", "ground", "brought", "interest",
+ "heat", "reach", "snow", "fast", "bed", "five", "bring", "sing", "sit", "listen", "perhaps", "six",
+ "fill", "table", "east", "travel", "weight", "less", "language", "morning", "among"
+ )
}
const val REQUEST_MEDIA = 27
@@ -93,14 +114,17 @@ class MainActivity : KPrefActivity() {
* This is how the setup looks like with all the proper tags
*/
checkbox(title = R.string.checkbox_1, getter = KPrefSample::check1, setter = { KPrefSample.check1 = it },
- builder = {
- descRes = R.string.desc
- })
+ builder = {
+ descRes = R.string.desc
+ })
/**
* Since we know the order, we may omit the tags
*/
- checkbox(R.string.checkbox_2, KPrefSample::check2, { KPrefSample.check2 = it; reloadByTitle(R.string.checkbox_3) })
+ checkbox(
+ R.string.checkbox_2,
+ KPrefSample::check2,
+ { KPrefSample.check2 = it; reloadByTitle(R.string.checkbox_3) })
/**
* Since the builder is the last argument and is a lambda, we may write the setup cleanly like so:
@@ -143,7 +167,6 @@ class MainActivity : KPrefActivity() {
input("Type here", item.pref, { _, input -> item.pref = input.toString() })
inputRange(0, 20)
}
-
}
}
@@ -189,7 +212,10 @@ class MainActivity : KPrefActivity() {
* Showcases a little trick. The id for reloading is [R.string.checkbox_2],
* but the title displayed is still [R.string.checkbox_3]
*/
- checkbox(R.string.checkbox_2, KPrefSample::check2, { KPrefSample.check2 = it; reloadByTitle(R.string.checkbox_3) }) {
+ checkbox(
+ R.string.checkbox_2,
+ KPrefSample::check2,
+ { KPrefSample.check2 = it; reloadByTitle(R.string.checkbox_3) }) {
titleFun = { R.string.checkbox_3 }
descRes = R.string.kau_lorem_ipsum
}
@@ -208,7 +234,6 @@ class MainActivity : KPrefActivity() {
descRes = R.string.time_desc_24
use24HourFormat = true
}
-
}
fun subPrefs(): KPrefAdapterBuilder.() -> Unit = {
@@ -297,6 +322,6 @@ class MainActivity : KPrefActivity() {
}
inline fun <reified T : AboutActivityBase> Context.kauLaunchAbout() =
- startActivity<T>(bundleBuilder = {
- withSceneTransitionAnimation(this@kauLaunchAbout)
- }) \ No newline at end of file
+ startActivity<T>(bundleBuilder = {
+ withSceneTransitionAnimation(this@kauLaunchAbout)
+ })
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt
index 820d22f..0e6b22f 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt
@@ -1,9 +1,29 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.content.Context
import android.net.Uri
import androidx.core.content.FileProvider
-import ca.allanwang.kau.mediapicker.*
+import ca.allanwang.kau.mediapicker.MediaActionCamera
+import ca.allanwang.kau.mediapicker.MediaActionGallery
+import ca.allanwang.kau.mediapicker.MediaPickerActivityBase
+import ca.allanwang.kau.mediapicker.MediaPickerActivityOverlayBase
+import ca.allanwang.kau.mediapicker.MediaType
+import ca.allanwang.kau.mediapicker.createMediaFile
import java.io.File
/**
@@ -13,8 +33,8 @@ private fun actions(multiple: Boolean) = listOf(object : MediaActionCamera() {
override fun createFile(context: Context): File = createMediaFile("KAU", ".jpg")
- override fun createUri(context: Context, file: File): Uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file)
-
+ override fun createUri(context: Context, file: File): Uri =
+ FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file)
}, MediaActionGallery(multiple))
class ImagePickerActivity : MediaPickerActivityBase(MediaType.IMAGE, actions(true))
@@ -23,4 +43,4 @@ class ImagePickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.IMAG
class VideoPickerActivity : MediaPickerActivityBase(MediaType.VIDEO, actions(true))
-class VideoPickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.VIDEO, actions(false)) \ No newline at end of file
+class VideoPickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.VIDEO, actions(false))
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt
index 09401cd..025179d 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt
@@ -1,9 +1,24 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
-import androidx.recyclerview.widget.RecyclerView
import android.view.View
import android.widget.CheckBox
import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.iitems.KauIItem
import ca.allanwang.kau.utils.hasPermission
@@ -11,7 +26,7 @@ import ca.allanwang.kau.utils.hasPermission
* Created by Allan Wang on 2017-07-03.
*/
class PermissionCheckbox(val permission: String) : KauIItem<PermissionCheckbox, PermissionCheckbox.ViewHolder>(
- R.layout.permission_checkbox, { ViewHolder(it) }) {
+ R.layout.permission_checkbox, { ViewHolder(it) }) {
override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) {
super.bindView(holder, payloads)
@@ -25,4 +40,4 @@ class PermissionCheckbox(val permission: String) : KauIItem<PermissionCheckbox,
val text: TextView = v.findViewById(R.id.perm_text)
val checkbox: CheckBox = v.findViewById(R.id.perm_checkbox)
}
-} \ No newline at end of file
+}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt
index 6060245..6e6d718 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.app.Application
@@ -10,4 +25,4 @@ class SampleApp : Application() {
super.onCreate()
KPrefSample.initialize(this, "pref_sample")
}
-} \ No newline at end of file
+}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt
index 4197b6d..5107e18 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/SwipeActivity.kt
@@ -1,10 +1,35 @@
+/*
+ * Copyright 2018 Allan Wang
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package ca.allanwang.kau.sample
import android.app.Activity
import android.os.Bundle
import ca.allanwang.kau.internal.KauBaseActivity
-import ca.allanwang.kau.swipe.*
-import ca.allanwang.kau.utils.*
+import ca.allanwang.kau.swipe.SWIPE_EDGE_BOTTOM
+import ca.allanwang.kau.swipe.SWIPE_EDGE_LEFT
+import ca.allanwang.kau.swipe.SWIPE_EDGE_RIGHT
+import ca.allanwang.kau.swipe.SWIPE_EDGE_TOP
+import ca.allanwang.kau.swipe.kauSwipeFinish
+import ca.allanwang.kau.swipe.kauSwipeOnCreate
+import ca.allanwang.kau.swipe.kauSwipeOnDestroy
+import ca.allanwang.kau.utils.darken
+import ca.allanwang.kau.utils.navigationBarColor
+import ca.allanwang.kau.utils.rndColor
+import ca.allanwang.kau.utils.startActivity
+import ca.allanwang.kau.utils.statusBarColor
import kotlinx.android.synthetic.main.activity_swipe.*
/**
@@ -24,8 +49,8 @@ class SwipeActivity : KauBaseActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_swipe)
listOf(swipe_from_left, swipe_from_right, swipe_from_top, swipe_from_bottom)
- .zip(listOf(SWIPE_EDGE_LEFT, SWIPE_EDGE_RIGHT, SWIPE_EDGE_TOP, SWIPE_EDGE_BOTTOM))
- .forEach { (button, edge) -> button.setOnClickListener { startActivityWithEdge(edge) } }
+ .zip(listOf(SWIPE_EDGE_LEFT, SWIPE_EDGE_RIGHT, SWIPE_EDGE_TOP, SWIPE_EDGE_BOTTOM))
+ .forEach { (button, edge) -> button.setOnClickListener { startActivityWithEdge(edge) } }
val flag = intent.getIntExtra(SWIPE_EDGE, -1)
swipe_toolbar.title = when (flag) {
SWIPE_EDGE_LEFT -> "Left Edge Swipe"
@@ -54,4 +79,4 @@ class SwipeActivity : KauBaseActivity() {
override fun onBackPressed() {
kauSwipeFinish()
}
-} \ No newline at end of file
+}