summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActionBar.java6
-rw-r--r--core/java/android/app/ActivityGroup.java5
-rw-r--r--core/java/android/app/AlertDialog.java2
-rw-r--r--core/java/android/app/LocalActivityManager.java7
-rw-r--r--core/java/android/app/Notification.java10
-rw-r--r--core/java/android/app/TabActivity.java28
-rw-r--r--core/java/android/hardware/Camera.java4
-rw-r--r--core/java/android/os/INetworkManagementService.aidl5
-rw-r--r--core/java/android/provider/CalendarContract.java6
-rw-r--r--core/java/android/provider/ContactsContract.java3
-rw-r--r--core/java/android/view/View.java4
-rw-r--r--core/java/android/webkit/WebSettings.java54
-rw-r--r--core/java/android/widget/GridLayout.java131
-rw-r--r--core/java/com/android/internal/app/AlertController.java8
-rw-r--r--core/java/com/android/internal/view/menu/ListMenuPresenter.java4
-rw-r--r--core/java/com/android/internal/widget/DialogTitle.java10
16 files changed, 211 insertions, 76 deletions
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index cac06ec..3ec5edb 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -487,6 +487,12 @@ public abstract class ActionBar {
* Create and return a new {@link Tab}.
* This tab will not be included in the action bar until it is added.
*
+ * <p>Very often tabs will be used to switch between {@link Fragment}
+ * objects. Here is a typical implementation of such tabs:</p>
+ *
+ * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java
+ * complete}
+ *
* @return A new Tab
*
* @see #addTab(Tab)
diff --git a/core/java/android/app/ActivityGroup.java b/core/java/android/app/ActivityGroup.java
index 5b04253..fbd78be 100644
--- a/core/java/android/app/ActivityGroup.java
+++ b/core/java/android/app/ActivityGroup.java
@@ -23,8 +23,13 @@ import android.os.Bundle;
import android.util.Log;
/**
+ * @deprecated Use the new {@link Fragment} and {@link FragmentManager} APIs
+ * instead; these are also
+ * available on older platforms through the Android compatibility package.
+ *
* A screen that contains and runs multiple embedded activities.
*/
+@Deprecated
public class ActivityGroup extends Activity {
private static final String TAG = "ActivityGroup";
private static final String STATES_KEY = "android:states";
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/android/app/LocalActivityManager.java b/core/java/android/app/LocalActivityManager.java
index c958e1b..0a6b804 100644
--- a/core/java/android/app/LocalActivityManager.java
+++ b/core/java/android/app/LocalActivityManager.java
@@ -28,12 +28,17 @@ import java.util.HashMap;
import java.util.Map;
/**
- * Helper class for managing multiple running embedded activities in the same
+ * @deprecated Use the new {@link Fragment} and {@link FragmentManager} APIs
+ * instead; these are also
+ * available on older platforms through the Android compatibility package.
+ *
+ * <p>Helper class for managing multiple running embedded activities in the same
* process. This class is not normally used directly, but rather created for
* you as part of the {@link android.app.ActivityGroup} implementation.
*
* @see ActivityGroup
*/
+@Deprecated
public class LocalActivityManager {
private static final String TAG = "LocalActivityManager";
private static final boolean localLOGV = false;
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index c9351af..170d2b5 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -929,15 +929,15 @@ public class Notification implements Parcelable
if (mContentInfo != null) {
contentView.setTextViewText(R.id.info, mContentInfo);
} else if (mNumber > 0) {
- if (mNumber > 999) {
- contentView.setTextViewText(R.id.info, "999+");
+ final int tooBig = mContext.getResources().getInteger(
+ R.integer.status_bar_notification_info_maxnum);
+ if (mNumber > tooBig) {
+ contentView.setTextViewText(R.id.info, mContext.getResources().getString(
+ R.string.status_bar_notification_info_overflow));
} else {
NumberFormat f = NumberFormat.getIntegerInstance();
contentView.setTextViewText(R.id.info, f.format(mNumber));
}
- contentView.setFloat(R.id.info, "setTextSize",
- mContext.getResources().getDimensionPixelSize(
- R.dimen.status_bar_content_number_size));
} else {
contentView.setViewVisibility(R.id.info, View.GONE);
}
diff --git a/core/java/android/app/TabActivity.java b/core/java/android/app/TabActivity.java
index 033fa0c..0fd0c2c 100644
--- a/core/java/android/app/TabActivity.java
+++ b/core/java/android/app/TabActivity.java
@@ -23,8 +23,34 @@ import android.widget.TabWidget;
import android.widget.TextView;
/**
- * An activity that contains and runs multiple embedded activities or views.
+ * @deprecated New applications should use Fragments instead of this class;
+ * to continue to run on older devices, you can use the v4 support library
+ * which provides a version of the Fragment API that is compatible down to
+ * {@link android.os.Build.VERSION_CODES#DONUT}.
+ *
+ * <p>For apps developing against {@link android.os.Build.VERSION_CODES#HONEYCOMB}
+ * or later, tabs are typically presented in the UI using the new
+ * {@link ActionBar#newTab() ActionBar.newTab()} and
+ * related APIs for placing tabs within their action bar area.</p>
+ *
+ * <p>A replacement for TabActivity can also be implemented by directly using
+ * TabHost. You will need to define a layout that correctly uses a TabHost
+ * with a TabWidget as well as an area in which to display your tab content.
+ * A typical example would be:</p>
+ *
+ * {@sample development/samples/Support4Demos/res/layout/fragment_tabs.xml complete}
+ *
+ * <p>The implementation needs to take over responsibility for switching
+ * the shown content when the user switches between tabs.
+ *
+ * {@sample development/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.java
+ * complete}
+ *
+ * <p>Also see the <a href="{@docRoot}resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabsPager.html">
+ * Fragment Tabs Pager</a> sample for an example of using the support library's ViewPager to
+ * allow the user to swipe the content to switch between tabs.</p>
*/
+@Deprecated
public class TabActivity extends ActivityGroup {
private TabHost mTabHost;
private String mDefaultTab = null;
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 1df3108..338e6c8 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -216,7 +216,9 @@ public class Camera {
* {@link #getNumberOfCameras()}-1.
* @return a new Camera object, connected, locked and ready for use.
* @throws RuntimeException if connection to the camera service fails (for
- * example, if the camera is in use by another process).
+ * example, if the camera is in use by another process or device policy
+ * manager has disabled the camera).
+ * @see android.app.admin.DevicePolicyManager#getCameraDisabled(android.content.ComponentName)
*/
public static Camera open(int cameraId) {
return new Camera(cameraId);
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index f17a6f2..b97ec19 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -59,6 +59,11 @@ interface INetworkManagementService
void setInterfaceConfig(String iface, in InterfaceConfiguration cfg);
/**
+ * Clear all IP addresses on the specified interface
+ */
+ void clearInterfaceAddresses(String iface);
+
+ /**
* Retrieves the network routes currently configured on the specified
* interface
*/
diff --git a/core/java/android/provider/CalendarContract.java b/core/java/android/provider/CalendarContract.java
index 1a24716..17b1031 100644
--- a/core/java/android/provider/CalendarContract.java
+++ b/core/java/android/provider/CalendarContract.java
@@ -1748,8 +1748,10 @@ public final class CalendarContract {
/**
* A few Calendar globals are needed in the CalendarProvider for expanding
- * the Instances table and these are all stored in the first (and only)
- * row of the CalendarMetaData table.
+ * the Instances table and these are all stored in the first (and only) row
+ * of the CalendarMetaData table.
+ *
+ * @hide
*/
protected interface CalendarMetaDataColumns {
/**
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 1816066..b5a11ab 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -163,14 +163,12 @@ public final class ContactsContract {
* obtaining possible recipients, letting the provider know which account is selected during
* the composition. The provider may use the "primary account" information to optimize
* the search result.
- * @hide
*/
public static final String PRIMARY_ACCOUNT_NAME = "name_for_primary_account";
/**
* A query parameter specifing a primary account. This parameter should be used with
* {@link #PRIMARY_ACCOUNT_NAME}. See the doc in {@link #PRIMARY_ACCOUNT_NAME}.
- * @hide
*/
public static final String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account";
@@ -6317,7 +6315,6 @@ public final class ContactsContract {
* boolean successful = resolver.update(uri, new ContentValues(), null, null) > 0;
* </pre>
* </p>
- * @hide
*/
public static final class DataUsageFeedback {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b0e651a..f2400d8 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8736,6 +8736,10 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
}
jumpDrawablesToCurrentState();
resolveLayoutDirection();
+ if (isFocused()) {
+ InputMethodManager imm = InputMethodManager.peekInstance();
+ imm.focusIn(this);
+ }
}
/**
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index c361a4a..761007f 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -59,6 +59,7 @@ public class WebSettings {
* NORMAL is 100%
* LARGER is 150%
* LARGEST is 200%
+ * @deprecated Use {@link WebSettings#setTextZoom(int)} and {@link WebSettings#getTextZoom()} instead.
*/
public enum TextSize {
SMALLEST(50),
@@ -158,7 +159,7 @@ public class WebSettings {
// know what they are.
private LayoutAlgorithm mLayoutAlgorithm = LayoutAlgorithm.NARROW_COLUMNS;
private Context mContext;
- private TextSize mTextSize = TextSize.NORMAL;
+ private int mTextSize = 100;
private String mStandardFontFamily = "sans-serif";
private String mFixedFontFamily = "monospace";
private String mSansSerifFontFamily = "sans-serif";
@@ -709,26 +710,61 @@ public class WebSettings {
}
/**
+ * Set the text zoom of the page in percent. Default is 100.
+ * @param textZoom A percent value for increasing or decreasing the text.
+ */
+ public synchronized void setTextZoom(int textZoom) {
+ if (mTextSize != textZoom) {
+ if (WebView.mLogEvent) {
+ EventLog.writeEvent(EventLogTags.BROWSER_TEXT_SIZE_CHANGE,
+ mTextSize, textZoom);
+ }
+ mTextSize = textZoom;
+ postSync();
+ }
+ }
+
+ /**
+ * Get the text zoom of the page in percent.
+ * @return A percent value describing the text zoom.
+ * @see setTextSizeZoom
+ */
+ public synchronized int getTextZoom() {
+ return mTextSize;
+ }
+
+ /**
* Set the text size of the page.
* @param t A TextSize value for increasing or decreasing the text.
* @see WebSettings.TextSize
+ * @deprecated Use {@link #setTextZoom(int)} instead
*/
public synchronized void setTextSize(TextSize t) {
- if (WebView.mLogEvent && mTextSize != t ) {
- EventLog.writeEvent(EventLogTags.BROWSER_TEXT_SIZE_CHANGE,
- mTextSize.value, t.value);
- }
- mTextSize = t;
- postSync();
+ setTextZoom(t.value);
}
/**
- * Get the text size of the page.
+ * Get the text size of the page. If the text size was previously specified
+ * in percent using {@link #setTextZoom(int)}, this will return
+ * the closest matching {@link TextSize}.
* @return A TextSize enum value describing the text size.
* @see WebSettings.TextSize
+ * @deprecated Use {@link #getTextZoom()} instead
*/
public synchronized TextSize getTextSize() {
- return mTextSize;
+ TextSize closestSize = null;
+ int smallestDelta = Integer.MAX_VALUE;
+ for (TextSize size : TextSize.values()) {
+ int delta = Math.abs(mTextSize - size.value);
+ if (delta == 0) {
+ return size;
+ }
+ if (delta < smallestDelta) {
+ smallestDelta = delta;
+ closestSize = size;
+ }
+ }
+ return closestSize != null ? closestSize : TextSize.NORMAL;
}
/**
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index 544bc6b..a15ca0c 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -135,11 +135,44 @@ public class GridLayout extends ViewGroup {
*/
public static final int UNDEFINED = Integer.MIN_VALUE;
+ /**
+ * This constant is an {@link #setAlignmentMode(int) alignmentMode}.
+ * When the {@code alignmentMode} is set to {@link #ALIGN_BOUNDS}, alignment
+ * is made between the edges of each component's raw
+ * view boundary: i.e. the area delimited by the component's:
+ * {@link android.view.View#getTop() top},
+ * {@link android.view.View#getLeft() left},
+ * {@link android.view.View#getBottom() bottom} and
+ * {@link android.view.View#getRight() right} properties.
+ * <p>
+ * For example, when {@code GridLayout} is in {@link #ALIGN_BOUNDS} mode,
+ * children that belong to a row group that uses {@link #TOP} alignment will
+ * all return the same value when their {@link android.view.View#getTop()}
+ * method is called.
+ *
+ * @see #setAlignmentMode(int)
+ */
+ public static final int ALIGN_BOUNDS = 0;
+
+ /**
+ * This constant is an {@link #setAlignmentMode(int) alignmentMode}.
+ * When the {@code alignmentMode} is set to {@link #ALIGN_MARGINS},
+ * the bounds of each view are extended outwards, according
+ * to their margins, before the edges of the resulting rectangle are aligned.
+ * <p>
+ * For example, when {@code GridLayout} is in {@link #ALIGN_MARGINS} mode,
+ * the quantity {@code top - layoutParams.topMargin} is the same for all children that
+ * belong to a row group that uses {@link #TOP} alignment.
+ *
+ * @see #setAlignmentMode(int)
+ */
+ public static final int ALIGN_MARGINS = 1;
+
// Misc constants
private static final String TAG = GridLayout.class.getName();
private static final boolean DEBUG = false;
- private static final Paint GRID_PAINT = new Paint();
+ private static Paint GRID_PAINT;
private static final double GOLDEN_RATIO = (1 + Math.sqrt(5)) / 2;
private static final int MIN = 0;
private static final int PRF = 1;
@@ -151,7 +184,7 @@ public class GridLayout extends ViewGroup {
private static final int DEFAULT_COUNT = UNDEFINED;
private static final boolean DEFAULT_USE_DEFAULT_MARGINS = false;
private static final boolean DEFAULT_ORDER_PRESERVED = false;
- private static final boolean DEFAULT_MARGINS_INCLUDED = true;
+ private static final int DEFAULT_ALIGNMENT_MODE = ALIGN_MARGINS;
// todo remove this
private static final int DEFAULT_CONTAINER_MARGIN = 20;
@@ -161,14 +194,17 @@ public class GridLayout extends ViewGroup {
private static final int ROW_COUNT = styleable.GridLayout_rowCount;
private static final int COLUMN_COUNT = styleable.GridLayout_columnCount;
private static final int USE_DEFAULT_MARGINS = styleable.GridLayout_useDefaultMargins;
- private static final int MARGINS_INCLUDED = styleable.GridLayout_marginsIncludedInAlignment;
+ private static final int ALIGNMENT_MODE = styleable.GridLayout_alignmentMode;
private static final int ROW_ORDER_PRESERVED = styleable.GridLayout_rowOrderPreserved;
private static final int COLUMN_ORDER_PRESERVED = styleable.GridLayout_columnOrderPreserved;
// Static initialization
static {
- GRID_PAINT.setColor(Color.argb(50, 255, 255, 255));
+ if (DEBUG) {
+ GRID_PAINT = new Paint();
+ GRID_PAINT.setColor(Color.argb(50, 255, 255, 255));
+ }
}
// Instance variables
@@ -178,7 +214,7 @@ public class GridLayout extends ViewGroup {
private boolean mLayoutParamsValid = false;
private int mOrientation = DEFAULT_ORIENTATION;
private boolean mUseDefaultMargins = DEFAULT_USE_DEFAULT_MARGINS;
- private boolean mMarginsIncludedInAlignment = DEFAULT_MARGINS_INCLUDED;
+ private int mAlignmentMode = DEFAULT_ALIGNMENT_MODE;
private int mDefaultGravity = Gravity.NO_GRAVITY;
/* package */ boolean accommodateBothMinAndMax = false;
@@ -189,10 +225,7 @@ public class GridLayout extends ViewGroup {
* {@inheritDoc}
*/
public GridLayout(Context context) {
- super(context);
- if (DEBUG) {
- setWillNotDraw(false);
- }
+ this(context, null, 0);
}
/**
@@ -200,6 +233,9 @@ public class GridLayout extends ViewGroup {
*/
public GridLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ if (DEBUG) {
+ setWillNotDraw(false);
+ }
processAttributes(context, attrs);
}
@@ -207,18 +243,17 @@ public class GridLayout extends ViewGroup {
* {@inheritDoc}
*/
public GridLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- processAttributes(context, attrs);
+ this(context, attrs, 0);
}
private void processAttributes(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, styleable.GridLayout);
try {
- setRowCount(a.getInteger(ROW_COUNT, DEFAULT_COUNT));
- setColumnCount(a.getInteger(COLUMN_COUNT, DEFAULT_COUNT));
- mOrientation = a.getInteger(ORIENTATION, DEFAULT_ORIENTATION);
+ setRowCount(a.getInt(ROW_COUNT, DEFAULT_COUNT));
+ setColumnCount(a.getInt(COLUMN_COUNT, DEFAULT_COUNT));
+ mOrientation = a.getInt(ORIENTATION, DEFAULT_ORIENTATION);
mUseDefaultMargins = a.getBoolean(USE_DEFAULT_MARGINS, DEFAULT_USE_DEFAULT_MARGINS);
- mMarginsIncludedInAlignment = a.getBoolean(MARGINS_INCLUDED, DEFAULT_MARGINS_INCLUDED);
+ mAlignmentMode = a.getInt(ALIGNMENT_MODE, DEFAULT_ALIGNMENT_MODE);
setRowOrderPreserved(a.getBoolean(ROW_ORDER_PRESERVED, DEFAULT_ORDER_PRESERVED));
setColumnOrderPreserved(a.getBoolean(COLUMN_ORDER_PRESERVED, DEFAULT_ORDER_PRESERVED));
} finally {
@@ -348,15 +383,15 @@ public class GridLayout extends ViewGroup {
* When {@code false}, the default value of all margins is zero.
* <p>
* When setting to {@code true}, consider setting the value of the
- * {@link #setMarginsIncludedInAlignment(boolean) marginsIncludedInAlignment}
- * property to {@code false}.
+ * {@link #setAlignmentMode(int) alignmentMode}
+ * property to {@link #ALIGN_BOUNDS}.
* <p>
* The default value of this property is {@code false}.
*
* @param useDefaultMargins use {@code true} to make GridLayout allocate default margins
*
* @see #getUseDefaultMargins()
- * @see #setMarginsIncludedInAlignment(boolean)
+ * @see #setAlignmentMode(int)
*
* @see MarginLayoutParams#leftMargin
* @see MarginLayoutParams#topMargin
@@ -371,36 +406,38 @@ public class GridLayout extends ViewGroup {
}
/**
- * Returns whether GridLayout aligns the edges of the view or the edges
- * of the larger rectangle created by extending the view by its associated
- * margins.
+ * Returns the alignment mode.
*
- * @see #setMarginsIncludedInAlignment(boolean)
+ * @return the alignment mode; either {@link #ALIGN_BOUNDS} or {@link #ALIGN_MARGINS}
*
- * @return {@code true} if alignment is between edges including margins
+ * @see #ALIGN_BOUNDS
+ * @see #ALIGN_MARGINS
*
- * @attr ref android.R.styleable#GridLayout_marginsIncludedInAlignment
+ * @see #setAlignmentMode(int)
+ *
+ * @attr ref android.R.styleable#GridLayout_alignmentMode
*/
- public boolean getMarginsIncludedInAlignment() {
- return mMarginsIncludedInAlignment;
+ public int getAlignmentMode() {
+ return mAlignmentMode;
}
/**
- * When {@code true}, the bounds of a view are extended outwards according to its
- * margins before the edges of the resulting rectangle are aligned.
- * When {@code false}, alignment occurs between the bounds of the view - i.e.
- * {@link #LEFT} alignment means align the left edges of the view.
+ * Sets the alignment mode to be used for all of the alignments between the
+ * children of this container.
* <p>
- * The default value of this property is {@code true}.
+ * The default value of this property is {@link #ALIGN_MARGINS}.
+ *
+ * @param alignmentMode either {@link #ALIGN_BOUNDS} or {@link #ALIGN_MARGINS}
*
- * @param marginsIncludedInAlignment {@code true} if alignment between edges includes margins
+ * @see #ALIGN_BOUNDS
+ * @see #ALIGN_MARGINS
*
- * @see #getMarginsIncludedInAlignment()
+ * @see #getAlignmentMode()
*
- * @attr ref android.R.styleable#GridLayout_marginsIncludedInAlignment
+ * @attr ref android.R.styleable#GridLayout_alignmentMode
*/
- public void setMarginsIncludedInAlignment(boolean marginsIncludedInAlignment) {
- mMarginsIncludedInAlignment = marginsIncludedInAlignment;
+ public void setAlignmentMode(int alignmentMode) {
+ mAlignmentMode = alignmentMode;
requestLayout();
}
@@ -782,7 +819,7 @@ public class GridLayout extends ViewGroup {
private int getMeasurementIncludingMargin(View c, boolean horizontal, int measurementType) {
int result = getMeasurement(c, horizontal, measurementType);
- if (mMarginsIncludedInAlignment) {
+ if (mAlignmentMode == ALIGN_MARGINS) {
int leadingMargin = getMargin(c, true, horizontal);
int trailingMargin = getMargin(c, false, horizontal);
return result + leadingMargin + trailingMargin;
@@ -857,7 +894,7 @@ public class GridLayout extends ViewGroup {
int c2ax = protect(hAlign.getAlignmentValue(null, cellWidth - colBounds.size(), type));
int c2ay = protect(vAlign.getAlignmentValue(null, cellHeight - rowBounds.size(), type));
- if (mMarginsIncludedInAlignment) {
+ if (mAlignmentMode == ALIGN_MARGINS) {
int leftMargin = getMargin(view, true, true);
int topMargin = getMargin(view, true, false);
int rightMargin = getMargin(view, false, true);
@@ -1359,7 +1396,7 @@ public class GridLayout extends ViewGroup {
private int getLocationIncludingMargin(View view, boolean leading, int index) {
int location = locations[index];
int margin;
- if (!mMarginsIncludedInAlignment) {
+ if (mAlignmentMode != ALIGN_MARGINS) {
margin = (leading ? leadingMargins : trailingMargins)[index];
} else {
margin = 0;
@@ -1371,7 +1408,7 @@ public class GridLayout extends ViewGroup {
Arrays.fill(a, MIN_VALUE);
a[0] = 0;
solve(getArcs(), a);
- if (!mMarginsIncludedInAlignment) {
+ if (mAlignmentMode != ALIGN_MARGINS) {
addMargins();
}
}
@@ -1752,16 +1789,16 @@ public class GridLayout extends ViewGroup {
private void init(Context context, AttributeSet attrs, int defaultGravity) {
TypedArray a = context.obtainStyledAttributes(attrs, styleable.GridLayout_Layout);
try {
- int gravity = a.getInteger(GRAVITY, defaultGravity);
+ int gravity = a.getInt(GRAVITY, defaultGravity);
- int column = a.getInteger(COLUMN, DEFAULT_COLUMN);
- int columnSpan = a.getInteger(COLUMN_SPAN, DEFAULT_SPAN_SIZE);
+ int column = a.getInt(COLUMN, DEFAULT_COLUMN);
+ int columnSpan = a.getInt(COLUMN_SPAN, DEFAULT_SPAN_SIZE);
Interval hSpan = new Interval(column, column + columnSpan);
this.columnGroup = new Group(hSpan, getColumnAlignment(gravity, width));
this.columnWeight = a.getFloat(COLUMN_WEIGHT, getDefaultWeight(width));
- int row = a.getInteger(ROW, DEFAULT_ROW);
- int rowSpan = a.getInteger(ROW_SPAN, DEFAULT_SPAN_SIZE);
+ int row = a.getInt(ROW, DEFAULT_ROW);
+ int rowSpan = a.getInt(ROW_SPAN, DEFAULT_SPAN_SIZE);
Interval vSpan = new Interval(row, row + rowSpan);
this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height));
this.rowWeight = a.getFloat(ROW_WEIGHT, getDefaultWeight(height));
@@ -2161,7 +2198,7 @@ public class GridLayout extends ViewGroup {
* An Alignment implementation must define {@link #getAlignmentValue(View, int, int)},
* to return the appropriate value for the type of alignment being defined.
* The enclosing algorithms position the children
- * so that the locations defined by the alignmnet values
+ * so that the locations defined by the alignment values
* are the same for all of the views in a group.
* <p>
* The GridLayout class defines the most common alignments used in general layout:
@@ -2287,4 +2324,4 @@ public class GridLayout extends ViewGroup {
return cellSize;
}
};
-} \ No newline at end of file
+}
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/view/menu/ListMenuPresenter.java b/core/java/com/android/internal/view/menu/ListMenuPresenter.java
index f8d24a3..cc09927 100644
--- a/core/java/com/android/internal/view/menu/ListMenuPresenter.java
+++ b/core/java/com/android/internal/view/menu/ListMenuPresenter.java
@@ -177,7 +177,9 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
public void restoreHierarchyState(Bundle inState) {
SparseArray<Parcelable> viewStates = inState.getSparseParcelableArray(VIEWS_TAG);
- ((View) mMenuView).restoreHierarchyState(viewStates);
+ if (viewStates != null) {
+ ((View) mMenuView).restoreHierarchyState(viewStates);
+ }
}
private class MenuAdapter extends BaseAdapter {
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);
}