Java 类com.facebook.drawee.view.DraweeTransition 实例源码

项目:GitHub    文件:ImageDetailsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_drawee_transition_detail);

  ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }

  SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.image);
  simpleDraweeView.setImageURI(getIntent().getData());

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
        ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER));
    getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
        ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP));
  }
}
项目:fresco    文件:ImageDetailsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_drawee_transition_detail);

  ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayHomeAsUpEnabled(true);
  }

  SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.image);
  simpleDraweeView.setImageURI(getIntent().getData());

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
        ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER));
    getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
        ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP));
  }
}
项目:TakeRest    文件:PhotoViewActivity.java   
@Override
protected void init() {
    super.init();
    transparentStatusBar();
    ButterKnife.bind(this);
    url = getIntent().getStringExtra("url");
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
    controller.setUri(Uri.parse(url));
    controller.setAutoPlayAnimations(true);
    controller.setOldController(photoDraweeView.getController());
    controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);
            if (imageInfo == null || photoDraweeView == null) {
                return;
            }
            photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
            normalScale = photoDraweeView.getScale();
        }
    });
    photoDraweeView.setController(controller.build());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
        String name = getIntent().getStringExtra("transition_name");
        photoDraweeView.setTransitionName(name);
        getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER));
        getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP));
    }
}
项目:apps-android-wikipedia    文件:BaseActivity.java   
protected void setSharedElementTransitions() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // For using shared element transitions with Fresco, we need to explicitly define
        // a DraweeTransition that will be automatically used by Drawees that are used in
        // transitions between activities.
        getWindow().setSharedElementEnterTransition(DraweeTransition
                .createTransitionSet(ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.CENTER_CROP));
        getWindow().setSharedElementReturnTransition(DraweeTransition
                .createTransitionSet(ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.CENTER_CROP));
    }
}
项目:TakeRest    文件:UserActivity.java   
@Override
public void onSuccess(User user) {
    initTab(user.getId());
    mAvator.setImageURI(user.getAvatar_url());
    getToolbar().setTitle(user.getName());
    StringBuilder sb = new StringBuilder();
    sb.append(FOLLOWERS);
    sb.append(BLANK);
    sb.append(user.getFollowers_count());
    sb.append(BLANK);
    sb.append(DIVIDER_STRING);
    sb.append(BLANK);
    sb.append(FOLLOWINGS);
    sb.append(BLANK);
    sb.append(user.getFollowings_count());
    mFollows.setText(sb.toString());
    if (user.getLocation() != null) {
        mLocation.setText(user.getLocation());
    }
    if (user.getBio() != null) {
        mBio.setText(Html.fromHtml(user.getBio()));
    } else {
        mBio.setText(getString(R.string.no_description));
    }
    if (user.getLinks() != null) {
        if (user.getLinks().getWeb() != null) {
            web_url = user.getLinks().getWeb();
            mHomepage.setVisibility(View.VISIBLE);
        } else {
            mHomepage.setVisibility(View.GONE);
        }
        if (user.getLinks().getTwitter() != null) {
            twitter_url = user.getLinks().getTwitter();
            mTwitter.setVisibility(View.VISIBLE);
        } else {
            mTwitter.setVisibility(View.GONE);
        }
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.CENTER_CROP));
        getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.CENTER_CROP));
    }
}
项目:TakeRest    文件:MovieBasicActivity.java   
@Override
public void onSuccess(final MovieBasic movieBasic) {
    String url = movieBasic.getImages().getLarge();
    String des = movieBasic.getCountries().get(0);
    String date = movieBasic.getYear();
    String title = movieBasic.getTitle();
    String plot = movieBasic.getSummary();
    shareUrl = movieBasic.getShare_url();
    ticketUrl = movieBasic.getSchedule_url();
    String original_title = movieBasic.getOriginal_title();
    double rating = movieBasic.getRating().getAverage();
    int watched = movieBasic.getCollect_count();
    StringBuilder sb = new StringBuilder();
    for (int i = 0;i < movieBasic.getGenres().size();i++){
        if (i < movieBasic.getGenres().size()-1){
            sb.append(movieBasic.getGenres().get(i)+"/");
        }else{
            sb.append(movieBasic.getGenres().get(i));
        }
    }
    setToolbarTitle(title);
    mBlurView.setImageURI(Uri.parse(url));
    mImage.setImageURI(Uri.parse(url));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
        getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.FIT_XY, ScalingUtils.ScaleType.FIT_XY));
        getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.FIT_XY, ScalingUtils.ScaleType.FIT_XY));
    }
    mDescription.setText(des+"\r\r"+date);
    mOriginalName.setText(ORIGINAL_TITLE+ original_title);
    mRatingBar.setMax(movieBasic.getRating().getMax());
    mRatingBar.setRating((float)movieBasic.getRating().getAverage()/2);
    mWatched.setText(watched+WATCHED);
    mType.setText(sb.toString());
    mPlot.setText(plot);
    mRating.setText(rating+"");
    final List<Director> list = movieBasic.getDirectors();
    list.addAll(movieBasic.getCasts());
    adapter = new DirectorAdapter(this,DirectorAdapter.NORMAL,list);
    mRecyclerView.setAdapter(adapter);
    adapter.setOnItemClickLitener(new DirectorAdapter.OnItemClickLitener() {
        @Override
        public void onItemClick(View view, int position) {
            Intent intent = new Intent(MovieBasicActivity.this,WebActivity.class);
            intent.putExtra(URL,list.get(position).getAlt());
            startActivity(intent);
        }
    });
    mShare.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent action_share = new Intent(Intent.ACTION_SEND);
            action_share.setType("text/plain");
            action_share.putExtra(Intent.EXTRA_SUBJECT, movieBasic.getTitle());
            action_share.putExtra(Intent.EXTRA_TEXT, movieBasic.getTitle()+movieBasic.getMobile_url());
            action_share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(Intent.createChooser(action_share, movieBasic.getTitle()));
        }
    });
}