Bug 806937: Private browsing mode for Browser toolbar. [r=mfinkle]
@ -11,6 +11,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
@ -35,7 +36,6 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
@ -54,8 +54,8 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
private static final String LOGTAG = "GeckoToolbar";
|
||||
private LinearLayout mLayout;
|
||||
private View mAwesomeBar;
|
||||
private View mAwesomeBarRightEdge;
|
||||
private View mAddressBarBg;
|
||||
private GeckoFrameLayout mAwesomeBarRightEdge;
|
||||
private BrowserToolbarBackground mAddressBarBg;
|
||||
private TextView mTitle;
|
||||
private int mTitlePadding;
|
||||
private boolean mSiteSecurityVisible;
|
||||
@ -125,7 +125,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
// Only used on tablet layout. We need a separate view for the background
|
||||
// because we need to slide it left/right for hiding/shoing the tabs sidebar
|
||||
// See prepareTabsAnimation().
|
||||
mAddressBarBg = mLayout.findViewById(R.id.address_bar_bg);
|
||||
mAddressBarBg = (BrowserToolbarBackground) mLayout.findViewById(R.id.address_bar_bg);
|
||||
|
||||
// Only used on tablet layout. The tabs sidebar slide animation is implemented
|
||||
// in terms of translating the inner elements of the tablet toolbar to give the
|
||||
@ -133,7 +133,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
// in the same position during the animation while the elements on the left
|
||||
// (favicon, back, forware, lock icon, title, ...) slide behind it.
|
||||
// See prepareTabsAnimation().
|
||||
mAwesomeBarRightEdge = mLayout.findViewById(R.id.awesome_bar_right_edge);
|
||||
mAwesomeBarRightEdge = (GeckoFrameLayout) mLayout.findViewById(R.id.awesome_bar_right_edge);
|
||||
|
||||
// This will hold the translation width inside the toolbar when the tabs
|
||||
// pane is visible. It will affect the padding applied to the title TextView.
|
||||
@ -784,12 +784,12 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
updateTabCount(Tabs.getInstance().getCount());
|
||||
updateBackButton(tab.canDoBack());
|
||||
updateForwardButton(tab.canDoForward());
|
||||
updateBackgroundColor(tab.isPrivate() ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBackgroundColor(int level) {
|
||||
mAwesomeBar.getBackground().setLevel(level);
|
||||
mAddressBarBg.setPrivateMode(tab.isPrivate());
|
||||
|
||||
if (mAwesomeBarRightEdge != null)
|
||||
mAwesomeBarRightEdge.setPrivateMode(tab.isPrivate());
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
@ -819,7 +819,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class RightEdge extends FrameLayout
|
||||
public static class RightEdge extends GeckoFrameLayout
|
||||
implements LightweightTheme.OnChangeListener {
|
||||
private BrowserApp mActivity;
|
||||
|
||||
@ -846,12 +846,16 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||
if (drawable == null)
|
||||
return;
|
||||
|
||||
StateListDrawable stateList = new StateListDrawable();
|
||||
stateList.addState(new int[] { R.attr.state_private }, mActivity.getResources().getDrawable(R.drawable.address_bar_bg_private));
|
||||
stateList.addState(new int[] {}, drawable);
|
||||
|
||||
int[] padding = new int[] { getPaddingLeft(),
|
||||
getPaddingTop(),
|
||||
getPaddingRight(),
|
||||
getPaddingBottom()
|
||||
};
|
||||
setBackgroundDrawable(drawable);
|
||||
setBackgroundDrawable(stateList);
|
||||
setPadding(padding[0], padding[1], padding[2], padding[3]);
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class BrowserToolbarBackground extends LinearLayout
|
||||
public class BrowserToolbarBackground extends GeckoLinearLayout
|
||||
implements CanvasDelegate.DrawManager,
|
||||
LightweightTheme.OnChangeListener {
|
||||
private GeckoActivity mActivity;
|
||||
@ -98,12 +98,16 @@ public class BrowserToolbarBackground extends LinearLayout
|
||||
if (drawable == null)
|
||||
return;
|
||||
|
||||
StateListDrawable stateList = new StateListDrawable();
|
||||
stateList.addState(new int[] { R.attr.state_private }, mActivity.getResources().getDrawable(R.drawable.address_bar_bg_private));
|
||||
stateList.addState(new int[] {}, drawable);
|
||||
|
||||
int[] padding = new int[] { getPaddingLeft(),
|
||||
getPaddingTop(),
|
||||
getPaddingRight(),
|
||||
getPaddingBottom()
|
||||
};
|
||||
setBackgroundDrawable(drawable);
|
||||
setBackgroundDrawable(stateList);
|
||||
setPadding(padding[0], padding[1], padding[2], padding[3]);
|
||||
}
|
||||
|
||||
|
@ -219,6 +219,7 @@ FENNEC_PP_JAVA_FILES = \
|
||||
$(NULL)
|
||||
|
||||
FENNEC_PP_XML_FILES = \
|
||||
res/drawable/address_bar_bg.xml \
|
||||
res/layout/abouthome_content.xml \
|
||||
res/layout/awesomebar_search.xml \
|
||||
res/layout/awesomebar_suggestion_row.xml \
|
||||
@ -524,6 +525,7 @@ RES_DRAWABLE_BASE = \
|
||||
res/drawable/address_bar_back_button_pressed_bg.xml \
|
||||
res/drawable/address_bar_forward_button.xml \
|
||||
res/drawable/address_bar_texture_port.png \
|
||||
res/drawable/address_bar_texture_port_pb.png \
|
||||
res/drawable/address_bar_url.xml \
|
||||
res/drawable/address_bar_url_default.9.png \
|
||||
res/drawable/address_bar_url_pressed.9.png \
|
||||
@ -598,6 +600,7 @@ RES_DRAWABLE_HDPI = \
|
||||
res/drawable-hdpi/tab_thumbnail_shadow.png \
|
||||
res/drawable-hdpi/tabs_carat.png \
|
||||
res/drawable-hdpi/address_bar_texture_port.png \
|
||||
res/drawable-hdpi/address_bar_texture_port_pb.png \
|
||||
res/drawable-hdpi/address_bar_url_default.9.png \
|
||||
res/drawable-hdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-hdpi/doorhanger_arrow.png \
|
||||
@ -636,6 +639,7 @@ RES_DRAWABLE_XHDPI = \
|
||||
res/drawable-xhdpi/abouthome_thumbnail_bg.png \
|
||||
res/drawable-xhdpi/address_bar_bg_shadow.png \
|
||||
res/drawable-xhdpi/address_bar_texture_port.png \
|
||||
res/drawable-xhdpi/address_bar_texture_port_pb.png \
|
||||
res/drawable-xhdpi/address_bar_url_default.9.png \
|
||||
res/drawable-xhdpi/address_bar_url_pressed.9.png \
|
||||
res/drawable-xhdpi/alert_addon.png \
|
||||
@ -789,13 +793,15 @@ RES_DRAWABLE_XHDPI_V11 = \
|
||||
$(NULL)
|
||||
|
||||
RES_DRAWABLE_LAND_V14 = \
|
||||
res/drawable-land-v14/address_bar_bg.xml \
|
||||
res/drawable-land-v14/address_bar_bg_normal.xml \
|
||||
res/drawable-land-v14/address_bar_bg_private.xml \
|
||||
$(NULL)
|
||||
|
||||
RES_DRAWABLE_LAND_MDPI_V14 = \
|
||||
res/drawable-land-mdpi-v14/ic_awesomebar_go.png \
|
||||
res/drawable-land-mdpi-v14/ic_awesomebar_search.png \
|
||||
res/drawable-land-mdpi-v14/address_bar_texture_land.png \
|
||||
res/drawable-land-mdpi-v14/address_bar_texture_land_pb.png \
|
||||
res/drawable-land-mdpi-v14/address_bar_url_default.9.png \
|
||||
res/drawable-land-mdpi-v14/address_bar_url_pressed.9.png \
|
||||
res/drawable-land-mdpi-v14/remote_tabs_off.png \
|
||||
@ -813,6 +819,7 @@ RES_DRAWABLE_LAND_HDPI_V14 = \
|
||||
res/drawable-land-hdpi-v14/ic_awesomebar_go.png \
|
||||
res/drawable-land-hdpi-v14/ic_awesomebar_search.png \
|
||||
res/drawable-land-hdpi-v14/address_bar_texture_land.png \
|
||||
res/drawable-land-hdpi-v14/address_bar_texture_land_pb.png \
|
||||
res/drawable-land-hdpi-v14/address_bar_url_default.9.png \
|
||||
res/drawable-land-hdpi-v14/address_bar_url_pressed.9.png \
|
||||
res/drawable-land-hdpi-v14/remote_tabs_off.png \
|
||||
@ -830,6 +837,7 @@ RES_DRAWABLE_LAND_XHDPI_V14 = \
|
||||
res/drawable-land-xhdpi-v14/ic_awesomebar_go.png \
|
||||
res/drawable-land-xhdpi-v14/ic_awesomebar_search.png \
|
||||
res/drawable-land-xhdpi-v14/address_bar_texture_land.png \
|
||||
res/drawable-land-xhdpi-v14/address_bar_texture_land_pb.png \
|
||||
res/drawable-land-xhdpi-v14/address_bar_url_default.9.png \
|
||||
res/drawable-land-xhdpi-v14/address_bar_url_pressed.9.png \
|
||||
res/drawable-land-xhdpi-v14/remote_tabs_off.png \
|
||||
@ -844,8 +852,10 @@ RES_DRAWABLE_LAND_XHDPI_V14 = \
|
||||
$(NULL)
|
||||
|
||||
RES_DRAWABLE_LARGE_MDPI_V11 = \
|
||||
res/drawable-large-mdpi-v11/address_bar_bg.xml \
|
||||
res/drawable-large-mdpi-v11/address_bar_bg_normal.xml \
|
||||
res/drawable-large-mdpi-v11/address_bar_bg_private.xml \
|
||||
res/drawable-large-mdpi-v11/address_bar_texture_tablet.png \
|
||||
res/drawable-large-mdpi-v11/address_bar_texture_tablet_pb.png \
|
||||
res/drawable-large-mdpi-v11/address_bar_back_button_bg.png \
|
||||
res/drawable-large-mdpi-v11/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-large-mdpi-v11/address_bar_url_default.9.png \
|
||||
@ -869,6 +879,7 @@ RES_DRAWABLE_LARGE_MDPI_V11 = \
|
||||
|
||||
RES_DRAWABLE_LARGE_HDPI_V11 = \
|
||||
res/drawable-large-hdpi-v11/address_bar_texture_tablet.png \
|
||||
res/drawable-large-hdpi-v11/address_bar_texture_tablet_pb.png \
|
||||
res/drawable-large-hdpi-v11/address_bar_back_button_bg.png \
|
||||
res/drawable-large-hdpi-v11/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-large-hdpi-v11/address_bar_url_default.9.png \
|
||||
@ -892,6 +903,7 @@ RES_DRAWABLE_LARGE_HDPI_V11 = \
|
||||
|
||||
RES_DRAWABLE_LARGE_XHDPI_V11 = \
|
||||
res/drawable-large-xhdpi-v11/address_bar_texture_tablet.png \
|
||||
res/drawable-large-xhdpi-v11/address_bar_texture_tablet_pb.png \
|
||||
res/drawable-large-xhdpi-v11/address_bar_back_button_bg.png \
|
||||
res/drawable-large-xhdpi-v11/address_bar_back_button_pressed_bg.png \
|
||||
res/drawable-large-xhdpi-v11/address_bar_url_default.9.png \
|
||||
@ -967,7 +979,8 @@ MOZ_ANDROID_DRAWABLES += \
|
||||
mobile/android/base/resources/drawable/abouthome_divider.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_normal.xml \
|
||||
mobile/android/base/resources/drawable/address_bar_bg_private.xml \
|
||||
mobile/android/base/resources/drawable/address_bar_bg_shadow_repeat.xml \
|
||||
mobile/android/base/resources/drawable/address_bar_url_level.xml \
|
||||
mobile/android/base/resources/drawable/autocomplete_list_bg.9.png \
|
||||
@ -1107,7 +1120,7 @@ PP_RES_XML= \
|
||||
# This is kinda awful; if any of the source files change, we remake them all.
|
||||
$(PP_RES_XML): $(patsubst res/%,$(srcdir)/resources/%.in,$(PP_RES_XML))
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
|
||||
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $(subst res,$(srcdir)/resources,$@).in > $@
|
||||
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $(subst res/,$(srcdir)/resources/,$@).in > $@
|
||||
|
||||
# AndroidManifest.xml includes these files, so they need to be marked as dependencies.
|
||||
SERVICES_MANIFEST_FRAGMENTS = $(wildcard $(topsrcdir)/mobile/android/services/manifests/*.in)
|
||||
|
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,9 @@
|
||||
<?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/. -->
|
||||
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/address_bar_texture_land_pb"
|
||||
android:tileMode="repeat"
|
||||
android:dither="false"/>
|
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 7.1 KiB |
@ -0,0 +1,9 @@
|
||||
<?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/. -->
|
||||
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/address_bar_texture_tablet_pb"
|
||||
android:tileMode="repeat"
|
||||
android:dither="false"/>
|
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.6 KiB |
16
mobile/android/base/resources/drawable/address_bar_bg.xml.in
Normal file
@ -0,0 +1,16 @@
|
||||
#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/. -->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:gecko="http://schemas.android.com/apk/res/@ANDROID_PACKAGE_NAME@">
|
||||
|
||||
<!-- private browsing mode -->
|
||||
<item gecko:state_private="true" android:drawable="@drawable/address_bar_bg_private"/>
|
||||
|
||||
<!-- normal mode -->
|
||||
<item android:drawable="@drawable/address_bar_bg_normal"/>
|
||||
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?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/. -->
|
||||
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/address_bar_texture_port_pb"
|
||||
android:tileMode="repeat"
|
||||
android:dither="false"/>
|
After Width: | Height: | Size: 3.1 KiB |