diff options
7 files changed, 60 insertions, 7 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 21a0fa66f..b0cbd355b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -11,6 +11,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.v4.app.ActivityOptionsCompat; import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.Menu; @@ -368,7 +369,16 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); + + View cover = findViewById(R.id.imgvCover); + if (cover != null && Build.VERSION.SDK_INT >= 16) { + ActivityOptionsCompat options = ActivityOptionsCompat. + makeSceneTransitionAnimation(MediaplayerActivity.this, + cover, "coverTransition"); + startActivity(intent, options.toBundle()); + } else { + startActivity(intent); + } return true; } else { if (media != null) { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index b3cda69d3..cc7d83e0c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Build; +import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.AppBarLayout; import android.support.design.widget.Snackbar; @@ -113,6 +114,12 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem } @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + supportPostponeEnterTransition(); + } + + @Override protected void onStop() { super.onStop(); Log.d(TAG, "onStop()"); @@ -277,6 +284,8 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem pageIndicator.setViewPager(pager); loadLastFragment(); pager.onSaveInstanceState(); + + navList.post(this::supportStartPostponedEnterTransition); } @Override diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 1e385728a..ebdb658d5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -1,6 +1,9 @@ package de.danoeh.antennapod.fragment; +import android.content.Intent; +import android.os.Build; import android.os.Bundle; +import android.support.v4.app.ActivityOptionsCompat; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; @@ -56,8 +59,15 @@ public class ExternalPlayerFragment extends Fragment { Log.d(TAG, "layoutInfo was clicked"); if (controller != null && controller.getMedia() != null) { - startActivity(PlaybackService.getPlayerActivityIntent( - getActivity(), controller.getMedia())); + Intent intent = PlaybackService.getPlayerActivityIntent(getActivity(), controller.getMedia()); + + if (Build.VERSION.SDK_INT >= 16) { + ActivityOptionsCompat options = ActivityOptionsCompat. + makeSceneTransitionAnimation(getActivity(), imgvCover, "coverTransition"); + startActivity(intent, options.toBundle()); + } else { + startActivity(intent); + } } }); return root; diff --git a/app/src/main/res/layout/cover_fragment.xml b/app/src/main/res/layout/cover_fragment.xml index 9ad1ff9c6..05b927da4 100644 --- a/app/src/main/res/layout/cover_fragment.xml +++ b/app/src/main/res/layout/cover_fragment.xml @@ -16,6 +16,7 @@ android:scaleType="fitCenter" app:layout_aspectRatio="100%" app:layout_widthPercent="82%" + android:transitionName="coverTransition" tools:src="@android:drawable/sym_def_app_icon" /> <LinearLayout diff --git a/app/src/main/res/layout/external_player_fragment.xml b/app/src/main/res/layout/external_player_fragment.xml index fb7abde55..c0eb9211f 100644 --- a/app/src/main/res/layout/external_player_fragment.xml +++ b/app/src/main/res/layout/external_player_fragment.xml @@ -22,6 +22,7 @@ android:scaleType="centerCrop" tools:src="@drawable/ic_drag_vertical_white_48dp" tools:background="@android:color/holo_green_dark" + android:transitionName="coverTransition" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true"/> diff --git a/core/src/main/res/values-v21/styles.xml b/core/src/main/res/values-v21/styles.xml index 42bd358c7..503337c95 100644 --- a/core/src/main/res/values-v21/styles.xml +++ b/core/src/main/res/values-v21/styles.xml @@ -1,5 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <resources> + <style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light"> + <item name="android:windowContentTransitions">true</item> + </style> + <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> + <item name="android:windowContentTransitions">true</item> + </style> <style name="Widget.AntennaPod.Button" parent="Widget.AppCompat.Button"> <item name="textAllCaps">true</item> diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 4f228f8f1..a88d8c3a8 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -1,7 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="Theme.AntennaPod.Light" parent="Theme.AppCompat.Light"> + <style name="Theme.AntennaPod.Light" parent="Theme.Base.AntennaPod.Light"> + <!-- Room for API dependent attributes --> + </style> + + <style name="Theme.Base.AntennaPod.Light" parent="Theme.AppCompat.Light"> <item name="colorPrimary">@color/primary_light</item> <item name="colorAccent">@color/holo_blue_light</item> <item name="progressBarTheme">@style/ProgressBarLight</item> @@ -60,7 +64,11 @@ <item name="attr/ic_cast_disconnect">@drawable/ic_cast_disconnect_grey600_36dp</item> </style> - <style name="Theme.AntennaPod.Dark" parent="Theme.AppCompat"> + <style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark"> + <!-- Room for API dependent attributes --> + </style> + + <style name="Theme.Base.AntennaPod.Dark" parent="Theme.AppCompat"> <item name="colorAccent">@color/holo_blue_dark</item> <item name="colorControlNormal">@color/white</item> <item name="buttonStyle">@style/Widget.AntennaPod.Button</item> @@ -119,7 +127,11 @@ <item name="attr/ic_cast_disconnect">@drawable/ic_cast_disconnect_white_36dp</item> </style> - <style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.AppCompat.Light.NoActionBar"> + <style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.Base.AntennaPod.Light.NoTitle"> + <!-- Room for API dependent attributes --> + </style> + + <style name="Theme.Base.AntennaPod.Light.NoTitle" parent="Theme.AppCompat.Light.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowActionModeOverlay">true</item> <item name="progressBarTheme">@style/ProgressBarLight</item> @@ -179,7 +191,11 @@ <item name="attr/ic_cast_disconnect">@drawable/ic_cast_disconnect_grey600_36dp</item> </style> - <style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.AppCompat.NoActionBar"> + <style name="Theme.AntennaPod.Dark.NoTitle" parent="Theme.Base.AntennaPod.Dark.NoTitle"> + <!-- Room for API dependent attributes --> + </style> + + <style name="Theme.Base.AntennaPod.Dark.NoTitle" parent="Theme.AppCompat.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowActionModeOverlay">true</item> <item name="progressBarTheme">@style/ProgressBarDark</item> |