Skip to content

SimpleDraweeView apply Fade.OUT transition without effect #2388

Closed
@b7woreo

Description

@b7woreo

Description

Use TransitionManager.begainDelayTransition() apply Fade transition on SimpleDraweeView from visible to invisible. SimpleDraweeView disappear directly without fade out effect.

Reproduction

Sample Project

Solution

Before Android 7.0 ImageView will call Drawable.setVisible() method when setVisibility method called, so when call GenericDraweeView.setVisibility(INVISIBLE) method will lead RootDrawable to invisible.
When begin transition, Fade direct modify target view visibility flag to restore target view visibility, but it will not change RootDrawable to visiable.
And then when GenericDraweeView try to draw RootDrawable through RootDrawable.draw() method, it just return because it is invisiable.

There is a simple way to fix issue: just remove isVisible judgement in RootDrawable.draw() method, like this:

  public void draw(Canvas canvas) {
    if (mVisibilityCallback != null) {
      mVisibilityCallback.onDraw();
    }
    super.draw(canvas);
    if (mControllerOverlay != null) {
      mControllerOverlay.setBounds(getBounds());
      mControllerOverlay.draw(canvas);
    }
  }

I read most of Drawable source code, such as BitmapDrawable, ColorDrawable etc, none of drawable skip draw when it is invisible. When view is invisible who own drawable, it will skip draw and will not call Drawable.draw() method, so this modification will not increase performance overhead and can keep same draw behaviour with all other drawable.

May I open a pr to fix this issue?

Additional Information

  • Fresco version: 2.0.0
  • Platform version: Android 5.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions