Open Two Item On RecyclerView When Click on One Of Items
Ebrahimjz opened this issue · 2 comments
Hi Every Body i Have an issue with folding-cell and that is some thing like this when i click on one of recyclerView Items in that it open truely but it open another one at the buttom of list i mean when i click on item 0 it open item 0 and item 10 (maybe recycler view loaded items at once) and reaptly item 20 30 and like this what can i do for this?
sorry for my bad english.
here is my adapter code
`
public class LessonShowAdapter extends RecyclerView.Adapter<LessonShowAdapter.LessonShowViewHolder> {
Context context;
List<LessonShowStruct> structs = new ArrayList<>();
public LessonShowAdapter(Context context, List<LessonShowStruct> structs) {
this.context = context;
this.structs = structs;
}
@NonNull
@Override
public LessonShowViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new LessonShowViewHolder(LayoutInflater.from(context).inflate(R.layout.model_lesson_show, parent, false));
}
@Override
public void onBindViewHolder(@NonNull final LessonShowViewHolder holder, int position) {
final LessonShowStruct struct = structs.get(position);
holder.Id = struct.getId();
holder.Name.setText(struct.getName());
holder.Number.setText(struct.getNumber());
//Glide.with(context).load(R.drawable.cell).into(holder.IMG);
holder.FoldName.setText(struct.getName());
holder.FoldDesc.setText(struct.getDesc());
if (struct.getIsLiked().equals("1")) {
holder.Like.setImageResource(R.drawable.ic_favorite_red);
}
holder.Open.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, OneLessonShowActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
});
holder.Like.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (struct.getIsLiked().equals("1"))
G.updateData("0");
else {
G.updateData("1");
}
}
});
holder.Options.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showPopUpOptionMenu(v);
}
});
holder.fc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.fc.toggle(false);
}
});
/* holder.FramNotFold.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
holder.fc.toggle(true);
}
});*/
}
private void showPopUpOptionMenu(View v) {
}
@Override
public int getItemCount() {
return structs.size();
}
class LessonShowViewHolder extends RecyclerView.ViewHolder {
String Id;
TextView Number, Name, FoldName, FoldDesc;
ImageView IMG, Like, Options;
Button Open;
FoldingCell fc;
FrameLayout FrameFold, FramNotFold;
LessonShowViewHolder(View itemView) {
super(itemView);
fc = itemView.findViewById(R.id.folding_cell);
Number = itemView.findViewById(R.id.lesson_show_number);
Name = itemView.findViewById(R.id.lesson_show_title);
Like = itemView.findViewById(R.id.lesson_show_fav);
Options = itemView.findViewById(R.id.lesson_show_more);
IMG = itemView.findViewById(R.id.lesson_show_image);
Open = itemView.findViewById(R.id.lesson_show_open);
FoldDesc = itemView.findViewById(R.id.lesson_show_descc);
FoldName = itemView.findViewById(R.id.lesson_show_tit);
FrameFold = itemView.findViewById(R.id.cell_title_view);
FramNotFold = itemView.findViewById(R.id.cell_content_view);
}
}
}`
Any feedback on this?
Hello, guys. We couldn't reproduce the exact same behavior. It looks like there is some logical issue on your side. We also updated this lib, added improvements and resolved some issues. Try to update to the most recent version of the lib and check again how you're using it, maybe look inside one of the example apps in this repo, cause they work correctly.