mirror of
https://github.com/KokaKiwi/BarInsta
synced 2026-03-05 12:01:35 +00:00
39 lines
No EOL
1.2 KiB
Java
Executable file
39 lines
No EOL
1.2 KiB
Java
Executable file
package thoughtbot.expandableadapter;
|
|
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import awais.instagrabber.R;
|
|
import awais.instagrabber.interfaces.OnGroupClickListener;
|
|
|
|
public class GroupViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
|
private final OnGroupClickListener listener;
|
|
private final TextView title;
|
|
private final ImageView arrow;
|
|
|
|
public GroupViewHolder(@NonNull final View itemView, final OnGroupClickListener listener) {
|
|
super(itemView);
|
|
this.listener = listener;
|
|
this.title = itemView.findViewById(android.R.id.text1);
|
|
this.arrow = itemView.findViewById(R.id.collapsingArrow);
|
|
this.title.setBackgroundColor(0x80_1565C0);
|
|
itemView.setOnClickListener(this);
|
|
}
|
|
|
|
public void setTitle(@NonNull final String title) {
|
|
this.title.setText(title);
|
|
}
|
|
|
|
@Override
|
|
public void onClick(final View v) {
|
|
if (listener != null) listener.toggleGroup(getLayoutPosition());
|
|
}
|
|
|
|
public void toggle(final boolean expand) {
|
|
arrow.setImageResource(expand ? R.drawable.collapse : R.drawable.expand);
|
|
}
|
|
} |