An extensive collection of Kotlin Android Utils

Overview
KAU

An extensive collection of Kotlin Android Utils

This library contains small helper functions used throughout almost all of my other projects. The goal is to make common interactions executable in a single line.

Get it on Google Play

ChangelogMigration


KAU is available on JitPack

Build Status Crowdin Awesome Kotlin Badge ZenHub GitHub license

To apply, add the following to your root build.gradle:

allprojects {
    repositories {
        ...
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}

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 dependencies.

dependencies {
    // all submodules extend this
    implementation "ca.allanwang.kau:core:$KAU"
    // all submodules with extensive ui extend this
    implementation "ca.allanwang.kau:core-ui:$KAU"
    
    implementation "ca.allanwang.kau:about:$KAU"
    implementation "ca.allanwang.kau:adapter:$KAU"
    implementation "ca.allanwang.kau:colorpicker:$KAU"
    implementation "ca.allanwang.kau:fastadapter:$KAU"
    implementation "ca.allanwang.kau:kpref-activity:$KAU"
    implementation "ca.allanwang.kau:mediapicker:$KAU"
    implementation "ca.allanwang.kau:searchview:$KAU"
}

Submodules

Linked to their respective docs.
Included dependencies are only those with exposed APIs; see new dependency configurations.
Implemented external dependencies are wrapped in parentheses. All KAU submodule dependencies are implemented, with the exception of core in core-ui. This means that you'll need to explicitly include each submodule you'd like to use, even if another declared submodule depends on it.

Core

Core UI

  • Collection of complex views and widgets
  • Includes :core

About

  • Modularized overlaying about section. Comes with a main panel, automatic lib detection, and a FAQ parser; also includes the lib strings for KAU.
  • Includes :core-ui, :fastadapter, About Libraries

Adapter

  • RecyclerView animations
  • Includes :core

Color Picker

  • Implementation of a color picker dialog with subtle transitions and a decoupled callback
  • Includes :core

FastAdapter

  • Kotlin bindings for the fast adapter
  • Includes :core, :adapter, Fast Adapter

KPref Activity

  • Fully programmatic implementation of a Preference Activity, backed by a RecyclerView
  • Includes :core, :fastadapter, :colorpicker

Media Picker

  • Fully functional image and video pickers, both as an overlay and as a requested activity.
  • Includes :core-ui, Glide, (Blurry)

SearchView

  • Material searchview with kotlin bindings
  • Includes :core-ui, :fastadapter

Gradle Plugin

  • Gradle plugin to help facilitate versioning and other gradle functions

Showcase

About Activity Gif Ink Indicator Gif Color Picker Gif KPref Items Gif SearchView Gif Swipe Gif

Proguard/MultiDex

Given that the core module contains a lot of extension functions, you may run into a dex error (over 64k methods)

To resolve that, add multiDexEnabled true under your app.gradle > android > defaultConfig

Likewise, it is highly recommended to use proguard to clean up your project upon release. All KAU components support proguard out of the box. Some may have extra requirements for certain features, which will be detailed in their respective README.

Translations

KAU depends on translations crowdsourced by the general public. If you would like to contribute, please visit here

Special thanks to the following awesome people for translating significant portions of KAU!

Language Contributors
Arabic Mohammed Qubati
Catalan Jaime Muñoz Martín
Chinese (Simplified) Alcatelia
Chinese (Traditional) yipinghuangSu, Jun-MingWei
Danish mhtorp
Dutch ItGuillaumeTatum ter Kuile
French Vincent KulakJean-Philippe Gravel
Galician Xesús M. Mosquera
German Bushido1992Marcel Soehnchen3LD0mi HA
Greek George Kitsopoulos
Hungarian János Erkli
Indonesian M. Angga Ariska
Italian Bonnee
Korean 잇스테이크
Norwegian
Polish pantinPL
Portuguese Sérgio MarquesMiguel Dos Reis
Portuguese (Brazilian) TheusKhan
Russian Вадим Жушман
Serbian Nikola Radmanović
Spanish Jahir FiquitivaNefi Salazar
Swedish Artswitcher
Tagalog Fray Damaso
Thai Thanawat Hanthong
Turkish zuma17
Ukrainian Вадим Жушман
Vietnamese Alienz

The full activity stream for the translations can be found here

Comments
  • SearchView not on top of toolbar in one activity. Fine in the other

    SearchView not on top of toolbar in one activity. Fine in the other

    I have 2 activities using the same theme but the searchview is offset on the child activity. In my main activity it works fine. But in my child activity that is launched from my main its offset.

    I do have a tab layout in the parent activity.

    Any ideas what to look for to fix this?

    screenshot_20180819-232521_memoria screenshot_20180819-232458_memoria

    opened by bignadad 5
  • SearchView is not shown in multiwindow mode

    SearchView is not shown in multiwindow mode

    When the app is in multiwindow mode and shown in the bottom part of the screen, the search view is not shown.

    The second screenshot is how it's shown when the app occupies ~3/4 of the screen.

    Thanks

    screenshot_20180121-131848

    screenshot_20180121-132255

    bug 
    opened by jahirfiquitiva 3
  • SearchView crash NoSuchFieldException mCursorDrawable

    SearchView crash NoSuchFieldException mCursorDrawable

    Getting this crash

    2018-12-17 09:41:27.013 7993-7993/com.memoria.photos.gallery W/System.err: java.lang.NoSuchFieldException: No field mCursorDrawable in class Landroid/widget/Editor; (declaration of 'android.widget.Editor' appears in /system/framework/framework.jar!classes2.dex) 2018-12-17 09:41:27.015 7993-7993/com.memoria.photos.gallery W/System.err: at java.lang.Class.getDeclaredField(Native Method) 2018-12-17 09:41:27.015 7993-7993/com.memoria.photos.gallery W/System.err: at ca.allanwang.kau.utils.ColorUtilsKt.tintCursor(ColorUtils.kt:242) 2018-12-17 09:41:27.015 7993-7993/com.memoria.photos.gallery W/System.err: at com.memoria.photos.gallery.activities.MediaActivity$onCreateOptionsMenu$2$3.invoke(MediaActivity.kt:320) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at com.memoria.photos.gallery.activities.MediaActivity$onCreateOptionsMenu$2$3.invoke(MediaActivity.kt:47) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at ca.allanwang.kau.searchview.SearchView$revealOpen$1.invoke(SearchView.kt:425) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at ca.allanwang.kau.searchview.SearchView$revealOpen$1.invoke(SearchView.kt:45) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at org.jetbrains.anko.AsyncKt.runOnUiThread(Async.kt:34) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at ca.allanwang.kau.searchview.SearchView.revealOpen(SearchView.kt:418) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at ca.allanwang.kau.searchview.SearchView$bind$2.onMenuItemClick(SearchView.kt:349) 2018-12-17 09:41:27.016 7993-7993/com.memoria.photos.gallery W/System.err: at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:154) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:991) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:981) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at androidx.appcompat.widget.ActionMenuView.invokeItem(ActionMenuView.java:625) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at androidx.appcompat.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:151) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at android.view.View.performClick(View.java:6597) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at android.view.View.performClickInternal(View.java:6574) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at android.view.View.access$3100(View.java:778) 2018-12-17 09:41:27.017 7993-7993/com.memoria.photos.gallery W/System.err: at android.view.View$PerformClick.run(View.java:25885) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at android.os.Handler.handleCallback(Handler.java:873) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at android.os.Looper.loop(Looper.java:193) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6669) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at java.lang.reflect.Method.invoke(Native Method) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 2018-12-17 09:41:27.018 7993-7993/com.memoria.photos.gallery W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

    when attempting to tint cursor

    openListener = { mSearchOpen = true it.menuY = resources.getStatusBarHeight() + [email protected](5) val editText = it.findViewById<EditText>(R.id.kau_search_edit_text) editText.setHintTextColor(config.searchHintText) editText.tintCursor(getColorCompat(R.color.search_cursor)) }

    bug 
    opened by bignadad 2
  • Seekbar increments not affecting result

    Seekbar increments not affecting result

    I'm trying to limit seekbar increments by steps. The user should be able to set a value between 0 and 10000, but only in steps of 100.

    seekbar(
        ...
        builder = {
            min = 0
            max = 10000
            increments = 100
        }
    )
    

    With this implementation each value between min and max is a valid argument.

    Either i'm not understanding the increments field, or the implementation is not working.

    bug 
    opened by Thames1990 2
  • Fragments

    Fragments

    I'm trying to get this to work with fragments - is that possible? I'm using MVVM and I declare my onCreateOptionsMenu inside a Fragment instead of an Activity.

    I've tried a few tactics but I keep running into errors and I feel like there's something I'm not seeing

    image

    question 
    opened by SeaRoth 2
  • Disable seekbar when the contract enabler is false

    Disable seekbar when the contract enabler is false

    I'm trying to disable the seekbar of a preference in a KPrefActivity when the KPrefSeekbar.KPrefSeekbarContract enabler is false.

    This is my contract:

    fun KPrefSeekbar.KPrefSeekbarContract.dependsOnLocationPermission() {
        enabler = { hasPermission(Manifest.permission.ACCESS_FINE_LOCATION) }
        onDisabledClick = { snackbar(R.string.requires_location_permission) }
    }
    

    As you can see in this video, the preference is disabled, but the seekbar is still enabled. Can you guide me how to disable it?

    bug 
    opened by Thames1990 2
  • Support Google Photos

    Support Google Photos

    opened by AllanWang 2
  • Github Actions

    Github Actions

    Travis is paywalled for open source, which is unfortunate. Moving to github actions.

    Modeled off of https://github.com/mikepenz/FastAdapter/blob/develop/.github/workflows/ci.yml

    opened by AllanWang 1
  • Add new language

    Add new language

    Hi @AllanWang

    I sent you request about that on dec 2020 through crowdin and can you review it? Search on https://crowdin.com/messages/ Subject: [KAU] Add new language From: helabasa

    opened by itsnotsaved 1
  • Cancel children from activity coroutines instead of job itself

    Cancel children from activity coroutines instead of job itself

    https://proandroiddev.com/kotlin-coroutines-patterns-anti-patterns-f9d12984c68e

    Perhaps add base fragment? Coroutines also has MainScope now so I'm not sure if we should delegate to that too

    opened by AllanWang 1
  • Fix glide loading for media activity

    Fix glide loading for media activity

    Looks like permission errors

        There was 1 cause:
        java.io.FileNotFoundException(open failed: EACCES (Permission denied))
         call GlideException#logRootCauses(String) for more detail
              Cause (1 of 1): class java.io.FileNotFoundException: open failed: EACCES (Permission denied)
          Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.content.res.AssetFileDescriptor, LOCAL
    
    opened by AllanWang 0
  • Remove custom debouncer and use coroutines

    Remove custom debouncer and use coroutines

    Relevant content

    • https://github.com/Kotlin/kotlinx.coroutines/issues/1082
    • https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/flow/operators/Delay.kt
    enhancement 
    opened by AllanWang 0
Releases(6.4.0)
  • 6.4.0(Nov 18, 2021)

  • 6.3.0(Sep 12, 2021)

    • Add support for Arctic Fox 2020.3.1
    • Move to new maven release system
    • Many version bumps
    • Update translations

    CI has been moved from Travis to Github Actions. No major changes beyond where to view logs. Auto release from master branch to play store has been disabled

    Source code(tar.gz)
    Source code(zip)
  • 6.2.0(Apr 17, 2021)

  • 6.1.0(Oct 4, 2020)

  • 6.0.0(Jul 19, 2020)

  • 5.2.0(Dec 31, 2019)

    • :about: Migrate about libraries to v7.x.x
    • :color: Draw CircleView in foreground instead of background
    • :core: Migrate iconics to v4.x.x
    • :core: Automatically switch light mode for navigationBarColor and statusBarColor
    • :core: Remove statusBarLight toggle
    • :core: Remove kau_status_bar_height; height should be found programmatically
    • :fastadapter: Migrate fastadapter to v4.x.x
    • :fastadapter-viewbinding: Create helper items for ViewBinding
    • Update translations
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Jun 14, 2019)

    • Update Android SDK to 29 and Kotlin to 1.3.31
    • Update translations
    • :core: Update Material Dialogs to 3.x
    • :core: Change ProgressAnimator API
    • :core: Remove cursor tinting in EditText as it used reflection
    • :colorpicker: Strip down to just the interface; unless you require the accent palette, it may be fine to just use MD's color extension
    • :gradle-plugin: Convert to kotlin, rework dependencies, and remove extension hooks
    Source code(tar.gz)
    Source code(zip)
  • 4.1.0(Jun 7, 2019)

    • :core: Deprecate NetworkUtils, as the underlying functions are deprecated
    • :core: Permission manager no longer synchronized, as all actions should occur in the main thread
    • :kpref-activity: Getter and setter now have action context, with the option to reload self
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(May 21, 2019)

  • 4.0.0-alpha02(Jan 6, 2019)

    • Update translations
    • :core: Remove anko dependency. Methods that used it now use coroutines; see the migration doc for minor changes
    • :core: Add default CoroutineScope implementation to KauBaseActivity
    • :core: Remove zip class. Coroutines and join can be used as an alternative
    • :core: Delete flyweight implementation. Kotlin already has getOrPut
    • :core: Introduce ContextHelper, where you can get the default looper, handler, and dispatcher for Android
    • :mediapicker: Use video preloading instead of full async loading
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-alpha01(Jan 6, 2019)

  • 3.8.0(Oct 8, 2018)

    • Update everything to Android Studio 3.1
    • Fix new lint issues (see Migration for resource related methods)
    • :adapter: Add more IAdapter functions to help retrieve selections
    • :core: Add deprecation warning to bindView for fragment based extensions; use bindViewResettable instead
    • :kpref-activity: Fix seekbar increment
    Source code(tar.gz)
    Source code(zip)
  • 3.6.1(Dec 31, 2017)

    v3.6.1

    • :core: [Breaking] Removed private text field and introduced lazy logging functions

    v3.6.0

    • :adapter: Create withOnRepeatedClickListener
    • :core: Create kotlin flyweight
    • :core: Created BundleUtils
    • :core: [Breaking] Refactored startActivity functions
    • :kpref-activity: [Breaking] Simplified listener function parameters
    • :kpref-activity: [Breaking] Added dynamic string loading options
    • (See Migrations.md for further details on breaking changes)
    Source code(tar.gz)
    Source code(zip)
  • 3.5.1(Dec 3, 2017)

    v3.5.1

    • Add Portuguese translations
    • Add some minor util elements
    • Update dependencies (sdk 27)

    v3.5.0

    • Update dependencies, many of which with major version increments
    • Add Vietnamese translations
    • Add Italian translations
    • Clean up unnecessary build version support
    • Optimize and refactor old code
    • :adapter: Add helper methods to enhance FastAdapter for Kotlin
    • :core: Create ProgressAnimator class
    • :searchview: Add searchview holder interface

    v3.4.5

    • Add French translations
    • Add Spanish translations
    • Add German translations
    • Remove unnecessary strings
    Source code(tar.gz)
    Source code(zip)
  • 3.4.4(Oct 14, 2017)

    • Add translation support for crowdin
    • Update dependencies
    • :mediapicker: Validate document uri before parsing
    • :searchview: Ignore casing for highlights
    Source code(tar.gz)
    Source code(zip)
  • 3.4.1(Sep 23, 2017)

  • 3.4.0(Aug 30, 2017)

    • Update to gradle 4.x; api and implementation rather than compile
    • Update dependencies
    • :searchview: Ensure reveals are called on the UI thread
    • :searchview: Check that searchview has a parent before checking card state
    • :mediapicker: Reuse request manager from activity
    • :kpref-activity: Add bounds to text item
    Source code(tar.gz)
    Source code(zip)
  • 3.2.5(Aug 5, 2017)

    • :core: Fix FAQ background
    • :core: Create FileUtils
    • :core: Create NotificationUtils
    • :core: Update swipe to remove most exceptions
    • :core: Make logging class functions inline
    • :core-ui: Move reactive libs to :searchview:
    Source code(tar.gz)
    Source code(zip)
  • 3.2.2(Aug 2, 2017)

  • 3.2.0(Jul 27, 2017)

Owner
Allan Wang
UX Engineer • McGill Science 2019
Allan Wang
Extensive Redis Pub-Sub wrapper for lettuce written in Kotlin

aware Extensive annotation-based Redis Pub-Sub wrapper for lettuce written in Kotlin. Aware was written to be a replacement for the very dated Banana

Subham 6 Dec 28, 2022
A simple Kotlin class to use to connect to a MongoDB collection.

mongodb-kotlin A simple Kotlin class to use to connect to a MongoDB collection. Once you have created a MongoDB project, choose Build a Database: Next

null 2 Oct 23, 2022
KoltinPulsar - A collection of experiments using Kotlin with Apache Pulsar

Some Experiments of using Kotlin and Apache Pulsar This is a collection of exper

Wayne Ellis 0 Jan 11, 2022
Third application for Big Brain Kotlin book, will be pokemon collection app

Big Brain Kotlin : Application #3 - PokemonHurddle Third application for Big Brain Kotlin book, will be pokemon collecting app 11285 Pokemon and becom

Chetan Gupta 3 May 12, 2022
Collection of various algorithms in mathematics, computer science etc implemented in Kotlin for educational purposes.

The Kotlin Algorithms Implementation of different algorithms and data structures using Kotlin lang Overview The repository is a collection of open-sou

Oleksii Shtanko 9 Aug 1, 2022
Collection of code samples for learning Android Fundamentals.

Android Tutorials Collection of code samples for learning Android Fundamentals and lessons in KOTLIN from YOUTUBE. The layout of Android Applications

Mustajab Ikram 2 Oct 11, 2022
Collection of Rewrite Recipes pertaining to the JHipster web application & microservice development platform

Apply JHipster best practices automatically What is this? This project implements a Rewrite module that applies best practices and migrations pertaini

OpenRewrite 5 Mar 7, 2022
A collection of code generators powered by ksp.

AutoKsp A collection of code generators powered by ksp. status: working in progress Projects AutoGradlePlugin - Generate gradle plugin properties file

shenghaiyang 0 Nov 8, 2021
A collection of katas either copied or ported from some amazing folks

Kotlin Refactoring Katas A collection of katas either copied or ported from some

Ragunath Jawahar 5 Nov 15, 2022
GraphQL Jetpack - A collection of packages for easily writing Java GraphQL server implementations

GraphQL Jetpack A collection of packages for easily writing Java GraphQL server

Ryan Yang 18 Dec 2, 2022
Collection of JVM library logic that the Sirloin software development team is currently using

Collection of JVM library logic that the Sirloin software development team is currently using

Sirloin Dev 4 May 10, 2022
Repo: Programming problems with solutions in Kotlin to help avid Kotlin learners to get a strong hold on Kotlin programming.

Kotlin_practice_problems Repo: Programming problems with solutions in Kotlin to help avid Kotlin learners to get a strong hold on Kotlin programming.

Aman 0 Oct 14, 2021
Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP)

Mockative Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP). Installation Mockative uses KSP to generate

Mockative 121 Dec 26, 2022
Kotlin-oop - Repositório criado para ser utilizado pelo projeto de Kotlin OOP desenvolvido em Kotlin nas aulas feitas através da plataforma Alura.

Projeto React OOP Repositório criado para ser utilizado pelo projeto de Kotlin OOP desenvolvido em Kotlin nas aulas feitas através da plataforma Alura

Marcos Felipe 1 Jan 5, 2022
Kotlin-koans - Kotlin Koans are a series of exercises to get you familiar with the Kotlin Syntax

kotlin-koans-edu Kotlin Koans are a series of exercises to get you familiar with

null 1 Jan 11, 2022
Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin Gradle DSL.

SampleCompose Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin

Mohammadali Rezaei 7 Nov 28, 2022
Clean Android multi-module offline-first scalable app in 2022. Including Jetpack Compose, MVI, Kotlin coroutines/Flow, Kotlin serialization, Hilt and Room.

Android Kotlin starter project - 2022 edition Android starter project, described precisely in this article. Purpose To show good practices using Kotli

Krzysztof Dąbrowski 176 Jan 3, 2023
Kotlin TodoMVC – full-stack Kotlin application demo

Kotlin full stack TodoMVC This project is an example implementation of the TodoMVC app written in Kotlin. More specifically, it's the Kotlin port of t

Gyula Voros 22 Oct 3, 2022
Integration Testing Kotlin Multiplatform Kata for Kotlin Developers. The main goal is to practice integration testing using Ktor and Ktor Client Mock

This kata is a Kotlin multiplatform version of the kata KataTODOApiClientKotlin of Karumi. We are here to practice integration testing using HTTP stub

Jorge Sánchez Fernández 29 Oct 3, 2022