All Projects → Faltenreich → Skeletonlayout

Faltenreich / Skeletonlayout

Licence: apache-2.0
Skeleton view pattern for Android

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Skeletonlayout

Androidveil
🎭 An easy, flexible way to implement veil skeletons and shimmering effect for Android.
Stars: ✭ 792 (+325.81%)
Mutual labels:  skeleton, recyclerview
Byrecyclerview
🔥 RecyclerView 下拉刷新、加载更多、item点击/长按、头布局/尾布局/状态布局、万能分割线、Skeleton骨架图、极简adapter(RV/LV)等
Stars: ✭ 290 (+55.91%)
Mutual labels:  skeleton, recyclerview
Binding
Simple API implement DataBinding and ViewBinding. 简单的 API 实现 DataBinding 和 ViewBinding,欢迎 star
Stars: ✭ 169 (-9.14%)
Mutual labels:  recyclerview
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+1480.65%)
Mutual labels:  progress
Hgcircularslider
A custom reusable circular / progress slider control for iOS application.
Stars: ✭ 2,240 (+1104.3%)
Mutual labels:  progress
Customadapter
RV Adapter 优雅封装,抽取列表模版,可以快速的添加一个列表,使用组装的方式构建Adapter,抽象Cell 角色,负责创建ViewHolder,绑定数据和逻辑处理。Cell为一个独立的组件。
Stars: ✭ 172 (-7.53%)
Mutual labels:  recyclerview
Sortrecyclerviewlist
Recyclerview实现字母排序,过滤搜索,顶部悬浮,波浪形的侧边栏
Stars: ✭ 179 (-3.76%)
Mutual labels:  recyclerview
Fastadapter
快速使用的RecyclerView Adapter
Stars: ✭ 170 (-8.6%)
Mutual labels:  recyclerview
Polymer Skeleton
💀 Skeleton for Polymer 3 app with Webpack, PostCSS and Service Workers ready.
Stars: ✭ 185 (-0.54%)
Mutual labels:  skeleton
Snappyrecyclerview
An extension to RecyclerView which will snap to child Views to the specified anchor, START, CENTER or END.
Stars: ✭ 178 (-4.3%)
Mutual labels:  recyclerview
Dragdroptworecyclerviews
A code example demonstrating a dragging and dropping from one RecyclerView into another RecyclerView.
Stars: ✭ 181 (-2.69%)
Mutual labels:  recyclerview
Airbnb Android Google Map View
This is a sample Android Application which has Google Map view similar to what AirBnb Android Application. Moving Markers like Uber/Ola. Custom Google Search for places. Recycler view with Animations added.
Stars: ✭ 175 (-5.91%)
Mutual labels:  recyclerview
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (-6.99%)
Mutual labels:  progress
Slim Born
Slim Framework 3 and 4 skeleton application has authentication MVC construction.
Stars: ✭ 179 (-3.76%)
Mutual labels:  skeleton
Svprogresshud
A clean and lightweight progress HUD for your iOS and tvOS app.
Stars: ✭ 12,339 (+6533.87%)
Mutual labels:  progress
Infinitescroll
Infinite Scroll (Endless Scrolling) for RecyclerView in Android
Stars: ✭ 183 (-1.61%)
Mutual labels:  recyclerview
Baumeister
👷 The aim of this project is to help you to build your things. From Bootstrap themes over static websites to single page applications.
Stars: ✭ 171 (-8.06%)
Mutual labels:  skeleton
Essential React
A minimal skeleton for building testable React apps using Babel
Stars: ✭ 2,035 (+994.09%)
Mutual labels:  skeleton
Placeholderview
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
Stars: ✭ 2,104 (+1031.18%)
Mutual labels:  recyclerview
Sherlockadapter
一个万能的封装了RecyclerView.Adapter的功能库。
Stars: ✭ 186 (+0%)
Mutual labels:  recyclerview

SkeletonLayout

Download API

Make your app feel faster

Users are time-sensitive and may skip an app due to long loading times and missing visual feedback. Instagram, Facebook, Google and other services tackled this problem with the so-called Skeleton View. This view is being displayed during the process of fetching or requesting data asynchronously which leads to a perceivedly more responsive app.

This library implements the Skeleton View pattern and provides an easy way for other developers to enable it in their apps.

Demo

Get it on Google Play

Preview

The SkeletonLayout mimics the design of established implementations per default, but you are free to get creative. Create your own skeleton view with custom shapes, colors and shimmers.

Features

  • Make your app feel faster: Immediate visual feedback long before your data has been fetched or requested
  • Support any View: Apply to any type of View or ViewGroup
  • RecyclerView on speed: Convenience adapter for RecyclerView as it is the main use case
  • ViewPager2 support: Convenience adapter for ViewPager2 as it uses a RecyclerView under the hood
  • Customization: Adjust shimmer, color and shape of the skeleton to set you apart from other apps
  • Minimum effort: A fistful lines of code to use the SkeletonLayout
  • Minimum footprint: org.jetbrains.kotlin:kotlin-stdlib-jdk7, androidx.recyclerview:recyclerview and androidx.viewpager2.widget.ViewPager2 are the only dependencies

Getting Started

Gradle
dependencies {
    implementation 'com.faltenreich:skeletonlayout:<version>'
}
XML
<com.faltenreich.skeletonlayout.SkeletonLayout
    android:id="@+id/skeletonLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    
    <!-- Views to mask -->
    
</com.faltenreich.skeletonlayout.SkeletonLayout>
Kotlin
class MainActivity : AppCompatActivity() {

    private lateinit var skeleton: Skeleton

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Either use an existing Skeletonlayout
        skeleton = findViewById(R.id.skeletonLayout)

        // or create a new SkeletonLayout from a given View
        skeleton = view.createSkeleton()

        // or apply a new SkeletonLayout to a RecyclerView
        skeleton = recyclerView.applySkeleton(R.layout.list_item_recyclerview)

        // or apply a new SkeletonLayout to a ViewPager2
        skeleton = viewPager2.applySkeleton(R.layout.list_item_viewpager2)

        skeleton.showSkeleton()
    }

    // Example callback that hides skeleton
    private fun onDataLoaded() {
        skeleton.showOriginal()
    }
}
Java
public class MainActivity extends AppCompatActivity {
    
    private Skeleton skeleton;
    
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        // Either use an existing Skeletonlayout
        skeleton = findViewById(R.id.skeletonLayout);
        
        // or create a new SkeletonLayout from a given View
        skeleton = SkeletonLayoutUtils.createSkeleton(view);
        
        // or apply a new SkeletonLayout to a RecyclerView
        skeleton = SkeletonLayoutUtils.applySkeleton(recyclerView, R.layout.list_item_recyclerview);

        // or apply a new SkeletonLayout to a ViewPager2
        skeleton = SkeletonLayoutUtils.applySkeleton(viewPager2, R.layout.list_item_viewpager2);

        skeleton.showSkeleton();
    }
    
    // Example callback that hides skeleton
    private void onDataLoaded() {
        skeleton.showOriginal();
    }
}

Configuration

Property Type Description
maskColor color Color of the mask that fills the original view bounds (defaults to #E0E0E0)
maskCornerRadius dimension The x- and y-radius of the oval used to round the mask corners (defaults to 25)
showShimmer boolean Animate shimmer if set to true (defaults to true)
shimmerColor color Color of the animated shimmer (defaults to #d5d5d5)
shimmerDurationInMillis integer Duration in milliseconds for one shimmer animation interval (defaults to 2000)
shimmerDirection enum Direction of animated shimmer (defaults to LEFT_TO_RIGHT)
shimmerAngle integer Angle in degrees for animated shimmer (defaults to 0)
itemCount integer Item count for Skeleton adapter (RecyclerView and ViewPager2 only, defaults to 3)

FAQ

When and how is the skeleton created? The skeleton gets created after the original view's onLayout(), since we rely on it to be fully rendered in order to mask its bounds.

How does the masking work? The mask is drawn onto a single Bitmap by iterating once through the given Views and their bounds.

May properties of the SkeletonLayout be changed at runtime? Yes. Any change to the skeleton leads to a redraw, since the whole content of the SkeletonLayout gets drawn onto a single bitmap.

Will the shimmer eat my users' battery? The shimmer is a shader (LinearGradient) whose local matrix is updated according to the framerate of the target device, so no redrawing is required and processing time is kept to an absolute minimum. Additionally the shimmer gets inactive onWindowFocusChanged() and onDetachedFromWindow().

License

Copyright 2020 Philipp Fahlteich

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