OSDN Git Service

Fix 4462497: Make lockscreen preference screen layouts more dynamic
authorJim Miller <jaggies@google.com>
Mon, 23 May 2011 23:44:24 +0000 (16:44 -0700)
committerJim Miller <jaggies@google.com>
Tue, 24 May 2011 00:15:36 +0000 (17:15 -0700)
This reduces the dependency of LockScreen preference screens
on a particular device size by using centering logic instead of
absolute offsets/sizes.

Change-Id: I6ff9e71dc122e12493148437dda647820ae0f308

res/layout-sw600dp-land/choose_lock_pattern.xml
res/layout-sw600dp-land/choose_lock_pattern_tutorial.xml
res/layout-sw600dp-land/confirm_lock_pattern.xml
res/layout-sw600dp/choose_lock_pattern.xml
res/layout-sw600dp/choose_lock_pattern_tutorial.xml
res/layout-sw600dp/confirm_lock_pattern.xml

index fc5e787..a32a5fb 100644 (file)
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <!-- left side: lock pattern widget -->
     <RelativeLayout
         android:layout_width="0dip"
         android:layout_height="match_parent"
-        android:layout_weight="1">
+        android:layout_weight="1"
+        android:gravity="center_horizontal|center_vertical"
+        android:orientation="horizontal">
 
-        <!-- left side: lock pattern -->
         <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
              android:layout_width="354dip"
              android:layout_height="354dip"
-             android:layout_gravity="center_horizontal"
-             android:layout_marginTop="72dip"
-             android:layout_marginLeft="111dip"
              aspect="square"/>
 
-        <!-- right side: instructions and buttons -->
-        <!-- header message -->
-        <TextView android:id="@+id/headerText"
-            android:layout_width="542dip"
-            android:layout_height="78dip"
-            android:layout_marginTop="88dip"
-            android:layout_alignParentTop="true"
-            android:layout_toRightOf="@id/lockPattern"
-            android:layout_marginLeft="100dip"
-            android:textSize="22sp"/>
+     </RelativeLayout>
+
+    <!-- right side: instructions and buttons -->
+    <RelativeLayout
+        android:layout_width="0dip"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_horizontal">
 
         <!-- footer message -->
         <TextView android:id="@+id/footerText"
-            android:layout_width="542dip"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@id/headerText"
             android:layout_marginTop="16dip"
             android:layout_toRightOf="@id/lockPattern"
             android:layout_marginLeft="100dip"
-            android:textSize="22sp"
+            android:textAppearance="?android:attr/textAppearanceLarge"
             android:visibility="gone"/>
 
         <!-- confirm / restart buttons -->
-        <LinearLayout
+        <LinearLayout android:id="@+id/buttonContainer"
             style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:layout_alignParentBottom="true"
 
         </LinearLayout>
 
+        <!-- header message -->
+        <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentTop="true"
+            android:layout_marginTop="20dip"
+            android:layout_marginLeft="20dip"
+            android:layout_above="@id/buttonContainer"
+            android:gravity="center_vertical|center_horizontal">
+
+            <TextView android:id="@+id/headerText"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+        </ScrollView>
+
+
     </RelativeLayout>
 
 </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
index 32b452d..1320ba0 100644 (file)
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <!-- left side: lock pattern example widget -->
     <RelativeLayout
         android:layout_width="0dip"
         android:layout_height="match_parent"
-        android:layout_weight="1">
+        android:layout_weight="1"
+        android:gravity="center_horizontal|center_vertical"
+        android:orientation="horizontal">
 
-        <!-- left side: lock pattern -->
         <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
              android:layout_width="354dip"
              android:layout_height="354dip"
-             android:layout_gravity="center_horizontal"
-             android:layout_marginTop="72dip"
-             android:layout_marginLeft="111dip"
              aspect="square"/>
 
-        <!-- right side: instructions and buttons -->
-        <!-- header message -->
-        <TextView android:id="@+id/headerText"
-            android:layout_width="542dip"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="88dip"
-            android:layout_alignParentTop="true"
-            android:layout_toRightOf="@id/lockPattern"
-            android:layout_marginLeft="100dip"
-            android:text="@string/lock_intro_message"
-            android:textSize="22sp"/>
+     </RelativeLayout>
+
+    <!-- right side: instructions and buttons -->
+    <RelativeLayout
+        android:layout_width="0dip"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_horizontal">
 
-        <LinearLayout
+        <!-- navigation buttons -->
+        <LinearLayout android:id="@+id/buttonContainer"
             style="@style/SecurityPreferenceButtonContainer"
             android:layout_alignParentRight="true"
             android:layout_alignParentBottom="true"
 
         </LinearLayout>
 
-    </RelativeLayout>
+        <!-- header message -->
+        <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentTop="true"
+            android:layout_marginTop="20dip"
+            android:layout_marginLeft="20dip"
+            android:gravity="center_vertical|center_horizontal"
+            android:layout_above="@id/buttonContainer">
+
+            <TextView android:id="@+id/headerText"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/lock_intro_message"
+                android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+        </ScrollView>
+
+    </RelativeLayout>>
 
 </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
 
index 04c3e85..ad08e44 100644 (file)
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
-        xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/topLayout"
     android:orientation="horizontal"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <!-- left side: lock pattern widget -->
     <RelativeLayout
         android:layout_width="0dip"
         android:layout_height="match_parent"
-        android:layout_weight="1">
+        android:layout_weight="1"
+        android:gravity="center_horizontal|center_vertical"
+        android:orientation="horizontal">
 
-        <!-- left side: lock pattern -->
         <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
              android:layout_width="354dip"
              android:layout_height="354dip"
-             android:layout_gravity="center_horizontal"
-             android:layout_marginTop="72dip"
-             android:layout_marginLeft="111dip"
              aspect="square"/>
 
-        <!-- right side: instructions and buttons -->
-        <!-- header message -->
-        <TextView android:id="@+id/headerText"
-            android:layout_width="542dip"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="88dip"
-            android:layout_alignParentTop="true"
-            android:layout_toRightOf="@id/lockPattern"
-            android:layout_marginLeft="100dip"
-            android:textSize="22sp"/>
+     </RelativeLayout>
+
+    <!-- right side: instructions and buttons -->
+    <RelativeLayout
+        android:layout_width="0dip"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_horizontal">
+
+        <!-- confirm / restart buttons -->
+        <LinearLayout android:id="@+id/buttonContainer"
+            style="@style/SecurityPreferenceButtonContainer"
+            android:layout_alignParentRight="true"
+            android:layout_alignParentBottom="true"
+            android:orientation="horizontal">
+
+            <!-- left / top button: skip, or re-try -->
+            <Button android:id="@+id/footerLeftButton"
+                style="@style/SecurityPreferenceButton"
+                android:text="@string/lockpattern_restart_button_text"/>
+
+            <!-- right / bottom button: confirm or ok -->
+            <Button android:id="@+id/footerRightButton"
+                style="@style/SecurityPreferenceButton"
+                android:text="@string/lockpattern_confirm_button_text"/>
+
+        </LinearLayout>
 
         <!-- footer message -->
         <TextView android:id="@+id/footerText"
-            android:layout_width="542dip"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_below="@id/headerText"
+            android:layout_above="@id/buttonContainer"
             android:layout_marginTop="16dip"
-            android:layout_toRightOf="@id/lockPattern"
-            android:layout_marginLeft="100dip"
-            android:textSize="22sp"/>
+            android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+        <!-- header message -->
+        <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentTop="true"
+            android:layout_marginTop="20dip"
+            android:layout_marginLeft="20dip"
+            android:layout_above="@id/footerText"
+            android:gravity="center_vertical|center_horizontal">
+
+            <TextView android:id="@+id/headerText"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:textSize="22sp"/>
+
+        </ScrollView>
 
     </RelativeLayout>
 
index 6b7b90e..d8f85cc 100644 (file)
     android:gravity="center_horizontal">
 
     <!-- top: instructions and buttons -->
+
     <!-- header message -->
-    <TextView android:id="@+id/headerText"
-        android:layout_width="542dip"
-        android:layout_height="78dip"
-        android:layout_marginTop="96dip"
-        android:textSize="22sp"/>
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="96dip">
+
+        <TextView android:id="@+id/headerText"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+    </ScrollView>
 
     <!-- footer message -->
     <TextView android:id="@+id/footerText"
-        android:layout_width="542dip"
-        android:layout_height="78dip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:layout_marginTop="16dip"
-        android:textSize="22sp"
+        android:textAppearance="?android:attr/textAppearanceLarge"
         android:visibility="gone"/>
 
     <!-- bottom: lock pattern -->
index c7bdc88..2a61666 100644 (file)
 
     <!-- top: instructions and buttons -->
     <!-- header message -->
-    <TextView android:id="@+id/headerText"
-        android:layout_width="542dip"
-        android:layout_height="78dip"
-        android:layout_marginTop="96dip"
-        android:textSize="22sp"
-        android:text="@string/lock_intro_message"/>
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="96dip">
+
+        <TextView android:id="@+id/headerText"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceLarge"
+            android:text="@string/lock_intro_message"/>
+
+    </ScrollView>
 
     <!-- bottom: lock pattern -->
     <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
index 6bffaef..d41525a 100644 (file)
 
     <!-- top: instructions and buttons -->
     <!-- header message -->
-    <TextView android:id="@+id/headerText"
-        android:layout_width="542dip"
-        android:layout_height="78dip"
-        android:layout_marginTop="96dip"
-        android:textSize="22sp"/>
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="96dip">
+
+        <TextView android:id="@+id/headerText"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+    </ScrollView>
 
     <!-- footer message -->
     <TextView android:id="@+id/footerText"
-        android:layout_width="542dip"
-        android:layout_height="78dip"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:layout_marginTop="16dip"
-        android:textSize="22sp"/>
+        android:textAppearance="?android:attr/textAppearanceLarge"/>
 
     <!-- bottom: lock pattern -->
     <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"