diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index ce3f9624c7..44bfbb8272 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -12,9 +12,11 @@ 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 com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import org.dolphinemu.dolphinemu.NativeLibrary; @@ -51,6 +53,10 @@ public final class EmulationActivity extends AppCompatActivity { super.onCreate(savedInstanceState); + // Picasso will take a while to load these big-ass screenshots. So don't run + // the animation until we say so. + postponeEnterTransition(); + mDeviceHasTouchScreen = getPackageManager().hasSystemFeature("android.hardware.touchscreen"); // Get a handle to the Window containing the UI. @@ -95,21 +101,42 @@ public final class EmulationActivity extends AppCompatActivity Picasso.with(this) .load(screenPath) - .fit() .noFade() - .into(mImageView); + .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() .setStartDelay(2000) .setDuration(500) .alpha(0.0f) + .withStartAction(new Runnable() + { + @Override + public void run() + { + mFrameLayout.setVisibility(View.VISIBLE); + } + }) .withEndAction(new Runnable() { @Override public void run() { mImageView.setVisibility(View.GONE); - mFrameLayout.setVisibility(View.VISIBLE); } }); @@ -354,4 +381,20 @@ 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; + } + }); + } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java index 8b279c52c2..3cb832f91b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java @@ -1,6 +1,7 @@ package org.dolphinemu.dolphinemu.adapters; import android.app.Activity; +import android.app.ActivityOptions; import android.content.Intent; import android.database.Cursor; import android.database.DataSetObserver; @@ -222,7 +223,12 @@ public final class GameAdapter extends RecyclerView.Adapter impl intent.putExtra("SelectedTitle", holder.title); intent.putExtra("ScreenPath", holder.screenshotPath); - view.getContext().startActivity(intent); + ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation( + (Activity) view.getContext(), + holder.imageScreenshot, + "image_game_screenshot"); + + view.getContext().startActivity(intent, options.toBundle()); } /** diff --git a/Source/Android/app/src/main/res/layout/activity_emulation.xml b/Source/Android/app/src/main/res/layout/activity_emulation.xml index 5a644b260a..c686c6191e 100644 --- a/Source/Android/app/src/main/res/layout/activity_emulation.xml +++ b/Source/Android/app/src/main/res/layout/activity_emulation.xml @@ -3,14 +3,16 @@ android:layout_height="match_parent" > - - + android:visibility="invisible"/> + + + \ No newline at end of file diff --git a/Source/Android/app/src/main/res/layout/card_game.xml b/Source/Android/app/src/main/res/layout/card_game.xml index b18bc9e7ee..9b172b6871 100644 --- a/Source/Android/app/src/main/res/layout/card_game.xml +++ b/Source/Android/app/src/main/res/layout/card_game.xml @@ -20,7 +20,7 @@ android:id="@+id/image_game_screen" android:layout_width="match_parent" android:layout_height="0dp" - android:transitionName="image_game_screen" + android:transitionName="image_game_screenshot" android:layout_weight="1" tools:src="@drawable/placeholder_screenshot" tools:scaleType="centerCrop"/> diff --git a/Source/Android/app/src/main/res/transition/change_image_transform.xml b/Source/Android/app/src/main/res/transition/change_image_transform.xml new file mode 100644 index 0000000000..3ee92bd7c4 --- /dev/null +++ b/Source/Android/app/src/main/res/transition/change_image_transform.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Source/Android/app/src/main/res/values/styles.xml b/Source/Android/app/src/main/res/values/styles.xml index 98cf984807..dc81c173a7 100644 --- a/Source/Android/app/src/main/res/values/styles.xml +++ b/Source/Android/app/src/main/res/values/styles.xml @@ -7,6 +7,18 @@ @color/dolphin_blue @color/dolphin_blue_dark + + @@ -66,6 +78,19 @@ @color/dolphin_blue @color/dolphin_blue_dark true + + + true + + + @android:transition/explode + @android:transition/explode + + + @transition/change_image_transform + + @transition/change_image_transform + @@ -81,7 +106,6 @@ @color/dolphin_accent_wiiware -