Skip to content

Commit

Permalink
fix(android): amend hasActivityTransitions() for transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Apr 8, 2019
1 parent ded78d1 commit ec8d399
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ protected void handleOpen(KrollDict options)
if (topActivity == null || topActivity.isFinishing()) {
return;
}

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

Expand Down
33 changes: 33 additions & 0 deletions android/modules/yahoo/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>titanium-yahoo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
}

@Override
protected void windowCreated(Bundle savedInstanceState)
public boolean isJSActivity()
{
super.windowCreated(savedInstanceState);
loadScript();
return false;
}

public boolean isJSActivity()
@Override
protected void onResume()
{
return false;
super.onResume();
loadScript();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
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 @@ -640,15 +641,18 @@ public void setNavigationWindow(TiWindowProxy navigationWindow)
@Nullable
protected Bundle createActivityOptionsBundle(Activity activity)
{
ActivityOptionsCompat options = null;
if (hasActivityTransitions()) {
Bundle b = ActivityOptions
.makeSceneTransitionAnimation(
activity, sharedElementPairs.toArray(new Pair[sharedElementPairs.size()]))
.toBundle();
return b;
if (!sharedElementPairs.isEmpty()) {
options = ActivityOptionsCompat.makeSceneTransitionAnimation(
activity, sharedElementPairs.toArray(new Pair[sharedElementPairs.size()]));
} else {
options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity);
}
} else {
return null;
options = ActivityOptionsCompat.makeBasic();
}
return options.toBundle();
}

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

0 comments on commit ec8d399

Please sign in to comment.