Java源码示例:m.framework.ui.widget.asyncview.AsyncImageView
示例1
public void setData(int position) {
//TODO 设置listview的view
app = adapter.getItem(position);
tv_title.setText(app.title);
tv_msg.setText(app.text);
imv_download.setOnClickListener(this);
if (adapter.isFling()) {
Bitmap bm = BitmapProcessor.getBitmapFromCache(app.iconUrl);
if (bm != null && !bm.isRecycled()) {
imv_icon.setImageBitmap(bm);
} else {
imv_icon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
}
} else {
imv_icon.execute(app.iconUrl);
}
}
示例2
public View getView(int position, View convertView, ViewGroup parent) {
FollowListItem item = null;
if (convertView == null) {
LinearLayout llItem = new LinearLayout(parent.getContext());
item = new FollowListItem();
llItem.setTag(item);
convertView = llItem;
item.aivIcon = new AsyncImageView(getContext());
int dp_52 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 52);
int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 5);
LinearLayout.LayoutParams lpIcon = new LinearLayout.LayoutParams(dp_52, dp_52);
lpIcon.gravity = Gravity.CENTER_VERTICAL;
lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
item.aivIcon.setLayoutParams(lpIcon);
llItem.addView(item.aivIcon);
LinearLayout llText = new LinearLayout(parent.getContext());
llText.setPadding(0, dp_10, dp_10, dp_10);
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpText.gravity = Gravity.CENTER_VERTICAL;
lpText.weight = 1;
llText.setLayoutParams(lpText);
llItem.addView(llText);
item.tvName = new TextView(parent.getContext());
item.tvName.setTextColor(0xff000000);
item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
item.tvName.setSingleLine();
llText.addView(item.tvName);
item.tvSign = new TextView(parent.getContext());
item.tvSign.setTextColor(0x7f000000);
item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
item.tvSign.setSingleLine();
llText.addView(item.tvSign);
item.ivCheck = new ImageView(parent.getContext());
item.ivCheck.setPadding(0, 0, dp_10, 0);
LinearLayout.LayoutParams lpCheck = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpCheck.gravity = Gravity.CENTER_VERTICAL;
item.ivCheck.setLayoutParams(lpCheck);
llItem.addView(item.ivCheck);
} else {
item = (FollowListItem) convertView.getTag();
}
Following following = getItem(position);
item.tvName.setText(following.screeName);
item.tvSign.setText(following.description);
item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
if (isFling()) {
Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
if (bm != null && !bm.isRecycled()) {
item.aivIcon.setImageBitmap(bm);
} else {
item.aivIcon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
}
} else {
item.aivIcon.execute(following.icon);
}
if (position == getCount() - 1) {
next();
}
return convertView;
}
示例3
public View getView(int position, View convertView, ViewGroup parent) {
FollowListItem item = null;
if (convertView == null) {
LinearLayout llItem = new LinearLayout(parent.getContext());
item = new FollowListItem();
llItem.setTag(item);
convertView = llItem;
item.aivIcon = new AsyncImageView(getContext());
int dp_52 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 52);
int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 5);
LinearLayout.LayoutParams lpIcon = new LinearLayout.LayoutParams(dp_52, dp_52);
lpIcon.gravity = Gravity.CENTER_VERTICAL;
lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
item.aivIcon.setLayoutParams(lpIcon);
llItem.addView(item.aivIcon);
LinearLayout llText = new LinearLayout(parent.getContext());
llText.setPadding(0, dp_10, dp_10, dp_10);
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpText.gravity = Gravity.CENTER_VERTICAL;
lpText.weight = 1;
llText.setLayoutParams(lpText);
llItem.addView(llText);
item.tvName = new TextView(parent.getContext());
item.tvName.setTextColor(0xff000000);
item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
item.tvName.setSingleLine();
llText.addView(item.tvName);
item.tvSign = new TextView(parent.getContext());
item.tvSign.setTextColor(0x7f000000);
item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
item.tvSign.setSingleLine();
llText.addView(item.tvSign);
item.ivCheck = new ImageView(parent.getContext());
item.ivCheck.setPadding(0, 0, dp_10, 0);
LinearLayout.LayoutParams lpCheck = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpCheck.gravity = Gravity.CENTER_VERTICAL;
item.ivCheck.setLayoutParams(lpCheck);
llItem.addView(item.ivCheck);
} else {
item = (FollowListItem) convertView.getTag();
}
Following following = getItem(position);
item.tvName.setText(following.screeName);
item.tvSign.setText(following.description);
item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
if (isFling()) {
Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
if (bm != null && !bm.isRecycled()) {
item.aivIcon.setImageBitmap(bm);
} else {
item.aivIcon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
}
} else {
item.aivIcon.execute(following.icon);
}
if (position == getCount() - 1) {
next();
}
return convertView;
}
示例4
public View getView(int position, View convertView, ViewGroup parent) {
FollowListItem item = null;
if (convertView == null) {
LinearLayout llItem = new LinearLayout(parent.getContext());
item = new FollowListItem();
llItem.setTag(item);
convertView = llItem;
item.aivIcon = new AsyncImageView(getContext());
int dp_52 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 52);
int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 5);
LinearLayout.LayoutParams lpIcon = new LinearLayout.LayoutParams(dp_52, dp_52);
lpIcon.gravity = Gravity.CENTER_VERTICAL;
lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
item.aivIcon.setLayoutParams(lpIcon);
llItem.addView(item.aivIcon);
LinearLayout llText = new LinearLayout(parent.getContext());
llText.setPadding(0, dp_10, dp_10, dp_10);
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpText.gravity = Gravity.CENTER_VERTICAL;
lpText.weight = 1;
llText.setLayoutParams(lpText);
llItem.addView(llText);
item.tvName = new TextView(parent.getContext());
item.tvName.setTextColor(0xff000000);
item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
item.tvName.setSingleLine();
llText.addView(item.tvName);
item.tvSign = new TextView(parent.getContext());
item.tvSign.setTextColor(0x7f000000);
item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
item.tvSign.setSingleLine();
llText.addView(item.tvSign);
item.ivCheck = new ImageView(parent.getContext());
item.ivCheck.setPadding(0, 0, dp_10, 0);
LinearLayout.LayoutParams lpCheck = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpCheck.gravity = Gravity.CENTER_VERTICAL;
item.ivCheck.setLayoutParams(lpCheck);
llItem.addView(item.ivCheck);
} else {
item = (FollowListItem) convertView.getTag();
}
Following following = getItem(position);
item.tvName.setText(following.screeName);
item.tvSign.setText(following.description);
item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
if (isFling()) {
Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
if (bm != null && !bm.isRecycled()) {
item.aivIcon.setImageBitmap(bm);
} else {
item.aivIcon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
}
} else {
item.aivIcon.execute(following.icon);
}
if (position == getCount() - 1) {
next();
}
return convertView;
}
示例5
public View getView(int position, View convertView, ViewGroup parent) {
FollowListItem item = null;
if (convertView == null) {
LinearLayout llItem = new LinearLayout(parent.getContext());
item = new FollowListItem();
llItem.setTag(item);
convertView = llItem;
item.aivIcon = new AsyncImageView(getContext());
int dp_52 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 52);
int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 5);
LinearLayout.LayoutParams lpIcon = new LinearLayout.LayoutParams(dp_52, dp_52);
lpIcon.gravity = Gravity.CENTER_VERTICAL;
lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
item.aivIcon.setLayoutParams(lpIcon);
llItem.addView(item.aivIcon);
LinearLayout llText = new LinearLayout(parent.getContext());
llText.setPadding(0, dp_10, dp_10, dp_10);
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpText.gravity = Gravity.CENTER_VERTICAL;
lpText.weight = 1;
llText.setLayoutParams(lpText);
llItem.addView(llText);
item.tvName = new TextView(parent.getContext());
item.tvName.setTextColor(0xff000000);
item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
item.tvName.setSingleLine();
llText.addView(item.tvName);
item.tvSign = new TextView(parent.getContext());
item.tvSign.setTextColor(0x7f000000);
item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
item.tvSign.setSingleLine();
llText.addView(item.tvSign);
item.ivCheck = new ImageView(parent.getContext());
item.ivCheck.setPadding(0, 0, dp_10, 0);
LinearLayout.LayoutParams lpCheck = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpCheck.gravity = Gravity.CENTER_VERTICAL;
item.ivCheck.setLayoutParams(lpCheck);
llItem.addView(item.ivCheck);
} else {
item = (FollowListItem) convertView.getTag();
}
Following following = getItem(position);
item.tvName.setText(following.screeName);
item.tvSign.setText(following.description);
item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
if (isFling()) {
Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
if (bm != null && !bm.isRecycled()) {
item.aivIcon.setImageBitmap(bm);
} else {
item.aivIcon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
}
} else {
item.aivIcon.execute(following.icon);
}
if (position == getCount() - 1) {
next();
}
return convertView;
}
示例6
public View getView(int position, View convertView, ViewGroup parent) {
FollowListItem item = null;
if (convertView == null) {
LinearLayout llItem = new LinearLayout(parent.getContext());
item = new FollowListItem();
llItem.setTag(item);
convertView = llItem;
item.aivIcon = new AsyncImageView(getContext());
int dp_52 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 52);
int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 5);
LinearLayout.LayoutParams lpIcon = new LinearLayout.LayoutParams(dp_52, dp_52);
lpIcon.gravity = Gravity.CENTER_VERTICAL;
lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
item.aivIcon.setLayoutParams(lpIcon);
llItem.addView(item.aivIcon);
LinearLayout llText = new LinearLayout(parent.getContext());
llText.setPadding(0, dp_10, dp_10, dp_10);
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpText.gravity = Gravity.CENTER_VERTICAL;
lpText.weight = 1;
llText.setLayoutParams(lpText);
llItem.addView(llText);
item.tvName = new TextView(parent.getContext());
item.tvName.setTextColor(0xff000000);
item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
item.tvName.setSingleLine();
llText.addView(item.tvName);
item.tvSign = new TextView(parent.getContext());
item.tvSign.setTextColor(0x7f000000);
item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
item.tvSign.setSingleLine();
llText.addView(item.tvSign);
item.ivCheck = new ImageView(parent.getContext());
item.ivCheck.setPadding(0, 0, dp_10, 0);
LinearLayout.LayoutParams lpCheck = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpCheck.gravity = Gravity.CENTER_VERTICAL;
item.ivCheck.setLayoutParams(lpCheck);
llItem.addView(item.ivCheck);
} else {
item = (FollowListItem) convertView.getTag();
}
Following following = getItem(position);
item.tvName.setText(following.screeName);
item.tvSign.setText(following.description);
item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
if (isFling()) {
Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
if (bm != null && !bm.isRecycled()) {
item.aivIcon.setImageBitmap(bm);
} else {
item.aivIcon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
}
} else {
item.aivIcon.execute(following.icon);
}
if (position == getCount() - 1) {
next();
}
return convertView;
}