Fix Security Settings padding

- for OwnerInfo / Trust Agent / Trusted Credentials / Device Admin
- fix also scrollbars position
- also layout code formatting

See bug: #15384992 Setting Dashboard - padding updates

Change-Id: Ib840c6dea62d7cead671b2ca8744502a7ecb435a
diff --git a/res/layout/advanced_security_settings.xml b/res/layout/advanced_security_settings.xml
index 952d967..149b49b 100644
--- a/res/layout/advanced_security_settings.xml
+++ b/res/layout/advanced_security_settings.xml
@@ -18,21 +18,28 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:orientation="vertical">
+
     <FrameLayout
             android:layout_width="match_parent"
             android:layout_height="0px"
             android:layout_weight="1">
+
         <ListView android:id="@android:id/list"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:drawSelectorOnTop="false"
                 android:fastScrollEnabled="true" />
+
         <TextView android:id="@android:id/empty"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:gravity="center"
                 android:text="@string/no_trust_agents"
                 android:textAppearance="?android:attr/textAppearanceMedium" />
+
     </FrameLayout>
+
 </LinearLayout>
diff --git a/res/layout/device_admin_item.xml b/res/layout/device_admin_item.xml
index 56be346..102cc16 100644
--- a/res/layout/device_admin_item.xml
+++ b/res/layout/device_admin_item.xml
@@ -22,24 +22,21 @@
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="horizontal"
-    android:paddingEnd="6dip"
-    android:paddingStart="6dip"
     android:gravity="center_vertical" >
 
     <LinearLayout
         android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:minWidth="64dip"
+        android:layout_height="wrap_content"
         android:gravity="center"
-        android:padding="8dip"
         android:orientation="horizontal">
+
         <ImageView
             android:id="@+id/icon"
             android:layout_width="@android:dimen/app_icon_size"
             android:layout_height="@android:dimen/app_icon_size"
             android:layout_gravity="center_vertical"
-            android:contentDescription="@null"
-            />
+            android:contentDescription="@null" />
+
     </LinearLayout>
 
     <RelativeLayout
@@ -70,12 +67,11 @@
 
     </RelativeLayout>
 
-    <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
+    <CheckBox
         android:id="@+id/checkbox"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
-        android:layout_marginEnd="16dip"
         android:layout_marginStart="16dip"
         android:focusable="false"
         android:clickable="false" />
diff --git a/res/layout/device_admin_settings.xml b/res/layout/device_admin_settings.xml
index 669ac3c..b89f48b 100644
--- a/res/layout/device_admin_settings.xml
+++ b/res/layout/device_admin_settings.xml
@@ -18,20 +18,28 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical">
+
     <FrameLayout
             android:layout_width="match_parent"
             android:layout_height="0px"
             android:layout_weight="1">
+
         <ListView android:id="@android:id/list"
                 android:layout_width="match_parent" 
                 android:layout_height="match_parent"
+                android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+                android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+                android:scrollbarStyle="outsideOverlay"
                 android:drawSelectorOnTop="false"
                 android:fastScrollEnabled="true" />
+
         <TextView android:id="@android:id/empty"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:gravity="center"
                 android:text="@string/no_device_admins"
                 android:textAppearance="?android:attr/textAppearanceMedium" />
+
     </FrameLayout>
+
 </LinearLayout>
diff --git a/res/layout/ownerinfo.xml b/res/layout/ownerinfo.xml
index 938fd96..b38e3f0 100644
--- a/res/layout/ownerinfo.xml
+++ b/res/layout/ownerinfo.xml
@@ -14,15 +14,17 @@
      limitations under the License.
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:orientation="vertical"
-    android:paddingStart="6dip"
-    android:paddingEnd="6dip"
-    android:layout_width="match_parent" android:layout_height="wrap_content"
     android:scrollbars="vertical" >
 
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:scrollbarStyle="outsideOverlay"
         android:fillViewport="true">
 
         <LinearLayout
diff --git a/res/layout/trust_agent_item.xml b/res/layout/trust_agent_item.xml
index 5674d03..e2ef953 100644
--- a/res/layout/trust_agent_item.xml
+++ b/res/layout/trust_agent_item.xml
@@ -78,7 +78,6 @@
             android:layout_width="wrap_content"
             android:layout_height="fill_parent"
             android:paddingStart="15dip"
-            android:paddingEnd="?android:attr/scrollbarSize"
             android:src="@drawable/ic_sysbar_quicksettings"
             android:contentDescription="@string/input_method_settings_button"
             android:layout_gravity="center"
diff --git a/res/layout/trusted_credential.xml b/res/layout/trusted_credential.xml
index e559a6e..d8f315a 100644
--- a/res/layout/trusted_credential.xml
+++ b/res/layout/trusted_credential.xml
@@ -18,22 +18,22 @@
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:gravity="center_vertical"
-    android:paddingEnd="?android:attr/scrollbarSize"
     android:background="?android:attr/selectableItemBackground"
-    android:padding="15dip"
-    >
+    android:paddingTop="15dip"
+    android:paddingBottom="15dip">
+
     <RelativeLayout
         android:layout_width="0px"
         android:layout_height="wrap_content"
-        android:layout_weight="1"
-        >
+        android:layout_weight="1">
+
         <TextView
             android:id="@+id/trusted_credential_subject_primary"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-        />
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
         <TextView
             android:id="@+id/trusted_credential_subject_secondary"
             android:layout_width="fill_parent"
@@ -41,9 +41,10 @@
             android:layout_below="@id/trusted_credential_subject_primary"
             android:layout_alignStart="@id/trusted_credential_subject_primary"
             android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textColor="?android:attr/textColorSecondary"
-        />
+            android:textColor="?android:attr/textColorSecondary" />
+
     </RelativeLayout>
+
     <!-- checkbox is invisible and not gone so that the height is consistent between tabs -->
     <CheckBox
         android:id="@+id/trusted_credential_status"
@@ -52,6 +53,6 @@
         android:visibility="invisible"
         android:clickable="false"
         android:focusable="false"
-        android:layout_weight="0"
-    />
+        android:layout_weight="0" />
+
 </LinearLayout>
diff --git a/res/layout/trusted_credentials.xml b/res/layout/trusted_credentials.xml
index a96fefe..f2c1562 100644
--- a/res/layout/trusted_credentials.xml
+++ b/res/layout/trusted_credentials.xml
@@ -16,65 +16,77 @@
 <TabHost
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    >
+    android:layout_height="match_parent">
+
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:padding="5dp"
-        >
+        android:layout_height="fill_parent">
+
         <TabWidget
             android:id="@android:id/tabs"
             android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-         />
+            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:layout_height="fill_parent">
+
             <FrameLayout
                 android:id="@+id/system_tab"
                 android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
-                >
+                android:layout_height="fill_parent">
+
                 <ProgressBar
                     android:id="@+id/system_progress"
-		    style="?android:attr/progressBarStyleHorizontal"
+                    style="?android:attr/progressBarStyleHorizontal"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
-                    android:visibility="gone"
-                />
+                    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+                    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+                    android:visibility="gone" />
+
                 <ListView
                     android:id="@+id/system_list"
                     android:layout_width="fill_parent"
                     android:layout_height="fill_parent"
-                    android:visibility="gone"
-                    >
+                    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+                    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+                    android:scrollbarStyle="outsideOverlay"
+                    android:visibility="gone">
                 </ListView>
+
             </FrameLayout>
+
             <FrameLayout
                 android:id="@+id/user_tab"
                 android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
-                >
+                android:layout_height="fill_parent">
+
                 <ProgressBar
                     android:id="@+id/user_progress"
                     style="?android:attr/progressBarStyleLarge"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:visibility="gone"
-                />
+                    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+                    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+                    android:visibility="gone" />
+
                 <ListView
                     android:id="@+id/user_list"
                     android:layout_width="fill_parent"
                     android:layout_height="fill_parent"
-                    android:visibility="gone"
-                    >
+                    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+                    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+                    android:scrollbarStyle="outsideOverlay"
+                    android:visibility="gone">
                 </ListView>
+
             </FrameLayout>
+
         </FrameLayout>
+
     </LinearLayout>
+
 </TabHost>