diff options
| author | Grace Kloba <klobag@google.com> | 2010-04-20 11:07:50 -0700 |
|---|---|---|
| committer | Grace Kloba <klobag@google.com> | 2010-04-20 11:07:50 -0700 |
| commit | 50c241e6339c681c2427a57a31a357d35927c2ac (patch) | |
| tree | f2747ec120a5fa04958f1cca42502e7d6668722d /src/com/android/browser/GeolocationPermissionsPrompt.java | |
| parent | 8588d15a7c0b87049469fd80f9c53eb274cd837b (diff) | |
| download | packages_apps_Browser-50c241e6339c681c2427a57a31a357d35927c2ac.tar.gz packages_apps_Browser-50c241e6339c681c2427a57a31a357d35927c2ac.tar.bz2 packages_apps_Browser-50c241e6339c681c2427a57a31a357d35927c2ac.zip | |
Using ViewStub to defer the inflation of GeolocationPermissionsPrompt until we first show it.
This should shave 5% of Browser start up time.
Fix http://b/issue?id=2604295
Diffstat (limited to 'src/com/android/browser/GeolocationPermissionsPrompt.java')
| -rwxr-xr-x | src/com/android/browser/GeolocationPermissionsPrompt.java | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/com/android/browser/GeolocationPermissionsPrompt.java b/src/com/android/browser/GeolocationPermissionsPrompt.java index 982aa89e9..95c541543 100755 --- a/src/com/android/browser/GeolocationPermissionsPrompt.java +++ b/src/com/android/browser/GeolocationPermissionsPrompt.java @@ -46,15 +46,26 @@ public class GeolocationPermissionsPrompt extends LinearLayout { public GeolocationPermissionsPrompt(Context context, AttributeSet attrs) { super(context, attrs); - LayoutInflater factory = LayoutInflater.from(context); - factory.inflate(R.layout.geolocation_permissions_prompt, this); + } + void init() { mInner = (LinearLayout) findViewById(R.id.inner); mMessage = (TextView) findViewById(R.id.message); mShareButton = (Button) findViewById(R.id.share_button); mDontShareButton = (Button) findViewById(R.id.dont_share_button); mRemember = (CheckBox) findViewById(R.id.remember); - setButtonClickListeners(); + + final GeolocationPermissionsPrompt me = this; + mShareButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + me.handleButtonClick(true); + } + }); + mDontShareButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + me.handleButtonClick(false); + } + }); } /** @@ -79,23 +90,6 @@ public class GeolocationPermissionsPrompt extends LinearLayout { } /** - * Sets the on click listeners for the buttons. - */ - private void setButtonClickListeners() { - final GeolocationPermissionsPrompt me = this; - mShareButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - me.handleButtonClick(true); - } - }); - mDontShareButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - me.handleButtonClick(false); - } - }); - } - - /** * Handles a click on one the buttons by invoking the callback. */ private void handleButtonClick(boolean allow) { |
