本文整理匯總了Java中com.loopj.android.image.SmartImage類的典型用法代碼示例。如果您正苦於以下問題:Java SmartImage類的具體用法?Java SmartImage怎麽用?Java SmartImage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SmartImage類屬於com.loopj.android.image包,在下文中一共展示了SmartImage類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bind
import com.loopj.android.image.SmartImage; //導入依賴的package包/類
@Override
public void bind(OpenHABWidget widget) {
View parent = (View) itemView.getParent();
// We scale the image at max 90% of the available height
int parentWidth = parent != null ? parent.getWidth() : 0;
int parentHeight = parent != null ? parent.getHeight() : 0;
mImageView.setMaxSize(parentWidth > 0 ? parentWidth : mScreenSize.x,
(parentHeight > 0 ? parentHeight : mScreenSize.y) * 90 / 100);
OpenHABItem item = widget.getItem();
final String state = item != null ? item.getState() : null;
if (state != null && state.matches("data:image/.*;base64,.*")) {
mImageView.setImageWithData(new SmartImage() {
@Override
public Bitmap getBitmap(Context context) {
byte[] data = Base64.decode(state.substring(state.indexOf(",") + 1), Base64.DEFAULT);
return BitmapFactory.decodeByteArray(data, 0, data.length);
}
});
mRefreshRate = 0;
} else {
// Widget URL may be relative, add base URL if that's the case
Uri uri = Uri.parse(widget.getUrl());
if (uri.getScheme() == null) {
uri = Uri.parse(mConnectionInfo.baseUrl + widget.getUrl());
}
mImageView.setImageUrl(uri.toString(), mConnectionInfo.userName,
mConnectionInfo.password, false);
mRefreshRate = widget.getRefresh();
}
}
示例2: setImageWithData
import com.loopj.android.image.SmartImage; //導入依賴的package包/類
public void setImageWithData(SmartImage image) {
this.myImageUrl = null;
this.username = null;
this.password = null;
this.refreshDisabled = true;
setImage(image, imageCompletionListener);
}