use of cn.sharesdk.onekeyshare.CustomerLogo in project nmid-headline by miao1007.
the class PlatformGridViewAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup viewGroup) {
ViewHolder viewHolder;
if (view == null) {
view = LayoutInflater.from(context).inflate(getLayoutRes(context, "skyblue_share_platform_list_item"), null);
viewHolder = new ViewHolder();
viewHolder.checkedImageView = (ImageView) view.findViewById(getIdRes(context, "checkedImageView"));
viewHolder.logoImageView = (ImageView) view.findViewById(getIdRes(context, "logoImageView"));
viewHolder.nameTextView = (TextView) view.findViewById(getIdRes(context, "nameTextView"));
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
Bitmap logo;
String label;
Object item = getItem(position);
boolean disabled;
boolean isDirectShare = item instanceof Platform ? ShareCore.isDirectShare((Platform) item) : true;
if (directOnlyPosition == -1) {
disabled = !checkedPositionList.isEmpty() && isDirectShare;
} else {
disabled = position != directOnlyPosition;
}
if (item instanceof Platform) {
logo = getIcon((Platform) item, disabled ? "" : "_checked");
label = getName((Platform) item);
view.setOnClickListener(this);
} else {
CustomerLogo customerLogo = (CustomerLogo) item;
logo = disabled ? customerLogo.disableLogo : customerLogo.enableLogo;
label = customerLogo.label;
view.setOnClickListener(this);
//TODO 需要整理
// view.setOnClickListener(((CustomerLogo) item).listener);
}
String checkedResName = directOnlyPosition != -1 && directOnlyPosition != position ? "skyblue_platform_checked_disabled" : "skyblue_platform_checked";
viewHolder.position = position;
viewHolder.checkedImageView.setImageBitmap(BitmapFactory.decodeResource(context.getResources(), getBitmapRes(context, checkedResName)));
viewHolder.checkedImageView.setVisibility(checkedPositionList.contains(viewHolder.position) ? View.VISIBLE : View.GONE);
viewHolder.nameTextView.setText(label);
viewHolder.logoImageView.setImageBitmap(logo);
return view;
}
Aggregations