All Projects → ericktijerou → koleton

ericktijerou / koleton

Licence: Apache-2.0 License
The easiest library to show skeleton screens in an Android app.

Programming Languages

kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to koleton

Skeletonview
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
Stars: ✭ 10,804 (+12761.9%)
Mutual labels:  facebook, skeleton, placeholder, loading, loading-animation, facebook-animation
Tabanimated
A skeleton screen framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)
Stars: ✭ 2,909 (+3363.1%)
Mutual labels:  skeleton, placeholder, loading, loading-animation, skeleton-screen, facebook-animation
Skeleton
A library provides an easy way to show skeleton loading view like Facebook and Alipay
Stars: ✭ 3,368 (+3909.52%)
Mutual labels:  placeholder, shimmer, loadingview, skeleton-loading
Vue Content Loading
Vue component to easily build (or use presets) SVG loading cards Facebook like.
Stars: ✭ 729 (+767.86%)
Mutual labels:  facebook, skeleton, placeholder, loading
React Content Loader
⚪ SVG-Powered component to easily create skeleton loadings.
Stars: ✭ 11,830 (+13983.33%)
Mutual labels:  skeleton, placeholder, loading, skeleton-screen
Skeleton-Bones
Library for dynamically generating skeleton loader drawables for Layouts and Views
Stars: ✭ 78 (-7.14%)
Mutual labels:  skeleton, skeleton-loading, skeleton-screens
Skeletonui
☠️ Elegant skeleton loading animation in SwiftUI and Combine
Stars: ✭ 275 (+227.38%)
Mutual labels:  skeleton, placeholder, loading
Skeletonloadingview
SkeletonLoadingView(Shimmer) with Kotlin in Android💀💀
Stars: ✭ 146 (+73.81%)
Mutual labels:  skeleton, loading
Ocskeleton
[OCSkeleton] - Make your loading view a little difference.
Stars: ✭ 184 (+119.05%)
Mutual labels:  skeleton, placeholder
Placeholdifier
Turn any website into a live wireframe
Stars: ✭ 230 (+173.81%)
Mutual labels:  skeleton, placeholder
React Native Shimmer Placeholder
Placeholder/ Skeleton of React Native
Stars: ✭ 679 (+708.33%)
Mutual labels:  skeleton, placeholder
Listplaceholder
ListPlaceholder is a swift library allows you to easily add facebook style animated loading placeholder to your tableviews or collection views.
Stars: ✭ 511 (+508.33%)
Mutual labels:  facebook, placeholder
Rhplaceholder
Show pleasant loading view for your users 😍
Stars: ✭ 238 (+183.33%)
Mutual labels:  facebook, placeholder
Skeleton Elements
Skeleton elements - UI for improved perceived performance
Stars: ✭ 27 (-67.86%)
Mutual labels:  skeleton, placeholder
Windless
Windless makes it easy to implement invisible layout loading view.
Stars: ✭ 919 (+994.05%)
Mutual labels:  skeleton, loading
react-loading-placeholder
Loading placeholer, inspired by Facebook
Stars: ✭ 17 (-79.76%)
Mutual labels:  placeholder, loading
ZXLoadingView
🍕ZXLoadingView is an iOS progress-activity
Stars: ✭ 14 (-83.33%)
Mutual labels:  loading, loadingview
XHLoadingView
🚀A load Loading page state view,load,no network,empty data,load failure state switch.
Stars: ✭ 58 (-30.95%)
Mutual labels:  loading, loadingview
Skeleton
Skeleton Android
Stars: ✭ 293 (+248.81%)
Mutual labels:  skeleton, placeholder
React Skeletor
Skeleton loading for React
Stars: ✭ 551 (+555.95%)
Mutual labels:  skeleton, loading

Koleton

The easiest library to show skeleton screens in an Android app.

Kotlin Minimum SDK Version

An Android library that provides an easy way to show skeleton of any view.

Koleton is an acronym for: Kotlin skeleton.

Made with by ericktijerou.

img img img

Installation

You can download and install Koleton with Maven Central and Gradle:

// In your module's `build.gradle.kts`
dependencies {
    implementation("com.ericktijerou.koleton:koleton:1.0.0-beta01")
}

Make sure to include mavenCentral() in your repositories

repositories {
  mavenCentral()
}

Quick Start

To load the skeleton of a View, use the loadSkeleton extension function:

// ConstraintLayout
constraintLayout.loadSkeleton()

// TextView
textView?.loadSkeleton(length = 20)

// RecyclerView
recyclerView.loadSkeleton(R.layout.item_example)

Skeletons can be configured with an optional trailing lambda:

// ConstraintLayout
constraintLayout.loadSkeleton {
    color(R.color.colorSkeleton)
    cornerRadius(radiusInPixel)
    shimmer(false)
    lineSpacing(spacingInPixel)
}

// TextView
textView?.loadSkeleton(length = 20) {
    color(R.color.colorSkeleton)
    ...
}

// RecyclerView
recyclerView.loadSkeleton(R.layout.item_example) {
    itemCount(3)
    ...
}

To hide the skeleton, use the hideSkeleton extension function:

view.hideSkeleton()

SkeletonLoader

Koleton will lazily create a SkeletonLoader with the default values. If you want to set the default values, you can set a default SkeletonLoader instance by either:

// In your Application
class MyApplication : Application(), SkeletonLoaderFactory {

    override fun newSkeletonLoader(): SkeletonLoader {
        return SkeletonLoader.Builder(this)
            ...
            .color(R.color.colorSkeleton)
            .cornerRadius(radiusInPixel)
            .build()
    }
}

Or calling Koleton.setSkeletonLoader

val skeletonLoader = SkeletonLoader.Builder(context)
    ...
    .color(R.color.colorSkeleton)
    .cornerRadius(radiusInPixel)
    .build()
Koleton.setSkeletonLoader(skeletonLoader)

The default SkeletonLoader can be retrieved like so:

val skeletonLoader = Koleton.skeletonLoader(context)

Paging

Koleton works well with Paging library with the help of KoletonView.

If you want to show a skeleton when you scroll to the bottom of your list, use the generateSkeleton extension function:

// In your PagedListAdapter
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
    val view = LayoutInflater.from(parent.context).inflate(R.layout.item_sample, parent, false)
    return when (viewType) {
        ...
        TYPE_SKELETON -> SkeletonViewHolder(view.generateSkeleton())
        ...
    }
}

...

class SkeletonViewHolder(val koletonView: KoletonView) : RecyclerView.ViewHolder(koletonView) {
    fun showSkeleton() {
        koletonView.showSkeleton()
    }
}

Shimmer effect

Koleton works with Facebook’s shimmer library. If you want to create a custom shimmer effect, you need to include in your dependencies:

// In your module's `build.gradle.kts`
dependencies {
    implementation("com.facebook.shimmer:shimmer:0.5.0")
}

And set the custom shimmer in the lambda expression:

constraintLayout.loadSkeleton {
    val customShimmer = Shimmer.AlphaHighlightBuilder()
        .setDirection(Shimmer.Direction.TOP_TO_BOTTOM)
        ...
        .build()
    shimmer(customShimmer)
}

img

You can find more information about Facebook's shimmer effect on the shimmer-android page.

License

   Copyright 2020 ericktijerou

   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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].