Import label items from label spinners. This is a small change to
ensure I can play well with other changes in this tree. Next up, I'll
bring over the ActionBar machinery.
Change-Id: Ibca5613ccda3ad4f724a9a08cbe6e0c9dba6d6b3
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index de778dd..b6f12f9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,5 +17,7 @@
<activity android:name=".ComposeActivity"
android:theme="@android:style/Theme.Holo.Light" />
+ <activity android:name=".browse.LabelItem"
+ android:theme="@android:style/Theme.Holo.Light" />
</application>
</manifest>
diff --git a/res/layout/label_switch_spinner_dropdown_item.xml b/res/layout/label_switch_spinner_dropdown_item.xml
new file mode 100644
index 0000000..3db816b
--- /dev/null
+++ b/res/layout/label_switch_spinner_dropdown_item.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2011 Google Inc.
+ * Licensed to 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.
+ */
+-->
+
+
+<!-- Each item in the label switch spinner. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ style="?android:attr/spinnerDropDownItemStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="@dimen/account_dropdown_item_height"
+ android:gravity="center_vertical">
+
+ <TextView
+ android:id="@+id/name"
+ android:layout_height="wrap_content"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:maxLines="2"
+ android:ellipsize="end"
+ style="@style/AccountSpinnerDropdownTextPrimary" />
+
+ <TextView
+ android:id="@+id/unread"
+ style="@style/UnreadCount" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/layout_tests.xml b/res/layout/layout_tests.xml
index e57f4d2..a5f8c8c 100644
--- a/res/layout/layout_tests.xml
+++ b/res/layout/layout_tests.xml
@@ -26,11 +26,18 @@
<Button android:id="@+id/compose"
android:text="@string/test_compose"
android:layout_height="wrap_content"
- android:layout_width="wrap_content"/>
+ android:layout_width="wrap_content"
+ android:onClick="composeTest"/>
<Button android:id="@+id/account_spinner"
android:text="@string/test_accountspinner"
android:layout_height="wrap_content"
- android:layout_width="wrap_content"/>
+ android:layout_width="wrap_content"
+ android:onClick="accountSpinnerTest"/>
+ <Button android:id="@+id/label_spinner"
+ android:text="@string/test_labelspinner"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:onClick="labelSpinnerTest"/>
</LinearLayout>
</ScrollView>
\ No newline at end of file
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index b18c649..14a2439 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -17,7 +17,9 @@
* limitations under the License.
*/
-->
+
<resources>
+ <dimen name="account_dropdown_item_height">48dip</dimen>
<dimen name="wide_senders_font_size">16sp</dimen>
<dimen name="wide_subject_font_size">16sp</dimen>
<dimen name="senders_font_size">18sp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2b0425a..21c8363 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -61,4 +61,5 @@
<!-- Layout tests strings -->
<string name="test_compose" translate="false">Test Compose Layout</string>
<string name="test_accountspinner" translate="false">Test Account Spinner Layout</string>
+ <string name="test_labelspinner" translate="false">Test Label Spinner Layout</string>
</resources>
\ 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 5619821..f3c350f 100644
--- a/src/com/google/android/unifiedemail/UnifiedEmail.java
+++ b/src/com/google/android/unifiedemail/UnifiedEmail.java
@@ -16,6 +16,8 @@
package com.google.android.unifiedemail;
+import com.google.android.unifiedemail.browse.LabelItem;
+
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
@@ -24,28 +26,26 @@
import android.view.View.OnClickListener;
import android.widget.Button;
-public class UnifiedEmail extends Activity implements OnClickListener {
+public class UnifiedEmail extends Activity {
+ void startActivityWithClass(Class <?> cls){
+ Intent intent = new Intent();
+ intent.setComponent(new ComponentName(this, cls));
+ startActivity(intent);
+ }
@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);
+ public void labelSpinnerTest(View v){
+ startActivityWithClass(LabelItem.class);
+ }
+ public void accountSpinnerTest(View v){
+ startActivityWithClass(ComposeActivity.class);
+ }
+ public void composeTest(View v){
+ startActivityWithClass(ComposeActivity.class);
}
}
\ No newline at end of file
diff --git a/src/com/google/android/unifiedemail/browse/LabelItem.java b/src/com/google/android/unifiedemail/browse/LabelItem.java
new file mode 100644
index 0000000..ef3b4f8
--- /dev/null
+++ b/src/com/google/android/unifiedemail/browse/LabelItem.java
@@ -0,0 +1,31 @@
+/**
+ * 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.browse;
+
+import android.app.Activity;
+import android.os.Bundle;
+import com.google.android.unifiedemail.R;
+
+public class LabelItem extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.label_switch_spinner_dropdown_item);
+ }
+
+}