Skip to content

Commit

Permalink
Revert "fix(android): amend hasActivityTransitions() for transitions (#…
Browse files Browse the repository at this point in the history
…10589)"

This reverts commit 6fe04f8.
  • Loading branch information
sgtcoolguy committed Apr 5, 2019
1 parent 1bc07c0 commit d1f8404
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,37 +135,21 @@ public void close(@Kroll.argument(optional = true) Object arg)
}

@Override
protected void handleOpen(final KrollDict options)
protected void handleOpen(KrollDict options)
{
Activity topActivity = TiApplication.getAppCurrentActivity();
// Don't open if app is closing or closed
if (topActivity == null || topActivity.isFinishing()) {
return;
}

// for transitions, wait for root activity to be resumed
final boolean animated = TiConvert.toBoolean(options, TiC.PROPERTY_ANIMATED, true);
if (animated && topActivity instanceof TiBaseActivity) {
final TiBaseActivity baseActivity = (TiBaseActivity) topActivity;
if (!baseActivity.isResumed) {
getMainHandler().postDelayed(new Runnable() {
@Override
public void run()
{
handleOpen(options);
}
}, Build.VERSION.SDK_INT > Build.VERSION_CODES.M ? 1 : 100);
return;
}
}

Intent intent = new Intent(topActivity, TiActivity.class);
fillIntent(topActivity, intent);

int windowId = TiActivityWindows.addWindow(this);
intent.putExtra(TiC.INTENT_PROPERTY_USE_ACTIVITY_WINDOW, true);
intent.putExtra(TiC.INTENT_PROPERTY_WINDOW_ID, windowId);

boolean animated = TiConvert.toBoolean(options, TiC.PROPERTY_ANIMATED, true);
if (!animated) {
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
topActivity.startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
Expand Down Expand Up @@ -641,18 +640,15 @@ public void setNavigationWindow(TiWindowProxy navigationWindow)
@Nullable
protected Bundle createActivityOptionsBundle(Activity activity)
{
ActivityOptionsCompat options = null;
if (hasActivityTransitions()) {
if (!sharedElementPairs.isEmpty()) {
options = ActivityOptionsCompat.makeSceneTransitionAnimation(
activity, sharedElementPairs.toArray(new Pair[sharedElementPairs.size()]));
} else {
options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity);
}
Bundle b = ActivityOptions
.makeSceneTransitionAnimation(
activity, sharedElementPairs.toArray(new Pair[sharedElementPairs.size()]))
.toBundle();
return b;
} else {
options = ActivityOptionsCompat.makeBasic();
return null;
}
return options.toBundle();
}

/**
Expand All @@ -661,6 +657,6 @@ protected Bundle createActivityOptionsBundle(Activity activity)
protected boolean hasActivityTransitions()
{
final boolean animated = TiConvert.toBoolean(getProperties(), TiC.PROPERTY_ANIMATED, true);
return LOLLIPOP_OR_GREATER && animated;
return (LOLLIPOP_OR_GREATER && animated && sharedElementPairs != null && !sharedElementPairs.isEmpty());
}
}

0 comments on commit d1f8404

Please sign in to comment.