当前位置: 首页>>代码示例>>Java>>正文


Java Transition类代码示例

本文整理汇总了Java中com.bumptech.glide.request.transition.Transition的典型用法代码示例。如果您正苦于以下问题:Java Transition类的具体用法?Java Transition怎么用?Java Transition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Transition类属于com.bumptech.glide.request.transition包,在下文中一共展示了Transition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadImageView

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
private void loadImageView() {
    final String url = getArguments().getString(ARGUMENTS_IMAGE);
    Glide.with(this).downloadOnly().load(url)
            /* todo replace error icon */
            .apply(new RequestOptions().error(R.mipmap.qq_refresh_success))
            .into(new SimpleTarget<File>() {
                @Override
                public void onResourceReady(File resource, Transition<? super File> transition) {
                    mImageView.setImage(ImageSource.uri(Uri.fromFile(resource)));
                }

                @Override
                public void onLoadFailed(@Nullable Drawable errorDrawable) {
                    super.onLoadFailed(errorDrawable);
                }
            });

}
 
开发者ID:yangjiantao,项目名称:AndroidUiKit,代码行数:19,代码来源:PhotoViewFragment.java

示例2: onGranted

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Override
public void onGranted() {
    Glide.with(context).load(url).into(new SimpleTarget<Drawable>() {
        @Override
        public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
            String path = String.format("%s/Android/data/%s/",
                    Environment.getExternalStorageDirectory(), AppUtils.getAppPackageName());
            String filename = TimeUtils.getNowString() + ".png";
            boolean ok = ImageUtils.save(ImageUtils.drawable2Bitmap(resource),
                    path + filename, Bitmap.CompressFormat.PNG);
            if (ok) {
                ToastUtils.showShort(R.string.success);
            } else {
                ToastUtils.showShort(R.string.error);
            }
        }
    });
}
 
开发者ID:RanKKI,项目名称:PSNine,代码行数:19,代码来源:ImageViewActivity.java

示例3: onResourceReady

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
/**
 * Internal {@link #onResourceReady(Resource, DataSource)} 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<R> resource, R result, DataSource dataSource) {
  // We must call isFirstReadyResource before setting status.
  boolean isFirstResource = isFirstReadyResource();
  status = Status.COMPLETE;
  this.resource = resource;

  if (glideContext.getLogLevel() <= Log.DEBUG) {
    Log.d(GLIDE_TAG, "Finished loading " + result.getClass().getSimpleName() + " from "
        + dataSource + " for " + model + " with size [" + width + "x" + height + "] in "
        + LogTime.getElapsedMillis(startTime) + " ms");
  }

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

  notifyLoadSuccess();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:SingleRequest.java

示例4: testClone

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Test
public void testClone() throws IOException {
  Target<Drawable> firstTarget = mock(Target.class);
  doAnswer(new CallSizeReady(100, 100)).when(firstTarget).getSize(isA(SizeReadyCallback.class));
  Target<Drawable> secondTarget = mock(Target.class);
  doAnswer(new CallSizeReady(100, 100)).when(secondTarget).getSize(isA(SizeReadyCallback.class));
  RequestBuilder<Drawable> firstRequest = requestManager
      .load(mockUri("content://first"));

  firstRequest.into(firstTarget);

  firstRequest.clone()
      .apply(placeholderOf(new ColorDrawable(Color.RED)))
      .into(secondTarget);

  verify(firstTarget).onResourceReady(isA(Drawable.class), isA(Transition.class));
  verify(secondTarget).onResourceReady(notNull(Drawable.class), isA(Transition.class));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:GlideTest.java

示例5: testLoadColorDrawable_withUnitBitmapTransformation_returnsColorDrawable

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Test
public void testLoadColorDrawable_withUnitBitmapTransformation_returnsColorDrawable() {
  ColorDrawable colorDrawable = new ColorDrawable(Color.RED);
  requestManager
      .load(colorDrawable)
      .apply(new RequestOptions()
          .override(100, 100)
          .centerCrop())
      .into(target);

  ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class);
  verify(target).onResourceReady(argumentCaptor.capture(), isA(Transition.class));

  Object result = argumentCaptor.getValue();

  assertThat(result).isInstanceOf(ColorDrawable.class);
  assertThat(((ColorDrawable) result).getColor()).isEqualTo(Color.RED);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:GlideTest.java

示例6: testLoadColorDrawable_withNonUnitBitmapTransformation_returnsBitmapDrawable

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Test
public void testLoadColorDrawable_withNonUnitBitmapTransformation_returnsBitmapDrawable() {
  ColorDrawable colorDrawable = new ColorDrawable(Color.RED);
  requestManager
      .load(colorDrawable)
      .apply(new RequestOptions()
          .override(100, 100)
          .circleCrop())
      .into(target);

  ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class);
  verify(target).onResourceReady(argumentCaptor.capture(), isA(Transition.class));

  Object result = argumentCaptor.getValue();

  assertThat(result).isInstanceOf(BitmapDrawable.class);
  Bitmap bitmap = ((BitmapDrawable) result).getBitmap();
  assertThat(bitmap.getWidth()).isEqualTo(100);
  assertThat(bitmap.getHeight()).isEqualTo(100);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:GlideTest.java

示例7: removeFromManagers_afterRequestManagerRemoved_clearsRequest

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Test
public void removeFromManagers_afterRequestManagerRemoved_clearsRequest() {
  target = requestManager.load(mockUri("content://uri")).into(new SimpleTarget<Drawable>() {
    @Override
    public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
      // Do nothing.
    }
  });
  Request request = Preconditions.checkNotNull(target.getRequest());

  requestManager.onDestroy();
  requestManager.clear(target);

  assertThat(target.getRequest()).isNull();
  assertThat(request.isCancelled()).isTrue();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:GlideTest.java

示例8: changeViewState

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
private void changeViewState(){
    imageName.setText(mainObject.getFileName());

    if (image.getDrawable() == null) {
        Glide.with(parentActivity)
                .load(mainObject.getPath())
                .into(new DrawableImageViewTarget(image) {
                    @Override
                    public void onResourceReady(Drawable resource, @Nullable Transition<? super Drawable> transition) {
                        super.onResourceReady(resource, transition);
                        circleProgress.setVisibility(View.GONE);
                        mainObject.setState(ImageState.unselected);
                    }
                });
    }
}
 
开发者ID:marckregio,项目名称:maklib,代码行数:17,代码来源:ImageItemView.java

示例9: onResume

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Override
public void onResume(){
    super.onResume();
    if(mUserService.isLoggedIn()){
        mUserService.me()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(u -> {
                    userName.setText(u.getUsername());
                    mAvatarView.setAvatarOfUser(u);
                    GlideApp.with(this)
                        .load(NodeBBService.url(u.getCoverUrl()))
                        .into(new SimpleTarget<Drawable>() {
                            @Override
                            public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
                                mHeaderView.setBackground(resource);
                            }
                        });
                });
    }
}
 
开发者ID:hyb1996,项目名称:NodeET,代码行数:22,代码来源:DrawerFragment.java

示例10: getUserProfile

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
private void getUserProfile() {
    mUserService.me()
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(u -> {
                        mUserName.setText(u.getUsername());
                        mAvatarView.setAvatarOfUser(u);
                        mReputation.setText(u.getReputation());
                        mPost.setText(u.getPostcount());
                        mFollowing.setText(String.valueOf(u.getFollowingCount()));
                        mFollower.setText(String.valueOf(u.getFollowerCount()));
                        mLoginTime.setText(DateTimeFormatter.format(Long.parseLong(u.getLastonline())));
                        mRegTime.setText(DateTimeFormatter.format(Long.parseLong(u.getJoindate())));
                        mProfileViews.setText(u.getProfileviews());
                        mEmail.setText(u.getEmail());
                        GlideApp.with(UserProfileActivity.this)
                                .load(NodeBBService.url(u.getCoverUrl()))
                                .into(new SimpleTarget<Drawable>() {
                                    @Override
                                    public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
                                        mHeaderView.setBackground(resource);
                                    }
                                });
                    });
}
 
开发者ID:hyb1996,项目名称:NodeET,代码行数:26,代码来源:UserProfileActivity.java

示例11: onResourceReady

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Override
public void onResourceReady(final Bitmap resource, Transition<? super Bitmap> transition) {
    try {

        final ViewTreeObserver observer = getView().getViewTreeObserver();
        observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            public boolean onPreDraw() {

                //final Bitmap scaledBitmap = Bitmap.createScaledBitmap(resource, mPhotoContainer.getWidth(), mPhotoContainer.getHeight(), true);
                mPhoto.setImageBitmap(resource);
                mPhoto.invalidate();

                mPhoto.setVisibility(View.VISIBLE);
                mPhotoNoImage.setVisibility(View.GONE);

                return true;
            }
        });

    } catch (Exception ex) {
        Log.e(getClass().getSimpleName(),ex.getMessage());
    }
}
 
开发者ID:victoraldir,项目名称:BuddyBook,代码行数:24,代码来源:DetailActivityFragment.java

示例12: renderImage

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
private void renderImage(Object image, final ImageView imageView){

        GlideApp.with(mContext)
                .asBitmap()
                .load(image)
                .placeholder(R.drawable.iconerror)
                .error(R.drawable.iconerror)
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onResourceReady(final Bitmap resource, Transition<? super Bitmap> transition) {

                        int valueWidth = (int) mContext.getResources().getDimension(R.dimen.book_cover_width);
                        int valueHeight = (int) mContext.getResources().getDimension(R.dimen.book_cover_height);


                        final Bitmap scaledBitmap = Bitmap.createScaledBitmap(resource, valueWidth, valueHeight, true);
                        imageView.setImageBitmap(resource);
                        imageView.invalidate();

                    }
                });
    }
 
开发者ID:victoraldir,项目名称:BuddyBook,代码行数:23,代码来源:BookGridAdapterFirebase.java

示例13: onResourceReady

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Override
public void onResourceReady(Drawable resource, @Nullable Transition<? super Drawable> transition) {
    super.onResourceReady(resource, transition);

    BadgedFourThreeImageView badgedImageView = (BadgedFourThreeImageView) getView();
    if (resource instanceof GifDrawable) {
        Bitmap image = ((GifDrawable) resource).getFirstFrame();
        if (image != null) {
            // look at the corner to determine the gif badge color
            int cornerSize = (int) (56 * getView().getContext().getResources().getDisplayMetrics
                    ().scaledDensity);
            Bitmap corner = Bitmap.createBitmap(image,
                    image.getWidth() - cornerSize,
                    image.getHeight() - cornerSize,
                    cornerSize, cornerSize);
            boolean isDark = ColorUtils.isDark(corner);
            corner.recycle();
            badgedImageView.setBadgeColor(ContextCompat.getColor(getView().getContext(),
                    isDark ? R.color.gif_badge_dark_image : R.color.gif_badge_light_image));
        } else {
            badgedImageView.setBadgeColor(ContextCompat.getColor(getView().getContext(),
                    R.color.gif_badge_light_image));
        }
    }
}
 
开发者ID:gejiaheng,项目名称:Protein,代码行数:26,代码来源:DribbbleTarget.java

示例14: onBindViewHolder

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ContributorAdapter.ViewHolder holder, int position) {
    ContributorData contributor = contributors.get(position);

    Glide.with(holder.imageView.getContext()).asBitmap().load(contributor.imageUrl).into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
            holder.imageView.setImageBitmap(resource);
        }
    });

    holder.textView.setText(contributor.name);

    holder.itemView.setTag(contributor);
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (view.getTag() != null && view.getTag() instanceof ContributorData)
                view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(((ContributorData) view.getTag()).url)));
        }
    });
}
 
开发者ID:TheAndroidMaster,项目名称:MediaNotification,代码行数:23,代码来源:ContributorAdapter.java

示例15: loadArtWork

import com.bumptech.glide.request.transition.Transition; //导入依赖的package包/类
@Override
public void loadArtWork(long artistId) {
    LogUtils.i(TAG, "loadArtWork");

    if (mView != null) {
        Glide.with(mView.getContext()).asBitmap().load(String.valueOf(artistId))
                .into(new SimpleTarget<Bitmap>() {
                    @Override
                    public void onLoadFailed(Drawable errorDrawable) {
                        super.onLoadFailed(errorDrawable);

                        if (mView != null) {
                            mView.showArtwork(errorDrawable);
                        }
                    }

                    @Override
                    public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
                        if (mView != null) {
                            mView.showArtwork(resource);
                        }
                    }
                });
    }
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:26,代码来源:ArtistDetailPresenter.java


注:本文中的com.bumptech.glide.request.transition.Transition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。