skydoves / AndroidVeil

:performing_arts: An easy and flexible way to implement loading skeletons and shimmering effects on layouts for Android.
Apache License 2.0
1.52k stars 106 forks source link

Implementing veil skeletons in a RecyclerView with multiple view types (layouts) #10

Open itabdullah1 opened 4 years ago

itabdullah1 commented 4 years ago

Is your feature request related to a problem?

How to implement veil skeletons in a RecyclerView with multiple view types? Currently VeilRecyclerFrameView accepts only one VeilLayout. How to add one VeilLayout for each view types ? For example I use 7 different layouts in my RecyclerView as below:

    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {

        if (viewType == 0) {
            View view = inflater.inflate(R.layout.item_content_settings, parent, false);
            return new MyViewHolder(view);
        } else if (viewType == 1) {
            View view = inflater.inflate(R.layout.item_edit_delete_settings, parent, false);
            return new EditDeleteItemHolder(view);
        } else if (viewType == 2) {
            View view = inflater.inflate(R.layout.item_addnew_settings, parent, false);
            return new AddItemHolder(view);
        } else if (viewType == 3) {
            View view = inflater.inflate(R.layout.item_content_none_settings, parent, false);
            return new NoneHolder(view);
        } else if (viewType == 4) {
            View view = inflater.inflate(R.layout.item_email_id_settings, parent, false);
            return new EmailHolder(view);
        } else if (viewType == 5) {
            View view = inflater.inflate(R.layout.item_delete_data, parent, false);
            return new DeleteDataHolder(view);
        } else {
            View view = inflater.inflate(R.layout.button_save_settings, parent, false);
            return new SaveButtonHolder(view);
        }
    }

Thanks.

DroidPulkit commented 4 years ago

Looking for this feature in all shimmer lib, looks like we need to create something custom