merge fx-team into mozilla-central

This commit is contained in:
Gavin Sharp 2012-08-21 10:27:25 -07:00
commit 04744f7ec2
30 changed files with 376 additions and 260 deletions

View File

@ -42,6 +42,10 @@
]]></script>
<style type="text/css"><![CDATA[
#errorPageContainer {
background-image: none;
}
#errorPageContainer:before {
content: url('chrome://browser/content/aboutRobots-icon.png');
position: absolute;

View File

@ -291,7 +291,7 @@ var SocialToolbar = {
removeItem.setAttribute("accesskey", accesskey);
let statusAreaPopup = document.getElementById("social-statusarea-popup");
statusAreaPopup.addEventListener("popupshowing", function(e) {
statusAreaPopup.addEventListener("popupshown", function(e) {
this.button.setAttribute("open", "true");
}.bind(this));
statusAreaPopup.addEventListener("popuphidden", function(e) {
@ -439,12 +439,34 @@ var SocialToolbar = {
sizePanelToContent();
function dispatchPanelEvent(name) {
let evt = notifBrowser.contentDocument.createEvent("CustomEvent");
evt.initCustomEvent(name, true, true, {});
notifBrowser.contentDocument.documentElement.dispatchEvent(evt);
}
panel.addEventListener("popuphiding", function onpopuphiding() {
panel.removeEventListener("popuphiding", onpopuphiding);
SocialToolbar.button.removeAttribute("open");
dispatchPanelEvent("socialFrameHide");
});
panel.addEventListener("popupshown", function onpopupshown() {
panel.removeEventListener("popupshown", onpopupshown);
SocialToolbar.button.setAttribute("open", "true");
if (notifBrowser.contentDocument.readyState == "complete") {
dispatchPanelEvent("socialFrameShow");
} else {
// first time load, wait for load and dispatch after load
notifBrowser.addEventListener("load", function panelBrowserOnload(e) {
notifBrowser.removeEventListener("load", panelBrowserOnload, true);
setTimeout(function() {
dispatchPanelEvent("socialFrameShow");
}, 0);
}, true);
}
});
this.button.setAttribute("open", "true");
panel.openPopup(iconImage, "bottomcenter topleft", 0, 0, false, false);
}
}
@ -499,7 +521,7 @@ var SocialSidebar = {
let sbrowser = document.getElementById("social-sidebar-browser");
sbrowser.docShell.isActive = !hideSidebar;
if (hideSidebar) {
this.dispatchEvent("sidebarhide");
this.dispatchEvent("socialFrameHide");
// If we're disabled, unload the sidebar content
if (!this.canShow) {
sbrowser.removeAttribute("origin");
@ -514,11 +536,11 @@ var SocialSidebar = {
sbrowser.removeEventListener("load", sidebarOnShow);
// let load finish, then fire our event
setTimeout(function () {
SocialSidebar.dispatchEvent("sidebarshow");
SocialSidebar.dispatchEvent("socialFrameShow");
}, 0);
});
} else {
this.dispatchEvent("sidebarshow");
this.dispatchEvent("socialFrameShow");
}
}
}

View File

@ -92,6 +92,7 @@ _BROWSER_FILES = \
browser_bug427559.js \
browser_bug432599.js \
browser_bug435035.js \
browser_bug435325.js \
browser_bug441778.js \
browser_popupNotification.js \
browser_bug455852.js \

View File

@ -2,7 +2,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/* Ensure that clicking the button in the Offline mode neterror page makes the browser go online. See bug 435325. */
/* TEST_PATH=docshell/test/browser/browser_bug435325.js make -C $(OBJDIR) mochitest-browser-chrome */
function test() {
waitForExplicitFinish();
@ -34,9 +33,8 @@ function checkPage() {
"The error page has got a #errorTryAgain element");
gBrowser.contentDocument.getElementById("errorTryAgain").click();
ok(!Services.io.offline, "After clicking the Try Again button, we're back "
+" online. This depends on Components.interfaces.nsIDOMWindowUtils being "
+"available from untrusted content (bug 435325).");
ok(!Services.io.offline, "After clicking the Try Again button, we're back " +
"online.");
finish();
}

View File

@ -37,20 +37,21 @@ var tests = {
let port = Social.provider.port;
ok(port, "provider has a port");
port.postMessage({topic: "test-init"});
Social.provider.port.onmessage = function (e) {
port.onmessage = function (e) {
let topic = e.data.topic;
switch (topic) {
case "got-panel-message":
ok(true, "got panel message");
// Wait for the panel to close before ending the test
let panel = document.getElementById("social-notification-panel");
panel.addEventListener("popuphidden", function hiddenListener() {
panel.removeEventListener("popuphidden", hiddenListener);
next();
});
panel.hidePopup();
break;
case "got-social-panel-visibility":
if (e.data.result == "shown") {
ok(true, "panel shown");
let panel = document.getElementById("social-notification-panel");
panel.hidePopup();
} else if (e.data.result == "hidden") {
ok(true, "panel hidden");
next();
}
case "got-sidebar-message":
// The sidebar message will always come first, since it loads by default
ok(true, "got sidebar message");
@ -59,6 +60,7 @@ var tests = {
break;
}
}
port.postMessage({topic: "test-init"});
// Our worker sets up ambient notification at the same time as it responds to
// the workerAPI initialization. If it's already initialized, we can

View File

@ -38,13 +38,13 @@ function doTest(finishcb) {
ok(!command.hidden, "toggle command should be visible");
checkShown(true);
browser.addEventListener("sidebarhide", function sidebarhide() {
browser.removeEventListener("sidebarhide", sidebarhide);
browser.addEventListener("socialFrameHide", function sidebarhide() {
browser.removeEventListener("socialFrameHide", sidebarhide);
checkShown(false);
browser.addEventListener("sidebarshow", function sidebarshow() {
browser.removeEventListener("sidebarshow", sidebarshow);
browser.addEventListener("socialFrameShow", function sidebarshow() {
browser.removeEventListener("socialFrameShow", sidebarshow);
checkShown(true);

View File

@ -6,6 +6,14 @@
var port = navigator.mozSocial.getWorker().port;
port.postMessage({topic: "panel-message", result: "ok"});
}
window.addEventListener("socialFrameShow", function(e) {
var port = navigator.mozSocial.getWorker().port;
port.postMessage({topic: "status-panel-visibility", result: "shown"});
}, false);
window.addEventListener("socialFrameHide", function(e) {
var port = navigator.mozSocial.getWorker().port;
port.postMessage({topic: "status-panel-visibility", result: "hidden"});
}, false);
</script>
</head>
<body onload="pingWorker();">

View File

@ -39,6 +39,9 @@ onconnect = function(e) {
if (testPort && event.data.result == "ok")
testPort.postMessage({topic:"got-panel-message"});
break;
case "status-panel-visibility":
testPort.postMessage({topic:"got-social-panel-visibility", result: event.data.result });
break;
case "test-chatbox-open":
sidebarPort.postMessage({topic:"test-chatbox-open"});
break;

View File

@ -3,7 +3,6 @@
- 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/. -->
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/orion.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/debugger.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/devtools/common.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/devtools/debugger.css" type="text/css"?>

View File

@ -17,7 +17,6 @@ MOCHITEST_BROWSER_FILES = \
browser_bug349769.js \
browser_bug388121-1.js \
browser_bug388121-2.js \
browser_bug435325.js \
browser_bug441169.js \
browser_bug420605.js \
file_bug420605.html \

View File

@ -85,6 +85,7 @@ public class AboutHomeContent extends ScrollView
protected SimpleCursorAdapter mTopSitesAdapter;
protected GridView mTopSitesGrid;
private AboutHomePromoBox mPromoBox;
protected AboutHomeSection mAddons;
protected AboutHomeSection mLastTabs;
protected AboutHomeSection mRemoteTabs;
@ -155,6 +156,7 @@ public class AboutHomeContent extends ScrollView
}
});
mPromoBox = (AboutHomePromoBox) findViewById(R.id.promo_box);
mAddons = (AboutHomeSection) findViewById(R.id.recommended_addons);
mLastTabs = (AboutHomeSection) findViewById(R.id.last_tabs);
mRemoteTabs = (AboutHomeSection) findViewById(R.id.remote_tabs);
@ -179,28 +181,6 @@ public class AboutHomeContent extends ScrollView
}
});
TextView syncTextView = (TextView) findViewById(R.id.sync_text);
String syncText = syncTextView.getText().toString() + " \u00BB";
String boldName = getContext().getResources().getString(R.string.abouthome_sync_bold_name);
int styleIndex = syncText.indexOf(boldName);
// Highlight any occurrence of "Firefox Sync" in the string
// with a bold style.
if (styleIndex >= 0) {
SpannableString spannableText = new SpannableString(syncText);
spannableText.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), styleIndex, styleIndex + 12, 0);
syncTextView.setText(spannableText, TextView.BufferType.SPANNABLE);
}
LinearLayout syncBox = (LinearLayout) findViewById(R.id.sync_box);
syncBox.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Context context = v.getContext();
Intent intent = new Intent(context, SetupSyncActivity.class);
context.startActivity(intent);
}
});
setTopSitesConstants();
}
@ -232,9 +212,11 @@ public class AboutHomeContent extends ScrollView
findViewById(R.id.no_top_sites_text).setVisibility(visibilityWithoutTopSites);
}
private void setSyncVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
findViewById(R.id.sync_box).setVisibility(visibility);
private void setPromoBoxVisibility(boolean visible, AboutHomePromoBox.Type type) {
if (visible)
mPromoBox.show(type);
else
mPromoBox.hide();
}
private void updateLayout(GeckoApp.StartupMode startupMode, boolean syncIsSetup) {
@ -246,7 +228,7 @@ public class AboutHomeContent extends ScrollView
boolean isFirstRun = (startupMode == GeckoApp.StartupMode.NEW_PROFILE);
setTopSitesVisibility(!isFirstRun || hasTopSites, hasTopSites);
setSyncVisibility(!syncIsSetup);
setPromoBoxVisibility(!syncIsSetup, AboutHomePromoBox.Type.SYNC);
}
private void updateLayoutForSync() {

View File

@ -0,0 +1,126 @@
/* 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;
import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
import android.content.Context;
import android.content.Intent;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* A promotional box for the about:home page. The layout contains an ImageView to the left of a
* TextView whose resources may be overidden to display custom values for a new type of promo box.
* To do this, add a new Type value and update show() to call setResources() for your values -
* including a set[Box Type]Resources() helper method is recommended.
*/
public class AboutHomePromoBox extends LinearLayout implements View.OnClickListener {
private static final String LOGTAG = "AboutHomePromoBox";
public enum Type { SYNC };
private Type mType;
private final Context mContext;
private final TextView mTextView;
private final ImageView mImageView;
// Use setResources() to set these variables for each PromoBox type.
private int mTextResource;
private int mBoldTextResource;
private int mImageResource;
public AboutHomePromoBox(Context context, AttributeSet attrs) {
super(context, attrs);
final LayoutInflater inflater = LayoutInflater.from(context);
inflater.inflate(R.layout.abouthome_promo_box, this);
mContext = context;
mTextView = (TextView) findViewById(R.id.text);
mImageView = (ImageView) findViewById(R.id.icon);
setOnClickListener(this);
}
@Override
public void onClick(View v) {
Log.d(LOGTAG, "I work out.");
switch (mType) {
case SYNC:
final Context context = v.getContext();
final Intent intent = new Intent(context, SetupSyncActivity.class);
context.startActivity(intent);
break;
default:
Log.e(LOGTAG, "Invalid type was set when promo box was clicked.");
break;
}
}
/**
* Shows the specified promo box. If a promo box is already active, it will be overidden with a
* promo box of the specified type.
*/
public void show(Type type) {
mType = type;
switch (type) {
case SYNC:
setSyncResources();
break;
default:
Log.e(LOGTAG, "Invalid PromoBoxType specified.");
break;
}
updateViewResources();
setVisibility(View.VISIBLE);
}
public void hide() {
setVisibility(View.GONE);
mType = null;
}
private void setResources(int textResource, int boldTextResource, int imageResource) {
mTextResource = textResource;
mBoldTextResource = boldTextResource;
mImageResource = imageResource;
}
private void updateViewResources() {
updateTextViewResources();
mImageView.setImageResource(mImageResource);
}
private void updateTextViewResources() {
final String promoText = mContext.getResources().getString(mTextResource) + " \u00BB";
final String boldName = mContext.getResources().getString(mBoldTextResource);
final int styleIndex = promoText.indexOf(boldName);
if (styleIndex < 0)
mTextView.setText(promoText);
else {
final SpannableString spannableText = new SpannableString(promoText);
spannableText.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), styleIndex,
styleIndex + boldName.length(), 0);
mTextView.setText(spannableText, TextView.BufferType.SPANNABLE);
}
}
// Type.SYNC: Setup Firefox sync.
private void setSyncResources() {
setResources(R.string.abouthome_about_sync, R.string.abouthome_sync_bold_name,
R.drawable.abouthome_sync_logo);
}
}

View File

@ -7,20 +7,18 @@ package org.mozilla.gecko;
import android.app.AlertDialog;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.preference.DialogPreference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.text.method.ScrollingMovementMethod;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import java.util.HashMap;
@ -31,16 +29,9 @@ class FontSizePreference extends DialogPreference {
private static final int PREVIEW_FONT_SIZE_UNIT = TypedValue.COMPLEX_UNIT_PT;
private static final int DEFAULT_FONT_INDEX = 2;
// Final line height = line height * line_mult + line_mult;
private static final float LINE_SPACING_ADD = 0f; // Units unknown.
private static final float LINE_SPACING_MULT = 1.0f;
private static final float MIN_TEXTVIEW_WIDTH_DIP = 360; // Width of the Galaxy Nexus (portrait).
/** The dialog will encompass the minimum width + (1 / scaleFactor) of the remaining space. */
private static final float TEXTVIEW_WIDTH_SCALE_FACTOR = 3;
private final Context mContext;
private int mCurrentOrientation;
/** Container for mPreviewFontView to allow for scrollable padding at the top of the view. */
private ScrollView mScrollingContainer;
private TextView mPreviewFontView;
private Button mIncreaseFontButton;
private Button mDecreaseFontButton;
@ -53,8 +44,6 @@ class FontSizePreference extends DialogPreference {
private int mPreviewFontIndex = mSavedFontIndex;
private final HashMap<String, Integer> mFontTwipToIndexMap;
private boolean mPreviewFontViewHeightSet;
public FontSizePreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
@ -66,7 +55,6 @@ class FontSizePreference extends DialogPreference {
for (int i = 0; i < mFontTwipValues.length; ++i) {
mFontTwipToIndexMap.put(mFontTwipValues[i], i);
}
mCurrentOrientation = res.getConfiguration().orientation;
}
@Override
@ -74,15 +62,23 @@ class FontSizePreference extends DialogPreference {
final LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogView = inflater.inflate(R.layout.font_size_preference, null);
initInternalViews(dialogView);
updatePreviewFontSize(mFontTwipValues[mPreviewFontIndex]);
builder.setTitle(null);
builder.setView(dialogView);
}
/** Saves relevant views to instance variables and initializes their settings. */
private void initInternalViews(View dialogView) {
mScrollingContainer = (ScrollView) dialogView.findViewById(R.id.scrolling_container);
// Background cannot be set in XML (see bug 783597 - TODO: Change this to XML when bug is fixed).
mScrollingContainer.setBackgroundColor(Color.WHITE);
mPreviewFontView = (TextView) dialogView.findViewById(R.id.preview);
mPreviewFontView.setMovementMethod(new ScrollingMovementMethod());
// There is no way to get the value for this padding so we turn it off.
mPreviewFontView.setIncludeFontPadding(false);
// Retrieving line spacing is not available until API 16 so we override the values instead.
mPreviewFontView.setLineSpacing(LINE_SPACING_ADD, LINE_SPACING_MULT);
mDecreaseFontButton = (Button) dialogView.findViewById(R.id.decrease_preview_font_button);
mIncreaseFontButton = (Button) dialogView.findViewById(R.id.increase_preview_font_button);
setButtonState(mPreviewFontIndex);
mDecreaseFontButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
updatePreviewFontSize(mFontTwipValues[--mPreviewFontIndex]);
@ -104,13 +100,6 @@ class FontSizePreference extends DialogPreference {
}
}
});
// Set mPreviewFontView dimensions.
setPreviewFontViewWidth();
setPreviewFontViewHeightListener();
setFontSizeToMaximum(); // Expects onGlobalLayout() to be called.
builder.setView(dialogView);
}
@Override
@ -130,77 +119,6 @@ class FontSizePreference extends DialogPreference {
prefChangeListener.onPreferenceChange(this, twipVal);
}
protected void onConfigurationChanged(Configuration newConfig) {
if (mCurrentOrientation != newConfig.orientation) {
mCurrentOrientation = newConfig.orientation;
// mPreviewFontView will be null if the dialog has not yet been shown.
if (mPreviewFontView != null) {
// Recalculate the mPreviewFontView dimensions since we have new screen dimensions.
setPreviewFontViewWidth();
mPreviewFontViewHeightSet = false;
setFontSizeToMaximum(); // Expects onGlobalLayout() to be called.
}
}
}
/**
* Sets the preview font size to the maximum given size.
*/
private void setFontSizeToMaximum() {
updatePreviewFontSize(mFontTwipValues[mFontTwipValues.length - 1]);
// NOTE: If this method is being used with onGlobalLayout() to set mFontPreviewView height,
// the font size cannot be changed past this point or the dialog height will not calculate
// correctly. We must wait for the global layout state to change, calculate the height in
// onGlobalLayout(), and only then can changes be made.
}
/**
* Sets a global layout listener that will calculate the maximum required height of
* mPreviewFontView based upon the current font values and then reset the TextView to the saved
* preference values. This listener will only run once. mPreviewFontViewHeightSet must be set to
* false before being used again.
*/
private void setPreviewFontViewHeightListener() {
mPreviewFontViewHeightSet = false;
final ViewTreeObserver vto = mPreviewFontView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (!mPreviewFontViewHeightSet) {
mPreviewFontViewHeightSet = true;
final int desiredHeight = (int) (mPreviewFontView.getLineCount() *
mPreviewFontView.getLineHeight() * LINE_SPACING_MULT + LINE_SPACING_ADD +
mPreviewFontView.getPaddingTop() + mPreviewFontView.getPaddingBottom());
mPreviewFontView.setHeight(desiredHeight);
// Set the dialog state to the saved preference values.
setButtonState(mPreviewFontIndex);
updatePreviewFontSize(mFontTwipValues[mPreviewFontIndex]);
}
}
});
}
/**
* Sets the width of the mPreviewFontView TextView. The width is calculated by adding a constant
* minimum width to a fraction of the remaining space on screen (if any), which is determined by
* the given scale factor. Note that in ICS, it appears that the dialog will not wrap content
* and will set the view size itself. In Gingerbread, this code executes and sets the dialog
* width dynamically.
*/
private void setPreviewFontViewWidth() {
final DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
final float density = metrics.density;
final float actualWidthDip = metrics.widthPixels / density;
float scaleExtraDip = (actualWidthDip - MIN_TEXTVIEW_WIDTH_DIP) / TEXTVIEW_WIDTH_SCALE_FACTOR;
scaleExtraDip = scaleExtraDip >= 0 ? scaleExtraDip : 0;
final float desiredWidthDip = MIN_TEXTVIEW_WIDTH_DIP + scaleExtraDip;
final int desiredWidthPx = Math.round(desiredWidthDip * density);
mPreviewFontView.setWidth(desiredWidthPx);
}
/**
* Finds the index of the given twip value and sets it as the saved preference value. Also the
* current preview text size to the given value. Does not update the mPreviewFontView text size.
@ -217,19 +135,27 @@ class FontSizePreference extends DialogPreference {
}
/**
* Updates the mPreviewFontView to the given text size, resets the scroll to the top left, and
* invalidates the view. Does not update the font indices.
* Updates the mPreviewFontView to the given text size, resets the container's scroll to the top
* left, and invalidates the view. Does not update the font indices.
*/
private void updatePreviewFontSize(String twip) {
float pt = convertTwipStrToPT(twip);
// Android will not render a font size of 0 pt but for Gecko, 0 twip turns off font
// inflation. Thus we special case 0 twip to display a renderable font size.
if (pt == 0) {
// Android adds an inexplicable extra margin on the smallest font size so to get around
// this, we reinflate the view.
ViewGroup parentView = (ViewGroup) mScrollingContainer.getParent();
parentView.removeAllViews();
final LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogView = inflater.inflate(R.layout.font_size_preference, parentView);
initInternalViews(dialogView);
mPreviewFontView.setTextSize(PREVIEW_FONT_SIZE_UNIT, 1);
} else {
mPreviewFontView.setTextSize(PREVIEW_FONT_SIZE_UNIT, pt);
}
mPreviewFontView.scrollTo(0, 0);
mScrollingContainer.scrollTo(0, 0);
}
/**

View File

@ -48,7 +48,6 @@ public class GeckoPreferences
private PreferenceScreen mPreferenceScreen;
private static boolean sIsCharEncodingEnabled = false;
private static final String NON_PREF_PREFIX = "android.not_a_preference.";
private static final String FONT_SIZE_PREF_KEY = "font.size.inflation.minTwips";
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -69,15 +68,6 @@ public class GeckoPreferences
initValues();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
final FontSizePreference fontSizePref =
(FontSizePreference) mPreferenceScreen.findPreference(FONT_SIZE_PREF_KEY);
fontSizePref.onConfigurationChanged(newConfig);
}
@Override
protected void onDestroy() {
super.onDestroy();

View File

@ -38,7 +38,9 @@ public final class GeckoViewsFactory implements LayoutInflater.Factory {
Log.i(LOGTAG, "Creating custom Gecko view: " + viewName);
if (TextUtils.equals(viewName, "AboutHomeSection"))
if (TextUtils.equals(viewName, "AboutHomePromoBox"))
return new AboutHomePromoBox(context, attrs);
else if (TextUtils.equals(viewName, "AboutHomeSection"))
return new AboutHomeSection(context, attrs);
else if (TextUtils.equals(viewName, "AwesomeBarTabs"))
return new AwesomeBarTabs(context, attrs);

View File

@ -36,6 +36,7 @@ UTIL_JAVA_FILES := \
FENNEC_JAVA_FILES = \
AboutHomeContent.java \
AboutHomePromoBox.java \
AboutHomeSection.java \
ActivityHandlerHelper.java \
AndroidImport.java \
@ -333,6 +334,7 @@ RES_LAYOUT = \
res/layout/select_dialog_list.xml \
res/layout/abouthome_addon_row.xml \
res/layout/abouthome_last_tabs_row.xml \
res/layout/abouthome_promo_box.xml \
res/layout/abouthome_section.xml \
res/layout/abouthome_remote_tab_row.xml \
res/layout/abouthome_topsite_item.xml \
@ -357,6 +359,7 @@ RES_LAYOUT_LARGE_V11 = \
RES_LAYOUT_XLARGE_V11 = \
res/layout-xlarge-v11/awesomebar_search.xml \
res/layout-xlarge-v11/browser_toolbar_menu.xml \
res/layout-xlarge-v11/font_size_preference.xml \
res/layout-xlarge-v11/remote_tabs_child.xml \
res/layout-xlarge-v11/remote_tabs_group.xml \
res/layout-xlarge-v11/tabs_panel_toolbar_menu.xml \
@ -418,9 +421,9 @@ RES_DRAWABLE_BASE = \
res/drawable/folder.png \
res/drawable/abouthome_icon.png \
res/drawable/abouthome_logo.png \
res/drawable/abouthome_promo_box_bg.9.png \
res/drawable/abouthome_sync_logo.png \
res/drawable/abouthome_sync_bg.9.png \
res/drawable/abouthome_sync_pressed_bg.9.png \
res/drawable/abouthome_promo_box_pressed_bg.9.png \
res/drawable/abouthome_thumbnail.png \
res/drawable/address_bar_bg_shadow.png \
res/drawable/alert_addon.png \
@ -502,9 +505,9 @@ RES_DRAWABLE_HDPI = \
res/drawable-hdpi/home_star.png \
res/drawable-hdpi/abouthome_icon.png \
res/drawable-hdpi/abouthome_logo.png \
res/drawable-hdpi/abouthome_promo_box_bg.9.png \
res/drawable-hdpi/abouthome_sync_logo.png \
res/drawable-hdpi/abouthome_sync_bg.9.png \
res/drawable-hdpi/abouthome_sync_pressed_bg.9.png \
res/drawable-hdpi/abouthome_promo_box_pressed_bg.9.png \
res/drawable-hdpi/abouthome_thumbnail.png \
res/drawable-hdpi/address_bar_bg_shadow.png \
res/drawable-hdpi/alert_addon.png \
@ -568,9 +571,9 @@ RES_DRAWABLE_XHDPI = \
res/drawable-xhdpi/folder.png \
res/drawable-xhdpi/abouthome_icon.png \
res/drawable-xhdpi/abouthome_logo.png \
res/drawable-xhdpi/abouthome_promo_box_bg.9.png \
res/drawable-xhdpi/abouthome_sync_logo.png \
res/drawable-xhdpi/abouthome_sync_bg.9.png \
res/drawable-xhdpi/abouthome_sync_pressed_bg.9.png \
res/drawable-xhdpi/abouthome_promo_box_pressed_bg.9.png \
res/drawable-xhdpi/abouthome_thumbnail.png \
res/drawable-xhdpi/address_bar_bg_curve.png \
res/drawable-xhdpi/address_bar_bg_shadow.png \
@ -954,7 +957,7 @@ MOZ_ANDROID_DRAWABLES += \
$(SYNC_RES_DRAWABLE) \
mobile/android/base/resources/drawable/abouthome_bg_repeat.xml \
mobile/android/base/resources/drawable/abouthome_divider.xml \
mobile/android/base/resources/drawable/abouthome_sync_box.xml \
mobile/android/base/resources/drawable/abouthome_promo_box.xml \
mobile/android/base/resources/drawable/action_bar_button.xml \
mobile/android/base/resources/drawable/address_bar_bg.xml \
mobile/android/base/resources/drawable/address_bar_bg_shadow_repeat.xml \

View File

@ -143,6 +143,7 @@ public class TabsPanel extends LinearLayout {
mListContainer.removeAllViews();
}
final boolean showAnimation = !mVisible;
mVisible = true;
mCurrentPanel = panel;
@ -162,7 +163,8 @@ public class TabsPanel extends LinearLayout {
mListContainer.addView(mPanel.getLayout());
if (isSideBar()) {
dispatchLayoutChange(getWidth(), getHeight());
if (showAnimation)
dispatchLayoutChange(getWidth(), getHeight());
} else {
int actionBarHeight = (int) (mContext.getResources().getDimension(R.dimen.browser_toolbar_height));
@ -171,7 +173,8 @@ public class TabsPanel extends LinearLayout {
int listHeight = (int) (0.5 * mContext.getResources().getDisplayMetrics().heightPixels);
int height = actionBarHeight + listHeight;
dispatchLayoutChange(getWidth(), height);
if (showAnimation)
dispatchLayoutChange(getWidth(), height);
}
// If Sync is set up, query the database for remote clients.

View File

@ -5,7 +5,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/abouthome_sync_pressed_bg"/>
<item android:drawable="@drawable/abouthome_sync_bg"/>
<item android:state_pressed="true" android:drawable="@drawable/abouthome_promo_box_pressed_bg"/>
<item android:drawable="@drawable/abouthome_promo_box_bg"/>
</selector>

View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

View File

@ -69,37 +69,18 @@
android:textSize="12sp"
android:gravity="top|center_horizontal"/>
<LinearLayout android:id="@+id/sync_box"
android:background="@drawable/abouthome_sync_box"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="17dp"
android:layout_marginBottom="14dp"
android:gravity="center"
android:clickable="true"
android:visibility="gone">
<ImageView android:id="@+id/sync_logo"
android:src="@drawable/abouthome_sync_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="left|center_vertical"/>
<TextView android:id="@+id/sync_text"
android:text="@string/abouthome_about_sync"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="7dp"
android:gravity="center"
android:textSize="15sp"
android:textColor="#FFFFFF"/>
</LinearLayout>
<org.mozilla.gecko.AboutHomePromoBox android:id="@+id/promo_box"
android:orientation="horizontal"
android:background="@drawable/abouthome_promo_box"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="17dp"
android:layout_marginBottom="14dp"
android:gravity="center"
android:clickable="true"
android:visibility="gone"/>
</LinearLayout>

View File

@ -0,0 +1,52 @@
<?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/. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView android:id="@+id/scrolling_container"
android:layout_width="fill_parent"
android:layout_height="350dp"
android:layout_margin="8dp"
android:padding="8dp"
android:scrollbars="vertical"
android:scrollbarStyle="outsideOverlay"
android:fadeScrollbars="true"
android:requiresFadingEdge="vertical">
<TextView android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/pref_font_size_preview_text"
android:textColor="#ff000000"/>
</ScrollView>
<LinearLayout android:id="@+id/button_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:orientation="horizontal">
<Button android:id="@+id/decrease_preview_font_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/pref_font_size_adjust_char"
android:textSize="8sp"/>
<Button android:id="@+id/increase_preview_font_button"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="@string/pref_font_size_adjust_char"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>

View File

@ -80,37 +80,18 @@
android:textSize="12sp"
android:gravity="top|center_horizontal"/>
<LinearLayout android:id="@+id/sync_box"
android:background="@drawable/abouthome_sync_box"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="17dp"
android:layout_marginBottom="14dp"
android:gravity="center"
android:clickable="true"
android:visibility="gone">
<ImageView android:id="@+id/sync_logo"
android:src="@drawable/abouthome_sync_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="left|center_vertical"/>
<TextView android:id="@+id/sync_text"
android:text="@string/abouthome_about_sync"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="7dp"
android:gravity="center"
android:textSize="15sp"
android:textColor="#FFFFFF"/>
</LinearLayout>
<org.mozilla.gecko.AboutHomePromoBox android:id="@+id/promo_box"
android:orientation="horizontal"
android:background="@drawable/abouthome_promo_box"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="17dp"
android:layout_marginBottom="14dp"
android:gravity="center"
android:clickable="true"
android:visibility="gone"/>
<org.mozilla.gecko.AboutHomeSection android:id="@+id/last_tabs"
android:layout_width="fill_parent"

View File

@ -0,0 +1,24 @@
<?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/. -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
<ImageView android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="left|center_vertical"/>
<TextView android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="7dp"
android:gravity="center"
android:textSize="15sp"
android:textColor="#FFFFFF"/>
</merge>

View File

@ -3,28 +3,17 @@
- 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/. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#ffffffff"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:text="@string/pref_font_size_preview_text"
android:textColor="#ff000000"
android:scrollbars="vertical"
android:fadeScrollbars="true"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout android:id="@+id/button_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="horizontal">
<Button android:id="@+id/decrease_preview_font_button"
@ -43,4 +32,23 @@
</LinearLayout>
</LinearLayout>
<ScrollView android:id="@+id/scrolling_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/button_container"
android:layout_margin="8dp"
android:padding="8dp"
android:scrollbars="vertical"
android:scrollbarStyle="outsideOverlay"
android:fadeScrollbars="true"
android:requiresFadingEdge="vertical">
<TextView android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/pref_font_size_preview_text"
android:textColor="#ff000000"/>
</ScrollView>
</RelativeLayout>

View File

@ -1477,8 +1477,8 @@ var gCategories = {
category.setAttribute("priority", aPriority);
category.setAttribute("hidden", aStartHidden);
var node = this.node.firstChild;
while (node = node.nextSibling) {
var node;
for (node of this.node.children) {
var nodePriority = parseInt(node.getAttribute("priority"));
// If the new type's priority is higher than this one then this is the
// insertion point
@ -1650,7 +1650,7 @@ var gHeader = {
this._search.addEventListener("command", function search_onCommand(aEvent) {
var query = aEvent.target.value;
if (query.length == 0)
return false;
return;
gViewController.loadView("addons://search/" + encodeURIComponent(query));
}, false);
@ -2306,6 +2306,7 @@ var gSearchView = {
return listitem;
listitem = listitem.nextSibling;
}
return null;
}
};
@ -2458,6 +2459,7 @@ var gListView = {
return listitem;
listitem = listitem.nextSibling;
}
return null;
}
};