summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2010-02-09 19:08:36 -0800
committerGilles Debunne <debunne@google.com>2010-02-12 15:57:12 -0800
commitf5c6eff63d19a9f7a970a4f90619edac873c006d (patch)
tree0cb11840311e11da2703fe91d6fbec50c5498917 /core/java/android/widget
parenta10b48d5a584253cdea4ceea7d5307a3f240dc4a (diff)
downloadframeworks_base-f5c6eff63d19a9f7a970a4f90619edac873c006d.zip
frameworks_base-f5c6eff63d19a9f7a970a4f90619edac873c006d.tar.gz
frameworks_base-f5c6eff63d19a9f7a970a4f90619edac873c006d.tar.bz2
Force layout on TableRows when column widths are shrinked or streched.
Also features some comment typos and import re-ordering. Change-Id: I32cb14419d7d349064032718469daf62a0a72e3a
Diffstat (limited to 'core/java/android/widget')
-rw-r--r--core/java/android/widget/EditText.java8
-rw-r--r--core/java/android/widget/LinearLayout.java20
-rw-r--r--core/java/android/widget/TableLayout.java10
-rw-r--r--core/java/android/widget/TableRow.java2
4 files changed, 28 insertions, 12 deletions
diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java
index 57aca24..1532db1 100644
--- a/core/java/android/widget/EditText.java
+++ b/core/java/android/widget/EditText.java
@@ -16,9 +16,13 @@
package android.widget;
-import android.text.*;
-import android.text.method.*;
import android.content.Context;
+import android.text.Editable;
+import android.text.Selection;
+import android.text.Spannable;
+import android.text.TextUtils;
+import android.text.method.ArrowKeyMovementMethod;
+import android.text.method.MovementMethod;
import android.util.AttributeSet;
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index ea5841a..9fcb829 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -16,6 +16,8 @@
package android.widget;
+import com.android.internal.R;
+
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
@@ -25,8 +27,6 @@ import android.view.ViewDebug;
import android.view.ViewGroup;
import android.widget.RemoteViews.RemoteView;
-import com.android.internal.R;
-
/**
* A Layout that arranges its children in a single column or a single row. The direction of
@@ -366,14 +366,15 @@ public class LinearLayout extends ViewGroup {
int oldHeight = Integer.MIN_VALUE;
if (lp.height == 0 && lp.weight > 0) {
- // heightMode is either UNSPECIFIED OR AT_MOST, and this child
- // wanted to stretch to fill available space. Translate that to
- // WRAP_CONTENT so that it does not end up with a height of 0
- oldHeight = 0;
- lp.height = LayoutParams.WRAP_CONTENT;
+ // heightMode is either UNSPECIFIED or AT_MOST, and this
+ // child wanted to stretch to fill available space.
+ // Translate that to WRAP_CONTENT so that it does not end up
+ // with a height of 0
+ oldHeight = 0;
+ lp.height = LayoutParams.WRAP_CONTENT;
}
- // Determine how big this child would like to. If this or
+ // Determine how big this child would like to be. If this or
// previous children have given a weight, then we allow it to
// use all available space (and we will shrink things later
// if needed).
@@ -673,7 +674,8 @@ public class LinearLayout extends ViewGroup {
int oldWidth = Integer.MIN_VALUE;
if (lp.width == 0 && lp.weight > 0) {
- // widthMode is either UNSPECIFIED OR AT_MOST, and this child
+ // widthMode is either UNSPECIFIED or AT_MOST, and this
+ // child
// wanted to stretch to fill available space. Translate that to
// WRAP_CONTENT so that it does not end up with a width of 0
oldWidth = 0;
diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java
index 66500a3..73760ac 100644
--- a/core/java/android/widget/TableLayout.java
+++ b/core/java/android/widget/TableLayout.java
@@ -575,6 +575,16 @@ public class TableLayout extends LinearLayout {
final int totalExtraSpace = size - totalWidth;
int extraSpace = totalExtraSpace / count;
+ // Column's widths are changed: force child table rows to re-measure.
+ // (done by super.measureVertical after shrinkAndStretchColumns.)
+ final int nbChildren = getChildCount();
+ for (int i = 0; i < nbChildren; i++) {
+ View child = getChildAt(i);
+ if (child instanceof TableRow) {
+ child.forceLayout();
+ }
+ }
+
if (!allColumns) {
for (int i = 0; i < count; i++) {
int column = columns.keyAt(i);
diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java
index abf08bf..48d12df 100644
--- a/core/java/android/widget/TableRow.java
+++ b/core/java/android/widget/TableRow.java
@@ -22,8 +22,8 @@ import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.Gravity;
import android.view.View;
-import android.view.ViewGroup;
import android.view.ViewDebug;
+import android.view.ViewGroup;
/**