summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-09-09 16:22:34 -0700
committerAdam Powell <adamp@google.com>2011-09-09 17:40:06 -0700
commitba3c377ba428bcf1c9b5a5cdf697fec0ed4fade7 (patch)
tree5c93f7432be7c464f983f93ca1bff8869a209998 /core/java
parent0e23c2efb03c8eac7e2bcd6aad61cfc4b15340fc (diff)
Fix metrics on Holo progress dialogs
Change-Id: I8818d002dcee0ca6d6deead9e0403c07e8ef4460
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ProgressDialog.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/java/android/app/ProgressDialog.java b/core/java/android/app/ProgressDialog.java
index f1a04f85f232..7f1f3850a397 100644
--- a/core/java/android/app/ProgressDialog.java
+++ b/core/java/android/app/ProgressDialog.java
@@ -16,7 +16,10 @@
package android.app;
+import com.android.internal.R;
+
import android.content.Context;
+import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
@@ -29,8 +32,6 @@ import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.internal.R;
-
import java.text.NumberFormat;
/**
@@ -119,6 +120,9 @@ public class ProgressDialog extends AlertDialog {
@Override
protected void onCreate(Bundle savedInstanceState) {
LayoutInflater inflater = LayoutInflater.from(mContext);
+ TypedArray a = mContext.obtainStyledAttributes(null,
+ com.android.internal.R.styleable.AlertDialog,
+ com.android.internal.R.attr.alertDialogStyle, 0);
if (mProgressStyle == STYLE_HORIZONTAL) {
/* Use a separate handler to update the text views as they
@@ -149,17 +153,22 @@ public class ProgressDialog extends AlertDialog {
}
}
};
- View view = inflater.inflate(R.layout.alert_dialog_progress, null);
+ View view = inflater.inflate(a.getResourceId(
+ com.android.internal.R.styleable.AlertDialog_horizontalProgressLayout,
+ R.layout.alert_dialog_progress), null);
mProgress = (ProgressBar) view.findViewById(R.id.progress);
mProgressNumber = (TextView) view.findViewById(R.id.progress_number);
mProgressPercent = (TextView) view.findViewById(R.id.progress_percent);
setView(view);
} else {
- View view = inflater.inflate(R.layout.progress_dialog, null);
+ View view = inflater.inflate(a.getResourceId(
+ com.android.internal.R.styleable.AlertDialog_progressLayout,
+ R.layout.progress_dialog), null);
mProgress = (ProgressBar) view.findViewById(R.id.progress);
mMessageView = (TextView) view.findViewById(R.id.message);
setView(view);
}
+ a.recycle();
if (mMax > 0) {
setMax(mMax);
}