OSDN Git Service

Deprecate fill_parent and introduce match_parent.
authorRomain Guy <romainguy@android.com>
Fri, 8 Jan 2010 23:07:24 +0000 (15:07 -0800)
committerRomain Guy <romainguy@android.com>
Fri, 8 Jan 2010 23:12:07 +0000 (15:12 -0800)
Bug: #2361749.

16 files changed:
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtils.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutConstants.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/mock_attrs.xml
layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java
layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule
layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule
layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule
layoutopt/samples/compound.xml
layoutopt/samples/has_children.xml
layoutopt/samples/inefficient_weight.xml
layoutopt/samples/scrolling.xml
layoutopt/samples/simple.xml
layoutopt/samples/too_deep.xml
layoutopt/samples/too_many.xml
layoutopt/samples/useless.xml
layoutopt/samples/wrong_dimension.xml

index 246113c..92793b5 100644 (file)
@@ -711,7 +711,7 @@ public final class DescriptorsUtils {
      * This does not override attributes which are not empty.
      */
     public static void setDefaultLayoutAttributes(UiElementNode ui_node, boolean updateLayout) {
-        // if this ui_node is a layout and we're adding it to a document, use fill_parent for
+        // if this ui_node is a layout and we're adding it to a document, use match_parent for
         // both W/H. Otherwise default to wrap_layout.
         boolean fill = ui_node.getDescriptor().hasChildren() &&
                        ui_node.getUiParent() instanceof UiDocumentNode;
index b36c985..5c9f778 100644 (file)
@@ -56,7 +56,7 @@ public class LayoutConstants {
     public static final String ATTR_LAYOUT_X = "layout_x";                      //$NON-NLS-1$
 
     public static final String VALUE_WRAP_CONTENT = "wrap_content";             //$NON-NLS-1$
-    public static final String VALUE_FILL_PARENT = "fill_parent";               //$NON-NLS-1$
+    public static final String VALUE_FILL_PARENT = "match_parent";               //$NON-NLS-1$
     public static final String VALUE_TRUE = "true";                             //$NON-NLS-1$
     public static final String VALUE_N_DIP = "%ddip";                           //$NON-NLS-1$
 
index aa9a1f7..db77e17 100644 (file)
              the special constants. -->
         <attr name="layout_width" format="dimension">
             <!-- The view should be as big as its parent (minus padding). -->
-            <enum name="fill_parent" value="-1" />
+            <enum name="match_parent" value="-1" />
             <!-- The view should be only big enough to enclose its content (plus padding). -->
             <enum name="wrap_content" value="-2" />
         </attr>
              the special constants. -->
         <attr name="layout_height" format="dimension">
             <!-- The view should be as big as its parent (minus padding). -->
-            <enum name="fill_parent" value="-1" />
+            <enum name="match_parent" value="-1" />
             <!-- The view should be only big enough to enclose its content (plus padding). -->
             <enum name="wrap_content" value="-2" />
         </attr>
index a70086d..508a277 100644 (file)
@@ -42,7 +42,7 @@ public class LayoutAnalysisCategory {
     private static final String ANDROID_PADDING_BOTTOM = "android:paddingBottom";
     private static final String ANDROID_LAYOUT_WIDTH = "android:layout_width";
     private static final String ANDROID_LAYOUT_HEIGHT = "android:layout_height";
-    private static final String VALUE_FILL_PARENT = "fill_parent";
+    private static final String VALUE_FILL_PARENT = "match_parent";
     private static final String VALUE_WRAP_CONTENT = "wrap_content";
     
     private static final String[] sContainers = new String[] {
@@ -118,7 +118,7 @@ public class LayoutAnalysisCategory {
     }
 
     /**
-     * Returns whether this node's width is fill_parent.
+     * Returns whether this node's width is match_parent.
      */
     public static boolean isWidthFillParent(Element element) {
         return element.getAttribute(ANDROID_LAYOUT_WIDTH).equals(VALUE_FILL_PARENT);
@@ -132,7 +132,7 @@ public class LayoutAnalysisCategory {
     }
 
     /**
-     * Returns whether this node's height is fill_parent.
+     * Returns whether this node's height is match_parent.
      */
     public static boolean isHeightFillParent(Element element) {
         return element.getAttribute(ANDROID_LAYOUT_HEIGHT).equals(VALUE_FILL_PARENT);
index d29ebd5..36d3c2e 100644 (file)
@@ -4,7 +4,7 @@
 //
 // Conditions:
 // - The node has a ScrollView parent
-// - The node has a height set to fill_parent
+// - The node has a height set to match_parent
 
 if (node.'..'.is("ScrollView") && node.isHeightFillParent()) {
     analysis << "This ${node.name()} tag should use android:layout_height=\"wrap_content\""
index 17da843..b96e034 100644 (file)
@@ -4,7 +4,7 @@
 //
 // Conditions:
 // - The node has a HorizontalScrollView parent
-// - The node has a width set to fill_parent
+// - The node has a width set to match_parent
 
 if (node.'..'.is("HorizontalScrollView") && node.isWidthFillParent()) {
     analysis << "This ${node.name()} tag should use android:layout_width=\"wrap_content\""
index d3fc3d9..c477155 100644 (file)
@@ -6,7 +6,7 @@
 // Conditions:
 // - The node is the root of the document
 // - The node is a FrameLayout
-// - The node is fill_parent in both orientation *or* it has no layout_gravity
+// - The node is match_parent in both orientation *or* it has no layout_gravity
 // - The node does not have a background nor a foreground
 // - The node does not have padding
 
index 176089b..f7b28ef 100644 (file)
@@ -3,8 +3,8 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <ImageView
         android:layout_width="wrap_content"
index f216db5..3e663b2 100644 (file)
@@ -3,11 +3,11 @@
 <ListView
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
        <ListView 
-           android:layout_width="fill_parent"
-           android:layout_height="fill_parent" />
+           android:layout_width="match_parent"
+           android:layout_height="match_parent" />
        
 </ListView>
\ No newline at end of file
index 785350a..81c8b71 100644 (file)
@@ -3,24 +3,24 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
        <Button 
-           android:layout_width="fill_parent"
+           android:layout_width="match_parent"
            android:layout_height="wrap_content"
                android:layout_weight="1.0" />
        
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
 
-           android:layout_width="fill_parent"
-           android:layout_height="fill_parent"
+           android:layout_width="match_parent"
+           android:layout_height="match_parent"
        
                android:orientation="vertical">
 
                <Button 
-                   android:layout_width="fill_parent"
+                   android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                        android:layout_weight="1.0" />
 
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
 
-           android:layout_width="fill_parent"
-           android:layout_height="fill_parent"
+           android:layout_width="match_parent"
+           android:layout_height="match_parent"
        
                android:orientation="vertical">
 
                <Button 
-                   android:layout_width="fill_parent"
+                   android:layout_width="match_parent"
                    android:layout_height="0dip"
                        android:layout_weight="1.0" />
 
index 534289c..9eb862f 100644 (file)
@@ -3,16 +3,16 @@
 <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
        <LinearLayout
-           android:layout_width="fill_parent"
-           android:layout_height="fill_parent">
+           android:layout_width="match_parent"
+           android:layout_height="match_parent">
 
                <ListView 
-                   android:layout_width="fill_parent"
-                   android:layout_height="fill_parent" />
+                   android:layout_width="match_parent"
+                   android:layout_height="match_parent" />
 
        </LinearLayout>
 
index 1fd36e2..d462c69 100644 (file)
@@ -3,5 +3,5 @@
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent" />
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" />
index 7317362..0c617b8 100644 (file)
@@ -3,8 +3,8 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <Button
         android:layout_width="wrap_content"
         android:text="Ok" />
         
     <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
         <LinearLayout
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent">
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
 
             <LinearLayout
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
 
                 <LinearLayout
-                    android:layout_width="fill_parent"
-                    android:layout_height="fill_parent">
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent">
 
                     <LinearLayout
-                        android:layout_width="fill_parent"
-                        android:layout_height="fill_parent">
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent">
 
                         <LinearLayout
-                            android:layout_width="fill_parent"
-                            android:layout_height="fill_parent">
+                            android:layout_width="match_parent"
+                            android:layout_height="match_parent">
 
                             <LinearLayout
-                                android:layout_width="fill_parent"
-                                android:layout_height="fill_parent">
+                                android:layout_width="match_parent"
+                                android:layout_height="match_parent">
 
                                 <LinearLayout
-                                    android:layout_width="fill_parent"
-                                    android:layout_height="fill_parent">
+                                    android:layout_width="match_parent"
+                                    android:layout_height="match_parent">
 
                                     <LinearLayout
-                                        android:layout_width="fill_parent"
-                                        android:layout_height="fill_parent">
+                                        android:layout_width="match_parent"
+                                        android:layout_height="match_parent">
 
                                         <LinearLayout
-                                            android:layout_width="fill_parent"
-                                            android:layout_height="fill_parent">
+                                            android:layout_width="match_parent"
+                                            android:layout_height="match_parent">
 
                                             <LinearLayout
-                                                android:layout_width="fill_parent"
-                                                android:layout_height="fill_parent">
+                                                android:layout_width="match_parent"
+                                                android:layout_height="match_parent">
 
                                                 <Button
                                                     android:layout_width="wrap_content"
index 41c18ff..2ea266d 100644 (file)
@@ -3,8 +3,8 @@
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     
     <Button
         android:layout_width="wrap_content"
@@ -67,8 +67,8 @@
         android:text="Ok" />
 
     <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
         <Button
             android:layout_width="wrap_content"
             android:text="Ok" />
 
             <LinearLayout
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
 
                 <Button
                     android:layout_width="wrap_content"
     </LinearLayout>
 
     <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
         <Button
             android:layout_width="wrap_content"
             android:text="Ok" />
 
             <LinearLayout
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
 
                 <Button
                     android:layout_width="wrap_content"
index 1c2d5d8..61b70af 100644 (file)
@@ -3,12 +3,12 @@
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
        <LinearLayout
-               android:layout_width="fill_parent"
-           android:layout_height="fill_parent">
+               android:layout_width="match_parent"
+           android:layout_height="match_parent">
        
                <TextView
                        android:layout_width="wrap_content"
index c0b292b..79b922b 100644 (file)
@@ -3,11 +3,11 @@
 <HorizontalScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
        <LinearLayout
-           android:layout_width="fill_parent"
-           android:layout_height="fill_parent" />
+           android:layout_width="match_parent"
+           android:layout_height="match_parent" />
 
 </HorizontalScrollView>