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
Collection of Small Android Projects

AndroidDemoProjects ActivityRecognition: Example of using Google Play Services to recognize a user's activity, such as running, walking, or riding a b

Paul Ruiz 601 Dec 9, 2022
TMDbHub - Listing movies using the TMDb API. You can filter results, view details, and save them to a collection

TMDb Hub Listing movies using the TMDb API. You can filter results, view details

David Varga 4 Dec 30, 2021
Linuxcnc probescripts - Collection of scripts for several touch-probe routines

linuxcnc_probescripts Collection of scripts for several touch-probe routines. Al

Multifuchs UG (haftungsbeschränkt) 0 Jan 30, 2022
📱 Andriller - is software utility with a collection of forensic tools for smartphones

Andriller - is software utility with a collection of forensic tools for smartphones. It performs read-only, forensically sound, non-destructive acquisition from Android devices. It has features, such as powerful Lockscreen cracking for Pattern, PIN code, or Password; custom decoders for Apps data from Android (some Apple iOS & Windows) databases for decoding communications. Extraction and decoders produce reports in HTML and Excel formats.

Denis Sazonov 980 Dec 27, 2022
Android-basics-kotlin-tip-time-app - Tip Time app from Android Basics in Kotlin

Tip Time Tip Time app from Android Basics in Kotlin at developers.google.com. It

Ramon Lima e Meira 0 Jan 2, 2022
A full-stack application showing the power 💪 of KOTLIN. Entire android app + backend Apis written in Kotlin 🔥

Gamebaaz ?? A full-stack application showing the power ?? of KOTLIN. Entire android app + backend Apis written in Kotlin ?? Android Backend Jetpack Co

Sarnava Konar 85 Nov 17, 2022
An simple image gallery app utilizing Unsplash API to showcase modern Android development architecture (MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit)

Imagine App An simple image gallery app utilizing Unsplash API. Built with ❤︎ by Wajahat Karim and contributors Features Popular photos with paginatio

Wajahat Karim 313 Jan 4, 2023
Primeiro aplicativo desenvolvido na linguagem kotlin, durante o Hackathon no curso de Android Kotlin da Cel.Lep em parceria com Estação Hack from Facebook

Tela Splash: Nome do aplicativo e uma imagem: Tela Main, principal tela do aplicativo: Um campo para o usuário informar a medida; Um spinner com os ti

Maria Fortunato 0 Nov 3, 2021
MVVM + Kotlin + Jetpack Compose +Navigation Compose + Hilt + Retrofit + Unit Testing + Compose Testing + Coroutines + Kotlin Flow + Io mockK

MvvmKotlinJetpackCompose Why do we need an architecture even when you can make an app without it? let's say you created a project without any architec

Sayyed Rizwan 46 Nov 29, 2022
A general purpose kotlin library that use kotlin coroutines, flows and channels to provide timer features with the most easy and efficient way

Timer Timer is a general purpose kotlin library that use kotlin coroutines, flows and channels to provide timer features with the most easy and effici

Amr Saraya 3 Jul 11, 2022
Solution to the 2021 Advent of code challenge in Kotlin. aoc-2021-in-kotlin

advent-of-code-2021 Welcome to the Advent of Code1 Kotlin project created by aniobistanley using the Advent of Code Kotlin Template delivered by JetBr

null 0 Dec 24, 2021
Coinbase-pro-feed-kotlin - Kotlin Coinbase Pro Level 2 Order Book Feed

Kotlin Coinbase Pro Level 2 Order Book Feed Quick start Depending on your OS run

Eric McEvoy 0 Jan 2, 2022
Kotlin-basic-calculator - Basic calculator to understand syntax and the methods of Kotlin

KotlinBasicCalculator I always love to create a calculater for understand the sy

Onur Serbes 1 Mar 8, 2022
To Do List App is built in Kotlin using Material 3, Data Binding, Navigation Component Graphs, Room persistence library, Kotlin coroutines, LiveData, Dagger Hilt, and Notifications following MVVM Architecture.

ToDoListApp ToDoList App demonstrates modern Android development with Hilt, Coroutines, LiveData, Jetpack (Room, ViewModel), and Material 3 Design bas

Naman Garg 10 Jan 8, 2023
Shreyas Patil 2.1k Dec 30, 2022
A sample app illustrating Android development using Kotlin with MVVM architecture, Android Jetpack, and other commonly used libraries.

Anime Facts A sample app illustrating Android development using Kotlin with MVVM architecture, Android Jetpack, and other commonly used libraries. Ani

Eugene Javiñas 0 Dec 5, 2021
Android app which fetches a sample movies list to display. Built using Kotlin and latest Android tech stack, with an approach to clean architecture.

movies-sample-app This is an Android app which fetches a sample movies list to display. Built using Kotlin and latest Android tech stack, with an appr

Nadeem Ahmed 1 Oct 21, 2021
An Open-Source repository that contains all the Android Dev and Kotlin concepts and several projects on android ranging in difficulty making this repo completely beginner-friendly.

An Open-Source repository that contains all the Android Dev and Kotlin concepts and several projects on android ranging in difficulty making this repo completely beginner-friendly. The main aim of this repository is to help students who are learning Android Development or preparing for an Android Developer role-based job.

Mimo Patra 15 Dec 29, 2022