aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/gradle.xml2
-rw-r--r--.idea/misc.xml2
-rw-r--r--.idea/modules.xml2
-rw-r--r--README.md309
-rw-r--r--about/README.md28
-rw-r--r--adapter/README.md11
-rw-r--r--colorpicker/README.md7
-rw-r--r--core-ui/README.md29
-rw-r--r--core/README.md162
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt7
-rw-r--r--imagepicker/README.md3
-rw-r--r--kpref-activity/README.md69
-rw-r--r--sample/build.gradle2
-rw-r--r--sample/src/main/res/xml/changelog.xml4
-rw-r--r--searchview/.gitignore (renamed from searchbar/.gitignore)0
-rw-r--r--searchview/README.md13
-rw-r--r--searchview/build.gradle (renamed from searchbar/build.gradle)0
-rw-r--r--searchview/progress-proguard.txt (renamed from searchbar/progress-proguard.txt)0
-rw-r--r--searchview/src/main/AndroidManifest.xml (renamed from searchbar/src/main/AndroidManifest.xml)0
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt (renamed from searchbar/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt)0
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt (renamed from searchbar/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt)0
-rw-r--r--searchview/src/main/res/layout/kau_search_iitem.xml (renamed from searchbar/src/main/res/layout/kau_search_iitem.xml)0
-rw-r--r--searchview/src/main/res/layout/kau_search_view.xml (renamed from searchbar/src/main/res/layout/kau_search_view.xml)0
-rw-r--r--searchview/src/main/res/values/dimens.xml (renamed from searchbar/src/main/res/values/dimens.xml)0
-rw-r--r--searchview/src/main/res/values/ids.xml (renamed from searchbar/src/main/res/values/ids.xml)0
-rw-r--r--settings.gradle2
26 files changed, 398 insertions, 254 deletions
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 4200089..a9e4cd2 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -16,7 +16,7 @@
<option value="$PROJECT_DIR$/imagepicker" />
<option value="$PROJECT_DIR$/kpref-activity" />
<option value="$PROJECT_DIR$/sample" />
- <option value="$PROJECT_DIR$/searchbar" />
+ <option value="$PROJECT_DIR$/searchview" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7319f02..085136f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -53,7 +53,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
diff --git a/.idea/modules.xml b/.idea/modules.xml
index c4694c5..15d01d0 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -11,7 +11,7 @@
<module fileurl="file://$PROJECT_DIR$/imagepicker/imagepicker.iml" filepath="$PROJECT_DIR$/imagepicker/imagepicker.iml" />
<module fileurl="file://$PROJECT_DIR$/kpref-activity/kpref-activity.iml" filepath="$PROJECT_DIR$/kpref-activity/kpref-activity.iml" />
<module fileurl="file://$PROJECT_DIR$/sample/sample.iml" filepath="$PROJECT_DIR$/sample/sample.iml" />
- <module fileurl="file://$PROJECT_DIR$/searchbar/searchbar.iml" filepath="$PROJECT_DIR$/searchbar/searchbar.iml" />
+ <module fileurl="file://$PROJECT_DIR$/searchview/searchview.iml" filepath="$PROJECT_DIR$/searchview/searchview.iml" />
</modules>
</component>
</project> \ No newline at end of file
diff --git a/README.md b/README.md
index fe3dd3e..ef61110 100644
--- a/README.md
+++ b/README.md
@@ -26,265 +26,82 @@ allprojects {
```
And add the following dependencies (You can use a specific version, commit, or -SNAPSHOT):
+Note that only core is required if you want the basic features.
+Note that if you use any particular submodule, it will automatically include all of its necessary submodules.
```gradle
dependencies {
-
+ //All submodules extend this
compile "ca.allanwang.kau:core:$KAU"
+ //All submodules with extensive ui extend this
+ compile "ca.allanwang.kau:core-ui:$KAU"
- //Optional addition for image picker
+ compile "ca.allanwang.kau:about:$KAU"
+ compile "ca.allanwang.kau:colorpicker:$KAU"
compile "ca.allanwang.kau:imagepicker:$KAU"
+ compile "ca.allanwang.kau:kpref-activity:$KAU"
+ compile "ca.allanwang.kau:searchview:$KAU"
}
```
-----------
-# Features
-* [KPrefs](#kprefs)
-* [KPref Items](#kpref-items)
-* [Changelog XML](#changelog)
-* [Search View](#search-view)
-* [Ripple Canvas](#ripple-canvas)
-* [About Activity](#about-activity)
-* [Timber Logger](#timber-logger)
-* [Extensions](#extensions)
-* [Email Builder](#email-builder)
-
-<a name="kprefs"></a>
-## KPrefs
-
-A typical SharedPreference contains items that look like so:
-
-```Java
-class MyPrefs {
- public static final String TEXT_COLOR = "TEXT_COLOR";
-
- private static SharedPreference prefs = ...
-
- public static void setTextColor(int color) {
- prefs.edit().putInt(TEXT_COLOR, color).apply();
- }
-
- public static int getTextColor() {
- prefs.getInt(TEXT_COLOR, Color.WHITE);
- }
-}
-```
-
-KPrefs greatly simplifies it by using Kotlin's object pattern and delegates to achieve the following:
-
-```Kotlin
-object MyPrefs : KPref() {
- var textColor: Int by kpref("TEXT_COLOR", Color.WHITE)
- var bgColor: Int by kpref("BG_COLOR", Color.BLACK)
- var isFirstLaunch: Boolean by kpref("IS_FIRST_LAUNCH", true)
- ...
-}
-```
-
-By using `KPrefSample.textColor = Color.RED` or `textView.setTextColor(KPrefSample.textColor)` we can effectively set and save the value.
-
-The values are retrieved lazily and are only done so once; future retrievals will be done with a local value, and updating a preference will both save it in the SharedPreference and update it locally.
-
-The object inherits the initializer method `fun initialize(c: Context, preferenceName: String)`, which must be invoked (preferably in the Application class) before using a preference.
-
-There is also a `reset()` method to clear the local values and have them retrieve from the SharedPreference again
-
-<a name="kpref-items"></a>
-## KPref Items
-
-KAU supports Preferences that are created without xmls and through AppCompat.
-The items are backed by a [FastAdapter](https://github.com/mikepenz/FastAdapter) and support [iicons](https://github.com/mikepenz/Android-Iconics)
-
-![KPref Items Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_kpref_items.gif)
-
-The easiest way to create the settings is to extend `KPrefActivity`.
-
-We will then override `onCreateKPrefs` to generate our adapter builder.
-
-The adapter builder can easily add items using defined functions.
-Each item added extends one or more contracts to configure it.
-
-The contracts are as follows:
-
-Contract | Mandatory | Optional | Description
-:--- | :--- | :--- | :---
-`CoreAttributeContract` | `NA` | `textColor` `accentColor` | Defines stylings that are added in every item
-`CoreContract` | `titleRes` | `descRes` `iicon` | Implemented by every item
-`BaseContract` | `getter` `setter` | `enabler` `onClick` `onDisabledClick` | Implemented by every preference item
-`KPrefColorContract` | `NA` | `showPreview` | Additional configurations for the color picker
-`KPrefTextContract` | `NA` | `textGetter` | Additional configurations for the text item
-`KPrefSubItemsContract` | `itemBuilder` | `NA` | Contains a new list for the adapter to load when clicked
-
-The kpref items are as followed:
-
-Item | Implements | Description
-:--- | :--- | :---
-`checkbox` | `CoreContract` `BaseContract` | Checkbox item; by default, clicking it will toggle the checkbox and the kpref
-`colorPicker` | `CoreContract` `BaseContract` `KPrefColorContract` | Color picker item; by default, clicking it will open a dialog which will change the color (int)
-`header` | `CoreContract` | Header; just a title that isn't clickable
-`text` | `CoreContract` `BaseContract` `KPrefTextContract` | Text item; displays the kpref as a String on the right; does not have click implementation by default
-`plainText` | `BaseContract` | Plain text item; like `text` but does not deal with any preferences directly, so it doesn't need a getter or setter
-This can be used to display text or deal with preference that are completely handed within the click event (eg a dialog).
-`subItems` | `CoreContract` `KPrefSubItemsContract` | Sub items; contains a new page for the activity to load when clicked
-
-An example of the adapter builder:
-
-```kotlin
-override fun onCreateKPrefs(savedInstanceState: android.os.Bundle?): KPrefAdapterBuilder.() -> Unit = {
-
- textColor = { KPrefSample.textColor } // getter function so the new text color will be retrieved for every reload
- accentColor = { KPrefSample.accentColor }
-
- header(R.string.header)
-
- /**
- * 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
- })
-
- /**
- * This is how it looks like without the tags
- */
- checkbox(R.string.checkbox_3, { KPrefSample.check3 }, { KPrefSample.check3 = it }) {
- descRes = R.string.desc_dependent
- enabler = { KPrefSample.check2 }
- onDisabledClick = {
- itemView, _, _ ->
- itemView.context.toast("I am still disabled")
- true
- }
- }
-}
-```
-
-<a name="changelog"></a>
-## Changelog XML
-
-Create an xml resource with the following structure:
-
-```xml
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <version title="v0.1" />
- <item text="Initial Changelog" />
- <item text="Bullet point here" />
- <item text="More points" />
- <item text="" /> <!-- this one is empty and therefore ignored -->
-</resources>
-```
-
-And show it with `context.showChangelog(@XmlRes xmlRes: Int)`
-There is an optional `customize` argument to modify the builder before showing the changelog.
-
-As mentioned, blank items will be ignored, so feel free to create a bunch of empty lines to facilitate updating the items in the future.
-
-<a name="search-view"></a>
-## Search View
-
-Kau contains a fully functional SearchView that can be added programmatically with one line.
-It contains a `bindSearchView` extension functions for both activities and viewgroups.
-
-![Search View Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_search_view.gif)
+# Submodules
+(linked to their respective Docs)
+
+## [Core](/core#readme)
+* Collection of extension functions and small helper methods applicable in almost any application.
+* Notable features: KPrefs, Changelog XML, Ripple Canvas, Extensions, Email Builder
+* Includes
+[`AppCompat`](https://developer.android.com/topic/libraries/support-library/index.html),
+[`Material Dialogs (core)`](https://github.com/afollestad/material-dialogs),
+[`Iconics`](https://github.com/mikepenz/Android-Iconics),
+[`Anko`](https://github.com/Kotlin/anko),
+[`Timber`](https://github.com/JakeWharton/timber),
+[`Kotlin stdlib`](https://kotlinlang.org/api/latest/jvm/stdlib/)
+
+## [Core UI](/core-ui#readme)
+* Collection of complex views and widgets
+* Includes `:core`, `:adapter`,
+[`RxJava`](https://github.com/ReactiveX/RxJava),
+[`RxAndroid`](https://github.com/ReactiveX/RxAndroid),
+[`RxKotlin`](https://github.com/ReactiveX/RxKotlin),
+[`RxBinding`](https://github.com/JakeWharton/RxBinding)
+
+## [About](/about#readme)
+* Implementation of an overlaying about section, along with automatic lib detection; also includes the lib strings for KAU
+* Includes `:core-ui`, `:adapter`,
+[`About Libraries`](https://github.com/mikepenz/AboutLibraries)
+
+## [Adapter](/adapter#readme)
+* Kotlin bindings for the fast adapter, as well as RecyclerView animations
+* Includes `:core`,
+[`Fast Adapter`](https://github.com/mikepenz/FastAdapter)
+
+## [Color Picker](/colorpicker#readme)
+* Implementation of a color picker dialog with subtle transitions and a decoupled callback
+* Includes `:core`,
+[`Material Dialogs (commons)`](https://github.com/afollestad/material-dialogs)
+
+## [Image Picker](/imagepicker#readme)
+* WIP - Overlaying media chooser
+* Includes `:core-ui`,
+[`Glide`](https://github.com/bumptech/glide)
+
+## [Kpref Activity](/kpref-activity#readme)
+* Fully programmatic implementation of a Preference Activity, backed by RecyclerViews
+* Includes `:core-ui`, `:adapter`, `colorpicker`
+
+## [SearchView](/searchview#readme)
+* Material searchview with kotlin bindings
+* Includes `:core-ui`, `:adapter`
-The search view is:
-* Fully themable - set the foreground or background color to style every portion, from text colors to backgrounds to ripples
-* Complete - binding the search view to a menu id will set the menu icon (if not previously set) and attach all the necessary listeners
-* Configurable - modify any portion of the inner Config class when binding the search view
-* Thread friendly - the search view is built with observables and emits values in a separate thread,
-which means that you don't have to worry about long processes in the text watcher. Likewise, all adapter changes are automatically done on the ui thread.
-
-<a name="ripple-canvas"></a>
-## Ripple Canvas
-
-Ripple canvas provides a way to create simultaneous ripples against a background color.
-They can be used as transitions, or as a toolbar background to replicate the look for [Google Calendar](https://stackoverflow.com/questions/27872324/how-can-i-animate-the-color-change-of-the-statusbar-and-toolbar-like-the-new-ca)
-
-![KPref Accent Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_kpref_accent.gif)
-
-Many ripples can be stacked on top of each other to run at the same time from different locations.
-The canvas also supports color fading and direct color setting so it can effectively replace any background.
-
-<a name="about-activity"></a>
-## About Activity
+-----------
-Most apps could not be possible without the collective efforts of other developers and their libraries.
-It's always nice to give credit where credit is due, but it's not always at the top of ones agenda.
-About Activity aims to fix that by preparing a beautiful overlay activity that does just that.
+# Showcase
![About Activity Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_about_activity.gif)
-
-The overlay is heavily based off of the about section in [Plaid](https://github.com/nickbutcher/plaid),
-and adds on the power of [About Libraries](https://github.com/mikepenz/AboutLibraries) to automatically find the dependencies.
-
-This activity can be easily added by extending `AboutActivityBase`.
-Everything is already prepared, but you can modify the theme or other components through the config DSL or through the open functions.
-There are also numerous iitem cards already prepared if you wish to add that in your main view.
-
-Be sure to include the activity in your Manifest and have it extend `Kau.Translucent.About`, or any other style that achieves the same look.
-
-<a name="timber-logger"></a>
-## Timber Logger
-
-[Timber](https://github.com/JakeWharton/timber)'s DebugTree uses the tag to specify the current class that is being logged. To add the tag directly in the message, create an object that extends the TimberLogger class with the tag name as the argument.
-
-<a name="extensions"></a>
-## Extension Functions
-
-> "[Extensions](https://kotlinlang.org/docs/reference/extensions.html) provide the ability to extend a class with new functionality without having to inherit from the class"
-Note that since KAU depends on [ANKO](https://github.com/Kotlin/anko), all of the extensions in its core package is also in KAU.
-
-### AnimUtils
-> Extends View
-* Fade In/Fade Out/Circle Reveal with callbacks
-* Switch texts in a TextView with a fade transition
-
-### ColorUtils
-> Extends Int
-* Check if color is dark or light
-* Check if color is visible against another color
-* Convert color to HSV (float[]) or hex (String)
-* Get the disabled color of a theme
-* Adjust alpha
-> Extends String
-* Parses color; adds onto the original parser by supporting #AAA values
-> Extends View
-* Various tinting for different views; taken from [MDTintHelper](https://github.com/afollestad/material-dialogs/blob/master/core/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java)
-
-### ContextUtils
-> Extends Activity
-* Restart an activity
-> Extends Context
-* Start Activity using the class, with optional intents and stack clearing
-* Create a toast directly
-* Get resource values through `.color(id)`, `.dimen(id)`, `.drawable(id)`, `.integer(id)`, `.string(id)`
-* Get attribute values through resolve methods
-* Show a Changelog by parsing an xml resource
-* Check if network is available
-
-### IIconUtils
-> Extends [IIcon](https://github.com/mikepenz/Android-Iconics)
-* `toDrawable` method that only requires a context; defaults to a white icon of size 24dp and uses a ColorStateList to allow for dimming
-
-### Utils [Misc]
-> Extends Int
-* dpToPx & pxToDp conversions
-* Check sdk version
-* Check if app is installed
-
-### ViewUtils
-> Extends View
-* `visible()`, `invisible()`, `gone()`, `isVisible()`, `isInvisible()`, `isGone()` methods
-* matchParent method to set the layout params to match_parent
-* Create snackbar directly
-* Set IIcon into ImageView directly
-
-<a name="email-builder"></a>
-## Email Builder
-
-Easily send an email through `Context.sendEmail`.
-Include your email and subject, along with other optional configurations such as retrieving device info. \ No newline at end of file
+![KPref Accent Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_kpref_accent.gif)
+![KPref Items Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_kpref_items.gif)
+![SearchView Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_search_view.gif) \ No newline at end of file
diff --git a/about/README.md b/about/README.md
new file mode 100644
index 0000000..afbf89a
--- /dev/null
+++ b/about/README.md
@@ -0,0 +1,28 @@
+# KAU :about
+
+Most apps could not be possible without the collective efforts of other developers and their libraries.
+It's always nice to give credit where credit is due, but it's not always at the top of ones agenda.
+About Activity aims to fix that by preparing a beautiful overlay activity that does just that.
+
+![About Activity Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_about_activity.gif)
+
+The overlay is heavily based off of the about section in [Plaid](https://github.com/nickbutcher/plaid),
+and adds on the power of [About Libraries](https://github.com/mikepenz/AboutLibraries) to automatically find the dependencies.
+
+This activity can be easily added by extending `AboutActivityBase`.
+Everything is already prepared, but you can modify the theme or other components through the config DSL or through the open functions.
+There are also numerous iitem cards already prepared (in this submodule and from `:adapter`)if you wish to add that in your main view.
+
+Be sure to include the activity in your Manifest and have it extend `Kau.Translucent.About`, or any other style that achieves the same look.
+
+## Proguard
+
+Without auto detect, KAU about will retain the classes containing the lib strings by default.
+If you use proguard with auto detect, make sure to retain all R classes to make it possible
+
+```
+-keep class .R
+-keep class **.R$* {
+ <fields>;
+}
+``` \ No newline at end of file
diff --git a/adapter/README.md b/adapter/README.md
new file mode 100644
index 0000000..6d59777
--- /dev/null
+++ b/adapter/README.md
@@ -0,0 +1,11 @@
+# KAU :adapter
+
+Collection of kotlin bindings and custom IItems for [Fast Adapter](https://github.com/mikepenz/FastAdapter)
+
+## KauIItems
+
+Extends `AbstractIItems` and contains the arguments (layoutRes, ViewHolder lambda, idRes)
+In that order. Those variables are used to override the default abstract functions.
+If a layout is only used for one item, it may also be used as the id, which you may leave blank in this case.
+The ViewHolder lambda is typically of the form `{ ViewHolder(it) }`
+Where you will have a nested class `ViewHolder(v: View) : RecyclerView.ViewHolder(v)` \ No newline at end of file
diff --git a/colorpicker/README.md b/colorpicker/README.md
new file mode 100644
index 0000000..5c22823
--- /dev/null
+++ b/colorpicker/README.md
@@ -0,0 +1,7 @@
+# KAU :colorpicker
+
+Material Dialogs by default contains a color picker, but it requires an activity that also implements the color callback.
+KAU's colorpicker decouples the two, so it only needs a context and a separate callback.
+The color picker also animates the selection, and uses Kotlin's DSL to provide easy calling.
+
+To use it, call `Context.colorPickerDialog` and specify and configs as required through the builder. \ No newline at end of file
diff --git a/core-ui/README.md b/core-ui/README.md
new file mode 100644
index 0000000..8abf05e
--- /dev/null
+++ b/core-ui/README.md
@@ -0,0 +1,29 @@
+# KAU :core-ui
+
+Holds a collection of generic UIs.
+This submodule takes heavy influence from [Plaid](https://github.com/nickbutcher/plaid), a beautiful showcase for Material Design.
+
+## BoundedCardView
+
+Extends a CardView and provides `maxHeight` and `maxHeightPercentage` attributes.
+These values are judged once the view it attached and can be helpful to limit the size with respect to its parent.
+
+One example is in KAU's `:searchview`, where the search results will always allow some space below it for the user to tap and exit.
+
+## CutoutView
+
+Given a background and a text/vector, will "erase" the text/vector from the background.
+This can be seen in effect in KAU's `:about` submodule.
+
+## ElasticDragDismissFrameLayout
+
+When scrolling vertically, this frame will allow for overscrolling and will pull the layout out of view and exit if a threshold is reached.
+Note that Activities with this frame must be translucent. `@style/Kau.Translucent` can be used as a base.
+
+## InkPageIndicator
+
+A beautiful viewpager indicator
+
+## TextSlider
+
+An animated and themable Text Switcher. Specify its direction and set a new text value and it will slide it into view. \ No newline at end of file
diff --git a/core/README.md b/core/README.md
new file mode 100644
index 0000000..8619cf5
--- /dev/null
+++ b/core/README.md
@@ -0,0 +1,162 @@
+# Kau :core
+
+> The framework of everything
+
+## Contents
+
+* [KPrefs](#kprefs)
+* [Changelog XML](#changelog)
+* [Ripple Canvas](#ripple-canvas)
+* [Timber Logger](#timber-logger)
+* [Email Builder](#email-builder)
+* [Extensions](#extensions)
+
+<a name="kprefs"></a>
+## KPrefs
+
+A typical SharedPreference contains items that look like so:
+
+```Java
+class MyPrefs {
+ public static final String TEXT_COLOR = "TEXT_COLOR";
+
+ private static SharedPreference prefs = ...
+
+ public static void setTextColor(int color) {
+ prefs.edit().putInt(TEXT_COLOR, color).apply();
+ }
+
+ public static int getTextColor() {
+ prefs.getInt(TEXT_COLOR, Color.WHITE);
+ }
+}
+```
+
+KPrefs greatly simplifies it by using Kotlin's object pattern and delegates to achieve the following:
+
+```Kotlin
+object MyPrefs : KPref() {
+ var textColor: Int by kpref("TEXT_COLOR", Color.WHITE)
+ var bgColor: Int by kpref("BG_COLOR", Color.BLACK)
+ var isFirstLaunch: Boolean by kpref("IS_FIRST_LAUNCH", true)
+ ...
+}
+```
+
+By using `KPrefSample.textColor = Color.RED` or `textView.setTextColor(KPrefSample.textColor)` we can effectively set and save the value.
+
+The values are retrieved lazily and are only done so once; future retrievals will be done with a local value, and updating a preference will both save it in the SharedPreference and update it locally.
+
+The object inherits the initializer method `fun initialize(c: Context, preferenceName: String)`, which must be invoked (preferably in the Application class) before using a preference.
+
+There is also a `reset()` method to clear the local values and have them retrieve from the SharedPreference again.
+
+In shared preferences, we often require a boolean that returns true once, so we can use it to showcase views or display prompts on the first load.
+Kpref supports special preferences like these through the `KPrefSingleDelgate`
+
+It can be used in a KPref like so:
+
+```Kotlin
+object MyPrefs : KPref() {
+ val displayHelper: Boolean by kprefSingle("KEY_HERE")
+ ...
+}
+```
+
+Notice that it is a `val` and takes no default. It will return true the first time and false for all subsequent calls.
+
+<a name="changelog"></a>
+## Changelog XML
+
+Create an xml resource with the following structure:
+
+```xml
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <version title="v0.1" />
+ <item text="Initial Changelog" />
+ <item text="Bullet point here" />
+ <item text="More points" />
+ <item text="" /> <!-- this one is empty and therefore ignored -->
+</resources>
+```
+
+And show it with `context.showChangelog(@XmlRes xmlRes: Int)`
+There is an optional `customize` argument to modify the builder before showing the changelog.
+
+As mentioned, blank items will be ignored, so feel free to create a bunch of empty lines to facilitate updating the items in the future.
+
+<a name="ripple-canvas"></a>
+## Ripple Canvas
+
+Ripple canvas provides a way to create simultaneous ripples against a background color.
+They can be used as transitions, or as a toolbar background to replicate the look for [Google Calendar](https://stackoverflow.com/questions/27872324/how-can-i-animate-the-color-change-of-the-statusbar-and-toolbar-like-the-new-ca)
+
+![KPref Accent Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_kpref_accent.gif)
+
+Many ripples can be stacked on top of each other to run at the same time from different locations.
+The canvas also supports color fading and direct color setting so it can effectively replace any background.
+
+<a name="timber-logger"></a>
+## Timber Logger
+
+[Timber](https://github.com/JakeWharton/timber)'s DebugTree uses the tag to specify the current class that is being logged.
+To add the tag directly in the message, create an object that extends the TimberLogger class with the tag name as the argument.
+Along with the timber methods (`v`, `i`, `d`, `e`), Timber Logger also supports `eThrow` to wrap a String in a throwable
+
+<a name="email-builder"></a>
+## Email Builder
+
+Easily send an email through `Context.sendEmail`.
+Include your email and subject, along with other optional configurations such as retrieving device info.
+
+<a name="extensions"></a>
+## Extension Functions
+
+> "[Extensions](https://kotlinlang.org/docs/reference/extensions.html) provide the ability to extend a class with new functionality without having to inherit from the class"
+Note that since KAU depends on [ANKO](https://github.com/Kotlin/anko), all of the extensions in its core package is also in KAU.
+
+### AnimUtils
+> Extends View
+* Fade In/Fade Out/Circle Reveal with callbacks
+* Switch texts in a TextView with a fade transition
+
+### ColorUtils
+> Extends Int
+* Check if color is dark or light
+* Check if color is visible against another color
+* Convert color to HSV (float[]) or hex (String)
+* Get the disabled color of a theme
+* Adjust alpha
+> Extends String
+* Parses color; adds onto the original parser by supporting #AAA values
+> Extends View
+* Various tinting for different views; taken from [MDTintHelper](https://github.com/afollestad/material-dialogs/blob/master/core/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java)
+
+### ContextUtils
+> Extends Activity
+* Restart an activity
+> Extends Context
+* Start Activity using the class, with optional intents and stack clearing
+* Create a toast directly
+* Get resource values through `.color(id)`, `.dimen(id)`, `.drawable(id)`, `.integer(id)`, `.string(id)`
+* Get attribute values through resolve methods
+* Show a Changelog by parsing an xml resource
+* Check if network is available
+
+### IIconUtils
+> Extends [IIcon](https://github.com/mikepenz/Android-Iconics)
+* `toDrawable` method that only requires a context; defaults to a white icon of size 24dp and uses a ColorStateList to allow for dimming
+
+### Utils [Misc]
+> Extends Int
+* dpToPx & pxToDp conversions
+* Check sdk version
+* Check if app is installed
+
+### ViewUtils
+> Extends View
+* `visible()`, `invisible()`, `gone()`, `isVisible()`, `isInvisible()`, `isGone()` methods
+* matchParent method to set the layout params to match_parent
+* Create snackbar directly
+* Set IIcon into ImageView directly
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
index 58e570f..6c0b608 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
@@ -40,8 +40,11 @@ class KPrefSingleDelegate internal constructor(private val key: String, private
_v2
} else {
_value = pref.sp.getBoolean(key, true)
- if (_value!!) pref.sp.edit().putBoolean(key, false).apply()
- _value!!
+ if (_value!!) {
+ pref.sp.edit().putBoolean(key, false).apply()
+ _value = false
+ true
+ } else false
}
}
}
diff --git a/imagepicker/README.md b/imagepicker/README.md
new file mode 100644
index 0000000..7fb185c
--- /dev/null
+++ b/imagepicker/README.md
@@ -0,0 +1,3 @@
+# KAU :imagepicker
+
+WIP \ No newline at end of file
diff --git a/kpref-activity/README.md b/kpref-activity/README.md
new file mode 100644
index 0000000..3c3266c
--- /dev/null
+++ b/kpref-activity/README.md
@@ -0,0 +1,69 @@
+# KAU :kpref-activity
+
+KAU supports Preferences that are created without xmls and through AppCompat.
+The items are backed by a [FastAdapter](https://github.com/mikepenz/FastAdapter) and support [iicons](https://github.com/mikepenz/Android-Iconics)
+
+![KPref Items Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_kpref_items.gif)
+
+The easiest way to create the settings is to extend `KPrefActivity`.
+
+We will then override `onCreateKPrefs` to generate our adapter builder.
+
+The adapter builder can easily add items using defined functions.
+Each item added extends one or more contracts to configure it.
+
+The contracts are as follows:
+
+Contract | Mandatory | Optional | Description
+:--- | :--- | :--- | :---
+`CoreAttributeContract` | `NA` | `textColor` `accentColor` | Defines stylings that are added in every item
+`CoreContract` | `titleRes` | `descRes` `iicon` | Implemented by every item
+`BaseContract` | `getter` `setter` | `enabler` `onClick` `onDisabledClick` | Implemented by every preference item
+`KPrefColorContract` | `NA` | `showPreview` | Additional configurations for the color picker
+`KPrefTextContract` | `NA` | `textGetter` | Additional configurations for the text item
+`KPrefSubItemsContract` | `itemBuilder` | `NA` | Contains a new list for the adapter to load when clicked
+
+The kpref items are as followed:
+
+Item | Implements | Description
+:--- | :--- | :---
+`checkbox` | `CoreContract` `BaseContract` | Checkbox item; by default, clicking it will toggle the checkbox and the kpref
+`colorPicker` | `CoreContract` `BaseContract` `KPrefColorContract` | Color picker item; by default, clicking it will open a dialog which will change the color (int)
+`header` | `CoreContract` | Header; just a title that isn't clickable
+`text` | `CoreContract` `BaseContract` `KPrefTextContract` | Text item; displays the kpref as a String on the right; does not have click implementation by default
+`plainText` | `BaseContract` | Plain text item; like `text` but does not deal with any preferences directly, so it doesn't need a getter or setter
+This can be used to display text or deal with preference that are completely handed within the click event (eg a dialog).
+`subItems` | `CoreContract` `KPrefSubItemsContract` | Sub items; contains a new page for the activity to load when clicked
+
+An example of the adapter builder:
+
+```kotlin
+override fun onCreateKPrefs(savedInstanceState: android.os.Bundle?): KPrefAdapterBuilder.() -> Unit = {
+
+ textColor = { KPrefSample.textColor } // getter function so the new text color will be retrieved for every reload
+ accentColor = { KPrefSample.accentColor }
+
+ header(R.string.header)
+
+ /**
+ * 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
+ })
+
+ /**
+ * This is how it looks like without the tags
+ */
+ checkbox(R.string.checkbox_3, { KPrefSample.check3 }, { KPrefSample.check3 = it }) {
+ descRes = R.string.desc_dependent
+ enabler = { KPrefSample.check2 }
+ onDisabledClick = {
+ itemView, _, _ ->
+ itemView.context.toast("I am still disabled")
+ true
+ }
+ }
+}
+``` \ No newline at end of file
diff --git a/sample/build.gradle b/sample/build.gradle
index abbfac3..b3dd20b 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -54,7 +54,7 @@ dependencies {
compile project(':core')
compile project(':core-ui')
compile project(':kpref-activity')
- compile project(':searchbar')
+ compile project(':searchview')
compile project(':imagepicker')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
diff --git a/sample/src/main/res/xml/changelog.xml b/sample/src/main/res/xml/changelog.xml
index ca55a60..f460ac1 100644
--- a/sample/src/main/res/xml/changelog.xml
+++ b/sample/src/main/res/xml/changelog.xml
@@ -6,7 +6,9 @@
<item text="" />
-->
- <version title="v1.6"/>
+ <version title="v2.0"/>
+ <item text="Huge refactoring to separate functions to their own submodules" />
+ <item text="Huge Docs update" />
<item text="Reorder KauIItem arguments to support optional id" />
<item text="Create KPrefSeekbar, which binds an int kpref to a seekbar" />
<item text="Open all kpref item binders so they may be extended" />
diff --git a/searchbar/.gitignore b/searchview/.gitignore
index 796b96d..796b96d 100644
--- a/searchbar/.gitignore
+++ b/searchview/.gitignore
diff --git a/searchview/README.md b/searchview/README.md
new file mode 100644
index 0000000..7274f6e
--- /dev/null
+++ b/searchview/README.md
@@ -0,0 +1,13 @@
+# KAU :searchview
+
+KAU contains a fully functional SearchView that can be added programmatically with one line.
+It contains a `bindSearchView` extension functions for both activities and viewgroups.
+
+![Search View Gif](https://github.com/AllanWang/Storage-Hub/blob/master/kau/kau_search_view.gif)
+
+The searchview is:
+* Fully themable - set the foreground or background color to style every portion, from text colors to backgrounds to ripples
+* Complete - binding the search view to a menu id will set the menu icon (if not previously set) and attach all the necessary listeners
+* Configurable - modify any portion of the inner Config class when binding the search view
+* Thread friendly - the search view is built with observables and emits values in a separate thread,
+which means that you don't have to worry about long processes in the text watcher. Likewise, all adapter changes are automatically done on the ui thread.
diff --git a/searchbar/build.gradle b/searchview/build.gradle
index 9504b20..9504b20 100644
--- a/searchbar/build.gradle
+++ b/searchview/build.gradle
diff --git a/searchbar/progress-proguard.txt b/searchview/progress-proguard.txt
index 8b13789..8b13789 100644
--- a/searchbar/progress-proguard.txt
+++ b/searchview/progress-proguard.txt
diff --git a/searchbar/src/main/AndroidManifest.xml b/searchview/src/main/AndroidManifest.xml
index f2ec3e7..f2ec3e7 100644
--- a/searchbar/src/main/AndroidManifest.xml
+++ b/searchview/src/main/AndroidManifest.xml
diff --git a/searchbar/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt
index 75d9b27..75d9b27 100644
--- a/searchbar/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt
+++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt
diff --git a/searchbar/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
index 2178806..2178806 100644
--- a/searchbar/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
+++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
diff --git a/searchbar/src/main/res/layout/kau_search_iitem.xml b/searchview/src/main/res/layout/kau_search_iitem.xml
index 16df945..16df945 100644
--- a/searchbar/src/main/res/layout/kau_search_iitem.xml
+++ b/searchview/src/main/res/layout/kau_search_iitem.xml
diff --git a/searchbar/src/main/res/layout/kau_search_view.xml b/searchview/src/main/res/layout/kau_search_view.xml
index c975dad..c975dad 100644
--- a/searchbar/src/main/res/layout/kau_search_view.xml
+++ b/searchview/src/main/res/layout/kau_search_view.xml
diff --git a/searchbar/src/main/res/values/dimens.xml b/searchview/src/main/res/values/dimens.xml
index acf79cb..acf79cb 100644
--- a/searchbar/src/main/res/values/dimens.xml
+++ b/searchview/src/main/res/values/dimens.xml
diff --git a/searchbar/src/main/res/values/ids.xml b/searchview/src/main/res/values/ids.xml
index b77ad4e..b77ad4e 100644
--- a/searchbar/src/main/res/values/ids.xml
+++ b/searchview/src/main/res/values/ids.xml
diff --git a/settings.gradle b/settings.gradle
index 7284dca..3564f5c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,4 +7,4 @@ include ':core',
':core-ui',
':imagepicker',
':kpref-activity',
- ':searchbar'
+ ':searchview'