diff options
| author | 2011-06-10 15:45:10 -0700 | |
|---|---|---|
| committer | 2011-06-10 15:45:10 -0700 | |
| commit | 40b62b9e66bf55cf2c49184298fa00c290e2bc2c (patch) | |
| tree | 8b9ee62eed8cda7bee4eb17198f44b2a08244573 | |
| parent | f74b9bf13bcd5dd7e085e1a9a9ea494805d704c8 (diff) | |
| parent | 26e432d25f2ba199ae8b762fc68da8463389dd9b (diff) | |
Merge "Make View respect LAYOUT_DIRECTION_LOCALE"
29 files changed, 1935 insertions, 717 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 30ac3f77bf78..441cdc14db8a 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -76,6 +76,7 @@ import java.lang.reflect.InvocationTargetException;  import java.lang.reflect.Method;  import java.util.ArrayList;  import java.util.Arrays; +import java.util.Locale;  import java.util.WeakHashMap;  import java.util.concurrent.CopyOnWriteArrayList; @@ -8665,7 +8666,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit      /**       * Resolving the layout direction. LTR is set initially. -     * We are supposing here that the parent directionality will be resolved before its children +     * We are supposing here that the parent directionality will be resolved before its children.       */      private void resolveLayoutDirection() {          mPrivateFlags2 &= ~RESOLVED_LAYOUT_RTL; @@ -8680,6 +8681,34 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit              case LAYOUT_DIRECTION_RTL:                  mPrivateFlags2 |= RESOLVED_LAYOUT_RTL;                  break; +            case LAYOUT_DIRECTION_LOCALE: +                if(isLayoutDirectionRtl(Locale.getDefault())) { +                    mPrivateFlags2 |= RESOLVED_LAYOUT_RTL; +                } +                break; +            default: +                // Nothing to do, LTR by default +        } +    } + +    /** +     * Check if a Locale is corresponding to a RTL script. +     * +     * @param locale Locale to check +     * @return true if a Locale is corresponding to a RTL script. +     */ +    private static boolean isLayoutDirectionRtl(Locale locale) { +        if (locale == null || locale.equals(Locale.ROOT)) return false; +        // Be careful: this code will need to be changed when vertical scripts will be supported +        // OR if ICU4C is updated to have the "likelySubtags" file +        switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) { +            case Character.DIRECTIONALITY_LEFT_TO_RIGHT: +                return false; +            case Character.DIRECTIONALITY_RIGHT_TO_LEFT: +            case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC: +                return true; +            default: +                return false;          }      } diff --git a/tests/BiDiTests/Android b/tests/BiDiTests/Android new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/tests/BiDiTests/Android diff --git a/tests/BiDiTests/AndroidManifest.xml b/tests/BiDiTests/AndroidManifest.xml index ad27a62bc1f0..135c5dde0b58 100644 --- a/tests/BiDiTests/AndroidManifest.xml +++ b/tests/BiDiTests/AndroidManifest.xml @@ -57,6 +57,13 @@              </intent-filter>          </activity> +        <activity android:name=".BiDiTestLinearLayoutLocaleActivity" +                  android:windowSoftInputMode="stateAlwaysHidden"> +            <intent-filter> +                <action android:name="android.intent.action.MAIN" /> +            </intent-filter> +        </activity> +          <activity android:name=".BiDiTestFrameLayoutLtrActivity"                    android:windowSoftInputMode="stateAlwaysHidden">              <intent-filter> @@ -71,6 +78,13 @@              </intent-filter>          </activity> +        <activity android:name=".BiDiTestFrameLayoutLocaleActivity" +                  android:windowSoftInputMode="stateAlwaysHidden"> +            <intent-filter> +                <action android:name="android.intent.action.MAIN" /> +            </intent-filter> +        </activity> +          <activity android:name=".BiDiTestRelativeLayoutLtrActivity"                    android:windowSoftInputMode="stateAlwaysHidden">              <intent-filter> @@ -99,6 +113,13 @@              </intent-filter>          </activity> +        <activity android:name=".BiDiTestRelativeLayoutLocaleActivity2" +                  android:windowSoftInputMode="stateAlwaysHidden"> +            <intent-filter> +                <action android:name="android.intent.action.MAIN" /> +            </intent-filter> +        </activity> +          <activity android:name=".BiDiTestTableLayoutLtrActivity"                    android:windowSoftInputMode="stateAlwaysHidden">              <intent-filter> @@ -113,6 +134,13 @@              </intent-filter>          </activity> +        <activity android:name=".BiDiTestTableLayoutLocaleActivity" +                  android:windowSoftInputMode="stateAlwaysHidden"> +            <intent-filter> +                <action android:name="android.intent.action.MAIN" /> +            </intent-filter> +        </activity> +      </application>  </manifest> diff --git a/tests/BiDiTests/res/layout/basic.xml b/tests/BiDiTests/res/layout/basic.xml index f254e3c4d40f..d5f5ba7ff72c 100644 --- a/tests/BiDiTests/res/layout/basic.xml +++ b/tests/BiDiTests/res/layout/basic.xml @@ -15,34 +15,34 @@  -->  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent"> +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent">      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content"> +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content"> -       <Button android:id="@+id/button" -               android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button_text" -               android:textSize="32dip" -        /> +        <Button android:id="@+id/button" +                android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button_text" +                android:textSize="32dip" +                />          <TextView android:id="@+id/textview" -              android:layout_height="wrap_content" -              android:layout_width="wrap_content" -              android:textSize="32dip" -              android:text="@string/textview_text" -        /> +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="32dip" +                  android:text="@string/textview_text" +                />          <EditText android:id="@+id/edittext" -              android:layout_height="wrap_content" -              android:layout_width="match_parent" -              android:textSize="32dip" -        /> +                  android:layout_height="wrap_content" +                  android:layout_width="match_parent" +                  android:textSize="32dip" +                />      </LinearLayout> diff --git a/tests/BiDiTests/res/layout/canvas.xml b/tests/BiDiTests/res/layout/canvas.xml index 77007af3a6bd..03b1bb23bffc 100644 --- a/tests/BiDiTests/res/layout/canvas.xml +++ b/tests/BiDiTests/res/layout/canvas.xml @@ -15,20 +15,20 @@  -->  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent"> +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent">      <SeekBar android:id="@+id/seekbar" -               android:layout_height="wrap_content" -               android:layout_width="match_parent" -               /> +             android:layout_height="wrap_content" +             android:layout_width="match_parent" +            />      <view class="com.android.bidi.BiDiTestView" -        android:id="@+id/testview" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:background="#FF0000" -    /> +          android:id="@+id/testview" +          android:layout_width="match_parent" +          android:layout_height="wrap_content" +          android:background="#FF0000" +            />  </LinearLayout> diff --git a/tests/BiDiTests/res/layout/frame_layout_locale.xml b/tests/BiDiTests/res/layout/frame_layout_locale.xml new file mode 100644 index 000000000000..812e0dcba646 --- /dev/null +++ b/tests/BiDiTests/res/layout/frame_layout_locale.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + +     Licensed under the Apache License, Version 2.0 (the "License"); +     you may not use this file except in compliance with the License. +     You may obtain a copy of the License at + +          http://www.apache.org/licenses/LICENSE-2.0 + +     Unless required by applicable law or agreed to in writing, software +     distributed under the License is distributed on an "AS IS" BASIS, +     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +     See the License for the specific language governing permissions and +     limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +             android:id="@+id/frame_layout_ltr" +             android:layout_width="match_parent" +             android:layout_height="match_parent" +             android:layoutDirection="locale" +             android:background="#FF000000"> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="right|center_vertical" +            android:background="#FFFF0000"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="left|center_vertical" +            android:background="#FF00FF00"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="top|center_horizontal" +            android:background="#FF0000FF"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="bottom|center_horizontal" +            android:background="#FF00FFFF"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="top|start" +            android:background="#FFFFFFFF"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="top|end" +            android:background="#FFFFFF00"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="bottom|start" +            android:background="#FFFFFFFF"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="bottom|end" +            android:background="#FFFFFF00"> +    </FrameLayout> + +    <FrameLayout +            android:layout_width="100dp" +            android:layout_height="100dp" +            android:layout_gravity="center_horizontal|center_vertical" +            android:background="#FF888888"> +    </FrameLayout> + +</FrameLayout> + diff --git a/tests/BiDiTests/res/layout/frame_layout_ltr.xml b/tests/BiDiTests/res/layout/frame_layout_ltr.xml index 61fd06e08532..79effe699662 100644 --- a/tests/BiDiTests/res/layout/frame_layout_ltr.xml +++ b/tests/BiDiTests/res/layout/frame_layout_ltr.xml @@ -15,74 +15,74 @@  -->  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/frame_layout_ltr" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="ltr" -    android:background="#FF000000"> +             android:id="@+id/frame_layout_ltr" +             android:layout_width="match_parent" +             android:layout_height="match_parent" +             android:layoutDirection="ltr" +             android:background="#FF000000"> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="right|center_vertical"              android:background="#FFFF0000"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="left|center_vertical"              android:background="#FF00FF00"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|center_horizontal"              android:background="#FF0000FF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|center_horizontal"              android:background="#FF00FFFF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|start"              android:background="#FFFFFFFF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|end"              android:background="#FFFFFF00"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|start"              android:background="#FFFFFFFF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|end"              android:background="#FFFFFF00"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="center_horizontal|center_vertical"              android:background="#FF888888"> -        </FrameLayout> +    </FrameLayout>  </FrameLayout> diff --git a/tests/BiDiTests/res/layout/frame_layout_rtl.xml b/tests/BiDiTests/res/layout/frame_layout_rtl.xml index 598b41a233a2..a793862b8317 100644 --- a/tests/BiDiTests/res/layout/frame_layout_rtl.xml +++ b/tests/BiDiTests/res/layout/frame_layout_rtl.xml @@ -15,74 +15,74 @@  -->  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/frame_layout_ltr" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="rtl" -    android:background="#FF000000"> +             android:id="@+id/frame_layout_ltr" +             android:layout_width="match_parent" +             android:layout_height="match_parent" +             android:layoutDirection="rtl" +             android:background="#FF000000"> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="right|center_vertical"              android:background="#FFFF0000"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="left|center_vertical"              android:background="#FF00FF00"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|center_horizontal"              android:background="#FF0000FF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|center_horizontal"              android:background="#FF00FFFF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|start"              android:background="#FFFFFFFF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|end"              android:background="#FFFFFF00"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|start"              android:background="#FFFFFFFF"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|end"              android:background="#FFFFFF00"> -        </FrameLayout> +    </FrameLayout> -        <FrameLayout +    <FrameLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="center_horizontal|center_vertical"              android:background="#FF888888"> -        </FrameLayout> +    </FrameLayout>  </FrameLayout> diff --git a/tests/BiDiTests/res/layout/linear_layout_locale.xml b/tests/BiDiTests/res/layout/linear_layout_locale.xml new file mode 100644 index 000000000000..72046cb23342 --- /dev/null +++ b/tests/BiDiTests/res/layout/linear_layout_locale.xml @@ -0,0 +1,257 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + +     Licensed under the Apache License, Version 2.0 (the "License"); +     you may not use this file except in compliance with the License. +     You may obtain a copy of the License at + +          http://www.apache.org/licenses/LICENSE-2.0 + +     Unless required by applicable law or agreed to in writing, software +     distributed under the License is distributed on an "AS IS" BASIS, +     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +     See the License for the specific language governing permissions and +     limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +              android:id="@+id/linear_layout_rtl" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="locale"> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="inherit"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="ltr"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="rtl"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="locale"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="inherit"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="ltr"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="rtl"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="locale"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> + +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                /> +    </LinearLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/linear_layout_ltr.xml b/tests/BiDiTests/res/layout/linear_layout_ltr.xml index d4386f2d0102..bea087e26968 100644 --- a/tests/BiDiTests/res/layout/linear_layout_ltr.xml +++ b/tests/BiDiTests/res/layout/linear_layout_ltr.xml @@ -15,198 +15,243 @@  -->  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/linear_layout_ltr" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="ltr"> +              android:id="@+id/linear_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="ltr">      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="inherit"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="inherit"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="ltr"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="ltr"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="rtl"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="rtl"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="inherit"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="locale"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="ltr"> +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="inherit"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="ltr"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="rtl"> +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="rtl"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="locale"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                />      </LinearLayout>  </LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/linear_layout_rtl.xml b/tests/BiDiTests/res/layout/linear_layout_rtl.xml index 9d0726386c3d..12f14efede55 100644 --- a/tests/BiDiTests/res/layout/linear_layout_rtl.xml +++ b/tests/BiDiTests/res/layout/linear_layout_rtl.xml @@ -15,198 +15,243 @@  -->  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/linear_layout_rtl" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="rtl"> +              android:id="@+id/linear_layout_rtl" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="rtl">      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="inherit"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="inherit"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="ltr"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="ltr"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="horizontal" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="rtl"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="rtl"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="inherit"> +                  android:orientation="horizontal" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="locale"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> - +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="ltr"> +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="inherit"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="ltr"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                />      </LinearLayout>      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:orientation="vertical" -        android:layout_width="match_parent" -        android:layout_height="wrap_content" -        android:layoutDirection="rtl"> +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="rtl"> -       <Button android:layout_height="wrap_content" -               android:layout_width="wrap_content" -               android:text="@string/button1_text" -               android:textSize="24dip" -        /> +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                />          <TextView android:id="@+id/textview"                    android:layout_height="wrap_content"                    android:layout_width="wrap_content"                    android:textSize="24dip"                    android:text="@string/textview_text" -        /> +                />          <Button android:layout_height="wrap_content"                  android:layout_width="wrap_content"                  android:text="@string/button2_text"                  android:textSize="24dip" -         /> +                /> +    </LinearLayout> + +    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +                  android:orientation="vertical" +                  android:layout_width="match_parent" +                  android:layout_height="wrap_content" +                  android:layoutDirection="locale"> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button1_text" +                android:textSize="24dip" +                /> +        <TextView android:id="@+id/textview" +                  android:layout_height="wrap_content" +                  android:layout_width="wrap_content" +                  android:textSize="24dip" +                  android:text="@string/textview_text" +                /> + +        <Button android:layout_height="wrap_content" +                android:layout_width="wrap_content" +                android:text="@string/button2_text" +                android:textSize="24dip" +                />      </LinearLayout>  </LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/main.xml b/tests/BiDiTests/res/layout/main.xml index e39d1d6ee002..eb73d44aa762 100644 --- a/tests/BiDiTests/res/layout/main.xml +++ b/tests/BiDiTests/res/layout/main.xml @@ -15,26 +15,26 @@  -->  <TabHost xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@android:id/tabhost" -    android:layout_width="fill_parent" -    android:layout_height="fill_parent"> +         android:id="@android:id/tabhost" +         android:layout_width="fill_parent" +         android:layout_height="fill_parent">      <LinearLayout -        android:orientation="vertical" -        android:layout_width="fill_parent" -        android:layout_height="fill_parent" -        android:padding="5dp"> +            android:orientation="vertical" +            android:layout_width="fill_parent" +            android:layout_height="fill_parent" +            android:padding="5dp">          <TabWidget -            android:id="@android:id/tabs" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" /> +                android:id="@android:id/tabs" +                android:layout_width="fill_parent" +                android:layout_height="wrap_content"/>          <FrameLayout -            android:id="@android:id/tabcontent" -            android:layout_width="fill_parent" -            android:layout_height="fill_parent" -            android:padding="5dp" /> +                android:id="@android:id/tabcontent" +                android:layout_width="fill_parent" +                android:layout_height="fill_parent" +                android:padding="5dp"/>      </LinearLayout> diff --git a/tests/BiDiTests/res/layout/relative_layout_2_locale.xml b/tests/BiDiTests/res/layout/relative_layout_2_locale.xml new file mode 100644 index 000000000000..c99a99bb9793 --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_2_locale.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + +     Licensed under the Apache License, Version 2.0 (the "License"); +     you may not use this file except in compliance with the License. +     You may obtain a copy of the License at + +          http://www.apache.org/licenses/LICENSE-2.0 + +     Unless required by applicable law or agreed to in writing, software +     distributed under the License is distributed on an "AS IS" BASIS, +     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +     See the License for the specific language governing permissions and +     limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +              android:id="@+id/relative_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="locale"> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px"> + +        <TextView android:id="@+id/label_1" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_1" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_1"/> + +        <Button android:id="@+id/ok_1" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_1" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_1" +                android:layout_alignTop="@id/ok_1" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="ltr"> + +        <TextView android:id="@+id/label_2" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_2" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_2"/> + +        <Button android:id="@+id/ok_2" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_2" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_2" +                android:layout_alignTop="@id/ok_2" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="inherit"> + +        <TextView android:id="@+id/label_3" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_3" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_3"/> + +        <Button android:id="@+id/ok_3" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_3" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_3" +                android:layout_alignTop="@id/ok_3" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="rtl"> + +        <TextView android:id="@+id/label_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_4"/> + +        <Button android:id="@+id/ok_4" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_4" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_4" +                android:layout_alignTop="@id/ok_4" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="locale"> + +        <TextView android:id="@+id/label_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_4"/> + +        <Button android:id="@+id/ok_4" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_4" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_4" +                android:layout_alignTop="@id/ok_4" +                android:text="Cancel"/> +    </RelativeLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml new file mode 100644 index 000000000000..c4cab1167a2a --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + +     Licensed under the Apache License, Version 2.0 (the "License"); +     you may not use this file except in compliance with the License. +     You may obtain a copy of the License at + +          http://www.apache.org/licenses/LICENSE-2.0 + +     Unless required by applicable law or agreed to in writing, software +     distributed under the License is distributed on an "AS IS" BASIS, +     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +     See the License for the specific language governing permissions and +     limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +              android:id="@+id/relative_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="ltr"> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px"> + +        <TextView android:id="@+id/label_1" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_1" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_1"/> + +        <Button android:id="@+id/ok_1" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_1" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_1" +                android:layout_alignTop="@id/ok_1" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="ltr"> + +        <TextView android:id="@+id/label_2" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_2" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_2"/> + +        <Button android:id="@+id/ok_2" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_2" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_2" +                android:layout_alignTop="@id/ok_2" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="inherit"> + +        <TextView android:id="@+id/label_3" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_3" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_3"/> + +        <Button android:id="@+id/ok_3" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_3" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_3" +                android:layout_alignTop="@id/ok_3" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="rtl"> + +        <TextView android:id="@+id/label_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_4"/> + +        <Button android:id="@+id/ok_4" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_4" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_4" +                android:layout_alignTop="@id/ok_4" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="locale"> + +        <TextView android:id="@+id/label_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_4"/> + +        <Button android:id="@+id/ok_4" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_4" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_4" +                android:layout_alignTop="@id/ok_4" +                android:text="Cancel"/> +    </RelativeLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml new file mode 100644 index 000000000000..009d4426ea73 --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + +     Licensed under the Apache License, Version 2.0 (the "License"); +     you may not use this file except in compliance with the License. +     You may obtain a copy of the License at + +          http://www.apache.org/licenses/LICENSE-2.0 + +     Unless required by applicable law or agreed to in writing, software +     distributed under the License is distributed on an "AS IS" BASIS, +     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +     See the License for the specific language governing permissions and +     limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +              android:id="@+id/relative_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="rtl"> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px"> + +        <TextView android:id="@+id/label_1" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_1" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_1"/> + +        <Button android:id="@+id/ok_1" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_1" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_1" +                android:layout_alignTop="@id/ok_1" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="ltr"> + +        <TextView android:id="@+id/label_2" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_2" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_2"/> + +        <Button android:id="@+id/ok_2" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_2" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_2" +                android:layout_alignTop="@id/ok_2" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="inherit"> + +        <TextView android:id="@+id/label_3" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_3" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_3"/> + +        <Button android:id="@+id/ok_3" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_3" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_3" +                android:layout_alignTop="@id/ok_3" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="rtl"> + +        <TextView android:id="@+id/label_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_4"/> + +        <Button android:id="@+id/ok_4" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_4" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_4" +                android:layout_alignTop="@id/ok_4" +                android:text="Cancel"/> +    </RelativeLayout> + +    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +                    android:layout_width="fill_parent" +                    android:layout_height="wrap_content" +                    android:background="#FF000000" +                    android:padding="10px" +                    android:layoutDirection="locale"> + +        <TextView android:id="@+id/label_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:text="Type here:"/> + +        <EditText android:id="@+id/entry_4" +                  android:layout_width="fill_parent" +                  android:layout_height="wrap_content" +                  android:layout_below="@id/label_4"/> + +        <Button android:id="@+id/ok_4" +                android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_below="@id/entry_4" +                android:layout_alignParentRight="true" +                android:layout_marginLeft="10px" +                android:text="OK"/> + +        <Button android:layout_width="wrap_content" +                android:layout_height="wrap_content" +                android:layout_toLeftOf="@id/ok_4" +                android:layout_alignTop="@id/ok_4" +                android:text="Cancel"/> +    </RelativeLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_ltr.xml index d789707dfe62..e9e8661d7460 100644 --- a/tests/BiDiTests/res/layout/relative_layout_ltr.xml +++ b/tests/BiDiTests/res/layout/relative_layout_ltr.xml @@ -15,74 +15,74 @@  -->  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/frame_layout_ltr" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="ltr" -    android:background="#FF000000"> +             android:id="@+id/frame_layout_ltr" +             android:layout_width="match_parent" +             android:layout_height="match_parent" +             android:layoutDirection="ltr" +             android:background="#FF000000"> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="right|center_vertical"              android:background="#FFFF0000"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="left|center_vertical"              android:background="#FF00FF00"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|center_horizontal"              android:background="#FF0000FF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|center_horizontal"              android:background="#FF00FFFF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|start"              android:background="#FFFFFFFF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|end"              android:background="#FFFFFF00"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|start"              android:background="#FFFFFFFF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|end"              android:background="#FFFFFF00"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="center_horizontal|center_vertical"              android:background="#FF888888"> -        </RelativeLayout> +    </RelativeLayout>  </FrameLayout> diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml b/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml deleted file mode 100644 index a13ef8bfc0ad..000000000000 --- a/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml +++ /dev/null @@ -1,155 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project - -     Licensed under the Apache License, Version 2.0 (the "License"); -     you may not use this file except in compliance with the License. -     You may obtain a copy of the License at - -          http://www.apache.org/licenses/LICENSE-2.0 - -     Unless required by applicable law or agreed to in writing, software -     distributed under the License is distributed on an "AS IS" BASIS, -     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -     See the License for the specific language governing permissions and -     limitations under the License. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/relative_layout_ltr" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="ltr"> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px"> - -        <TextView android:id="@+id/label_1" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_1" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_1" /> - -        <Button android:id="@+id/ok_1" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_1" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_1" -                android:layout_alignTop="@id/ok_1" -                android:text="Cancel" /> - -    </RelativeLayout> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px" -            android:layoutDirection="ltr"> - -        <TextView android:id="@+id/label_2" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_2" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_2" /> - -        <Button android:id="@+id/ok_2" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_2" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_2" -                android:layout_alignTop="@id/ok_2" -                android:text="Cancel" /> - -    </RelativeLayout> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px" -            android:layoutDirection="inherit"> - -        <TextView android:id="@+id/label_3" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_3" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_3" /> - -        <Button android:id="@+id/ok_3" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_3" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_3" -                android:layout_alignTop="@id/ok_3" -                android:text="Cancel" /> - -    </RelativeLayout> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px" -            android:layoutDirection="rtl"> - -        <TextView android:id="@+id/label_4" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_4" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_4" /> - -        <Button android:id="@+id/ok_4" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_4" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_4" -                android:layout_alignTop="@id/ok_4" -                android:text="Cancel" /> - -    </RelativeLayout> - -</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_rtl.xml index 580892474206..57b2ad085a1b 100644 --- a/tests/BiDiTests/res/layout/relative_layout_rtl.xml +++ b/tests/BiDiTests/res/layout/relative_layout_rtl.xml @@ -15,74 +15,74 @@  -->  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/frame_layout_rtl" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="rtl" -    android:background="#FF000000"> +             android:id="@+id/frame_layout_rtl" +             android:layout_width="match_parent" +             android:layout_height="match_parent" +             android:layoutDirection="rtl" +             android:background="#FF000000"> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="right|center_vertical"              android:background="#FFFF0000"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="left|center_vertical"              android:background="#FF00FF00"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|center_horizontal"              android:background="#FF0000FF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|center_horizontal"              android:background="#FF00FFFF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|start"              android:background="#FFFFFFFF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="top|end"              android:background="#FFFFFF00"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|start"              android:background="#FFFFFFFF"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="bottom|end"              android:background="#FFFFFF00"> -        </RelativeLayout> +    </RelativeLayout> -        <RelativeLayout +    <RelativeLayout              android:layout_width="100dp"              android:layout_height="100dp"              android:layout_gravity="center_horizontal|center_vertical"              android:background="#FF888888"> -        </RelativeLayout> +    </RelativeLayout>  </FrameLayout> diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml b/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml deleted file mode 100644 index 1a6b3d54a04d..000000000000 --- a/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml +++ /dev/null @@ -1,155 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project - -     Licensed under the Apache License, Version 2.0 (the "License"); -     you may not use this file except in compliance with the License. -     You may obtain a copy of the License at - -          http://www.apache.org/licenses/LICENSE-2.0 - -     Unless required by applicable law or agreed to in writing, software -     distributed under the License is distributed on an "AS IS" BASIS, -     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -     See the License for the specific language governing permissions and -     limitations under the License. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/relative_layout_ltr" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="rtl"> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px"> - -        <TextView android:id="@+id/label_1" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_1" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_1" /> - -        <Button android:id="@+id/ok_1" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_1" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_1" -                android:layout_alignTop="@id/ok_1" -                android:text="Cancel" /> - -    </RelativeLayout> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px" -            android:layoutDirection="ltr"> - -        <TextView android:id="@+id/label_2" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_2" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_2" /> - -        <Button android:id="@+id/ok_2" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_2" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_2" -                android:layout_alignTop="@id/ok_2" -                android:text="Cancel" /> - -    </RelativeLayout> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px" -            android:layoutDirection="inherit"> - -        <TextView android:id="@+id/label_3" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_3" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_3" /> - -        <Button android:id="@+id/ok_3" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_3" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_3" -                android:layout_alignTop="@id/ok_3" -                android:text="Cancel" /> - -    </RelativeLayout> - -    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" -            android:layout_width="fill_parent" -            android:layout_height="wrap_content" -            android:background="#FF000000" -            android:padding="10px" -            android:layoutDirection="rtl"> - -        <TextView android:id="@+id/label_4" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:text="Type here:" /> - -        <EditText android:id="@+id/entry_4" -                android:layout_width="fill_parent" -                android:layout_height="wrap_content" -                android:layout_below="@id/label_4" /> - -        <Button android:id="@+id/ok_4" -                android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_below="@id/entry_4" -                android:layout_alignParentRight="true" -                android:layout_marginLeft="10px" -                android:text="OK" /> - -        <Button android:layout_width="wrap_content" -                android:layout_height="wrap_content" -                android:layout_toLeftOf="@id/ok_4" -                android:layout_alignTop="@id/ok_4" -                android:text="Cancel" /> - -    </RelativeLayout> - -</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/table_layout_locale.xml b/tests/BiDiTests/res/layout/table_layout_locale.xml new file mode 100644 index 000000000000..847eb0702b57 --- /dev/null +++ b/tests/BiDiTests/res/layout/table_layout_locale.xml @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + +     Licensed under the Apache License, Version 2.0 (the "License"); +     you may not use this file except in compliance with the License. +     You may obtain a copy of the License at + +          http://www.apache.org/licenses/LICENSE-2.0 + +     Unless required by applicable law or agreed to in writing, software +     distributed under the License is distributed on an "AS IS" BASIS, +     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +     See the License for the specific language governing permissions and +     limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +              android:id="@+id/linear_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="locale"> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2"> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow> +    </TableLayout> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="inherit"> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow> +    </TableLayout> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="ltr"> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow> +    </TableLayout> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="rtl"> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow> +    </TableLayout> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="locale"> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow> +    </TableLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/table_layout_ltr.xml b/tests/BiDiTests/res/layout/table_layout_ltr.xml index 8e1891e7014c..49d1d0da9791 100644 --- a/tests/BiDiTests/res/layout/table_layout_ltr.xml +++ b/tests/BiDiTests/res/layout/table_layout_ltr.xml @@ -15,35 +15,35 @@  -->  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/linear_layout_ltr" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="ltr"> +              android:id="@+id/linear_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="ltr">      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -51,47 +51,46 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> -      </TableLayout>      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2" -        android:layoutDirection="inherit"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="inherit">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -99,47 +98,46 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> -      </TableLayout>      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2" -        android:layoutDirection="ltr"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="ltr">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -147,47 +145,46 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> -      </TableLayout>      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2" -        android:layoutDirection="rtl"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="rtl">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -195,21 +192,67 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> +    </TableLayout> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="locale"> +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow>      </TableLayout>  </LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/table_layout_rtl.xml b/tests/BiDiTests/res/layout/table_layout_rtl.xml index bd664e4900db..a665e45a00dd 100644 --- a/tests/BiDiTests/res/layout/table_layout_rtl.xml +++ b/tests/BiDiTests/res/layout/table_layout_rtl.xml @@ -15,35 +15,35 @@  -->  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -    android:id="@+id/linear_layout_ltr" -    android:orientation="vertical" -    android:layout_width="match_parent" -    android:layout_height="match_parent" -    android:layoutDirection="rtl"> +              android:id="@+id/linear_layout_ltr" +              android:orientation="vertical" +              android:layout_width="match_parent" +              android:layout_height="match_parent" +              android:layoutDirection="rtl">      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -51,47 +51,46 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> -      </TableLayout>      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2" -        android:layoutDirection="inherit"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="inherit">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -99,47 +98,46 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> -      </TableLayout>      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2" -        android:layoutDirection="ltr"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="ltr">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -147,47 +145,46 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> -      </TableLayout>      <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" -        android:layout_width="wrap_content" -        android:layout_height="wrap_content" -        android:stretchColumns="1,2" -        android:layoutDirection="rtl"> +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="rtl">          <TableRow>              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button1_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_right_text"                      android:textSize="24dip"                      android:gravity="right" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_after_text"                      android:textSize="24dip"                      android:gravity="after" -             /> +                    />          </TableRow>          <TableRow> @@ -195,21 +192,67 @@                      android:layout_width="wrap_content"                      android:text="@string/button2_text"                      android:textSize="24dip" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_left_text"                      android:textSize="24dip"                      android:gravity="left" -             /> +                    />              <Button android:layout_height="wrap_content"                      android:layout_width="wrap_content"                      android:text="@string/button_before_text"                      android:textSize="24dip"                      android:gravity="before" -             /> +                    />          </TableRow> +    </TableLayout> + +    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" +                 android:layout_width="wrap_content" +                 android:layout_height="wrap_content" +                 android:stretchColumns="1,2" +                 android:layoutDirection="locale"> +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button1_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_right_text" +                    android:textSize="24dip" +                    android:gravity="right" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_after_text" +                    android:textSize="24dip" +                    android:gravity="after" +                    /> +        </TableRow> + +        <TableRow> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button2_text" +                    android:textSize="24dip" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_left_text" +                    android:textSize="24dip" +                    android:gravity="left" +                    /> +            <Button android:layout_height="wrap_content" +                    android:layout_width="wrap_content" +                    android:text="@string/button_before_text" +                    android:textSize="24dip" +                    android:gravity="before" +                    /> +        </TableRow>      </TableLayout>  </LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java index 266268313ab8..1ffe7ee55cf5 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java @@ -57,6 +57,11 @@ public class BiDiTestActivity extends TabActivity {              setContent(intent);          tabHost.addTab(spec); +        intent = new Intent().setClass(this, BiDiTestLinearLayoutLocaleActivity.class); +        spec = tabHost.newTabSpec("linear-layout-locale").setIndicator("Linear LOC"). +            setContent(intent); +        tabHost.addTab(spec); +          intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class);          spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("Frame LTR").              setContent(intent); @@ -67,6 +72,11 @@ public class BiDiTestActivity extends TabActivity {              setContent(intent);          tabHost.addTab(spec); +        intent = new Intent().setClass(this, BiDiTestFrameLayoutLocaleActivity.class); +        spec = tabHost.newTabSpec("frame-layout-locale").setIndicator("Frame LOC"). +            setContent(intent); +        tabHost.addTab(spec); +          intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity.class);          spec = tabHost.newTabSpec("relative-layout-ltr").setIndicator("Relative LTR").              setContent(intent); @@ -87,6 +97,11 @@ public class BiDiTestActivity extends TabActivity {              setContent(intent);          tabHost.addTab(spec); +        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLocaleActivity2.class); +        spec = tabHost.newTabSpec("relative-layout-locale-2").setIndicator("Relative2 LOC"). +            setContent(intent); +        tabHost.addTab(spec); +          intent = new Intent().setClass(this, BiDiTestTableLayoutLtrActivity.class);          spec = tabHost.newTabSpec("table-layout-ltr").setIndicator("Table LTR").              setContent(intent); @@ -97,6 +112,11 @@ public class BiDiTestActivity extends TabActivity {              setContent(intent);          tabHost.addTab(spec); +        intent = new Intent().setClass(this, BiDiTestTableLayoutLocaleActivity.class); +        spec = tabHost.newTabSpec("table-layout-locale").setIndicator("Table LOC"). +            setContent(intent); +        tabHost.addTab(spec); +          tabHost.setCurrentTab(0);      }  }
\ No newline at end of file diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java new file mode 100644 index 000000000000..457c52a8d817 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + *      http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestFrameLayoutLocaleActivity extends Activity { + +    @Override +    protected void onCreate(Bundle savedInstanceState) { +        super.onCreate(savedInstanceState); + +        setContentView(R.layout.frame_layout_locale); +    } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java new file mode 100644 index 000000000000..8694dd15fa8a --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + *      http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestLinearLayoutLocaleActivity extends Activity { + +    @Override +    protected void onCreate(Bundle savedInstanceState) { +        super.onCreate(savedInstanceState); + +        setContentView(R.layout.linear_layout_locale); +    } +} diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java new file mode 100644 index 000000000000..8a52b3875cee --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + *      http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestRelativeLayoutLocaleActivity2 extends Activity { + +    @Override +    protected void onCreate(Bundle savedInstanceState) { +        super.onCreate(savedInstanceState); + +        setContentView(R.layout.relative_layout_2_locale); +    } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java index 476375c66d17..65a5ed0ed3a5 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java @@ -25,7 +25,7 @@ public class BiDiTestRelativeLayoutLtrActivity2 extends Activity {      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState); -        setContentView(R.layout.relative_layout_ltr_2); +        setContentView(R.layout.relative_layout_2_ltr);      }  } diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java index db2af7f20d31..dad549161ad6 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java @@ -25,7 +25,7 @@ public class BiDiTestRelativeLayoutRtlActivity2 extends Activity {      protected void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState); -        setContentView(R.layout.relative_layout_rtl_2); +        setContentView(R.layout.relative_layout_2_rtl);      }  } diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java new file mode 100644 index 000000000000..9222aa23f4d8 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + *      http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestTableLayoutLocaleActivity extends Activity { + +    @Override +    protected void onCreate(Bundle savedInstanceState) { +        super.onCreate(savedInstanceState); + +        setContentView(R.layout.table_layout_locale); +    } +} +  |