Start the postponed activity transition as soon as Picasso loads the

image.

Doing it on the preDraw for the View is too complicated. This works just
as well.
This commit is contained in:
Mike Harris 2017-10-07 22:17:46 -07:00
parent 25a08fc5cc
commit d48c64457a
1 changed files with 2 additions and 19 deletions

View File

@ -23,7 +23,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -248,14 +247,14 @@ public final class EmulationActivity extends AppCompatActivity
@Override
public void onSuccess()
{
scheduleStartPostponedTransition(mImageView);
startPostponedEnterTransition();
}
@Override
public void onError()
{
// Still have to do this, or else the app will crash.
scheduleStartPostponedTransition(mImageView);
startPostponedEnterTransition();
}
});
@ -862,22 +861,6 @@ public final class EmulationActivity extends AppCompatActivity
hideSystemUiAfterDelay();
}
private void scheduleStartPostponedTransition(final View sharedElement)
{
sharedElement.getViewTreeObserver().addOnPreDrawListener(
new ViewTreeObserver.OnPreDrawListener()
{
@Override
public boolean onPreDraw()
{
sharedElement.getViewTreeObserver().removeOnPreDrawListener(this);
startPostponedEnterTransition();
return true;
}
});
}
private void showMenu(SaveLoadStateFragment.SaveOrLoad saveOrLoad)
{
Fragment fragment = SaveLoadStateFragment.newInstance(saveOrLoad);