diff options
author | Adam Powell <adamp@google.com> | 2011-06-14 13:37:14 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2011-06-16 18:20:54 -0700 |
commit | a93347a62ec9887862abb9d6f216906c533a8562 (patch) | |
tree | ee9cf28e93786d4ff4cc393bedc378904500bb4b /core/java | |
parent | 46d6bcfb95525132fcfb4ec15aae0af4ec7475c5 (diff) | |
download | frameworks_base-a93347a62ec9887862abb9d6f216906c533a8562.zip frameworks_base-a93347a62ec9887862abb9d6f216906c533a8562.tar.gz frameworks_base-a93347a62ec9887862abb9d6f216906c533a8562.tar.bz2 |
Dialog-o-rama!
New styling for Holo dialogs. Now 76% easier for apps to create
dialog-based layouts! (Less tricky padding and margin rules)
Cancelable AlertDialogs now are canceled when the user touches
outside.
Dialogs in landscape mode will try not to fill the width of the
screen.
Change-Id: I621b5a19780883ee703a8492510451b480a0b8cc
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/AlertDialog.java | 2 | ||||
-rw-r--r-- | core/java/com/android/internal/app/AlertController.java | 8 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/DialogTitle.java | 10 |
3 files changed, 14 insertions, 6 deletions
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java index e83d104..7a465c1 100644 --- a/core/java/android/app/AlertDialog.java +++ b/core/java/android/app/AlertDialog.java @@ -890,7 +890,7 @@ public class AlertDialog extends Dialog implements DialogInterface { public AlertDialog create() { final AlertDialog dialog = new AlertDialog(P.mContext, mTheme, false); P.apply(dialog.mAlert); - dialog.setCancelable(P.mCancelable); + dialog.setCanceledOnTouchOutside(P.mCancelable); dialog.setOnCancelListener(P.mOnCancelListener); if (P.mOnKeyListener != null) { dialog.setOnKeyListener(P.mOnKeyListener); diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java index 71a7a52..8d6caa1 100644 --- a/core/java/com/android/internal/app/AlertController.java +++ b/core/java/com/android/internal/app/AlertController.java @@ -575,9 +575,13 @@ public class AlertController { params.weight = 0.5f; button.setLayoutParams(params); View leftSpacer = mWindow.findViewById(R.id.leftSpacer); - leftSpacer.setVisibility(View.VISIBLE); + if (leftSpacer != null) { + leftSpacer.setVisibility(View.VISIBLE); + } View rightSpacer = mWindow.findViewById(R.id.rightSpacer); - rightSpacer.setVisibility(View.VISIBLE); + if (rightSpacer != null) { + rightSpacer.setVisibility(View.VISIBLE); + } } private void setBackground(LinearLayout topPanel, LinearLayout contentPanel, diff --git a/core/java/com/android/internal/widget/DialogTitle.java b/core/java/com/android/internal/widget/DialogTitle.java index 125d2c5..cd165dc 100644 --- a/core/java/com/android/internal/widget/DialogTitle.java +++ b/core/java/com/android/internal/widget/DialogTitle.java @@ -54,15 +54,19 @@ public class DialogTitle extends TextView { if (ellipsisCount > 0) { setSingleLine(false); - TypedArray a = mContext.obtainStyledAttributes( - android.R.style.TextAppearance_Medium, - android.R.styleable.TextAppearance); + TypedArray a = mContext.obtainStyledAttributes(null, + android.R.styleable.TextAppearance, + android.R.attr.textAppearanceMedium, + android.R.style.TextAppearance_Medium); final int textSize = a.getDimensionPixelSize( android.R.styleable.TextAppearance_textSize, (int) (20 * getResources().getDisplayMetrics().density)); + final int textColor = a.getColor( + android.R.styleable.TextAppearance_textColor, 0xffffffff); // textSize is already expressed in pixels setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); + setTextColor(textColor); setMaxLines(2); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } |