Merge pull request #3503 from sigmabeta/android-rotation-bugfix

[Android] Don't show screenshot on rotation events
This commit is contained in:
Ryan Houdek 2016-01-12 10:38:44 -05:00
commit d5d6226fbb
1 changed files with 47 additions and 42 deletions

View File

@ -138,50 +138,50 @@ public final class EmulationActivity extends AppCompatActivity
mScreenPath = gameToEmulate.getStringExtra("ScreenPath"); mScreenPath = gameToEmulate.getStringExtra("ScreenPath");
mPosition = gameToEmulate.getIntExtra("GridPosition", -1); mPosition = gameToEmulate.getIntExtra("GridPosition", -1);
Picasso.with(this)
.load(mScreenPath)
.noFade()
.noPlaceholder()
.into(mImageView, new Callback()
{
@Override
public void onSuccess()
{
scheduleStartPostponedTransition(mImageView);
}
@Override
public void onError()
{
// Still have to do this, or else the app will crash.
scheduleStartPostponedTransition(mImageView);
}
});
mImageView.animate()
.withLayer()
.setStartDelay(2000)
.setDuration(500)
.alpha(0.0f)
.withStartAction(new Runnable()
{
@Override
public void run()
{
mFrameEmulation.setVisibility(View.VISIBLE);
}
})
.withEndAction(new Runnable()
{
@Override
public void run()
{
mImageView.setVisibility(View.GONE);
}
});
if (savedInstanceState == null) if (savedInstanceState == null)
{ {
Picasso.with(this)
.load(mScreenPath)
.noFade()
.noPlaceholder()
.into(mImageView, new Callback()
{
@Override
public void onSuccess()
{
scheduleStartPostponedTransition(mImageView);
}
@Override
public void onError()
{
// Still have to do this, or else the app will crash.
scheduleStartPostponedTransition(mImageView);
}
});
mImageView.animate()
.withLayer()
.setStartDelay(2000)
.setDuration(500)
.alpha(0.0f)
.withStartAction(new Runnable()
{
@Override
public void run()
{
mFrameEmulation.setVisibility(View.VISIBLE);
}
})
.withEndAction(new Runnable()
{
@Override
public void run()
{
mImageView.setVisibility(View.GONE);
}
});
// Instantiate an EmulationFragment. // Instantiate an EmulationFragment.
EmulationFragment emulationFragment = EmulationFragment.newInstance(path); EmulationFragment emulationFragment = EmulationFragment.newInstance(path);
@ -190,6 +190,11 @@ public final class EmulationActivity extends AppCompatActivity
.add(R.id.frame_emulation_fragment, emulationFragment, EmulationFragment.FRAGMENT_TAG) .add(R.id.frame_emulation_fragment, emulationFragment, EmulationFragment.FRAGMENT_TAG)
.commit(); .commit();
} }
else
{
mImageView.setVisibility(View.GONE);
mFrameEmulation.setVisibility(View.VISIBLE);
}
if (mDeviceHasTouchScreen) if (mDeviceHasTouchScreen)
{ {