Bug 1210242 - Support assist icon for Search Activity in Lollipop. r=mcomella
authorChristian Schmitz <tynn.dev@gmail.com>
Thu, 15 Oct 2015 19:26:38 +0200
changeset 292953 1dd1ef5e115039a54fcf30c2571768711bc3e6d2
parent 292952 bb09cf018056889554a4b2cfa7a629a043e4c49c
child 292954 c951580b6f9b81f7dcab62b40d03ad96d666e1ca
push id8824
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:18:56 +0000
treeherdermozilla-aurora@e2031358e2a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1210242
milestone45.0a1
Bug 1210242 - Support assist icon for Search Activity in Lollipop. r=mcomella
mobile/android/base/resources/values-v21/integers.xml
mobile/android/base/resources/values/integers.xml
mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/values-v21/integers.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<resources>
+
+    <integer name="search_assist_launch_res">@drawable/search_launcher</integer>
+
+</resources>
--- a/mobile/android/base/resources/values/integers.xml
+++ b/mobile/android/base/resources/values/integers.xml
@@ -7,10 +7,11 @@
 
     <integer name="number_of_top_sites">6</integer>
     <integer name="number_of_top_sites_cols">2</integer>
     <integer name="max_icon_grid_columns">4</integer>
     <integer name="panel_icon_grid_view_columns">3</integer>
     <integer name="number_of_inline_share_devices">2</integer>
     <integer name="max_search_suggestions">2</integer>
     <integer name="max_saved_suggestions">2</integer>
+    <integer name="search_assist_launch_res">0</integer>
 
 </resources>
--- a/mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in
+++ b/mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in
@@ -7,16 +7,26 @@
             android:configChanges="orientation|screenSize"
             android:theme="@style/AppTheme">
             <intent-filter>
                 <action android:name="android.intent.action.ASSIST"/>
 
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
 
+            <!-- Pre Lollipop devices display a generic search icon, if none is
+                 provided here. To use this we need to set the resource to 0.
+                 For Lollipop and later the search launcher icon ist used.
+                 To retrieve the resource value the Bundle.getInt() method is
+                 used, so we use integer resources instead of drawables, because
+                 setting a drawable referenced to 0 results in errors when used
+                 as a real drawable resource somewhere else. -->
+            <meta-data
+                android:name="com.android.systemui.action_assist_icon"
+                android:resource="@integer/search_assist_launch_res"/>
         </activity>
 
         <!-- Basic launcher widget. -->
         <receiver android:name="org.mozilla.search.SearchWidget"
                   android:label="@string/search_widget_name">
 
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />