use of io.virtualapp.home.models.AppData in project VirtualApp by asLody.
the class LaunchpadAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
AppData data = mList.get(position);
holder.color = getColor(position);
holder.iconView.setImageDrawable(data.getIcon());
holder.nameView.setText(data.getName());
if (data.isFirstOpen() && !data.isLoading()) {
holder.firstOpenDot.setVisibility(View.VISIBLE);
} else {
holder.firstOpenDot.setVisibility(View.INVISIBLE);
}
holder.itemView.setBackgroundColor(holder.color);
holder.itemView.setOnClickListener(v -> {
if (mAppClickListener != null) {
mAppClickListener.onAppClick(position, data);
}
});
if (data instanceof MultiplePackageAppData) {
MultiplePackageAppData multipleData = (MultiplePackageAppData) data;
holder.spaceLabelView.setVisibility(View.VISIBLE);
holder.spaceLabelView.setText(multipleData.userId + 1 + "");
} else {
holder.spaceLabelView.setVisibility(View.INVISIBLE);
}
if (data.isLoading()) {
startLoadingAnimation(holder.iconView);
} else {
holder.iconView.setProgress(100, false);
}
}
Aggregations