Skip to content

Commit

Permalink
Disabled shared element transitions from API 27 (#494)
Browse files Browse the repository at this point in the history
AdapterView is not supported by the transition framework. This
became an issue with the release of API 27. In Android 8.1 the
shared element view is removed from the exiting fragment. This
causes Android to call the removeView method from AdapterView
which is not implemented and causes the app to crash.

We can reenable shared element transitions for API 27 and up by
refactoring the GridView usage to RecycleView.
  • Loading branch information
poisdeux authored and SyncedSynapse committed Dec 22, 2017
1 parent b0e6d32 commit 250c1f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/org/xbmc/kore/ui/BaseMediaActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected void onCreate(Bundle savedInstanceState) {
if (fragment == null) {
fragment = createFragment();

if (Utils.isLollipopOrLater()) {
if (Utils.isLollipopAndPreOreo()) {
fragment.setExitTransition(null);
fragment.setReenterTransition(TransitionInflater
.from(this)
Expand All @@ -158,7 +158,7 @@ protected void onCreate(Bundle savedInstanceState) {
.commit();
}

if (Utils.isLollipopOrLater()) {
if (Utils.isLollipopAndPreOreo()) {
sharedElementTransition.setupExitTransition(this, fragment);
}

Expand Down Expand Up @@ -280,7 +280,7 @@ protected void showFragment(AbstractFragment fragment, ImageView sharedImageView
FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction();

// Set up transitions
if (Utils.isLollipopOrLater()) {
if (Utils.isLollipopAndPreOreo()) {
dataHolder.setPosterTransitionName(sharedImageView.getTransitionName());
sharedElementTransition.setupEnterTransition(this, fragTrans, fragment, sharedImageView);
} else {
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/org/xbmc/kore/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public static boolean isLollipopOrLater() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}

public static boolean isLollipopAndPreOreo() {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) &&
(Build.VERSION.SDK_INT < 27);
}

/**
* Concats a list of strings...
* @param list
Expand Down

0 comments on commit 250c1f0

Please sign in to comment.