Merge m-c to inbound on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 16 Jul 2013 16:54:43 -0400
changeset 138757 7d684675747610dde1df2f452b476bca341b734f
parent 138756 e97286839337c46c3d136372bce06836437a595b (current diff)
parent 138720 0888e29c83a3f069ab1119fdea6bf94f6d981d18 (diff)
child 138758 552874c60c72a799af495954608f5a44574fcd7d
push idunknown
push userunknown
push dateunknown
milestone25.0a1
Merge m-c to inbound on a CLOSED TREE.
mobile/android/base/preferences/SearchPreferenceCategory.java
mobile/android/base/resources/xml-v11/preferences_customize.xml
mobile/android/base/resources/xml/preferences_customize.xml.in
mobile/android/base/resources/xml/preferences_search.xml
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -229,17 +229,16 @@ FENNEC_JAVA_FILES = \
   menu/GeckoMenuInflater.java \
   menu/GeckoMenuItem.java \
   menu/GeckoSubMenu.java \
   menu/MenuItemActionBar.java \
   menu/MenuItemActionView.java \
   menu/MenuItemDefault.java \
   menu/MenuPanel.java \
   menu/MenuPopup.java \
-  preferences/SearchPreferenceCategory.java \
   widget/AboutHome.java \
   widget/AboutHomeView.java \
   widget/AboutHomeSection.java \
   widget/ActivityChooserModel.java \
   widget/AddonsSection.java \
   widget/ButtonToast.java \
   widget/ArrowPopup.java \
   widget/DateTimePicker.java \
@@ -306,17 +305,16 @@ FENNEC_PP_JAVA_FILES = \
   AppConstants.java \
   SysInfo.java \
   WebApp.java \
   WebApps.java \
   $(NULL)
 
 FENNEC_PP_XML_FILES = \
   res/xml/preferences.xml \
-  res/xml/preferences_customize.xml \
   res/xml/searchable.xml \
   $(NULL)
 
 ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
 MIN_CPU_VERSION=7
 else
 MIN_CPU_VERSION=5
 endif
@@ -570,25 +568,24 @@ RES_VALUES_XLARGE_V11 = \
   res/values-xlarge-v11/styles.xml \
   $(NULL)
 
 RES_VALUES_V14 = \
   res/values-v14/styles.xml \
   $(NULL)
 
 RES_XML = \
+  res/xml/preferences_customize.xml \
   res/xml/preferences_display.xml \
-  res/xml/preferences_search.xml \
   res/xml/preferences_privacy.xml \
   res/xml/preferences_vendor.xml \
   $(SYNC_RES_XML) \
   $(NULL)
 
 RES_XML_V11 = \
-  res/xml-v11/preferences_customize.xml \
   res/xml-v11/preference_headers.xml \
   res/xml-v11/preferences_customize_tablet.xml \
   res/xml-v11/preferences.xml \
   $(NULL)
 
 RES_ANIM = \
   res/anim/awesomebar_fade_in.xml \
   res/anim/popup_show.xml \
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -63,22 +63,20 @@
 <!-- Localization note (num_tabs2) : Number of tabs is always more than one.
      We can't use android plural forms, sadly. See bug #753859. -->
 <!ENTITY num_tabs2 "&formatD; tabs">
 <!ENTITY new_tab_opened "New tab opened">
 
 <!ENTITY settings "Settings">
 <!ENTITY settings_title "Settings">
 <!ENTITY pref_category_customize "Customize">
-<!ENTITY pref_category_search "Search">
 <!ENTITY pref_category_display "Display">
 <!ENTITY pref_category_privacy_short "Privacy">
 <!ENTITY pref_category_vendor "&vendorShortName;">
 <!ENTITY pref_category_datareporting "Data choices">
-<!ENTITY pref_category_installed_search_engines "Installed search engines">
 
 <!-- collected old strings - remove after determining final strings
      as part of Bug 877791 -->
 <!ENTITY pref_category_general "General">
 <!ENTITY pref_category_privacy "Privacy &amp; Security">
 <!ENTITY pref_category_content "Content">
 <!-- Localization note (datareporting_title) : This string matches
      (dataChoicesTab.label) in chrome/browser/preferences/advanced.dtd except in
deleted file mode 100644
--- a/mobile/android/base/preferences/SearchPreferenceCategory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.mozilla.gecko.preferences;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.os.Build;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.util.AttributeSet;
-import android.util.Log;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.GeckoEvent;
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.gfx.BitmapUtils;
-import org.mozilla.gecko.util.GeckoEventListener;
-
-public class SearchPreferenceCategory extends PreferenceCategory implements GeckoEventListener {
-    public static final String LOGTAG = "SearchPrefCategory";
-
-    private static int sIconSize;
-
-    public SearchPreferenceCategory(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        init();
-    }
-    public SearchPreferenceCategory(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        init();
-    }
-
-    public SearchPreferenceCategory(Context context) {
-        super(context);
-        init();
-    }
-
-    private void init() {
-        sIconSize = getContext().getResources().getDimensionPixelSize(R.dimen.searchpreferences_icon_size);
-    }
-
-    @Override
-    protected void onAttachedToActivity() {
-        super.onAttachedToActivity();
-
-        // Request list of search engines from Gecko
-        GeckoAppShell.registerEventListener("SearchEngines:Data", this);
-        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
-    }
-
-    @Override
-    public void handleMessage(String event, final JSONObject data) {
-        if (event.equals("SearchEngines:Data")) {
-            JSONArray engines;
-            try {
-                engines = data.getJSONArray("searchEngines");
-            } catch (JSONException e) {
-                Log.e(LOGTAG, "Unable to decode search engine data from Gecko.", e);
-                return;
-            }
-
-            // Create an element in this PreferenceCategory for each engine.
-            for (int i = 0; i < engines.length(); i++) {
-                try {
-                    JSONObject engineJSON = engines.getJSONObject(i);
-                    final String engineName = engineJSON.getString("name");
-
-                    Preference engine = new Preference(getContext());
-                    engine.setTitle(engineName);
-                    engine.setKey(engineName);
-
-                    // The setIcon feature is not available prior to API 11.
-                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-                        String iconURI = engineJSON.getString("iconURI");
-                        Bitmap iconBitmap = BitmapUtils.getBitmapFromDataURI(iconURI);
-                        Bitmap scaledIconBitmap = Bitmap.createScaledBitmap(iconBitmap, sIconSize, sIconSize, false);
-                        BitmapDrawable drawable = new BitmapDrawable(scaledIconBitmap);
-                        engine.setIcon(drawable);
-                    }
-                    addPreference(engine);
-                    // TODO: Bug 892113 - Add event listener here for tapping on each element. Produce a dialog to provide options.
-                } catch (JSONException e) {
-                    Log.e(LOGTAG, "JSONException parsing engine at index " + i, e);
-                }
-            }
-        }
-    }
-}
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -56,17 +56,16 @@
     <dimen name="prompt_service_icon_size">72dp</dimen>
     <dimen name="prompt_service_icon_text_padding">10dp</dimen>
     <dimen name="prompt_service_inputs_padding">16dp</dimen>
     <dimen name="prompt_service_left_right_text_with_icon_padding">10dp</dimen>
     <dimen name="prompt_service_top_bottom_text_with_icon_padding">8dp</dimen>
     <dimen name="prompt_service_min_list_item_height">48dp</dimen>
     <dimen name="remote_tab_child_row_height">64dp</dimen>
     <dimen name="remote_tab_group_row_height">26dp</dimen>
-    <dimen name="searchpreferences_icon_size">32dp</dimen>
     <dimen name="tab_thumbnail_height">90dp</dimen>
     <dimen name="tab_thumbnail_width">160dp</dimen>
     <dimen name="tabs_counter_size">22sp</dimen>
     <dimen name="tabs_panel_indicator_width">60dp</dimen>
     <dimen name="tabs_panel_list_padding">16dip</dimen>
     <dimen name="tabs_list_divider_height">2dp</dimen>
     <dimen name="tabs_sidebar_width">200dp</dimen>
     <dimen name="tabs_tray_horizontal_height">156dp</dimen>
deleted file mode 100644
--- a/mobile/android/base/resources/xml-v11/preferences_customize.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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/. -->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:gecko="http://schemas.android.com/apk/res-auto"
-                  android:enabled="false">
-
-     <PreferenceScreen android:title="@string/pref_category_search"
-                       android:fragment="org.mozilla.gecko.GeckoPreferenceFragment" >
-         <extra android:name="resource"
-                android:value="preferences_search"/>
-     </PreferenceScreen>
-
-    <org.mozilla.gecko.AndroidImportPreference
-                  android:key="android.not_a_preference.import_android"
-                  gecko:entries="@array/pref_import_android_entries"
-                  gecko:entryKeys="@array/pref_import_android_keys"
-                  gecko:initialValues="@array/pref_import_android_values"
-                  android:title="@string/pref_import_android"
-                  android:positiveButtonText="@string/bookmarkhistory_button_import"
-                  android:negativeButtonText="@string/button_cancel"
-                  android:persistent="false" />
-
-    <CheckBoxPreference android:key="android.not_a_preference.restoreSession"
-                        android:title="@string/pref_restore_session"
-                        android:defaultValue="false"
-                        android:persistent="true" />
-
-   <ListPreference android:key="app.update.autodownload"
-                   android:title="@string/pref_update_autodownload"
-                   android:entries="@array/pref_update_autodownload_entries"
-                   android:entryValues="@array/pref_update_autodownload_values"
-                   android:persistent="false" />
-
-</PreferenceScreen>
-
--- a/mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
+++ b/mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
@@ -9,36 +9,30 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:title="@string/pref_category_customize"
                   android:enabled="false">
 
     <org.mozilla.gecko.SyncPreference android:title="@string/pref_sync"
                                       android:persistent="false" />
 
-    <PreferenceScreen android:title="@string/pref_category_search"
-                      android:fragment="org.mozilla.gecko.GeckoPreferenceFragment" >
-        <extra android:name="resource"
-               android:value="preferences_search"/>
-    </PreferenceScreen>
-
     <org.mozilla.gecko.AndroidImportPreference
             android:key="android.not_a_preference.import_android"
             gecko:entries="@array/pref_import_android_entries"
             gecko:entryKeys="@array/pref_import_android_keys"
             gecko:initialValues="@array/pref_import_android_values"
             android:title="@string/pref_import_android"
             android:positiveButtonText="@string/bookmarkhistory_button_import"
             android:negativeButtonText="@string/button_cancel"
             android:persistent="false" />
 
-    <CheckBoxPreference android:key="android.not_a_preference.restoreSession"
-                        android:title="@string/pref_restore_session"
-                        android:defaultValue="false"
-                        android:persistent="true" />
+    <CheckBoxPreference android:key="browser.search.suggest.enabled"
+                        android:title="@string/pref_search_suggestions"
+                        android:defaultValue="true"
+                        android:persistent="false" />
 
     <ListPreference android:key="app.update.autodownload"
                     android:title="@string/pref_update_autodownload"
                     android:entries="@array/pref_update_autodownload_entries"
                     android:entryValues="@array/pref_update_autodownload_values"
                     android:persistent="false" />
 
 </PreferenceScreen>
rename from mobile/android/base/resources/xml/preferences_customize.xml.in
rename to mobile/android/base/resources/xml/preferences_customize.xml
--- a/mobile/android/base/resources/xml/preferences_customize.xml.in
+++ b/mobile/android/base/resources/xml/preferences_customize.xml
@@ -1,37 +1,32 @@
-#filter substitution
 <?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/. -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:enabled="false">
-    <PreferenceScreen android:title="@string/pref_category_search" >
-        <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
-                android:targetClass="org.mozilla.gecko.GeckoPreferences" >
-            <extra
-                android:name="resource"
-                android:value="preferences_search" />
-        </intent>
-    </PreferenceScreen>
 
     <org.mozilla.gecko.AndroidImportPreference
                   android:key="android.not_a_preference.import_android"
                   gecko:entries="@array/pref_import_android_entries"
                   gecko:entryKeys="@array/pref_import_android_keys"
                   gecko:initialValues="@array/pref_import_android_values"
                   android:title="@string/pref_import_android"
                   android:positiveButtonText="@string/bookmarkhistory_button_import"
                   android:negativeButtonText="@string/button_cancel"
                   android:persistent="false" />
 
+    <CheckBoxPreference android:key="browser.search.suggest.enabled"
+                        android:title="@string/pref_search_suggestions"
+                        android:defaultValue="true"
+                        android:persistent="false" />
+
     <CheckBoxPreference android:key="android.not_a_preference.restoreSession"
                         android:title="@string/pref_restore_session"
                         android:defaultValue="false"
                         android:persistent="true" />
 
    <ListPreference android:key="app.update.autodownload"
                    android:title="@string/pref_update_autodownload"
                    android:entries="@array/pref_update_autodownload_entries"
deleted file mode 100644
--- a/mobile/android/base/resources/xml/preferences_search.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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/. -->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:gecko="http://schemas.android.com/apk/res-auto"
-                  android:title="@string/pref_category_search"
-                  android:enabled="false">
-
-    <CheckBoxPreference android:key="browser.search.suggest.enabled"
-                        android:title="@string/pref_search_suggestions"
-                        android:defaultValue="false"
-                        android:persistent="false" />
-
-    <org.mozilla.gecko.preferences.SearchPreferenceCategory
-                        android:title="@string/pref_category_installed_search_engines"/>
-</PreferenceScreen>
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -75,22 +75,20 @@
   <string name="find_text">&find_text;</string>
   <string name="find_prev">&find_prev;</string>
   <string name="find_next">&find_next;</string>
   <string name="find_close">&find_close;</string>
 
   <string name="settings">&settings;</string>
   <string name="settings_title">&settings_title;</string>
   <string name="pref_category_customize">&pref_category_customize;</string>
-  <string name="pref_category_search">&pref_category_search;</string>
   <string name="pref_category_display">&pref_category_display;</string>
   <string name="pref_category_privacy_short">&pref_category_privacy_short;</string>
   <string name="pref_category_vendor">&pref_category_vendor;</string>
   <string name="pref_category_datareporting">&pref_category_datareporting;</string>
-  <string name="pref_category_installed_search_engines">&pref_category_installed_search_engines;</string>
 
   <string name="pref_header_customize">&pref_header_customize;</string>
   <string name="pref_header_display">&pref_header_display;</string>
   <string name="pref_header_privacy_short">&pref_header_privacy_short;</string>
   <string name="pref_header_vendor">&pref_header_vendor;</string>
 
   <string name="pref_remember_signons">&pref_remember_signons;</string>