From fba4ac38a8e2dff6e53ba8ecccc95dac2550a3fa Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 12 Aug 2017 19:31:55 -0700 Subject: Feature/kpref activity visibility (#38) * Add visibility toggle * Update docs --- kpref-activity/README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'kpref-activity/README.md') diff --git a/kpref-activity/README.md b/kpref-activity/README.md index 015d0d8..a9aac89 100644 --- a/kpref-activity/README.md +++ b/kpref-activity/README.md @@ -1,7 +1,14 @@ # 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) +The items are backed by a [FastAdapter](https://github.com/mikepenz/FastAdapter) and support [iicons](https://github.com/mikepenz/Android-Iconics). +The logic behind kpref items is that most states are based around callbacks. +As a result, we don't need to hold references of items that may change; +we simply reload the list and all states will be refetched. +This is especially powerful when items are interdependent. +Rather than adding a bunch of calls on one item when its state changes (which we can still do in this lib) +and propagating to other items when necessary, +we may instead reload and have each item verify their states themselves. ![KPref Items Gif](https://raw.githubusercontent.com/AllanWang/Storage-Hub/master/kau/kau_kpref_items.gif) @@ -18,10 +25,11 @@ 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 +`BaseContract` | `getter` `setter` | `enabler` `onClick` `onDisabledClick`, `visible` | Implemented by every preference item `KPrefColorContract` | `NA` | `showPreview` | Additional configurations for the color picker -`KPrefTextContract` | `NA` | `textGetter` | Additional configurations for the text item +`KPrefSeekbarContract` | `NA` | `min` `max` `increments` `toText` `textViewConfigs` | Addtional configurations for a seekbar, as well as text to be displayed on the side. `KPrefSubItemsContract` | `itemBuilder` | `NA` | Contains a new list for the adapter to load when clicked +`KPrefTextContract` | `NA` | `textGetter` | Additional configurations for the text item The kpref items are as followed: @@ -29,9 +37,10 @@ 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) +`seekbar` | `CoreContract` `BaseContract` `KprefSeekbarContract` | Seekbar item. Takes in a given range and will call the setter whenever a user picks a new value. `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 +`plainText` | `CoreContract` `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 -- cgit v1.2.3