當前位置: 首頁>>代碼示例>>Java>>正文


Java PictureDrawable類代碼示例

本文整理匯總了Java中android.graphics.drawable.PictureDrawable的典型用法代碼示例。如果您正苦於以下問題:Java PictureDrawable類的具體用法?Java PictureDrawable怎麽用?Java PictureDrawable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PictureDrawable類屬於android.graphics.drawable包,在下文中一共展示了PictureDrawable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onLoadFailed

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
    boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
  return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:SvgSoftwareLayerSetter.java

示例2: onResourceReady

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public boolean onResourceReady(PictureDrawable resource, Object model,
    Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
  return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:SvgSoftwareLayerSetter.java

示例3: drawableToBitmap

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
/**
 * @returns A {@link Bitmap} for a {@link Drawable}.
 */
public static Bitmap drawableToBitmap(final Drawable drawable) {
    if (null == drawable) return null;
    if (drawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

    final Bitmap bitmap = Bitmap.createBitmap(Math.max(0, drawable.getIntrinsicWidth()),
            Math.max(0, drawable.getIntrinsicHeight()), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(bitmap);

    // PictureDrawable's get handled separately.
    if (drawable instanceof PictureDrawable) {
        canvas.drawPicture(((PictureDrawable) drawable).getPicture());
        return bitmap;
    }

    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);

    return bitmap;
}
 
開發者ID:Tombarr,項目名稱:Noyze,代碼行數:25,代碼來源:Utils.java

示例4: attachView

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public void attachView(ImageZoomMvpView mvpView) {

    super.attachView(mvpView);

    requestBuilder = Glide.with(getMvpView().getAppContext())
            .using(Glide.buildStreamModelLoader(Uri.class,
                    getMvpView().getAppContext()), InputStream.class)
            .from(Uri.class)
            .as(SVG.class)
            .transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
            .sourceEncoder(new StreamEncoder())
            .cacheDecoder(new FileToStreamDecoder<SVG>(new SvgDecoder()))
            .decoder(new SvgDecoder())
            .placeholder(R.drawable.placeholder)
            .error(R.drawable.placeholder)
            .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
            .animate(android.R.anim.fade_in);

}
 
開發者ID:apache,項目名稱:incubator-taverna-mobile,代碼行數:21,代碼來源:ImageZoomPresenter.java

示例5: ContentBlock3ViewHolder

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
public ContentBlock3ViewHolder(View itemView, Context context,
                               OnContentBlock3ViewHolderInteractionListener listener) {
  super(itemView);
  mContext = context;
  mTitleTextView = (TextView) itemView.findViewById(R.id.titleTextView);
  mCopyrightTextView = (TextView) itemView.findViewById(R.id.copyrightTextView);
  mImageView = (ImageView) itemView.findViewById(R.id.imageImageView);
  mImageProgressBar = (ProgressBar) itemView.findViewById(R.id.imageProgressBar);
  mListener = listener;

  mFileManager = FileManager.getInstance(context);

  SvgDrawableTranscoder svgDrawableTranscoder =  new SvgDrawableTranscoder();
  svgDrawableTranscoder.setmDeviceWidth(mContext.getResources().getDisplayMetrics().widthPixels);

  requestBuilder = Glide.with(mContext)
      .using(Glide.buildStreamModelLoader(Uri.class, mContext), InputStream.class)
      .from(Uri.class)
      .as(SVG.class)
      .transcode(svgDrawableTranscoder, PictureDrawable.class)
      .sourceEncoder(new StreamEncoder())
      .cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder()))
      .decoder(new SvgDecoder())
      .listener(new SvgSoftwareLayerSetter<Uri>());
}
 
開發者ID:xamoom,項目名稱:xamoom-android-sdk,代碼行數:26,代碼來源:ContentBlock3ViewHolder.java

示例6: loadSvgIcon

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
private void loadSvgIcon(String imageName, ImageView imageView)
{
    SVG cachedSvg = svgCache.get(imageName);
    if (cachedSvg != null)
    {
        imageView.setImageDrawable(new PictureDrawable(cachedSvg.renderToPicture()));
    }
    else
    {
        if (currentlyRetrieving.contains(imageView))
            return;
        currentlyRetrieving.add(imageView);

        imageView.setImageDrawable(null);
        Needle.onBackgroundThread().withThreadPoolSize(10).execute(new IconRetrievalTask(imageName, imageView));
    }
}
 
開發者ID:matejdro,項目名稱:PebbleNotificationCenter-Android,代碼行數:18,代碼來源:IconPickerItem.java

示例7: thenDoUiRelatedWork

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
protected void thenDoUiRelatedWork(SVG svg)
{
    if (svg != null)
    {
        try
        {
            imageView.setImageDrawable(new PictureDrawable(svg.renderToPicture()));
            svgCache.put(imageName, svg);

        }
        catch (NullPointerException e)
        {
            //renderToPicture() sometimes throws NPE.

            Timber.e("SVG Error", e);
            e.printStackTrace();
        }
    }

    currentlyRetrieving.remove(imageView);
}
 
開發者ID:matejdro,項目名稱:PebbleNotificationCenter-Android,代碼行數:23,代碼來源:IconPickerItem.java

示例8: onCreate

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  imageViewRes = (ImageView) findViewById(R.id.svg_image_view1);
  imageViewNet = (ImageView) findViewById(R.id.svg_image_view2);

  requestBuilder = GlideApp.with(this)
      .as(PictureDrawable.class)
      .placeholder(R.drawable.image_loading)
      .error(R.drawable.image_error)
      .transition(withCrossFade())
      .listener(new SvgSoftwareLayerSetter());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:MainActivity.java

示例9: transcode

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode) {
  SVG svg = toTranscode.get();
  Picture picture = svg.renderToPicture();
  PictureDrawable drawable = new PictureDrawable(picture);
  return new SimpleResource<PictureDrawable>(drawable);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:SvgDrawableTranscoder.java

示例10: transcode

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public Resource<PictureDrawable> transcode(Resource<SVG> toTranscode, Options options) {
  SVG svg = toTranscode.get();
  Picture picture = svg.renderToPicture();
  PictureDrawable drawable = new PictureDrawable(picture);
  return new SimpleResource<>(drawable);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:SvgDrawableTranscoder.java

示例11: setSVG

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
/**
 * Directly set the SVG.
 */
public void setSVG(SVG mysvg) {
	if (mysvg == null)
		throw new IllegalArgumentException("Null value passed to setSVG()");

	setSoftwareLayerType();
	setImageDrawable(new PictureDrawable(mysvg.renderToPicture()));
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:11,代碼來源:SVGImageView.java

示例12: loadSvg

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
private Pair<Drawable, int[]> loadSvg(InputStream is) throws SVGParseException {
    SVG svg = SVG.getFromInputStream(is);
    int[] size = new int[2];
    size[0] = (int) svg.getDocumentViewBox().width();
    size[1] = (int) svg.getDocumentViewBox().height();
    svg.setDocumentWidth(mSize);
    svg.setDocumentHeight(mSize);
    return new Pair<>(new PictureDrawable(svg.renderToPicture()), size);
}
 
開發者ID:jruesga,項目名稱:rview,代碼行數:10,代碼來源:AsyncImageDiffProcessor.java

示例13: onException

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
 
開發者ID:amrendra18,項目名稱:udacity-p3,代碼行數:9,代碼來源:SvgSoftwareLayerSetter.java

示例14: onResourceReady

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
@Override
public boolean onResourceReady(PictureDrawable resource, T model, Target<PictureDrawable> target,
                               boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
 
開發者ID:amrendra18,項目名稱:udacity-p3,代碼行數:10,代碼來源:SvgSoftwareLayerSetter.java

示例15: getInstance

import android.graphics.drawable.PictureDrawable; //導入依賴的package包/類
public static SvgImageLoader getInstance(Context context) {
    if (mInstance == null) {
        mInstance = new SvgImageLoader();
        genericRequestBuilder = Glide.with(context)
                .using(Glide.buildStreamModelLoader(Uri.class, context), InputStream.class)
                .from(Uri.class)
                .as(SVG.class)
                .transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
                .sourceEncoder(new StreamEncoder())
                .cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder()))
                .decoder(new SvgDecoder())
                .listener(new SvgSoftwareLayerSetter<>());
    }
    return mInstance;
}
 
開發者ID:amrendra18,項目名稱:udacity-p3,代碼行數:16,代碼來源:SvgImageLoader.java


注:本文中的android.graphics.drawable.PictureDrawable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。