Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25206] Fix TiApplication activity type #9371

Merged
merged 3 commits into from
Aug 30, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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