Bug 1375351 - Part 3: Remove SkinConfig. r?nechen,walkingice
SkinConfig is used to detect current skin is Australis or Photon at runtime.
Since we don't support Australis anymore in Nightly, this class should be removed.
MozReview-Commit-ID: 8yjTFYyQcgt
deleted file mode 100644
--- a/mobile/android/app/src/australis/java/org/mozilla/gecko/skin/SkinConfig.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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.skin;
-
-import android.support.annotation.IntDef;
-
-public class SkinConfig {
-
- private static final int SKIN_AUSTRALIS = 0;
- private static final int SKIN_PHOTON = 1;
-
- @IntDef({ SKIN_AUSTRALIS, SKIN_PHOTON })
- private @interface Skin {}
-
- @SkinConfig.Skin
- private static final int SKIN = SKIN_AUSTRALIS;
-
- public static boolean isAustralis() {
- return SKIN == SKIN_AUSTRALIS;
- }
-
- public static boolean isPhoton() {
- return SKIN == SKIN_PHOTON;
- }
-}
deleted file mode 100644
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/skin/SkinConfig.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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.skin;
-
-import android.support.annotation.IntDef;
-
-public class SkinConfig {
-
- private static final int SKIN_AUSTRALIS = 0;
- private static final int SKIN_PHOTON = 1;
-
- @IntDef({ SKIN_AUSTRALIS, SKIN_PHOTON })
- private @interface Skin {}
-
- @SkinConfig.Skin
- private static final int SKIN = SKIN_PHOTON;
-
- public static boolean isAustralis() {
- return SKIN == SKIN_AUSTRALIS;
- }
-
- public static boolean isPhoton() {
- return SKIN == SKIN_PHOTON;
- }
-}
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -14,17 +14,16 @@ import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.BrowserApp;
import org.mozilla.gecko.R;
import org.mozilla.gecko.reader.ReaderModeUtils;
import org.mozilla.gecko.SiteIdentity;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.Experiments;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.ViewUtil;
import org.mozilla.gecko.widget.themed.ThemedImageButton;
import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
import org.mozilla.gecko.widget.themed.ThemedTextView;
@@ -98,17 +97,17 @@ public class ToolbarDisplayLayout extend
private boolean mIsAttached;
private final ThemedTextView mTitle;
private final int mTitlePadding;
private ToolbarPrefs mPrefs;
private OnTitleChangeListener mTitleChangeListener;
private final ThemedImageButton mSiteSecurity;
- private final ImageButton mStop;
+ private final ThemedImageButton mStop;
private OnStopListener mStopListener;
private final PageActionLayout mPageActionLayout;
private final SiteIdentityPopup mSiteIdentityPopup;
private int mSecurityImageLevel;
// Security level constants, which map to the icons / levels defined in:
@@ -154,34 +153,28 @@ public class ToolbarDisplayLayout extend
mPrivateCertificateOwnerColorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.url_bar_certificate_owner_private));
mSiteSecurity = (ThemedImageButton) findViewById(R.id.site_security);
mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
mSiteIdentityPopup.setAnchor(this);
mSiteIdentityPopup.setOnVisibilityChangeListener(mActivity);
- mStop = (ImageButton) findViewById(R.id.stop);
+ mStop = (ThemedImageButton) findViewById(R.id.stop);
mPageActionLayout = (PageActionLayout) findViewById(R.id.page_action_layout);
}
@Override
public void setPrivateMode(boolean isPrivate) {
super.setPrivateMode(isPrivate);
mSiteSecurity.setPrivateMode(isPrivate);
-
- // Bug 1375351 should change class type to ThemedImageButton to avoid casting
- if (SkinConfig.isPhoton()) {
- ((ThemedImageButton)mStop).setPrivateMode(isPrivate);
- }
-
+ mStop.setPrivateMode(isPrivate);
mPageActionLayout.setPrivateMode(isPrivate);
}
-
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
mIsAttached = true;
final Tab selectedTab = Tabs.getInstance().getSelectedTab();
if (selectedTab != null) {
--- a/mobile/android/base/java/org/mozilla/gecko/Tabs.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tabs.java
@@ -19,19 +19,17 @@ import android.support.annotation.Nullab
import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.distribution.PartnerBrowserCustomizationsClient;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.mozglue.SafeIntent;
import org.mozilla.gecko.notifications.WhatsNewReceiver;
import org.mozilla.gecko.preferences.GeckoPreferences;
-import org.mozilla.gecko.promotion.AddToHomeScreenPromotion;
import org.mozilla.gecko.reader.ReaderModeUtils;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.JavaUtil;
import org.mozilla.gecko.util.ThreadUtils;
import android.accounts.Account;
import android.accounts.AccountManager;
@@ -1048,21 +1046,17 @@ public class Tabs implements BundleEvent
* Opens a new tab and loads either about:home or, if PREFS_HOMEPAGE_FOR_EVERY_NEW_TAB is set,
* the user's homepage.
*/
public Tab addTab() {
return loadUrl(getHomepageForNewTab(mAppContext), Tabs.LOADURL_NEW_TAB);
}
public Tab addPrivateTab() {
- if (SkinConfig.isPhoton()) {
- return loadUrl(getHomepageForNewTab(mAppContext), Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
- } else {
- return loadUrl(AboutPages.PRIVATEBROWSING, Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
- }
+ return loadUrl(getHomepageForNewTab(mAppContext), Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
}
/**
* Open the url as a new tab, and mark the selected tab as its "parent".
*
* If the url is already open in a tab, the existing tab is selected.
* Use this for tabs opened by the browser chrome, so users can press the
* "Back" button to return to the previous tab.
--- a/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
@@ -28,17 +28,16 @@ import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.annotation.RobocopTarget;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserContract.History;
import org.mozilla.gecko.db.BrowserContract.URLColumns;
import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
import org.mozilla.gecko.home.SearchLoader.SearchCursorLoader;
import org.mozilla.gecko.preferences.GeckoPreferences;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.toolbar.AutocompleteHandler;
import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.ThreadUtils;
import android.app.Activity;
@@ -1192,20 +1191,19 @@ public class BrowserSearch extends HomeF
row.setPrivateMode(isPrivate);
} else {
// Account for the search engines
position -= getPrimaryEngineCount();
final Cursor c = getCursor(position);
final TwoLinePageRow row = (TwoLinePageRow) view;
- if (SkinConfig.isPhoton()) {
- // Highlight all substrings in title field if they matches the search term.
- row.setTitleFormatter(mTwoLinePageRowTitleFormatter);
- }
+ // Highlight all substrings in title field if they matches the search term.
+ row.setTitleFormatter(mTwoLinePageRowTitleFormatter);
+
row.updateFromCursor(c);
row.setPrivateMode(isPrivate);
}
}
}
private TwoLinePageRow.TitleFormatter mTwoLinePageRowTitleFormatter = new TwoLinePageRow.TitleFormatter() {
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/PrivateTabsPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/PrivateTabsPanel.java
@@ -5,17 +5,16 @@
package org.mozilla.gecko.tabs;
import org.mozilla.gecko.GeckoApp;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.tabs.TabsPanel.CloseAllPanelView;
import org.mozilla.gecko.tabs.TabsPanel.TabsLayout;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
@@ -39,30 +38,28 @@ class PrivateTabsPanel extends RelativeL
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.private_tabs_panel, this);
tabsLayout = (TabsLayout) findViewById(R.id.private_tabs_layout);
final View emptyTabsFrame = findViewById(R.id.private_tabs_empty);
tabsLayout.setEmptyView(emptyTabsFrame);
- if (SkinConfig.isPhoton()) {
- final TextView learnMoreView = (TextView) findViewById(R.id.learn_more_link);
- learnMoreView.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.ACTIONBAR, "new_tab");
+ final TextView learnMoreView = (TextView) findViewById(R.id.learn_more_link);
+ learnMoreView.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.ACTIONBAR, "new_tab");
- Tabs.getInstance().loadUrl(PRIVATE_BROWSING_URL, LOADURL_NEW_TAB | LOADURL_PRIVATE);
+ Tabs.getInstance().loadUrl(PRIVATE_BROWSING_URL, LOADURL_NEW_TAB | LOADURL_PRIVATE);
- final GeckoApp geckoApp = (GeckoApp) context;
- geckoApp.autoHideTabs();
- }
- });
- }
+ final GeckoApp geckoApp = (GeckoApp) context;
+ geckoApp.autoHideTabs();
+ }
+ });
}
@Override
public void setTabsPanel(final TabsPanel panel) {
tabsLayout.setTabsPanel(panel);
}
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabStripItemView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabStripItemView.java
@@ -5,35 +5,26 @@
package org.mozilla.gecko.tabs;
import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.annotation.RobocopTarget;
-import org.mozilla.gecko.skin.SkinConfig;
-import org.mozilla.gecko.widget.ResizablePathDrawable;
-import org.mozilla.gecko.widget.ResizablePathDrawable.NonScaledPathShape;
import org.mozilla.gecko.widget.themed.ThemedImageButton;
import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
import org.mozilla.gecko.widget.themed.ThemedTextView;
import android.content.Context;
-import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Path;
-import android.graphics.Region;
-import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.widget.TextViewCompat;
import android.util.AttributeSet;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
import android.widget.Checkable;
import android.widget.ImageView;
public class TabStripItemView extends ThemedLinearLayout
implements Checkable {
private static final String LOGTAG = "GeckoTabStripItem";
@@ -43,44 +34,29 @@ public class TabStripItemView extends Th
private int id = -1;
private boolean checked;
private final ImageView faviconView;
private final ThemedTextView titleView;
private final ThemedImageButton closeView;
- private ResizablePathDrawable backgroundDrawable;
- private final Region tabRegion;
- private final Region tabClipRegion;
- private boolean tabRegionNeedsUpdate;
-
private final int faviconSize;
private Bitmap lastFavicon;
public TabStripItemView(Context context) {
this(context, null);
}
public TabStripItemView(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(HORIZONTAL);
- tabRegion = new Region();
- tabClipRegion = new Region();
-
final Resources res = context.getResources();
- if (SkinConfig.isAustralis()) {
- final ColorStateList tabColors =
- ResourcesCompat.getColorStateList(res, R.color.tab_strip_item_bg, null);
- backgroundDrawable = new ResizablePathDrawable(new TabCurveShape(), tabColors);
- setBackgroundDrawable(backgroundDrawable);
- }
-
faviconSize = res.getDimensionPixelSize(R.dimen.browser_toolbar_favicon_size);
LayoutInflater.from(context).inflate(R.layout.tab_strip_item_view, this);
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (id < 0) {
throw new IllegalStateException("Invalid tab id:" + id);
@@ -108,54 +84,16 @@ public class TabStripItemView extends Th
}
@RobocopTarget
public int getTabId() {
return id;
}
@Override
- protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
- super.onSizeChanged(width, height, oldWidth, oldHeight);
-
- // Queue a tab region update in the next draw() call. We don't
- // update it immediately here because we need the new path from
- // the background drawable to be updated first.
- tabRegionNeedsUpdate = true;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (SkinConfig.isAustralis()) {
- final int action = event.getActionMasked();
- final int x = (int) event.getX();
- final int y = (int) event.getY();
-
- // Let motion events through if they're off the tab shape bounds.
- if (action == MotionEvent.ACTION_DOWN && !tabRegion.contains(x, y)) {
- return false;
- }
- }
-
- return super.onTouchEvent(event);
- }
-
- @Override
- public void draw(Canvas canvas) {
- super.draw(canvas);
-
- if (SkinConfig.isAustralis() && tabRegionNeedsUpdate) {
- final Path path = backgroundDrawable.getPath();
- tabClipRegion.set(0, 0, getWidth(), getHeight());
- tabRegion.setPath(path, tabClipRegion);
- tabRegionNeedsUpdate = false;
- }
- }
-
- @Override
public int[] onCreateDrawableState(int extraSpace) {
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
if (checked) {
mergeDrawableStates(drawableState, STATE_CHECKED);
}
return drawableState;
@@ -237,27 +175,9 @@ public class TabStripItemView extends Th
// Cache the original so we can debounce without scaling.
lastFavicon = favicon;
final Bitmap scaledFavicon =
Bitmap.createScaledBitmap(favicon, faviconSize, faviconSize, false);
faviconView.setImageBitmap(scaledFavicon);
}
-
- private static class TabCurveShape extends NonScaledPathShape {
- @Override
- protected void onResize(float width, float height) {
- final Path path = getPath();
-
- path.reset();
-
- final float curveWidth = TabCurve.getWidthForHeight(height);
-
- path.moveTo(0, height);
- TabCurve.drawFromBottom(path, 0, height, TabCurve.Direction.RIGHT);
- path.lineTo(width - curveWidth, 0);
-
- TabCurve.drawFromTop(path, width - curveWidth, height, TabCurve.Direction.RIGHT);
- path.lineTo(0, height);
- }
- }
}
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabStripView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabStripView.java
@@ -3,17 +3,16 @@
* 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.tabs;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.util.ThreadUtils;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
@@ -269,23 +268,18 @@ public class TabStripView extends Recycl
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
final boolean isLTR = !ViewUtils.isLayoutRtl(this);
final float strength = getFadingEdgeStrength(isLTR);
if (strength > 0.0f) {
if (isLTR) {
- if (SkinConfig.isAustralis()) {
- final int r = getRight();
- canvas.drawRect(r - fadingEdgeSize, getTop(), r, getBottom(), fadingEdgePaint);
- } else {
- final int w = getWidth();
- canvas.drawRect(w - fadingEdgeSize, getTop(), w, getBottom(), fadingEdgePaint);
- }
+ final int w = getWidth();
+ canvas.drawRect(w - fadingEdgeSize, getTop(), w, getBottom(), fadingEdgePaint);
} else {
canvas.drawRect(0, getTop(), fadingEdgeSize, getBottom(), fadingEdgePaint);
}
fadingEdgePaint.setAlpha((int) (strength * 255));
}
}
private void animateRestoredTabs() {
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabsLayout.java
@@ -3,17 +3,16 @@
* 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.tabs;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.widget.RecyclerViewClickSupport;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@@ -69,25 +68,21 @@ public abstract class TabsLayout extends
@Override
public void setTabsPanel(TabsPanel panel) {
tabsPanel = panel;
}
@Override
public void show() {
- if (SkinConfig.isPhoton()) {
- final boolean hasTabs = (tabsAdapter.getItemCount() > 0);
- setVisibility(hasTabs ? VISIBLE : GONE);
+ final boolean hasTabs = (tabsAdapter.getItemCount() > 0);
+ setVisibility(hasTabs ? VISIBLE : GONE);
- if (emptyView != null) {
- emptyView.setVisibility(hasTabs ? GONE : VISIBLE);
- }
- } else {
- setVisibility(View.VISIBLE);
+ if (emptyView != null) {
+ emptyView.setVisibility(hasTabs ? GONE : VISIBLE);
}
Tabs.getInstance().refreshThumbnails();
Tabs.registerOnTabsChangedListener(this);
refreshTabsData();
}
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
@@ -22,25 +22,23 @@ import org.mozilla.gecko.TouchEventInter
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.PropertyAnimator.PropertyAnimationListener;
import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.lwt.LightweightTheme;
import org.mozilla.gecko.lwt.LightweightThemeDrawable;
import org.mozilla.gecko.menu.GeckoMenu;
import org.mozilla.gecko.menu.MenuPopup;
import org.mozilla.gecko.preferences.GeckoPreferences;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.tabs.TabHistoryController;
import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.OnStopListener;
import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.OnTitleChangeListener;
import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.UpdateFlags;
import org.mozilla.gecko.util.Clipboard;
import org.mozilla.gecko.util.MenuUtils;
import org.mozilla.gecko.util.WindowUtil;
-import org.mozilla.gecko.widget.themed.ThemedFrameLayout;
import org.mozilla.gecko.widget.themed.ThemedImageButton;
import org.mozilla.gecko.widget.themed.ThemedImageView;
import org.mozilla.gecko.widget.themed.ThemedRelativeLayout;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
@@ -78,17 +76,16 @@ import android.support.annotation.NonNul
* as a set of listeners to allow {@code BrowserToolbar} users to react
* to state changes accordingly.
*/
public abstract class BrowserToolbar extends ThemedRelativeLayout
implements Tabs.OnTabsChangedListener,
GeckoMenu.ActionItemBarPresenter {
private static final String LOGTAG = "GeckoToolbar";
- private static final int LIGHTWEIGHT_THEME_INVERT_ALPHA = 34; // 255 - alpha = invert_alpha
private static final int LIGHTWEIGHT_THEME_ALPHA = 77;
public interface OnActivateListener {
public void onActivate();
}
public interface OnCommitListener {
public void onCommit();
@@ -844,22 +841,17 @@ public abstract class BrowserToolbar ext
super.setPrivateMode(isPrivate);
tabsButton.setPrivateMode(isPrivate);
tabsCounter.setPrivateMode(isPrivate);
urlEditLayout.setPrivateMode(isPrivate);
urlDisplayLayout.setPrivateMode(isPrivate);
- // bug 1375351: menuButton is a ThemedImageButton in Photon flavor
- if (SkinConfig.isPhoton()) {
- ((ThemedImageButton)menuButton).setPrivateMode(isPrivate);
- } else {
- ((ThemedFrameLayout)menuButton).setPrivateMode(isPrivate);
- }
+ ((ThemedImageButton) menuButton).setPrivateMode(isPrivate);
shadowPaint.setColor(isPrivate ? shadowPrivateColor : shadowColor);
if (modeChanged) {
WindowUtil.invalidateStatusBarColor(activity, isPrivate);
}
}
@@ -943,21 +935,17 @@ public abstract class BrowserToolbar ext
}
public static LightweightThemeDrawable getLightweightThemeDrawable(final View view,
final LightweightTheme theme, final int colorResID) {
final int color = ContextCompat.getColor(view.getContext(), colorResID);
final LightweightThemeDrawable drawable = theme.getColorDrawable(view, color);
if (drawable != null) {
- if (SkinConfig.isAustralis()) {
- drawable.setAlpha(LIGHTWEIGHT_THEME_INVERT_ALPHA, LIGHTWEIGHT_THEME_INVERT_ALPHA);
- } else {
- drawable.setAlpha(LIGHTWEIGHT_THEME_ALPHA, LIGHTWEIGHT_THEME_ALPHA);
- }
+ drawable.setAlpha(LIGHTWEIGHT_THEME_ALPHA, LIGHTWEIGHT_THEME_ALPHA);
}
return drawable;
}
public static class TabEditingState {
// The edited text from the most recent time this tab was unselected.
protected String lastEditingText;
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbarPhone.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbarPhone.java
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.PropertyAnimator.PropertyAnimationListener;
-import org.mozilla.gecko.skin.SkinConfig;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
/**
* A toolbar implementation for phones.
@@ -118,26 +117,15 @@ class BrowserToolbarPhone extends Browse
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(tabsCounter,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
animator.attach(menuButton,
PropertyAnimator.Property.TRANSLATION_X,
curveTranslation);
-
- // bug 1375351: menuIcon only exists in Australis flavor
- if (SkinConfig.isAustralis()) {
- animator.attach(menuIcon,
- PropertyAnimator.Property.TRANSLATION_X,
- curveTranslation);
- }
}
@Override
protected Drawable getLWTDefaultStateSetDrawable() {
- if (SkinConfig.isAustralis()) {
- return getTheme().getDrawable(this);
- } else {
- return BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
- }
+ return BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbarPhoneBase.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbarPhoneBase.java
@@ -9,17 +9,16 @@ import java.util.Arrays;
import android.support.v4.content.ContextCompat;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
-import org.mozilla.gecko.skin.SkinConfig;
import org.mozilla.gecko.widget.themed.ThemedImageButton;
import org.mozilla.gecko.widget.themed.ThemedImageView;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
@@ -108,21 +107,17 @@ abstract class BrowserToolbarPhoneBase e
}
});
}
@Override
public void setPrivateMode(final boolean isPrivate) {
super.setPrivateMode(isPrivate);
- if (SkinConfig.isAustralis()) {
- ((ThemedImageView) editCancel).setPrivateMode(isPrivate);
- } else {
- ((ThemedImageButton) editCancel).setPrivateMode(isPrivate);
- }
+ ((ThemedImageButton) editCancel).setPrivateMode(isPrivate);
}
@Override
protected boolean isTabsButtonOffscreen() {
return isEditing();
}
@Override
@@ -137,57 +132,32 @@ abstract class BrowserToolbarPhoneBase e
}
@Override
protected void updateNavigationButtons(final Tab tab) {
// We have no navigation buttons so do nothing.
}
@Override
- public void draw(final Canvas canvas) {
- super.draw(canvas);
-
- // bug 1375351: Only draw curve in Australis flavor
- if (SkinConfig.isAustralis()) {
- if (uiMode == UIMode.DISPLAY) {
- canvas.drawPath(roundCornerShape, roundCornerPaint);
- }
- }
- }
-
- @Override
public void triggerTabsPanelTransition(final PropertyAnimator animator, final boolean areTabsShown) {
if (areTabsShown) {
ViewHelper.setAlpha(tabsCounter, 0.0f);
-
- // bug 1375351: menuIcon only exists in Australis flavor
- if (SkinConfig.isAustralis()) {
- ViewHelper.setAlpha(menuIcon, 0.0f);
- } else {
- ViewHelper.setAlpha(menuButton, 0.0f);
- }
+ ViewHelper.setAlpha(menuButton, 0.0f);
return;
}
final PropertyAnimator buttonsAnimator =
new PropertyAnimator(animator.getDuration(), buttonsInterpolator);
buttonsAnimator.attach(tabsCounter,
PropertyAnimator.Property.ALPHA,
1.0f);
- // bug 1375351: menuIcon only exists in Australis flavor
- if (SkinConfig.isAustralis()) {
- buttonsAnimator.attach(menuIcon,
- PropertyAnimator.Property.ALPHA,
- 1.0f);
- } else {
- buttonsAnimator.attach(menuButton,
- PropertyAnimator.Property.ALPHA,
- 1.0f);
- }
+ buttonsAnimator.attach(menuButton,
+ PropertyAnimator.Property.ALPHA,
+ 1.0f);
buttonsAnimator.start();
}
/**
* Returns the number of pixels the url bar translating edge
* needs to translate to the right to enter its editing mode state.
* A negative value means the edge must translate to the left.
@@ -257,26 +227,18 @@ abstract class BrowserToolbarPhoneBase e
}
});
}
@Override
public void onLightweightThemeChanged() {
super.onLightweightThemeChanged();
- if (SkinConfig.isAustralis()) {
- ((ThemedImageView) editCancel).onLightweightThemeChanged();
- } else {
- ((ThemedImageButton) editCancel).onLightweightThemeChanged();
- }
+ ((ThemedImageButton) editCancel).onLightweightThemeChanged();
}
@Override
public void onLightweightThemeReset() {
super.onLightweightThemeReset();
- if (SkinConfig.isAustralis()) {
- ((ThemedImageView) editCancel).onLightweightThemeReset();
- } else {
- ((ThemedImageButton) editCancel).onLightweightThemeReset();
- }
+ ((ThemedImageButton) editCancel).onLightweightThemeReset();
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/NavButton.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/NavButton.java
@@ -2,17 +2,16 @@
* 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.toolbar;
import android.content.res.TypedArray;
import android.support.v4.content.ContextCompat;
import org.mozilla.gecko.R;
-import org.mozilla.gecko.skin.SkinConfig;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
@@ -54,20 +53,18 @@ abstract class NavButton extends ShapedB
super.setPrivateMode(isPrivate);
mBorderPaint.setColor(isPrivate ? mBorderColorPrivate : mBorderColor);
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
- if (SkinConfig.isPhoton()) {
- final double alpha = 255 * (isEnabled() ? 1 : 0.05);
- mBorderPaint.setAlpha((int) alpha);
- }
+ final double alpha = 255 * (isEnabled() ? 1 : 0.05);
+ mBorderPaint.setAlpha((int) alpha);
// Draw the border on top.
canvas.drawPath(mBorderPath, mBorderPaint);
}
// The drawable is constructed as per @drawable/url_bar_nav_button.
@Override
public void onLightweightThemeChanged() {
--- a/mobile/android/base/java/org/mozilla/gecko/util/WindowUtil.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/WindowUtil.java
@@ -7,26 +7,20 @@ package org.mozilla.gecko.util;
import android.app.Activity;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.Window;
import org.mozilla.gecko.R;
-import org.mozilla.gecko.skin.SkinConfig;
public class WindowUtil {
public static void invalidateStatusBarColor(final Activity activity, boolean darkTheme) {
- // Don't support status bar color change in Australis.
- if (SkinConfig.isAustralis()) {
- return;
- }
-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return;
}
final int colorResId;
if (HardwareUtils.isTablet()) {
colorResId = R.color.status_bar_bg_color_tablet;
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -1005,17 +1005,16 @@ gbjar.sources += ['java/org/mozilla/geck
'widget/themed/ThemedTextSwitcher.java',
'widget/themed/ThemedTextView.java',
'widget/themed/ThemedView.java',
]]
# The following sources are Photon specific, Eventually they should be merged into base.
gbjar.sources += ['../app/src/photon/java/org/mozilla/gecko/' + x for x in [
'home/SearchEngineRow.java',
'home/SuggestionItem.java',
- 'skin/SkinConfig.java',
'toolbar/BrowserToolbarTablet.java',
'toolbar/BrowserToolbarTabletBase.java',
'toolbar/ForwardButton.java',
'toolbar/TabCounter.java',
'toolbar/ToolbarDisplayLayout.java',
'toolbar/ToolbarRoundButton.java',
]]