kHRYSTAL / CircleRecyclerView

the library is a loop RecyclerView(expression), can show some effects when display
714 stars 100 forks source link

once item selected and saved it's position #25

Closed gagan50 closed 6 years ago

gagan50 commented 6 years ago

Once item position has been saved then everytime how i can show that item selected? Please provide source code for it.

Thank you

kHRYSTAL commented 6 years ago

called onItemInCenter, the argument is the selected itemView, you can change you selected style in that method and in onBindViewHolder you can write like this to set the unselected style

       @Override
        public void onBindViewHolder(VH holder, int position) {
            Object obj = holder.itemView.getTag(R.string.tag_is_center);
            boolean selected = false;
            if (obj != null)
                selected = (Boolean)obj;
            if (!selected) {
                // the item is not in center, revert the unselected style
            }
gagan50 commented 6 years ago

My Code is below please check it's not working correctly

import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast;

import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List;

import mac.app.meetandchill.DataString; import mac.app.meetandchill.R; import mac.app.meetandchill.adapter.CircularRecyclerViewAdapter;

/**

kHRYSTAL commented 6 years ago

watch this commit

preview

gagan50 commented 6 years ago

Thanks alot that's working cool

Gagandeep Singh (Asso. Android Developer) Emp Id- 9677

On Thu, Jul 5, 2018 at 3:16 PM, Matt Yao notifications@github.com wrote:

watch this commit https://github.com/kHRYSTAL/CircleRecyclerView/commit/c59408fae76e39d818278aae321d479ab0df697e

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kHRYSTAL/CircleRecyclerView/issues/25#issuecomment-402667860, or mute the thread https://github.com/notifications/unsubscribe-auth/AfxG8InCufIRu7qKLOlkbUgb2HMnvBf-ks5uDeBtgaJpZM4VDeAf .