|
|
|
|
@ -6,6 +6,7 @@ import android.view.ViewGroup; |
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
import androidx.leanback.widget.Presenter; |
|
|
|
|
|
|
|
|
|
import com.fongmi.android.tv.R; |
|
|
|
|
import com.fongmi.android.tv.bean.Class; |
|
|
|
|
import com.fongmi.android.tv.databinding.AdapterTypeBinding; |
|
|
|
|
import com.fongmi.android.tv.utils.ResUtil; |
|
|
|
|
@ -33,7 +34,7 @@ public class TypePresenter extends Presenter { |
|
|
|
|
ViewHolder holder = (ViewHolder) viewHolder; |
|
|
|
|
holder.binding.text.setText(item.getTypeName()); |
|
|
|
|
holder.binding.text.setCompoundDrawablePadding(ResUtil.dp2px(4)); |
|
|
|
|
holder.binding.text.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, item.getIcon(), 0); |
|
|
|
|
holder.binding.text.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, getIcon(item), 0); |
|
|
|
|
setOnClickListener(holder, view -> mListener.onItemClick(item)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -41,6 +42,10 @@ public class TypePresenter extends Presenter { |
|
|
|
|
public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getIcon(Class item) { |
|
|
|
|
return item.getFilter() == null ? 0 : item.getFilter() ? R.drawable.ic_type_filter_off : R.drawable.ic_type_filter_on; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class ViewHolder extends Presenter.ViewHolder { |
|
|
|
|
|
|
|
|
|
private final AdapterTypeBinding binding; |
|
|
|
|
|