Skip to content

Commit

Permalink
Revert "[TIMOB-25678] Android: Amend hasActivityTransitions() for tra…
Browse files Browse the repository at this point in the history
…nsitions" (#10404)

* Revert "[TIMOB-26491] Update ti.cloudpush to 3.2.0 (#10403)"

This reverts commit c77b295.

* Revert "[TIMOB-26484] Android: Added "sound" support to NotificationChannel (#10400)"

This reverts commit 24ece5b.

* Revert "[TIMOB-25678] Android: Amend hasActivityTransitions() for transitions (#9740)"

This reverts commit a36557c.
  • Loading branch information
garymathews authored and eric34 committed Oct 26, 2018
1 parent c77b295 commit 4e0db8c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ protected void handleOpen(KrollDict options)
int exitAnimation = TiConvert.toInt(options.get(TiC.PROPERTY_ACTIVITY_EXIT_ANIMATION), 0);
topActivity.overridePendingTransition(enterAnimation, exitAnimation);
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
&& Build.VERSION.SDK_INT != Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
topActivity.startActivity(intent, createActivityOptionsBundle(topActivity));
} else {
topActivity.startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-Present by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2009-2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand Down Expand Up @@ -30,16 +30,17 @@
import org.appcelerator.titanium.view.TiUIView;

import android.app.Activity;
import android.app.ActivityOptions;
import android.content.pm.ActivityInfo;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.Display;
import android.view.View;
import android.view.Window;
import android.view.ViewParent;

// clang-format off
Expand Down Expand Up @@ -588,7 +589,7 @@ public KrollProxy getParentForBubbling()
public void addSharedElement(TiViewProxy view, String transitionName)
{
if (LOLLIPOP_OR_GREATER) {
TiUIView v = view.getOrCreateView();
TiUIView v = view.peekView();
if (v != null) {
Pair<View, String> p = new Pair<View, String>(v.getNativeView(), transitionName);
sharedElementPairs.add(p);
Expand All @@ -613,37 +614,23 @@ public void removeAllSharedElements()
@Nullable
protected Bundle createActivityOptionsBundle(Activity activity)
{
ActivityOptionsCompat options = null;
if (hasActivityTransitions()) {

// NOTE: some versions of Android do not animate the window enter or exit transition
// without returning a valid bundle. If the activity has transitions; always return a bundle.
if (sharedElementPairs.isEmpty()) {
sharedElementPairs.add(new Pair<View, String>(new View(activity), "ti_compatibility_element"));
}
options = ActivityOptionsCompat.makeSceneTransitionAnimation(
activity, sharedElementPairs.toArray(new Pair[sharedElementPairs.size()]));
Bundle b = ActivityOptions
.makeSceneTransitionAnimation(
activity, sharedElementPairs.toArray(new Pair[sharedElementPairs.size()]))
.toBundle();
return b;
} else {
options = ActivityOptionsCompat.makeBasic();
return null;
}
return options.toBundle();
}

/**
* @return true if this window has activity transitions
*/
protected boolean hasActivityTransitions()
{
if (LOLLIPOP_OR_GREATER) {
final Window win = getActivity() != null ? getActivity().getWindow() : null;
final boolean isAnimated = TiConvert.toBoolean(getProperties(), TiC.PROPERTY_ANIMATED, true);
final boolean hasSharedElements = sharedElementPairs != null && !sharedElementPairs.isEmpty();
final boolean hasTransitions =
win != null
&& (win.getEnterTransition() != null || win.getExitTransition() != null
|| win.getReenterTransition() != null || win.getReturnTransition() != null);
return isAnimated && (hasSharedElements || hasTransitions);
}
return false;
final boolean animated = TiConvert.toBoolean(getProperties(), TiC.PROPERTY_ANIMATED, true);
return (LOLLIPOP_OR_GREATER && animated && sharedElementPairs != null && !sharedElementPairs.isEmpty());
}
}

0 comments on commit 4e0db8c

Please sign in to comment.