Skip to content

Commit

Permalink
[TIMOB-20037] Fix TiApplication activity type
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Aug 30, 2017
1 parent 240ea7e commit 18c2cf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public RProxy getR() {

@Kroll.method @Kroll.getProperty
public ActivityProxy getCurrentActivity() {
TiBaseActivity resultBaseActivity = TiApplication.getAppCurrentActivity();
TiBaseActivity resultBaseActivity = (TiBaseActivity) TiApplication.getAppCurrentActivity();
if (resultBaseActivity != null) {
return resultBaseActivity.getActivityProxy();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public abstract class TiApplication extends Application implements KrollApplicat

public static AtomicBoolean isActivityTransition = new AtomicBoolean(false);
protected static ArrayList<ActivityTransitionListener> activityTransitionListeners = new ArrayList<ActivityTransitionListener>();
protected static TiWeakList<TiBaseActivity> activityStack = new TiWeakList<TiBaseActivity>();
protected static TiWeakList<Activity> activityStack = new TiWeakList<Activity>();

public static interface ActivityTransitionListener
{
Expand Down Expand Up @@ -172,9 +172,9 @@ public static TiApplication getInstance()
return null;
}

public static void addToActivityStack(TiBaseActivity activity)
public static void addToActivityStack(Activity activity)
{
activityStack.add(new WeakReference<TiBaseActivity>(activity));
activityStack.add(new WeakReference<Activity>(activity));
}

public static void removeFromActivityStack(Activity activity)
Expand All @@ -190,7 +190,7 @@ public static void terminateActivityStack()
return;
}

WeakReference<TiBaseActivity> activityRef;
WeakReference<Activity> activityRef;
Activity currentActivity;

for (int i = activityStack.size() - 1; i >= 0; i--) {
Expand All @@ -214,7 +214,7 @@ public boolean activityStackHasLaunchActivity()
if (activityStack == null || activityStack.size() == 0) {
return false;
}
for (WeakReference<TiBaseActivity> activityRef : activityStack) {
for (WeakReference<Activity> activityRef : activityStack) {
if (activityRef != null && activityRef.get() instanceof TiLaunchActivity) {
return true;
}
Expand Down Expand Up @@ -242,7 +242,7 @@ public static boolean isCurrentActivityInForeground()
* @return the current activity
* @module.api
*/
public static TiBaseActivity getAppCurrentActivity()
public static Activity getAppCurrentActivity()
{
TiApplication tiApp = getInstance();
if (tiApp == null) {
Expand Down Expand Up @@ -272,12 +272,12 @@ public static Activity getAppRootOrCurrentActivity()
* @return the current activity if exists. Otherwise, the thread will wait for a valid activity to be visible.
* @module.api
*/
public TiBaseActivity getCurrentActivity()
public Activity getCurrentActivity()
{
int activityStackSize;

while ((activityStackSize = activityStack.size()) > 0) {
TiBaseActivity activity = (activityStack.get(activityStackSize - 1)).get();
Activity activity = (activityStack.get(activityStackSize - 1)).get();

// Skip and remove any activities which are dead or in the process of finishing.
if (activity == null || activity.isFinishing()) {
Expand Down

0 comments on commit 18c2cf1

Please sign in to comment.