Skip to content

wslaimin/Piccolo

Repository files navigation

Piccolo

Powerful skeleton and placeholder for views in Android.Easy api and free from OOM.

support:

  • Single view
  • RecyclerView
  • ListView
  • GridView
  • ViewPager

Screenshots

single view

RecyclerView

ListView

ViewPager

20210427_180111_57

Dependence

dependencies {
    implementation 'io.github.wslaimin:piccolo:1.0.1'
}

Usage

Mark target view

Use PiccoloLayout mark target view in xml

<com.lm.piccolo.view.PiccoloLayout
    android:id="@+id/Piccolo_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="60dp"
    app:mask="com.lm.piccolo.drawable.ImageShiningDrawable">

    <ImageView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:src="@drawable/ic_launcher_background"/>
</com.lm.piccolo.view.PiccoloLayout>

attributes of PiccoloLayout

name type description
app:mask drawable|color|Drawable classs drawable of placeholder
app:shining boolean whether start animation of drawable
app:shining_paddingLeft dimension padding left of drawable
app:shining_paddingRight dimension padding right of drawable
app:shining_paddingTop dimension padding top of drawable
app:shining_paddingBottom dimension padding bottom of drawable

Single view

show skeleton

PiccoloLayout piccoloImage=findViewById(R.id.Piccolo_image);
ConductorForView conductor=Piccolo.createForView(piccoloImage).visible(true);
conductor.play();

hide skeleton

conductor.visible(false).play();

Views generated by adapter

show skeleton

RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
ConductorForAdapter ConductorForAdapter = Piccolo.createForList(recyclerView);
int[] data=new int[]{R.layout.item, R.layout.item_another, R.layout.item, R.layout.item_another, R.layout.item, R.layout.item_another, R.layout.item, R.layout.item_another};
ConductorForAdapter.items(data)
              	.visible(true)
                .adapter(new Adapter())
                .play();

hide skeleton

ConductorForAdapter.visible(false).play();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages