类com.bumptech.glide.request.animation.GlideAnimation源码实例Demo

下面列出了怎么用com.bumptech.glide.request.animation.GlideAnimation的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: giffun   文件: GenericRequest.java
/**
 * Internal {@link #onResourceReady(Resource)} where arguments are known to be safe.
 *
 * @param resource original {@link Resource}, never <code>null</code>
 * @param result object returned by {@link Resource#get()}, checked for type and never <code>null</code>
 */
private void onResourceReady(Resource<?> resource, R result) {
    // We must call isFirstReadyResource before setting status.
    boolean isFirstResource = isFirstReadyResource();
    status = Status.COMPLETE;
    this.resource = resource;

    if (requestListener == null || !requestListener.onResourceReady(result, model, target, loadedFromMemoryCache,
            isFirstResource)) {
        GlideAnimation<R> animation = animationFactory.build(loadedFromMemoryCache, isFirstResource);
        target.onResourceReady(result, animation);
    }

    notifyLoadSuccess();

    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        logV("Resource ready in " + LogTime.getElapsedMillis(startTime) + " size: "
                + (resource.getSize() * TO_MEGABYTE) + " fromCache: " + loadedFromMemoryCache);
    }
}
 
源代码2 项目: giffun   文件: GlideDrawableImageViewTarget.java
/**
 * {@inheritDoc}
 * If no {@link GlideAnimation} is given or if the animation does not set the
 * {@link android.graphics.drawable.Drawable} on the view, the drawable is set using
 * {@link ImageView#setImageDrawable(android.graphics.drawable.Drawable)}.
 *
 * @param resource {@inheritDoc}
 * @param animation {@inheritDoc}
 */
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
    if (!resource.isAnimated()) {
        //TODO: Try to generalize this to other sizes/shapes.
        // This is a dirty hack that tries to make loading square thumbnails and then square full images less costly
        // by forcing both the smaller thumb and the larger version to have exactly the same intrinsic dimensions.
        // If a drawable is replaced in an ImageView by another drawable with different intrinsic dimensions,
        // the ImageView requests a layout. Scrolling rapidly while replacing thumbs with larger images triggers
        // lots of these calls and causes significant amounts of jank.
        float viewRatio = view.getWidth() / (float) view.getHeight();
        float drawableRatio = resource.getIntrinsicWidth() / (float) resource.getIntrinsicHeight();
        if (Math.abs(viewRatio - 1f) <= SQUARE_RATIO_MARGIN
                && Math.abs(drawableRatio - 1f) <= SQUARE_RATIO_MARGIN) {
            resource = new SquaringDrawable(resource, view.getWidth());
        }
    }
    super.onResourceReady(resource, animation);
    this.resource = resource;
    resource.setLoopCount(maxLoopCount);
    resource.start();
}
 
源代码3 项目: myapplication   文件: CaptureActivity.java
/**
 * 从相册返回扫描结果
 *
 * @param uri 图片地址
 */
private void operateAlbumScanResult(Uri uri) {
    int myWidth = getResources().getDisplayMetrics().widthPixels;
    int myHeight = getResources().getDisplayMetrics().heightPixels;

    Glide.with(CaptureActivity.this)
            .load(uri)
            .asBitmap()
            .into(new SimpleTarget<Bitmap>(myWidth, myHeight) {
                @Override
                public void onResourceReady(Bitmap resource,
                                            GlideAnimation<? super Bitmap> glideAnimation) {
                    Result resultZxing = new DecodeUtils(DecodeUtils.DECODE_DATA_MODE_ALL)
                            .decodeWithZxing(resource);
                    Log.i(TAG, "resultZxing >> " + resultZxing);

                    if (resultZxing != null) {
                        handleDecode(resultZxing, null);
                    } else {
                        SystemUtils.showHandlerToast(CaptureActivity.this,
                                "未发现二维码/条形码");
                    }
                }
            });
}
 
源代码4 项目: imsdk-android   文件: GlideImageLoader.java
@Override
    public void displaygGif(Activity activity, String path, ImageView imageView, int width, int height) {
        if(TextUtils.isEmpty(path)){
            com.orhanobut.logger.Logger.i("图片崩溃错误2");
            return;
        }
        Glide.with(activity)                             //配置上下文
                .load(path)
//                .load(new MyGlideUrl(path))      //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
                .asGif()
                .toBytes()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)//缓存全尺寸
                .dontAnimate()
                .into(new ViewTarget<ImageView, byte[]>(imageView) {
                    @Override
                    public void onResourceReady(byte[] resource, GlideAnimation<? super byte[]> glideAnimation) {
//                            try {
                        FrameSequence fs = FrameSequence.decodeByteArray(resource);
                        FrameSequenceDrawable drawable = new FrameSequenceDrawable(fs);
                        view.setImageDrawable(drawable);
                    }
                });
    }
 
源代码5 项目: SSForms   文件: FormAdapter.java
@Override
public void call(List<Image> images) {
    if (images != null) {
        AppTools appTools = new AppTools();
        Uri imageUri = Uri.fromFile(new File(images.get(0).getPath()));

        try {
            int rotateImage = appTools.getCameraPhotoOrientation(imageUri);
            Bitmap bmp = appTools.getThumbnail(imageUri, rotateImage, mContext);

            Glide.with((Activity) mContext)
                    .load(appTools.bitmapToByte(bmp))
                    .asBitmap()
                    .into(new SimpleTarget<Bitmap>() {
                        @Override
                        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                            ((FormElementProfileView) mDataset.get(clickedPosition)).setProfileImage(resource);
                            notifyItemChanged(clickedPosition);
                        }
                    });
        } catch (Exception ex) {
            String sX = ex.toString();
            String gg = "";
        }
    }
}
 
源代码6 项目: tribbble   文件: ArchiveItemView.java
public void bind(Shot shot, @DrawableRes int placeholderId) {
  mGifLabel.setVisibility(shot.isAnimated() ? VISIBLE : INVISIBLE);
  Glide.with(getContext())
      .load(shot.getImages().getHighResImage())
      .placeholder(placeholderId)
      .diskCacheStrategy(DiskCacheStrategy.SOURCE)
      .into(new GlideDrawableImageViewTarget(mShotImageView) {
        @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
          super.onResourceReady(resource, animation);
          resource.stop();
        }

        @Override public void onStart() {}

        @Override public void onStop() {}
      });
}
 
源代码7 项目: PocketEOS-Android   文件: MyApplication.java
public void showCirImage(String url, final ImageView image) {
    if (url == null || url.isEmpty() || "".equals(url)) {
        image.setImageResource(R.mipmap.defeat_person_img);
        return;
    }
    Glide.with(getApplicationContext())
            .load(url)
            .error(R.mipmap.ic_launcher_round)
            .into(new SimpleTarget<GlideDrawable>() { // 加上这段代码 可以解决
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> glideAnimation) {
                    image.setImageDrawable(resource); //显示图片
                }
            });
}
 
private void pictureSetFile(final TouchImageView imageset, Uri urinormal) {
    imageset.setMaxZoom(30);

    Glide.with(this)
            .load(urinormal)
            .override(2000, 2000)
            //.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
            .into(new GlideDrawableImageViewTarget(imageset) {
                @Override
                public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    imageset.setZoom(1);
                }
            })
    ;
}
 
源代码9 项目: leanback-assistant   文件: VideoDetailsFragment.java
private void initializeBackground(Movie movie) {
    mDetailsBackground.enableParallax();
    Glide.with(getActivity())
            .load(movie.getBackgroundImage())
            .asBitmap()
            .centerCrop()
            .error(R.drawable.assistant_tv_banner)
            .into(
                    new SimpleTarget<Bitmap>() {
                        @Override
                        public void onResourceReady(
                                Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation) {
                            mDetailsBackground.setCoverBitmap(bitmap);
                            mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size());
                        }
                    });
}
 
源代码10 项目: androidtestdebug   文件: AddNoteFragment.java
@Override
public void showImagePreview(@NonNull String imageUrl) {
    checkState(!TextUtils.isEmpty(imageUrl), "imageUrl cannot be null or empty!");
    mImageThumbnail.setVisibility(View.VISIBLE);

    // The image is loaded in a different thread so in order to UI-test this, an idling resource
    // is used to specify when the app is idle.
    EspressoIdlingResource.increment(); // App is busy until further notice.

    // This app uses Glide for image loading
    Glide.with(this)
            .load(imageUrl)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .centerCrop()
            .into(new GlideDrawableImageViewTarget(mImageThumbnail) {
                @Override
                public void onResourceReady(GlideDrawable resource,
                                            GlideAnimation<? super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    EspressoIdlingResource.decrement(); // Set app as idle.
                }
            });
}
 
源代码11 项目: GankApp   文件: ViewerFragment.java
@OnLongClick(R.id.image)
@SuppressWarnings("unused")
boolean setImageToWallpaper(){
    if(!PictUtil.hasSDCard()){
        Toast.makeText(getActivity(),"不支持下载文件",Toast.LENGTH_SHORT).show();
        return false;
    }
    Glide.with(this).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
            mBitmap = resource;
            saveImgFileToLocal();
        }

        @Override
        public void onLoadFailed(Exception e, Drawable errorDrawable) {
            super.onLoadFailed(e, errorDrawable);
            mBitmap = null;
            Toast.makeText(getActivity(),"下载图片失败,请重试",Toast.LENGTH_SHORT).show();
        }
    });
    return false;
}
 
源代码12 项目: YiZhi   文件: ImageBrowseActivity.java
/**
 * 加载gif
 */
private void loadGif() {
    Glide.with(ImageBrowseActivity.this)
            .load(mImageUrl)
            .fitCenter()
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .into(new GlideDrawableImageViewTarget(pvPic) {
                @Override
                public void onResourceReady(GlideDrawable resource, GlideAnimation<?
                        super GlideDrawable> animation) {
                    super.onResourceReady(resource, animation);
                    //在这里添加一些图片加载完成的操作
                    pbPicBrowse.setVisibility(View.GONE);
                }
            });
}
 
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
                     int[] appWidgetIds) {

    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.custom_view_futurestudio);

    appWidgetTarget = new AppWidgetTarget(context, remoteViews, R.id.custom_view_image, appWidgetIds) {
        @Override
        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
            super.onResourceReady(resource, glideAnimation);
        }
    };

    Glide
            .with(context.getApplicationContext())
            .load(GlideExampleActivity.eatFoodyImages[3])
            .asBitmap()
            .into(appWidgetTarget);

    pushWidgetUpdate(context, remoteViews);
}
 
源代码14 项目: Android   文件: ModifyAvaterPresenter.java
@Override
public void saveImageToGallery() {
    String path = MemoryDataManager.getInstance().getAvatar();
    if (!TextUtils.isEmpty(path)) {
        Glide.with(BaseApplication.getInstance())
                .load(path + "?size=500")
                .asBitmap()
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        if(resource != null){
                            saveNotigy(resource);
                        }else{
                            ToastEUtil.makeText(mView.getActivity(),R.string.Set_Save_Failed);
                        }
                    }
                });
    }
}
 
源代码15 项目: Android   文件: MsgImgHolder.java
@Override
public void saveInPhone() {
    super.saveInPhone();
    final MsgDefinBean bean = baseEntity.getMsgDefinBean();
    String local = TextUtils.isEmpty(bean.getContent()) ? bean.getUrl() : bean.getContent();
    Glide.with(BaseApplication.getInstance())
            .load(local)
            .asBitmap()
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    File file = FileUtil.createAbsNewFile(Environment.getExternalStorageDirectory().getAbsolutePath() + "/connect/" + bean.getMessage_id() + FileUtil.FileType.IMG.getFileType());
                    MediaStore.Images.Media.insertImage(context.getContentResolver(), resource, "connect", "");
                    context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file)));
                }
            });
}
 
源代码16 项目: leanback-extensions   文件: MainFragment.java
protected void updateBackground(String uri) {
	int width = mMetrics.widthPixels;
	int height = mMetrics.heightPixels;
	Glide.with(getActivity())
			.load(uri)
			.centerCrop()
			.error(mDefaultBackground)
			.into(new SimpleTarget<GlideDrawable>(width, height) {
				@Override
				public void onResourceReady(GlideDrawable resource,
				                            GlideAnimation<? super GlideDrawable>
						                            glideAnimation) {
					mBackgroundManager.setDrawable(resource);
				}
			});
	mBackgroundTimer.cancel();
}
 
源代码17 项目: SuperNote   文件: EditNotePresenter.java
private void replaceImage(final String imageName) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;

    File imageFile = new File(mView.getActivity().getExternalFilesDir(mNoteId).getPath() + "/" + imageName);

    BitmapFactory.decodeFile(imageFile.getPath(), options);

    int imageRequestWidth = getRequestImeWidth();
    int imageRequestHeight = setNeedHeight(options);


    Glide.with(mView.getActivity())
            .load(imageFile)
            .asBitmap()
            .override(imageRequestWidth, imageRequestHeight)
            .fitCenter()
            .priority(Priority.HIGH)
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    mView.replaceImage(imageName, resource);
                }
            });
}
 
源代码18 项目: SuperNote   文件: EditNotePresenter.java
private void displayImage() {

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;  // 对图片进行设置 但不形成示例,不耗费内存

        BitmapFactory.decodeFile(mImageFile.getPath(), options);

        int imageRequestWidth = getRequestImeWidth();
        int imageRequestHeight = getRequestImeHeight(options);
        Logger.d("width " + imageRequestWidth + "   height:" + imageRequestHeight);
        Logger.d("bitmap1 width " + options.outWidth + "   height:" + options.outHeight);

        Glide.with(mView.getActivity())
                .load(mImageFile)
                .asBitmap()
                .override(imageRequestWidth, imageRequestHeight)  // 设置大小
                .fitCenter()                                     // 不按照比例
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                        //根据Bitmap对象创建ImageSpan对象
                        Logger.d("bitmap width:" + resource.getWidth() + "   height:" + resource.getHeight());
                        mView.insertImage(mImageName, resource);
                    }
                });
    }
 
源代码19 项目: vk_music_android   文件: MusicService.java
public void loadAlbumArt(VKApiAudio audio) {
    Bitmap placeHolder = BitmapFactory.decodeResource(getResources(), R.drawable.ic_album_placeholder);
    currentAlbumArt.set(placeHolder);
    notificationManager.updateNotificationBitmap(placeHolder);

    albumArtProvider.getAlbumArtUrl(audio.artist + " - " + audio.title)
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(url -> {
                saveAlbumArtUrl(url);

                Glide.with(MusicService.this)
                        .load(url)
                        .asBitmap()
                        .error(R.drawable.ic_album_placeholder)
                        .into(new SimpleTarget<Bitmap>() {
                            @Override
                            public void onResourceReady(Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation) {
                                currentAlbumArt.set(bitmap);
                                notificationManager.updateNotificationBitmap(bitmap);
                            }
                        });
            }, throwable -> {
                saveAlbumArtUrl("");
                currentAlbumArt.set(placeHolder);
                notificationManager.updateNotificationBitmap(placeHolder);
            });
}
 
源代码20 项目: Pasta-for-Spotify   文件: TrackListData.java
@Override
public void bindView(final ViewHolder holder) {
    holder.name.setText(trackName);
    if (artists.size() > 0)
        holder.extra.setText(artists.get(0).artistName);
    else holder.extra.setText("");

    if (!PreferenceUtils.isThumbnails(holder.activity)) holder.image.setVisibility(View.GONE);
    else {
        Glide.with(holder.activity).load(trackImage).asBitmap().placeholder(ImageUtils.getVectorDrawable(holder.activity, R.drawable.preload)).thumbnail(0.2f).into(new BitmapImageViewTarget(holder.image) {
            @Override
            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                super.onResourceReady(resource, glideAnimation);

                if (holder.bg == null) return;
                Palette.from(resource).generate(new Palette.PaletteAsyncListener() {
                    @Override
                    public void onGenerated(Palette palette) {
                        ValueAnimator animator = ValueAnimator.ofObject(new ArgbEvaluator(), Color.DKGRAY, palette.getDarkVibrantColor(Color.DKGRAY));
                        animator.setDuration(250);
                        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                            @Override
                            public void onAnimationUpdate(ValueAnimator animation) {
                                int color = (int) animation.getAnimatedValue();
                                holder.bg.setBackgroundColor(color);
                            }
                        });
                        animator.start();
                    }
                });
            }
        });
    }
}
 
源代码21 项目: Pasta-for-Spotify   文件: PlayerService.java
private void showNotification() {
    startForeground(NOTIFICATION_ID, getNotificationBuilder().build());

    Glide.with(this).load(trackList.get(curPos).trackImage).asBitmap().into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(final Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
            Palette.from(resource).generate(new Palette.PaletteAsyncListener() {
                @Override
                public void onGenerated(Palette palette) {
                    startForeground(NOTIFICATION_ID, getNotificationBuilder().setLargeIcon(resource).setColor(palette.getVibrantColor(Color.GRAY)).build());
                }
            });
        }
    });
}
 
源代码22 项目: zulip-android   文件: PhotoViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photo_view);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    permissionStatus = getSharedPreferences("permissionStatus", MODE_PRIVATE);
    final Intent intent = getIntent();
    String url = intent.getStringExtra(Intent.EXTRA_TEXT);
    getSupportActionBar().setTitle(url);
    linkImage = (PhotoView) findViewById(R.id.linkImageView);
    progressBar = (ProgressBar) findViewById(R.id.progress);
    Glide.with(this).load(url).asBitmap().into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
            progressBar.setVisibility(View.GONE);
            linkImage.setImageBitmap(resource);
        }

        @Override
        public void onLoadFailed(Exception e, Drawable errorDrawable) {
            super.onLoadFailed(e, errorDrawable);
            progressBar.setVisibility(View.GONE);
            if (!isNetworkAvailable()) {
                Toast.makeText(getApplicationContext(), R.string.toast_no_internet_connection, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(getApplicationContext(), R.string.toast_unable_to_load_image, Toast.LENGTH_SHORT).show();
            }
        }
    });
}
 
源代码23 项目: RetroMusicPlayer   文件: AlbumTagEditorActivity.java
@Override
protected void loadImageFromFile(@NonNull final Uri selectedFileUri) {
    Glide.with(AlbumTagEditorActivity.this)
            .load(selectedFileUri)
            .asBitmap()
            .transcode(new BitmapPaletteTranscoder(AlbumTagEditorActivity.this), BitmapPaletteWrapper.class)
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .skipMemoryCache(true)
            .into(new SimpleTarget<BitmapPaletteWrapper>() {
                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    super.onLoadFailed(e, errorDrawable);
                    e.printStackTrace();
                    Toast.makeText(AlbumTagEditorActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                }

                @Override
                public void onResourceReady(BitmapPaletteWrapper resource, GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
                    RetroMusicColorUtil.getColor(resource.getPalette(), Color.TRANSPARENT);
                    albumArtBitmap = ImageUtil.resizeBitmap(resource.getBitmap(), 2048);
                    setImageBitmap(albumArtBitmap, RetroMusicColorUtil.getColor(resource.getPalette(),
                            ContextCompat.getColor(AlbumTagEditorActivity.this, R.color.md_grey_500)));
                    deleteAlbumArt = false;
                    dataChanged();
                    setResult(RESULT_OK);
                }
            });
}
 
源代码24 项目: GeometricWeather   文件: AbstractIconTarget.java
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
    if (!resource.isAnimated()) {
        resource = new SquaringDrawable(resource, size);
    }
    if (glideAnimation == null || !glideAnimation.animate(resource, this)) {
        setDrawableForTarget(resource);
    }
    this.resource = resource;
    resource.setLoopCount(GlideDrawable.LOOP_FOREVER);
    resource.start();
}
 
@Override
public void showWorkflowDetail(Workflow workflow) {

    this.mWorkflow = workflow;

    uploaderName.setText(workflow.getUploader().getContent());
    date.setText(workflow.getUpdatedAt()
            .substring(0, workflow.getUpdatedAt().indexOf(' ')));
    type.setText(workflow.getType().getContent());
    title.setText(workflow.getTitle());
    description.loadData(workflow.getDescription(), "text/html", "utf-8");

    Glide.with(getContext())
            .load(workflow.getPreviewUri())
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .placeholder(R.drawable.placeholder)
            .error(R.drawable.placeholder)
            .into(new SimpleTarget<GlideDrawable>() {
                @Override
                public void onResourceReady(GlideDrawable resource,
                        GlideAnimation<? super GlideDrawable> glideAnimation) {
                    workflowImage.setImageDrawable(resource);
                }
            });

    if (workflow.getLicenseType().getId() == null) {
        licenceId = "";
    } else {
        licenceId = workflow.getLicenseType().getId();
    }

    if (mWorkflow.getType().getContent().equals(getString(R.string.t2_workflow_type))) {
        fabRun.setVisibility(View.VISIBLE);
    } else {
        fabRun.setVisibility(View.GONE);
    }
}
 
@Override public void onResourceReady(Drawable resource, GlideAnimation<? super Drawable> glideAnimation) {
	if (resource instanceof Animatable) {
		animatable = (Animatable)resource;
		animatable.stop();
		animatable.start();
	}
	super.onResourceReady(resource, glideAnimation);
}
 
源代码27 项目: Music-Player   文件: AlbumTagEditorActivity.java
@Override
protected void loadImageFromFile(@NonNull final Uri selectedFileUri) {
    Glide.with(AlbumTagEditorActivity.this)
            .load(selectedFileUri)
            .asBitmap()
            .transcode(new BitmapPaletteTranscoder(AlbumTagEditorActivity.this), BitmapPaletteWrapper.class)
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .skipMemoryCache(true)
            .into(new SimpleTarget<BitmapPaletteWrapper>() {
                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    super.onLoadFailed(e, errorDrawable);
                    e.printStackTrace();
                    Toast.makeText(AlbumTagEditorActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                }

                @Override
                public void onResourceReady(BitmapPaletteWrapper resource, GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
                    MusicColorUtil.getColor(resource.getPalette(), Color.TRANSPARENT);
                    albumArtBitmap = ImageUtil.resizeBitmap(resource.getBitmap(), 2048);
                    setImageBitmap(albumArtBitmap, MusicColorUtil.getColor(resource.getPalette(), ATHUtil.resolveColor(AlbumTagEditorActivity.this, R.attr.defaultFooterColor)));
                    deleteAlbumArt = false;
                    dataChanged();
                    setResult(RESULT_OK);
                }
            });
}
 
源代码28 项目: Phonograph   文件: AlbumTagEditorActivity.java
@Override
protected void loadImageFromFile(@NonNull final Uri selectedFileUri) {
    Glide.with(AlbumTagEditorActivity.this)
            .load(selectedFileUri)
            .asBitmap()
            .transcode(new BitmapPaletteTranscoder(AlbumTagEditorActivity.this), BitmapPaletteWrapper.class)
            .diskCacheStrategy(DiskCacheStrategy.NONE)
            .skipMemoryCache(true)
            .into(new SimpleTarget<BitmapPaletteWrapper>() {
                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    super.onLoadFailed(e, errorDrawable);
                    e.printStackTrace();
                    Toast.makeText(AlbumTagEditorActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                }

                @Override
                public void onResourceReady(BitmapPaletteWrapper resource, GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
                    PhonographColorUtil.getColor(resource.getPalette(), Color.TRANSPARENT);
                    albumArtBitmap = ImageUtil.resizeBitmap(resource.getBitmap(), 2048);
                    setImageBitmap(albumArtBitmap, PhonographColorUtil.getColor(resource.getPalette(), ATHUtil.resolveColor(AlbumTagEditorActivity.this, R.attr.defaultFooterColor)));
                    deleteAlbumArt = false;
                    dataChanged();
                    setResult(RESULT_OK);
                }
            });
}
 
private void loadImageViewTarget() {
    viewTarget = new ViewTarget<FutureStudioView, GlideDrawable>( customView ) {
        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
            this.view.setImage( resource.getCurrent() );
        }
    };

    Glide
            .with( context.getApplicationContext() ) // safer!
            .load( eatFoodyImages[2] )
            .into( viewTarget );
}
 
源代码30 项目: leanback-assistant   文件: VideoDetailsFragment.java
private void setupDetailsOverviewRow() {
    final DetailsOverviewRow row = new DetailsOverviewRow(mMovie);

    Glide.with(this)
            .load(mMovie.getCardImage())
            .asBitmap()
            .dontAnimate()
            .error(R.drawable.assistant_tv_banner)
            .into(
                    new SimpleTarget<Bitmap>() {
                        @Override
                        public void onResourceReady(
                                final Bitmap resource, GlideAnimation glideAnimation) {
                            row.setImageBitmap(getActivity(), resource);
                        }
                    });

    SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter();

    adapter.set(
            ACTION_WATCH, new Action(ACTION_WATCH, getResources().getString(R.string.watch)));
    adapter.set(
            ACTION_RENT,
            new Action(
                    ACTION_RENT,
                    getResources().getString(R.string.rent),
                    mMovie.getRentalPrice()));
    adapter.set(
            ACTION_BUY,
            new Action(
                    ACTION_BUY,
                    getResources().getString(R.string.buy),
                    mMovie.getPurchasePrice()));
    row.setActionsAdapter(adapter);

    mAdapter.add(row);
}
 
 类所在包
 类方法
 同包方法