本文整理汇总了Java中com.facebook.drawee.view.DraweeHolder类的典型用法代码示例。如果您正苦于以下问题:Java DraweeHolder类的具体用法?Java DraweeHolder怎么用?Java DraweeHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DraweeHolder类属于com.facebook.drawee.view包,在下文中一共展示了DraweeHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setImageSpan
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
public void setImageSpan(
DraweeHolder draweeHolder,
int index,
final int drawableWidthPx,
final int drawableHeightPx,
boolean enableResizing,
@BetterImageSpan.BetterImageSpanAlignment int verticalAlignment) {
setImageSpan(
draweeHolder,
index,
index,
drawableWidthPx,
drawableHeightPx,
enableResizing,
verticalAlignment);
}
示例2: setIconSource
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
private void setIconSource(ReadableMap source, IconControllerListener controllerListener,
DraweeHolder holder) {
String uri = source != null ? source.getString("uri") : null;
if (uri == null) {
controllerListener.setIconImageInfo(null);
controllerListener.setDrawable(null);
} else if (uri.startsWith("http://") || uri.startsWith("https://") ||
uri.startsWith("file://")) {
controllerListener.setIconImageInfo(getIconImageInfo(source));
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse(uri))
.setControllerListener(controllerListener)
.setOldController(holder.getController())
.build();
holder.setController(controller);
holder.getTopLevelDrawable().setVisible(true, true);
} else {
controllerListener.setDrawable(getDrawableByName(uri));
}
}
示例3: FrescoBasedReactTextInlineImageSpan
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
public FrescoBasedReactTextInlineImageSpan(
Resources resources,
int height,
int width,
@Nullable Uri uri,
ReadableMap headers,
AbstractDraweeControllerBuilder draweeControllerBuilder,
@Nullable Object callerContext) {
mDraweeHolder = new DraweeHolder(
GenericDraweeHierarchyBuilder.newInstance(resources)
.build()
);
mDraweeControllerBuilder = draweeControllerBuilder;
mCallerContext = callerContext;
mHeight = height;
mWidth = width;
mUri = (uri != null) ? uri : Uri.EMPTY;
mHeaders = headers;
}
示例4: setIconSource
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
/**
* Sets an icon for a specific icon source. If the uri indicates an icon
* to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it.
* Otherwise it loads the Drawable from the Resources and directly returns it via a callback
*/
private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) {
String uri = source != null ? source.getString(PROP_ICON_URI) : null;
if (uri == null) {
controllerListener.setIconImageInfo(null);
controllerListener.setDrawable(null);
} else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) {
controllerListener.setIconImageInfo(getIconImageInfo(source));
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse(uri))
.setControllerListener(controllerListener)
.setOldController(holder.getController())
.build();
holder.setController(controller);
holder.getTopLevelDrawable().setVisible(true, true);
} else {
controllerListener.setDrawable(getDrawableByName(uri));
}
}
示例5: FrescoBasedReactTextInlineImageSpan
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
public FrescoBasedReactTextInlineImageSpan(
Resources resources,
int height,
int width,
@Nullable Uri uri,
AbstractDraweeControllerBuilder draweeControllerBuilder,
@Nullable Object callerContext) {
mDraweeHolder = new DraweeHolder(
GenericDraweeHierarchyBuilder.newInstance(resources)
.build()
);
mDraweeControllerBuilder = draweeControllerBuilder;
mCallerContext = callerContext;
mHeight = height;
mWidth = width;
mUri = (uri != null) ? uri : Uri.EMPTY;
}
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:19,代码来源:FrescoBasedReactTextInlineImageSpan.java
示例6: setIconSource
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
/**
* Sets an icon for a specific icon source. If the uri indicates an icon
* to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it.
* Otherwise it loads the Drawable from the Resources and directly returns it via a callback
*/
private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) {
String uri = source != null ? source.getString(PROP_ICON_URI) : null;
if (uri == null) {
controllerListener.setIconImageInfo(null);
controllerListener.setDrawable(null);
} else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) {
controllerListener.setIconImageInfo(getIconImageInfo(source));
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse(uri))
.setControllerListener(controllerListener)
.setOldController(holder.getController())
.build();
holder.setController(controller);
} else {
controllerListener.setDrawable(getDrawableByName(uri));
}
}
示例7: setIconSource
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
/**
* Sets an icon for a specific icon source. If the uri indicates an icon
* to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it.
* Otherwise it loads the Drawable from the Resources and directly returns it via a callback
*/
private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) {
String uri = source != null ? source.getString(PROP_ICON_URI) : null;
if (uri == null) {
controllerListener.setIconImageInfo(null);
controllerListener.setDrawable(null);
} else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) {
controllerListener.setIconImageInfo(getIconImageInfo(source));
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse(uri))
.setControllerListener(controllerListener)
.setOldController(holder.getController())
.build();
holder.setController(controller);
holder.getTopLevelDrawable().setVisible(true, true);
} else {
controllerListener.setDrawable(getDrawableByName(uri));
}
}
示例8: setIconSource
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
/**
* Sets an icon for a specific icon source. If the uri indicates an icon
* to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it.
* Otherwise it loads the Drawable from the Resources and directly returns it via a callback
*/
private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) {
String uri = source != null ? source.getString(PROP_ICON_URI) : null;
if (uri == null) {
controllerListener.setIconImageInfo(null);
controllerListener.setDrawable(null);
} else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) {
controllerListener.setIconImageInfo(getIconImageInfo(source));
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse(uri))
.setControllerListener(controllerListener)
.setOldController(holder.getController())
.build();
holder.setController(controller);
holder.getTopLevelDrawable().setVisible(true, true);
} else {
controllerListener.setDrawable(getDrawableByName(uri));
}
}
示例9: init
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
protected void init() {
if (null == mAttacher || null == mAttacher.getImageView()) {
mAttacher = new PhotoViewAttacher(this);
}
if (null != mPendingScaleType) {
setScaleType(mPendingScaleType);
mPendingScaleType = null;
}
if (mDraweeHolder == null) {
GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
.setFadeDuration(500)
.setProgressBarImage(new CustomProgressbarDrawable(this))
.build();
mDraweeHolder = DraweeHolder.create(hierarchy, getContext());
}
}
示例10: init
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
protected void init() {
if (null == mAttacher || null == mAttacher.getImageView()) {
mAttacher = new PhotoViewAttacher(this);
}
if (null != mPendingScaleType) {
setScaleType(mPendingScaleType);
mPendingScaleType = null;
}
if (mDraweeHolder == null) {
GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
.setFadeDuration(300)
.setProgressBarImage(new CustomProgressbarDrawable(this))
.build();
mDraweeHolder = DraweeHolder.create(hierarchy, getContext());
}
}
示例11: setup
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
private void setup(Context context, AttributeSet attrs, int defStyle) {
if (getScaleType() == ScaleType.FIT_CENTER) {
setScaleType(ScaleType.CENTER_CROP);
}
Drawable placeholder = null;
if (attrs != null) {
TypedArray typedArray =
context.obtainStyledAttributes(attrs, R.styleable.ShapedDrawee, defStyle, 0);
shape = typedArray.getDrawable(R.styleable.ShapedDrawee_maskShape);
placeholder = typedArray.getDrawable(R.styleable.ShapedDrawee_placeholder);
typedArray.recycle();
}
if (shape == null) {
throw new IllegalArgumentException("maskShape must be specified in layout!");
}
GenericDraweeHierarchy hierarchy =
new GenericDraweeHierarchyBuilder(getResources()).setPlaceholderImage(placeholder)
.setPlaceholderImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
.build();
mDraweeHolder = DraweeHolder.create(hierarchy, getContext());
}
示例12: addDraweeSpan
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
private static void addDraweeSpan(
DraweeSpanStringBuilder draweeSpanStringBuilder,
DraweeHolder draweeHolder,
int index,
int spanLength) {
draweeSpanStringBuilder.setImageSpan(
draweeHolder, /* draweeHolder */
index, /* startIndex */
index + spanLength, /* endIndex */
DRAWABLE_WIDTH, /* drawableWidthPx */
DRAWABLE_HEIGHT, /* drawableHeightPx */
false, /* enableResizing */
BetterImageSpan.ALIGN_CENTER); /* verticalAlignment */
}
示例13: setMenuItemIcon
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
private void setMenuItemIcon(final MenuItem item, ReadableMap iconSource) {
DraweeHolder<GenericDraweeHierarchy> holder =
DraweeHolder.create(createDraweeHierarchy(), getContext());
ActionIconControllerListener controllerListener =
new ActionIconControllerListener(item, holder);
controllerListener.setIconImageInfo(getIconImageInfo(iconSource));
setIconSource(iconSource, controllerListener, holder);
mActionsHolder.add(holder);
}
示例14: init
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
private void init(Context ctx, Drawable defaultDrawable) {
if (draweeHolder == null) {
Resources resources = ctx.getResources();
GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(resources)
.setPlaceholderImage(defaultDrawable)
.setFailureImage(defaultDrawable)
.build();
draweeHolder = DraweeHolder.create(hierarchy, ctx);
}
}
示例15: initDraweeHolder
import com.facebook.drawee.view.DraweeHolder; //导入依赖的package包/类
private void initDraweeHolder() {
if (mDraweeHolder == null) {
GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(mContext.getResources())
.build();
mDraweeHolder = DraweeHolder.create(hierarchy, mContext);
}
}