Import compose layouts. Create way to easily push/ test shared layouts.

Change-Id: I00aee82fe2caabc0a1000d8d95365051a4ad839a
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d3eb814..de778dd 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -15,5 +15,7 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".ComposeActivity"
+                  android:theme="@android:style/Theme.Holo.Light" />
     </application>
 </manifest>
diff --git a/res/layout/compose.xml b/res/layout/compose.xml
new file mode 100644
index 0000000..5781b63
--- /dev/null
+++ b/res/layout/compose.xml
@@ -0,0 +1,76 @@
+<?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:layout_height="match_parent"
+    android:layout_width="match_parent"
+    android:orientation="vertical">
+
+    <ScrollView
+      android:id="@+id/compose_scrollview"
+      android:fillViewport="true"
+      android:layout_height="0dip"
+      android:layout_weight="1"
+      android:layout_width="match_parent">
+
+        <LinearLayout android:id="@+id/content"
+            android:orientation="vertical"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginTop="4dip"
+            android:paddingLeft="16dip"
+            android:paddingRight="16dip">
+
+            <include layout="@layout/compose_from"/>
+
+            <LinearLayout android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android:orientation="horizontal">
+
+                <include layout="@layout/compose_recipients"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"/>
+
+            </LinearLayout>
+
+            <!--  Attachments -->
+            <!--<com.google.android.gm.AttachmentsView android:id="@+id/attachments"
+                android:layout_height="wrap_content"
+                android:layout_width="match_parent"
+                android:orientation="vertical"
+                android:paddingTop="2dip"
+                android:paddingRight="5dip"
+                android:paddingBottom="0dip"
+                android:paddingLeft="5dip" />-->
+
+            <!-- Body -->
+            <include layout="@layout/compose_body"/>
+
+            <!-- Quoted text -->
+            <!--<com.google.android.gm.QuotedTextView android:id="@+id/quoted_text_view"
+                android:layout_height="wrap_content"
+                android:layout_width="match_parent" />-->
+
+            <View android:id="@+id/composearea_tap_trap_bottom"
+                android:clickable="true"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"/>
+
+        </LinearLayout>
+
+    </ScrollView>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/compose_body.xml b/res/layout/compose_body.xml
new file mode 100644
index 0000000..119cac7
--- /dev/null
+++ b/res/layout/compose_body.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    style="@style/ComposeFieldLayout">
+
+    <EditText android:id="@+id/body_text"
+        style="@style/ComposeBodyStyle"
+        android:hint="@string/body_hint"/>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/compose_from.xml b/res/layout/compose_from.xml
new file mode 100644
index 0000000..7c5645f
--- /dev/null
+++ b/res/layout/compose_from.xml
@@ -0,0 +1,49 @@
+<?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:layout_width="match_parent"
+    android:layout_marginTop="4dip"
+    android:layout_height="48dip">
+
+    <!-- From spinner -->
+    <LinearLayout android:id="@+id/spinner_from_content"
+        style="@style/RecipientComposeFieldLayout"
+        android:background="@android:color/transparent"
+        android:layout_height="match_parent">
+
+        <Spinner android:id="@+id/from_picker"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"/>
+
+    </LinearLayout>
+
+    <!-- static From -->
+    <LinearLayout android:id="@+id/static_from_content"
+        style="@style/RecipientComposeFieldLayout"
+        android:layout_height="match_parent">
+
+        <TextView android:id="@+id/account_name"
+            android:layout_width="match_parent"
+            android:paddingLeft="8dip"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:textSize="18sp"
+            android:background="@android:color/transparent"
+            android:layout_height="match_parent" />
+
+    </LinearLayout>
+
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/compose_recipients.xml b/res/layout/compose_recipients.xml
new file mode 100644
index 0000000..6d425df
--- /dev/null
+++ b/res/layout/compose_recipients.xml
@@ -0,0 +1,113 @@
+<?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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/compose_recipients_wrapper"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <!-- To -->
+
+    <LinearLayout android:id="@+id/to_content"
+        style="@style/RecipientComposeFieldLayout">
+        <LinearLayout android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:addStatesFromChildren="true"
+            android:gravity="center_vertical"
+            android:layout_gravity="center_vertical">
+
+            <TextView style="@style/RecipientComposeHeading"
+                android:text="@string/to"
+                android:id="@+id/to_label"
+                android:contentDescription="@string/to"/>
+
+            <com.android.ex.chips.RecipientEditTextView
+                android:id="@+id/to"
+                style="@style/RecipientEditTextViewStyle"/>
+
+        </LinearLayout>
+
+        <View style="@style/RecipientComposeFieldSpacer"/>
+    </LinearLayout>
+
+
+    <RelativeLayout android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:id="@+id/cc_bcc_wrapper"
+        android:layout_below="@id/to_content">
+
+        <LinearLayout style="@style/RecipientComposeFieldLayout"
+            android:id="@+id/cc_content"
+            android:visibility="gone"
+            android:alpha="0"
+            android:layout_alignParentTop="true">
+
+            <LinearLayout android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:addStatesFromChildren="true"
+                android:gravity="center_vertical">
+
+                <TextView
+                    style="@style/RecipientComposeHeading"
+                    android:text="@string/cc"
+                    android:id="@+id/cc_label"
+                    android:contentDescription="@string/cc"/>
+
+                <com.android.ex.chips.RecipientEditTextView
+                    android:id="@+id/cc"
+                    style="@style/RecipientEditTextViewStyle"/>
+            </LinearLayout>
+
+            <View style="@style/RecipientComposeFieldSpacer"/>
+        </LinearLayout>
+
+        <LinearLayout style="@style/RecipientComposeFieldLayout"
+            android:id="@+id/bcc_content"
+            android:visibility="gone"
+            android:alpha="0"
+            android:layout_below="@id/cc_content">
+
+            <LinearLayout android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:addStatesFromChildren="true"
+                android:gravity="center_vertical">
+
+                <TextView style="@style/RecipientComposeHeading"
+                    android:text="@string/bcc"
+                    android:id="@+id/bcc_label"
+                    android:contentDescription="@string/bcc"/>
+
+                <com.android.ex.chips.RecipientEditTextView
+                    android:id="@+id/bcc"
+                    style="@style/RecipientEditTextViewStyle"/>
+
+            </LinearLayout>
+
+            <View style="@style/RecipientComposeFieldSpacer"/>
+        </LinearLayout>
+
+    </RelativeLayout>
+
+    <RelativeLayout style="@style/ComposeFieldLayout"
+                android:layout_below="@id/cc_bcc_wrapper">
+        <!-- Subject: localization cannot control what field pressing tab will bring the user to. This is controlled at runtime.  -->
+        <EditText android:id="@+id/subject"
+            android:inputType="textEmailSubject|textAutoCorrect|textCapSentences|textImeMultiLine|textMultiLine"
+            android:hint="@string/subject_hint"
+            android:textColorHint="@color/compose_label_text"
+            android:imeOptions="actionDone|flagNoExtractUi"
+            style="@style/ComposeEditTextView" />
+    </RelativeLayout>
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/layout_tests.xml b/res/layout/layout_tests.xml
new file mode 100644
index 0000000..e57f4d2
--- /dev/null
+++ b/res/layout/layout_tests.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/compose_scrollview"
+    android:fillViewport="true"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent">
+
+    <LinearLayout
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:orientation="vertical">
+        <Button android:id="@+id/compose"
+            android:text="@string/test_compose"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"/>
+        <Button android:id="@+id/account_spinner"
+            android:text="@string/test_accountspinner"
+            android:layout_height="wrap_content"
+            android:layout_width="wrap_content"/>
+    </LinearLayout>
+
+</ScrollView>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ee7809c..2b0425a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -19,6 +19,8 @@
 -->
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_name">Unified Email</string>
+
+    <!-- Compose -->
     <!-- Shown in Compose; the recipient(s) of the message [CHAR LIMIT=10] -->
     <string name="to">To</string>
     <!-- Shown in Compose; the cc recipient(s) of the message [CHAR LIMIT=10] -->
@@ -33,7 +35,6 @@
     <!-- Webview Context Menu Strings -->
     <!-- Title of dialog for choosing which activity to share a link with. [CHAR LIMIT=50]-->
     <string name="choosertitle_sharevia">Share via</string>
-
     <!-- Menu item to open a link  [CHAR LIMIT=50]-->
     <string name="contextmenu_openlink">Open in Browser</string>
     <!-- Menu item to copy the selection  [CHAR LIMIT=50]-->
@@ -52,10 +53,12 @@
     <string name="contextmenu_map">Map</string>
     <!-- Menu item to share link  [CHAR LIMIT=50]-->
     <string name="contextmenu_sharelink">Share link</string>
-
     <!-- Menu item that displays the help page for Gmail.  [CHAR LIMIT=50]-->
     <string name="contextmenu_help">Help</string>
-
     <!-- Solicit feedback string in about screen [CHAR LIMIT=50]-->
     <string name="contextmenu_feedback">Send feedback</string>
+
+    <!-- Layout tests strings -->
+    <string name="test_compose" translate="false">Test Compose Layout</string>
+    <string name="test_accountspinner" translate="false">Test Account Spinner Layout</string>
 </resources>
\ No newline at end of file
diff --git a/src/com/google/android/unifiedemail/ComposeActivity.java b/src/com/google/android/unifiedemail/ComposeActivity.java
new file mode 100644
index 0000000..2f897c9
--- /dev/null
+++ b/src/com/google/android/unifiedemail/ComposeActivity.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2011, Google Inc.
+ *
+ * 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.google.android.unifiedemail;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class ComposeActivity extends Activity {
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.compose);
+    }
+}
\ No newline at end of file
diff --git a/src/com/google/android/unifiedemail/UnifiedEmail.java b/src/com/google/android/unifiedemail/UnifiedEmail.java
index 7999af1..5619821 100644
--- a/src/com/google/android/unifiedemail/UnifiedEmail.java
+++ b/src/com/google/android/unifiedemail/UnifiedEmail.java
@@ -17,12 +17,35 @@
 package com.google.android.unifiedemail;
 
 import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
 import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
 
-public class UnifiedEmail extends Activity {
+public class UnifiedEmail extends Activity implements OnClickListener {
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        setContentView(R.layout.layout_tests);
+        ((Button)findViewById(R.id.compose)).setOnClickListener(this);
+        ((Button)findViewById(R.id.account_spinner)).setOnClickListener(this);
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        Intent intent = new Intent();
+        switch (id) {
+            case R.id.compose:
+                intent.setComponent(new ComponentName(this, ComposeActivity.class));
+                break;
+            case R.id.account_spinner:
+                intent.setComponent(new ComponentName(this, ComposeActivity.class));
+                break;
+        }
+        startActivity(intent);
     }
 }
\ No newline at end of file