Rearrange Percent demos.

* Group into Frame / Relative buckets
* Add layouts that show usage of parent / host paddings

Bug: 27871140
Change-Id: I753601709e743c902b634bf1a53776882443157e
diff --git a/samples/SupportPercentDemos/AndroidManifest.xml b/samples/SupportPercentDemos/AndroidManifest.xml
index e65c8c6..71fea32 100644
--- a/samples/SupportPercentDemos/AndroidManifest.xml
+++ b/samples/SupportPercentDemos/AndroidManifest.xml
@@ -52,6 +52,22 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".PercentFrameLayoutActivityHPaddings"
+                  android:label="@string/percent_frame_hpaddings_demo">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="com.example.android.supportpercent.SAMPLE_CODE"/>
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".PercentFrameLayoutActivityVPaddings"
+                  android:label="@string/percent_frame_vpaddings_demo">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="com.example.android.supportpercent.SAMPLE_CODE"/>
+            </intent-filter>
+        </activity>
+
         <activity android:name=".SimplePercentRelativeLayoutActivity"
                   android:label="@string/simple_percent_relative_demo">
             <intent-filter>
@@ -60,5 +76,21 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".PercentRelativeLayoutActivityHPaddings"
+                  android:label="@string/percent_relative_hpaddings_demo">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="com.example.android.supportpercent.SAMPLE_CODE"/>
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".PercentRelativeLayoutActivityVPaddings"
+                  android:label="@string/percent_relative_vpaddings_demo">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="com.example.android.supportpercent.SAMPLE_CODE"/>
+            </intent-filter>
+        </activity>
+
     </application>
 </manifest>
diff --git a/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_activity.xml b/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_activity.xml
index 2298a6c..cf509cb 100644
--- a/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_activity.xml
+++ b/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_activity.xml
@@ -15,9 +15,8 @@
      limitations under the License.
 -->
 <android.support.percent.PercentFrameLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        >
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <include layout="@layout/include_percent_frame_layout_content" />
 </android.support.percent.PercentFrameLayout>
diff --git a/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml b/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml
index 5ad98df..2e5a659 100644
--- a/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml
+++ b/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml
@@ -16,21 +16,18 @@
 -->
 <merge
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    >
+    xmlns:app="http://schemas.android.com/apk/res-auto">
     <View
         app:layout_widthPercent="60%"
         app:layout_heightPercent="60%"
         app:layout_marginTopPercent="20%"
         app:layout_marginLeftPercent="20%"
-        android:background="#FF0000"
-        />
+        android:background="#FF0000" />
     <View
         android:layout_gravity="bottom|right"
         app:layout_widthPercent="20%"
         app:layout_heightPercent="20%"
         app:layout_marginRightPercent="40%"
         app:layout_marginBottomPercent="40%"
-        android:background="#0000FF"
-        />
+        android:background="#0000FF" />
 </merge>
diff --git a/samples/SupportPercentDemos/res/layout/percent_frame_layout_activity_hpaddings.xml b/samples/SupportPercentDemos/res/layout/percent_frame_layout_activity_hpaddings.xml
new file mode 100644
index 0000000..5cc476d
--- /dev/null
+++ b/samples/SupportPercentDemos/res/layout/percent_frame_layout_activity_hpaddings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 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.
+-->
+<android.support.percent.PercentFrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingLeft="48dip"
+    android:paddingRight="64dip">
+    <View
+        android:id="@+id/child1"
+        app:layout_widthPercent="50%"
+        android:layout_height="match_parent"
+        android:layout_gravity="left"
+        android:background="#80FF0000" />
+    <View
+        android:id="@+id/child2"
+        app:layout_widthPercent="50%"
+        android:layout_height="match_parent"
+        android:layout_gravity="right"
+        android:background="#800000FF" />
+</android.support.percent.PercentFrameLayout>
diff --git a/samples/SupportPercentDemos/res/layout/percent_frame_layout_activity_vpaddings.xml b/samples/SupportPercentDemos/res/layout/percent_frame_layout_activity_vpaddings.xml
new file mode 100644
index 0000000..d71c368
--- /dev/null
+++ b/samples/SupportPercentDemos/res/layout/percent_frame_layout_activity_vpaddings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 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.
+-->
+<android.support.percent.PercentFrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingTop="48dip"
+    android:paddingBottom="64dip">
+    <View
+        android:id="@+id/child1"
+        android:layout_width="match_parent"
+        app:layout_heightPercent="50%"
+        android:layout_gravity="top"
+        android:background="#80FF0000" />
+    <View
+        android:id="@+id/child2"
+        android:layout_width="match_parent"
+        app:layout_heightPercent="50%"
+        android:layout_gravity="bottom"
+        android:background="#800000FF" />
+</android.support.percent.PercentFrameLayout>
diff --git a/samples/SupportPercentDemos/res/layout/percent_relative_layout_activity_hpaddings.xml b/samples/SupportPercentDemos/res/layout/percent_relative_layout_activity_hpaddings.xml
new file mode 100644
index 0000000..2d6f1e0
--- /dev/null
+++ b/samples/SupportPercentDemos/res/layout/percent_relative_layout_activity_hpaddings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 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.
+-->
+<android.support.percent.PercentRelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingLeft="48dip"
+    android:paddingRight="64dip">
+    <View
+        android:id="@+id/child1"
+        app:layout_widthPercent="50%"
+        android:layout_height="match_parent"
+        android:layout_alignParentLeft="true"
+        android:background="#80FF0000" />
+    <View
+        android:id="@+id/child2"
+        app:layout_widthPercent="50%"
+        android:layout_height="match_parent"
+        android:layout_toRightOf="@id/child1"
+        android:background="#800000FF" />
+</android.support.percent.PercentRelativeLayout>
diff --git a/samples/SupportPercentDemos/res/layout/percent_relative_layout_activity_vpaddings.xml b/samples/SupportPercentDemos/res/layout/percent_relative_layout_activity_vpaddings.xml
new file mode 100644
index 0000000..33defde
--- /dev/null
+++ b/samples/SupportPercentDemos/res/layout/percent_relative_layout_activity_vpaddings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 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.
+-->
+<android.support.percent.PercentRelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingTop="48dip"
+    android:paddingBottom="64dip">
+    <View
+        android:id="@+id/child1"
+        android:layout_width="match_parent"
+        app:layout_heightPercent="50%"
+        android:layout_alignParentTop="true"
+        android:background="#80FF0000" />
+    <View
+        android:id="@+id/child2"
+        android:layout_width="match_parent"
+        app:layout_heightPercent="50%"
+        android:layout_below="@id/child1"
+        android:background="#800000FF" />
+</android.support.percent.PercentRelativeLayout>
diff --git a/samples/SupportPercentDemos/res/layout/simple_percent_frame_layout_activity.xml b/samples/SupportPercentDemos/res/layout/simple_percent_frame_layout_activity.xml
index 0502e0d..d662b36 100644
--- a/samples/SupportPercentDemos/res/layout/simple_percent_frame_layout_activity.xml
+++ b/samples/SupportPercentDemos/res/layout/simple_percent_frame_layout_activity.xml
@@ -15,24 +15,21 @@
      limitations under the License.
 -->
 <android.support.percent.PercentFrameLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:app="http://schemas.android.com/apk/res-auto"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        >
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <View
         app:layout_widthPercent="50%"
         app:layout_heightPercent="50%"
         app:layout_marginTopPercent="25%"
         app:layout_marginLeftPercent="25%"
-        android:background="#FF0000"
-        />
+        android:background="#FF0000" />
     <View
         android:layout_gravity="bottom|right"
         app:layout_widthPercent="33.33%"
         app:layout_heightPercent="33.33%"
         app:layout_marginRightPercent="33.33%"
         app:layout_marginBottomPercent="33.33%"
-        android:background="#0000FF"
-        />
+        android:background="#0000FF" />
 </android.support.percent.PercentFrameLayout>
diff --git a/samples/SupportPercentDemos/res/layout/simple_percent_relative_layout_activity.xml b/samples/SupportPercentDemos/res/layout/simple_percent_relative_layout_activity.xml
index 9fae5ff..40904c1 100644
--- a/samples/SupportPercentDemos/res/layout/simple_percent_relative_layout_activity.xml
+++ b/samples/SupportPercentDemos/res/layout/simple_percent_relative_layout_activity.xml
@@ -18,21 +18,18 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    >
+    android:layout_height="match_parent">
     <View
         android:id="@+id/left"
         app:layout_widthPercent="25%"
         app:layout_heightPercent="50%"
         app:layout_marginLeftPercent="25%"
         app:layout_marginTopPercent="25%"
-        android:background="#FF0000"
-        />
+        android:background="#FF0000" />
     <View
         app:layout_widthPercent="25%"
         app:layout_heightPercent="50%"
         app:layout_marginTopPercent="25%"
         android:layout_toRightOf="@id/left"
-        android:background="#0000FF"
-        />
+        android:background="#0000FF" />
 </android.support.percent.PercentRelativeLayout>
diff --git a/samples/SupportPercentDemos/res/values/strings.xml b/samples/SupportPercentDemos/res/values/strings.xml
index 9405983..782532e 100644
--- a/samples/SupportPercentDemos/res/values/strings.xml
+++ b/samples/SupportPercentDemos/res/values/strings.xml
@@ -17,7 +17,11 @@
 <resources>
     <string name="activity_sample_code">Support Percent Demos</string>
 
-    <string name="simple_percent_frame_demo">Simple PercentFrameLayout demo</string>
-    <string name="include_percent_frame_demo">PercentFrameLayout with include demo</string>
-    <string name="simple_percent_relative_demo">Simple PercentRelativeLayout demo</string>
+    <string name="simple_percent_frame_demo">PercentFrameLayout / Basic</string>
+    <string name="include_percent_frame_demo">PercentFrameLayout / With include</string>
+    <string name="percent_frame_vpaddings_demo">PercentFrameLayout / With vertical paddings</string>
+    <string name="percent_frame_hpaddings_demo">PercentFrameLayout / With horizontal paddings</string>
+    <string name="simple_percent_relative_demo">PercentRelativeLayout / Basic</string>
+    <string name="percent_relative_vpaddings_demo">PercentRelativeLayout / With vertical paddings</string>
+    <string name="percent_relative_hpaddings_demo">PercentRelativeLayout / With horizontal paddings</string>
 </resources>
diff --git a/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentFrameLayoutActivityHPaddings.java b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentFrameLayoutActivityHPaddings.java
new file mode 100644
index 0000000..bf5e5ea
--- /dev/null
+++ b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentFrameLayoutActivityHPaddings.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 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.example.android.support.percent;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class PercentFrameLayoutActivityHPaddings extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.percent_frame_layout_activity_hpaddings);
+    }
+}
diff --git a/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentFrameLayoutActivityVPaddings.java b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentFrameLayoutActivityVPaddings.java
new file mode 100644
index 0000000..34f9ea7
--- /dev/null
+++ b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentFrameLayoutActivityVPaddings.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 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.example.android.support.percent;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class PercentFrameLayoutActivityVPaddings extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.percent_frame_layout_activity_vpaddings);
+    }
+}
diff --git a/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentRelativeLayoutActivityHPaddings.java b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentRelativeLayoutActivityHPaddings.java
new file mode 100644
index 0000000..232fdbe
--- /dev/null
+++ b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentRelativeLayoutActivityHPaddings.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 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.example.android.support.percent;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class PercentRelativeLayoutActivityHPaddings extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.percent_relative_layout_activity_hpaddings);
+    }
+}
diff --git a/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentRelativeLayoutActivityVPaddings.java b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentRelativeLayoutActivityVPaddings.java
new file mode 100644
index 0000000..928a511
--- /dev/null
+++ b/samples/SupportPercentDemos/src/com/example/android/support/percent/PercentRelativeLayoutActivityVPaddings.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 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.example.android.support.percent;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class PercentRelativeLayoutActivityVPaddings extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.percent_relative_layout_activity_vpaddings);
+    }
+}