Merge "Extend MailActionBarView with the more debug friendly SearchActionBarView." into jb-ub-mail
diff --git a/res/layout/search_actionbar_view.xml b/res/layout/search_actionbar_view.xml
new file mode 100644
index 0000000..4709ddd
--- /dev/null
+++ b/res/layout/search_actionbar_view.xml
@@ -0,0 +1,33 @@
+<?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.
+-->
+
+<!--
+     The custom action bar view for search mode (containing drop down account spinner,
+    label, and subject).
+-->
+<com.android.mail.ui.SearchMailActionBarView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal" >
+
+    <include layout="@layout/actionbar_label" />
+
+    <include layout="@layout/actionbar_subject" />
+
+</com.android.mail.ui.SearchMailActionBarView>
\ No newline at end of file
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index ffc2619..bc501ad 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -304,7 +304,10 @@
 
         // be sure to inherit from the ActionBar theme when inflating
         final LayoutInflater inflater = LayoutInflater.from(actionBar.getThemedContext());
-        mActionBarView = (MailActionBarView) inflater.inflate(R.layout.actionbar_view, null);
+        final boolean isSearch = mActivity.getIntent() != null
+                && Intent.ACTION_SEARCH.equals(mActivity.getIntent().getAction());
+        mActionBarView = (MailActionBarView) inflater.inflate(
+                isSearch ? R.layout.search_actionbar_view : R.layout.actionbar_view, null);
         // Why have a different variable for the same thing? We should apply
         // the same actions
         // on mActionBarView instead.
diff --git a/src/com/android/mail/ui/SearchMailActionBarView.java b/src/com/android/mail/ui/SearchMailActionBarView.java
new file mode 100644
index 0000000..e95d303
--- /dev/null
+++ b/src/com/android/mail/ui/SearchMailActionBarView.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+package com.android.mail.ui;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+public class SearchMailActionBarView extends MailActionBarView {
+
+    public SearchMailActionBarView(Context context) {
+        this(context, null);
+    }
+
+    public SearchMailActionBarView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public SearchMailActionBarView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+}