Merge pull request #2457 from ByteHamster/sharedElement
Shared element transition
This commit is contained in:
commit
68754684b7
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -112,6 +113,12 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
supportPostponeEnterTransition();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
@ -277,6 +284,8 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
pageIndicator.setViewPager(pager);
|
||||
loadLastFragment();
|
||||
pager.onSaveInstanceState();
|
||||
|
||||
navList.post(this::supportStartPostponedEnterTransition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue