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-14908: Android: Activity indicator changes from old style to holo theme style after second time onwards #4704

Merged
merged 2 commits into from
Sep 17, 2013
Merged
Changes from 1 commit
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 @@ -11,12 +11,14 @@
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.proxy.TiViewProxy;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiUIHelper;
import org.appcelerator.titanium.view.TiUIView;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
Expand All @@ -43,17 +45,28 @@ public TiUIActivityIndicator(TiViewProxy proxy)
super(proxy);
Log.d(TAG, "Creating an activity indicator", Log.DEBUG_MODE);

view = new LinearLayout(proxy.getActivity());
/*
* use getAppCurrentActivity over getActivity since technically the activity indicator
* should show up on top of the current activity when called - not just the
* activity it was created in
*/
Activity activity = TiApplication.getAppCurrentActivity();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the indicator is added to a window, so shouldn't it be on top of that window's activity? Unless there's a timing issue where the window's activity isn't set when indicator is added.


if (activity == null) {
Log.w(TAG, "Unable to create an activity indicator. Activity is null");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return here

}

view = new LinearLayout(activity);
view.setOrientation(LinearLayout.HORIZONTAL);
view.setGravity(Gravity.CENTER);

label = new TextView(proxy.getActivity());
label = new TextView(activity);
label.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
label.setPadding(0, 0, 0, 0);
label.setSingleLine(false);

currentStyle = getStyle();
progress = new ProgressBar(proxy.getActivity(), null, currentStyle);
progress = new ProgressBar(activity, null, currentStyle);

view.addView(progress);
view.addView(label);
Expand Down Expand Up @@ -148,7 +161,7 @@ protected void setStyle(int style)
}

view.removeAllViews();
progress = new ProgressBar(proxy.getActivity(), null, style);
progress = new ProgressBar(TiApplication.getAppCurrentActivity(), null, style);
currentStyle = style;
view.addView(progress);
view.addView(label);
Expand Down