author | Mark Capella <markcapella@twcny.rr.com> |
Wed, 17 Jul 2013 18:39:38 -0400 | |
changeset 143411 | c2cab1e6f266918e391c886f9a95de033779bb79 |
parent 143410 | 4e944265f5b8d39d08424b3f3a17bf23800439eb |
child 143412 | a4c2fc0828c7e01d5d1d2c37be109a05fa999e4a |
push id | 25130 |
push user | lrocha@mozilla.com |
push date | Wed, 21 Aug 2013 09:41:27 +0000 |
treeherder | mozilla-central@b2486721572e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | margaret |
bugs | 880047 |
milestone | 25.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -249,17 +249,16 @@ FENNEC_JAVA_FILES = \ 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 \ widget/Divider.java \ widget/FaviconView.java \ widget/GeckoPopupMenu.java \ widget/GeckoActionProvider.java \ widget/IconTabWidget.java \ @@ -504,17 +503,16 @@ RES_LAYOUT = \ res/layout/top_bookmark_item_view.xml \ res/layout/two_line_page_row.xml \ res/layout/list_item_header.xml \ res/layout/select_dialog_list.xml \ res/layout/select_dialog_multichoice.xml \ res/layout/select_dialog_singlechoice.xml \ res/layout/simple_dropdown_item_1line.xml \ res/layout/suggestion_item.xml \ - res/layout/abouthome_addon_row.xml \ res/layout/abouthome_last_tabs_row.xml \ res/layout/abouthome_section.xml \ res/layout/abouthome_topsite_item.xml \ res/layout/validation_message.xml \ res/layout/videoplayer.xml \ $(NULL) RES_LAYOUT_LARGE_V11 = \ @@ -632,17 +630,16 @@ RES_DRAWABLE_MDPI = \ res/drawable-mdpi/alert_camera.png \ res/drawable-mdpi/alert_mic.png \ res/drawable-mdpi/alert_mic_camera.png \ res/drawable-mdpi/arrow_popup_bg.9.png \ res/drawable-mdpi/autocomplete_list_bg.9.png \ res/drawable-mdpi/bookmark_folder_closed.png \ res/drawable-mdpi/bookmark_folder_opened.png \ res/drawable-mdpi/desktop_notification.png \ - res/drawable-mdpi/ic_addons_empty.png \ res/drawable-mdpi/ic_menu_addons_filler.png \ res/drawable-mdpi/ic_menu_bookmark_add.png \ res/drawable-mdpi/ic_menu_bookmark_remove.png \ res/drawable-mdpi/ic_menu_character_encoding.png \ res/drawable-mdpi/ic_menu_close_all_tabs.png \ res/drawable-mdpi/ic_menu_forward.png \ res/drawable-mdpi/ic_menu_new_private_tab.png \ res/drawable-mdpi/ic_menu_new_tab.png \ @@ -752,17 +749,16 @@ RES_DRAWABLE_HDPI = \ res/drawable-hdpi/alert_app.png \ res/drawable-hdpi/alert_download.png \ res/drawable-hdpi/bookmark_folder_closed.png \ res/drawable-hdpi/bookmark_folder_opened.png \ res/drawable-hdpi/alert_camera.png \ res/drawable-hdpi/alert_mic.png \ res/drawable-hdpi/alert_mic_camera.png \ res/drawable-hdpi/arrow_popup_bg.9.png \ - res/drawable-hdpi/ic_addons_empty.png \ res/drawable-hdpi/ic_menu_addons_filler.png \ res/drawable-hdpi/ic_menu_bookmark_add.png \ res/drawable-hdpi/ic_menu_bookmark_remove.png \ res/drawable-hdpi/ic_menu_character_encoding.png \ res/drawable-hdpi/ic_menu_close_all_tabs.png \ res/drawable-hdpi/ic_menu_forward.png \ res/drawable-hdpi/ic_menu_new_private_tab.png \ res/drawable-hdpi/ic_menu_new_tab.png \ @@ -849,17 +845,16 @@ RES_DRAWABLE_XHDPI = \ res/drawable-xhdpi/alert_app.png \ res/drawable-xhdpi/alert_download.png \ res/drawable-xhdpi/bookmark_folder_closed.png \ res/drawable-xhdpi/bookmark_folder_opened.png \ res/drawable-xhdpi/alert_camera.png \ res/drawable-xhdpi/alert_mic.png \ res/drawable-xhdpi/alert_mic_camera.png \ res/drawable-xhdpi/arrow_popup_bg.9.png \ - res/drawable-xhdpi/ic_addons_empty.png \ res/drawable-xhdpi/ic_menu_addons_filler.png \ res/drawable-xhdpi/ic_menu_bookmark_add.png \ res/drawable-xhdpi/ic_menu_bookmark_remove.png \ res/drawable-xhdpi/ic_menu_close_all_tabs.png \ res/drawable-xhdpi/ic_menu_character_encoding.png \ res/drawable-xhdpi/ic_menu_forward.png \ res/drawable-xhdpi/ic_menu_new_private_tab.png \ res/drawable-xhdpi/ic_menu_new_tab.png \
--- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -261,18 +261,16 @@ size. --> <!ENTITY button_ok "OK"> <!ENTITY button_cancel "Cancel"> <!ENTITY button_yes "Yes"> <!ENTITY button_no "No"> <!ENTITY button_clear_data "Clear data"> <!ENTITY button_set "Set"> <!ENTITY button_clear "Clear"> -<!ENTITY abouthome_addons_title "Add-ons for your &brandShortName;"> -<!ENTITY abouthome_addons_browse "Browse all &brandShortName; add-ons"> <!ENTITY abouthome_last_tabs_title "Your tabs from last time"> <!ENTITY abouthome_last_tabs_open "Open all tabs from last time"> <!ENTITY abouthome_top_sites_title "Top sites"> <!ENTITY abouthome_topsites_edit "Edit"> <!ENTITY abouthome_topsites_pin "Pin Site"> <!ENTITY abouthome_topsites_unpin "Unpin Site"> <!ENTITY abouthome_visited_empty "Websites you visited go here">
deleted file mode 100644 index 866a0aaf05310639183bc7a03cb27c2ef58cfc4e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@<O00001
deleted file mode 100644 index 1e46f6a2e94d66a01f0a529ca29db7098f41bccb..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@<O00001
deleted file mode 100644 index 30ebe81ba8f2080eaf0b9ec8dd32c0aa37717dbf..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@<O00001
--- a/mobile/android/base/resources/layout-xlarge-land-v11/abouthome_content.xml +++ b/mobile/android/base/resources/layout-xlarge-land-v11/abouthome_content.xml @@ -63,20 +63,13 @@ <org.mozilla.gecko.widget.LastTabsSection android:id="@+id/last_tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" gecko:title="@string/abouthome_last_tabs_title" gecko:more_text="@string/abouthome_last_tabs_open"/> - <org.mozilla.gecko.widget.AddonsSection android:id="@+id/recommended_addons" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:visibility="gone" - gecko:title="@string/abouthome_addons_title" - gecko:more_text="@string/abouthome_addons_browse"/> - </LinearLayout> </LinearLayout> </org.mozilla.gecko.widget.AboutHomeView>
deleted file mode 100644 --- a/mobile/android/base/resources/layout/abouthome_addon_row.xml +++ /dev/null @@ -1,12 +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/. --> - -<org.mozilla.gecko.GeckoTextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="@dimen/abouthome_rowitem_height" - android:paddingLeft="@dimen/abouthome_rowitem_left_padding" - android:gravity="center_vertical" - android:drawablePadding="12dip" - style="@style/AboutHome.RowItem.TextRow"/>
--- a/mobile/android/base/resources/layout/abouthome_content.xml +++ b/mobile/android/base/resources/layout/abouthome_content.xml @@ -48,18 +48,11 @@ <org.mozilla.gecko.widget.LastTabsSection android:id="@+id/last_tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" gecko:title="@string/abouthome_last_tabs_title" gecko:more_text="@string/abouthome_last_tabs_open"/> - <org.mozilla.gecko.widget.AddonsSection android:id="@+id/recommended_addons" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:visibility="gone" - gecko:title="@string/abouthome_addons_title" - gecko:more_text="@string/abouthome_addons_browse"/> - </LinearLayout> </org.mozilla.gecko.widget.AboutHomeView>
--- a/mobile/android/base/resources/values/dimens.xml +++ b/mobile/android/base/resources/values/dimens.xml @@ -1,16 +1,15 @@ <?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> - <dimen name="abouthome_addon_icon_size">32dp</dimen> <dimen name="abouthome_content_top_sites_item_height">110dp</dimen> <dimen name="abouthome_gutter_small">0dp</dimen> <dimen name="abouthome_gutter_large">0dp</dimen> <dimen name="abouthome_icon_crop">-14dp</dimen> <dimen name="abouthome_icon_radius">2dp</dimen> <dimen name="abouthome_rowitem_height">46dip</dimen> <dimen name="abouthome_rowitem_left_padding">12dip</dimen> <dimen name="abouthome_topsite_pinsize">20dp</dimen>
--- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -229,18 +229,16 @@ <string name="button_ok">&button_ok;</string> <string name="button_cancel">&button_cancel;</string> <string name="button_clear_data">&button_clear_data;</string> <string name="button_set">&button_set;</string> <string name="button_clear">&button_clear;</string> <string name="button_yes">&button_yes;</string> <string name="button_no">&button_no;</string> - <string name="abouthome_addons_title">&abouthome_addons_title;</string> - <string name="abouthome_addons_browse">&abouthome_addons_browse;</string> <string name="abouthome_last_tabs_title">&abouthome_last_tabs_title;</string> <string name="abouthome_last_tabs_open">&abouthome_last_tabs_open;</string> <string name="abouthome_top_sites_title">&abouthome_top_sites_title;</string> <string name="abouthome_about_sync">&abouthome_about_sync3;</string> <string name="abouthome_about_apps">&abouthome_about_apps3;</string> <string name="abouthome_sync_bold_name">&abouthome_sync_bold_name;</string> <string name="abouthome_apps_bold_name">&abouthome_apps_bold_name2;</string>
--- a/mobile/android/base/widget/AboutHome.java +++ b/mobile/android/base/widget/AboutHome.java @@ -23,28 +23,26 @@ import android.view.ContextMenu.ContextM import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; public class AboutHome extends Fragment { public static enum UpdateFlags { TOP_SITES, - PREVIOUS_TABS, - RECOMMENDED_ADDONS; + PREVIOUS_TABS; public static final EnumSet<UpdateFlags> ALL = EnumSet.allOf(UpdateFlags.class); } private UriLoadListener mUriLoadListener; private LoadCompleteListener mLoadCompleteListener; private LightweightTheme mLightweightTheme; private int mTopPadding; private AboutHomeView mAboutHomeView; - private AddonsSection mAddonsSection; private LastTabsSection mLastTabsSection; private TopSitesView mTopSitesView; private ScrollAnimator mScrollAnimator; public interface UriLoadListener { public void onAboutHomeUriLoad(String uriSpec); } @@ -86,17 +84,16 @@ public class AboutHome extends Fragment mLoadCompleteListener = null; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); mAboutHomeView = (AboutHomeView) inflater.inflate(R.layout.abouthome_content, container, false); - mAddonsSection = (AddonsSection) mAboutHomeView.findViewById(R.id.recommended_addons); mLastTabsSection = (LastTabsSection) mAboutHomeView.findViewById(R.id.last_tabs); mTopSitesView = (TopSitesView) mAboutHomeView.findViewById(R.id.top_sites_grid); mAboutHomeView.setLightweightTheme(mLightweightTheme); mLightweightTheme.addListener(mAboutHomeView); // ScrollAnimator implements the View.OnGenericMotionListener // interface, which was added in API level 12. @@ -113,31 +110,29 @@ public class AboutHome extends Fragment super.onViewCreated(view, savedInstanceState); view.setPadding(0, mTopPadding, 0, 0); ((PromoBox) view.findViewById(R.id.promo_box)).showRandomPromo(); update(AboutHome.UpdateFlags.ALL); mTopSitesView.setLoadCompleteListener(mLoadCompleteListener); mTopSitesView.setUriLoadListener(mUriLoadListener); - mAddonsSection.setUriLoadListener(mUriLoadListener); } @Override public void onDestroyView() { mLightweightTheme.removeListener(mAboutHomeView); mTopSitesView.onDestroy(); if (mScrollAnimator != null) { mScrollAnimator.cancel(); } mScrollAnimator = null; mAboutHomeView = null; - mAddonsSection = null; mLastTabsSection = null; mTopSitesView = null; super.onDestroyView(); } @Override public void onConfigurationChanged(Configuration newConfig) { @@ -199,20 +194,16 @@ public class AboutHome extends Fragment if (flags.contains(UpdateFlags.TOP_SITES)) { mTopSitesView.loadTopSites(); } if (flags.contains(UpdateFlags.PREVIOUS_TABS)) { mLastTabsSection.readLastTabs(); } - - if (flags.contains(UpdateFlags.RECOMMENDED_ADDONS)) { - mAddonsSection.readRecommendedAddons(); - } } public void setLastTabsVisibility(boolean visible) { if (mAboutHomeView == null) { return; } if (visible)
deleted file mode 100644 --- a/mobile/android/base/widget/AddonsSection.java +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.widget; - -import org.mozilla.gecko.BrowserApp; -import org.mozilla.gecko.Favicons; -import org.mozilla.gecko.R; -import org.mozilla.gecko.util.GamepadUtils; -import org.mozilla.gecko.util.ThreadUtils; -import org.mozilla.gecko.util.UiAsyncTask; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Rect; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.text.SpannableString; -import android.text.TextUtils; -import android.text.style.TextAppearanceSpan; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -public class AddonsSection extends AboutHomeSection { - private static final String LOGTAG = "GeckoAboutHomeAddons"; - - private Context mContext; - private BrowserApp mActivity; - private AboutHome.UriLoadListener mUriLoadListener; - - private static Rect sIconBounds; - private static TextAppearanceSpan sSubTitleSpan; - - public AddonsSection(Context context, AttributeSet attrs) { - super(context, attrs); - mContext = context; - mActivity = (BrowserApp) context; - - int iconSize = mContext.getResources().getDimensionPixelSize(R.dimen.abouthome_addon_icon_size); - sIconBounds = new Rect(0, 0, iconSize, iconSize); - sSubTitleSpan = new TextAppearanceSpan(mContext, R.style.AboutHome_TextAppearance_SubTitle); - - setOnMoreTextClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mUriLoadListener != null) - mUriLoadListener.onAboutHomeUriLoad(mContext.getString(R.string.bookmarkdefaults_url_addons)); - } - }); - } - - public void setUriLoadListener(AboutHome.UriLoadListener uriLoadListener) { - mUriLoadListener = uriLoadListener; - } - - private String readFromZipFile(String filename) { - ZipFile zip = null; - String str = null; - try { - InputStream fileStream = null; - File applicationPackage = new File(mActivity.getApplication().getPackageResourcePath()); - zip = new ZipFile(applicationPackage); - ZipEntry fileEntry = zip.getEntry(filename); - if (fileEntry == null) - return null; - fileStream = zip.getInputStream(fileEntry); - str = readStringFromStream(fileStream); - } catch (IOException ioe) { - Log.e(LOGTAG, "error reading zip file: " + filename, ioe); - } finally { - try { - if (zip != null) - zip.close(); - } catch (IOException ioe) { - // catch this here because we can continue even if the - // close failed - Log.e(LOGTAG, "error closing zip filestream", ioe); - } - } - return str; - } - - private String readStringFromStream(InputStream fileStream) { - String str = null; - try { - byte[] buf = new byte[32768]; - StringBuilder jsonString = new StringBuilder(); - int read = 0; - while ((read = fileStream.read(buf, 0, 32768)) != -1) - jsonString.append(new String(buf, 0, read)); - str = jsonString.toString(); - } catch (IOException ioe) { - Log.i(LOGTAG, "error reading filestream", ioe); - } finally { - try { - if (fileStream != null) - fileStream.close(); - } catch (IOException ioe) { - // catch this here because we can continue even if the - // close failed - Log.e(LOGTAG, "error closing filestream", ioe); - } - } - return str; - } - - private String getPageUrlFromIconUrl(String iconUrl) { - // Addon icon URLs come with a query argument that is usually - // used for expiration purposes. We want the "page URL" here to be - // stable enough to avoid unnecessary duplicate records of the - // same addon. - String pageUrl = iconUrl; - - try { - URL urlForIcon = new URL(iconUrl); - URL urlForPage = new URL(urlForIcon.getProtocol(), urlForIcon.getAuthority(), urlForIcon.getPath()); - pageUrl = urlForPage.toString(); - } catch (MalformedURLException e) { - // Defaults to pageUrl = iconUrl in case of error - } - - return pageUrl; - } - - public void readRecommendedAddons() { - new UiAsyncTask<Void, Void, JSONArray>(ThreadUtils.getBackgroundHandler()) { - @Override - public JSONArray doInBackground(Void... params) { - final String addonsFilename = "recommended-addons.json"; - String jsonString; - try { - jsonString = mActivity.getProfile().readFile(addonsFilename); - } catch (IOException ioe) { - Log.i(LOGTAG, "filestream is null"); - jsonString = readFromZipFile(addonsFilename); - } - - JSONArray addonsArray = null; - if (jsonString != null) { - try { - addonsArray = new JSONObject(jsonString).getJSONArray("addons"); - } catch (JSONException e) { - Log.i(LOGTAG, "error reading json file", e); - } - } - - return addonsArray; - } - - @Override - public void onPostExecute(JSONArray addons) { - if (addons == null || addons.length() == 0) { - hide(); - return; - } - - try { - for (int i = 0; i < addons.length(); i++) { - View addonView = createAddonView(addons.getJSONObject(i), getItemsContainer()); - addItem(addonView); - } - } catch (JSONException e) { - Log.e(LOGTAG, "Error reading JSON", e); - return; - } - - show(); - } - }.execute(); - } - - View createAddonView(JSONObject addonJSON, ViewGroup parent) throws JSONException { - String name = addonJSON.getString("name"); - String version = addonJSON.getString("version"); - String text = name + " " + version; - - SpannableString spannable = new SpannableString(text); - spannable.setSpan(sSubTitleSpan, name.length() + 1, text.length(), 0); - - final TextView row = (TextView) LayoutInflater.from(mContext).inflate(R.layout.abouthome_addon_row, getItemsContainer(), false); - row.setText(spannable, TextView.BufferType.SPANNABLE); - - Drawable drawable = mContext.getResources().getDrawable(R.drawable.ic_addons_empty); - drawable.setBounds(sIconBounds); - row.setCompoundDrawables(drawable, null, null, null); - - String iconUrl = addonJSON.getString("iconURL"); - String pageUrl = getPageUrlFromIconUrl(iconUrl); - - // homepageURL may point to non-AMO installs. For now we use learnmoreURL instead - // which is more likely to point to a mobile AMO page - String homepageUrl = addonJSON.optString("learnmoreURL"); - if (TextUtils.isEmpty(homepageUrl)) { - homepageUrl = addonJSON.getString("homepageURL"); - } - final String addonUrl = homepageUrl; - row.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mUriLoadListener != null) - mUriLoadListener.onAboutHomeUriLoad(addonUrl); - } - }); - row.setOnKeyListener(GamepadUtils.getClickDispatcher()); - - Favicons favicons = Favicons.getInstance(); - favicons.loadFavicon(pageUrl, iconUrl, Favicons.FLAG_PERSIST | Favicons.FLAG_SCALE, - new Favicons.OnFaviconLoadedListener() { - @Override - public void onFaviconLoaded(String url, Bitmap favicon) { - if (favicon != null) { - Drawable drawable = new BitmapDrawable(favicon); - drawable.setBounds(sIconBounds); - row.setCompoundDrawables(drawable, null, null, null); - } - } - }); - - return row; - } -}