--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -66,17 +66,16 @@ public class AppConstants {
public static final boolean preMarshmallow = MAX_SDK_VERSION < 23 || (MIN_SDK_VERSION < 23 && Build.VERSION.SDK_INT < 23);
public static final boolean preLollipop = MAX_SDK_VERSION < 21 || (MIN_SDK_VERSION < 21 && Build.VERSION.SDK_INT < 21);
public static final boolean preJBMR2 = MAX_SDK_VERSION < 18 || (MIN_SDK_VERSION < 18 && Build.VERSION.SDK_INT < 18);
public static final boolean preJBMR1 = MAX_SDK_VERSION < 17 || (MIN_SDK_VERSION < 17 && Build.VERSION.SDK_INT < 17);
public static final boolean preJB = MAX_SDK_VERSION < 16 || (MIN_SDK_VERSION < 16 && Build.VERSION.SDK_INT < 16);
public static final boolean preICS = MAX_SDK_VERSION < 14 || (MIN_SDK_VERSION < 14 && Build.VERSION.SDK_INT < 14);
public static final boolean preHCMR2 = MAX_SDK_VERSION < 13 || (MIN_SDK_VERSION < 13 && Build.VERSION.SDK_INT < 13);
public static final boolean preHCMR1 = MAX_SDK_VERSION < 12 || (MIN_SDK_VERSION < 12 && Build.VERSION.SDK_INT < 12);
- public static final boolean preHC = MAX_SDK_VERSION < 11 || (MIN_SDK_VERSION < 11 && Build.VERSION.SDK_INT < 11);
}
/**
* The name of the Java class that represents the android application.
*/
public static final String MOZ_ANDROID_APPLICATION_CLASS = "@MOZ_ANDROID_APPLICATION_CLASS@";
/**
* The name of the Java class that launches the browser activity.
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -953,21 +953,19 @@ public class BrowserApp extends GeckoApp
return;
}
super.onBackPressed();
}
@Override
public void onAttachedToWindow() {
- // Gingerbread 2.3 doesn't handle starting alphas correctly, so disable doorhanger overlays for that, and perf.
- if (!Versions.preHC){
- mDoorhangerOverlay = findViewById(R.id.doorhanger_overlay);
- mDoorhangerOverlay.setVisibility(View.VISIBLE);
- }
+ mDoorhangerOverlay = findViewById(R.id.doorhanger_overlay);
+ mDoorhangerOverlay.setVisibility(View.VISIBLE);
+
// We can't show the first run experience until Gecko has finished initialization (bug 1077583).
checkFirstrun(this, new SafeIntent(getIntent()));
}
@Override
protected void processTabQueue() {
if (TabQueueHelper.TAB_QUEUE_ENABLED && mInitialized) {
ThreadUtils.postToBackgroundThread(new Runnable() {
@@ -1080,30 +1078,16 @@ public class BrowserApp extends GeckoApp
// We only show the guest mode notification when our activity is in the foreground.
GuestSession.hideNotification(this);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
- // If Home Page is visible, the layerView surface has to be visible
- // to avoid a surface issue in Gingerbread phones.
- // We need to do this on the next iteration.
- // See bugs: 1058027 and 1003123
- if (mInitialized && hasFocus &&
- Versions.preHC && isHomePagerVisible() &&
- mLayerView.getVisibility() != View.VISIBLE){
- ThreadUtils.postToUiThread(new Runnable() {
- @Override
- public void run() {
- mLayerView.showSurface();
- }
- });
- }
// Sending a message to the toolbar when the browser window gains focus
// This is needed for qr code input
if (hasFocus) {
mBrowserToolbar.onParentFocus();
}
}
@@ -1309,39 +1293,32 @@ public class BrowserApp extends GeckoApp
if (tab != null && tab.hasFeeds()) {
JSONObject args = new JSONObject();
try {
args.put("tabId", tab.getId());
} catch (JSONException e) {
Log.e(LOGTAG, "error building json arguments", e);
}
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Feeds:Subscribe", args.toString()));
- if (Versions.preHC) {
- Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "subscribe");
- }
}
return true;
}
if (itemId == R.id.add_search_engine) {
// This can be selected from either the browser menu or the contextmenu, depending on the size and version (v11+) of the phone.
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null && tab.hasOpenSearch()) {
JSONObject args = new JSONObject();
try {
args.put("tabId", tab.getId());
} catch (JSONException e) {
Log.e(LOGTAG, "error building json arguments", e);
return true;
}
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Add", args.toString()));
-
- if (Versions.preHC) {
- Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "add_search_engine");
- }
}
return true;
}
if (itemId == R.id.copyurl) {
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
String url = ReaderModeUtils.stripAboutReaderUrl(tab.getURL());
@@ -1487,33 +1464,25 @@ public class BrowserApp extends GeckoApp
invalidateOptionsMenu();
}
}
@Override
public void onDoorHangerShow() {
mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
- if (Versions.preHC) {
- return;
- }
-
final Animator alphaAnimator = ObjectAnimator.ofFloat(mDoorhangerOverlay, "alpha", 1);
alphaAnimator.setDuration(250);
TransitionsTracker.track(alphaAnimator);
alphaAnimator.start();
}
@Override
public void onDoorHangerHide() {
- if (Versions.preHC) {
- return;
- }
-
final Animator alphaAnimator = ObjectAnimator.ofFloat(mDoorhangerOverlay, "alpha", 0);
alphaAnimator.setDuration(200);
TransitionsTracker.track(alphaAnimator);
alphaAnimator.start();
}
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoEditable.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoEditable.java
@@ -292,19 +292,17 @@ final class GeckoEditable extends JNIObj
default:
throw new IllegalStateException("Action not processed");
}
}
private KeyEvent [] synthesizeKeyEvents(CharSequence cs) {
try {
if (mKeyMap == null) {
- mKeyMap = KeyCharacterMap.load(
- Versions.preHC ? KeyCharacterMap.ALPHA :
- KeyCharacterMap.VIRTUAL_KEYBOARD);
+ mKeyMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
}
} catch (Exception e) {
// KeyCharacterMap.UnavailableException is not found on Gingerbread;
// besides, it seems like HC and ICS will throw something other than
// KeyCharacterMap.UnavailableException; so use a generic Exception here
return null;
}
KeyEvent [] keyEvents = mKeyMap.getEvents(cs.toString().toCharArray());
@@ -999,24 +997,17 @@ final class GeckoEditable extends JNIObj
return;
}
mListener.onSelectionChange(newStart, newEnd);
}
});
}
private void geckoReplaceText(int start, int oldEnd, CharSequence newText) {
- if (AppConstants.Versions.preHC) {
- // Don't use replace() because Gingerbread has a bug where if the replaced text
- // has the same spans as the original text, the spans will end up being deleted
- mText.delete(start, oldEnd);
- mText.insert(start, newText);
- } else {
- mText.replace(start, oldEnd, newText);
- }
+ mText.replace(start, oldEnd, newText);
}
private boolean geckoIsSameText(int start, int oldEnd, CharSequence newText) {
return oldEnd - start == newText.length() &&
TextUtils.regionMatches(mText, start, newText, 0, oldEnd - start);
}
@WrapForJNI @Override
--- a/mobile/android/base/java/org/mozilla/gecko/TextSelection.java
+++ b/mobile/android/base/java/org/mozilla/gecko/TextSelection.java
@@ -332,27 +332,16 @@ class TextSelection extends Layer implem
menuitem.setShowAsAction(actionEnum, R.attr.menuItemActionModeStyle);
final String iconString = obj.optString("icon");
BitmapUtils.getDrawable(anchorHandle.getContext(), iconString, new BitmapLoader() {
@Override
public void onBitmapFound(Drawable d) {
if (d != null) {
menuitem.setIcon(d);
-
- // Dynamically add padding to align the share icon on GB devices.
- // To be removed in bug 1122752.
- if (Versions.preHC && "drawable://ic_menu_share".equals(iconString)) {
- final View view = menuitem.getActionView();
-
- final Resources res = view.getContext().getResources();
- final int padding = res.getDimensionPixelSize(R.dimen.ab_share_padding);
-
- view.setPadding(padding, padding, padding, padding);
- }
}
}
});
} catch(Exception ex) {
Log.i(LOGTAG, "Exception building menu", ex);
}
}
return true;
--- a/mobile/android/base/java/org/mozilla/gecko/animation/AnimatorProxy.java
+++ b/mobile/android/base/java/org/mozilla/gecko/animation/AnimatorProxy.java
@@ -38,23 +38,20 @@ class AnimatorProxy {
private final AnimatorProxyImpl mImpl;
private AnimatorProxy(AnimatorProxyImpl impl) {
mImpl = impl;
}
public static AnimatorProxy create(View view) {
AnimatorProxy proxy = PROXIES.get(view);
- final boolean needsAnimationProxy = Versions.preHC;
-
// If the view's animation proxy has been overridden from somewhere else, we need to
// create a new AnimatorProxy for the view.
- if (proxy == null || (needsAnimationProxy && proxy.mImpl != view.getAnimation())) {
- AnimatorProxyImpl impl = (needsAnimationProxy ? new AnimatorProxyPreHC(view) :
- new AnimatorProxyPostHC(view));
+ if (proxy == null) {
+ AnimatorProxyImpl impl = (new AnimatorProxyPostHC(view));
proxy = new AnimatorProxy(impl);
PROXIES.put(view, proxy);
}
return proxy;
}
@@ -133,168 +130,16 @@ class AnimatorProxy {
public float getTranslationY() {
return mImpl.getTranslationY();
}
public void setTranslationY(float translationY) {
mImpl.setTranslationY(translationY);
}
- /*
- * AnimatorProxyPreHC uses the technique used by the NineOldAndroids described here:
- * http://jakewharton.com/advanced-pre-honeycomb-animation/
- *
- * Some of this code is based on Jake Wharton's AnimatorProxy released as part of
- * the NineOldAndroids library under the Apache License 2.0.
- */
- private static class AnimatorProxyPreHC extends Animation implements AnimatorProxyImpl {
- private final WeakReference<View> mViewRef;
-
- private final RectF mBefore;
- private final RectF mAfter;
- private final Matrix mTempMatrix;
-
- private float mAlpha;
- private float mTranslationX;
- private float mTranslationY;
-
- public AnimatorProxyPreHC(View view) {
- mBefore = new RectF();
- mAfter = new RectF();
- mTempMatrix = new Matrix();
-
- mAlpha = 1;
-
- loadCurrentTransformation(view);
-
- setDuration(0);
- setFillAfter(true);
- view.setAnimation(this);
-
- mViewRef = new WeakReference<View>(view);
- }
-
- private void loadCurrentTransformation(View view) {
- Animation animation = view.getAnimation();
- if (animation == null)
- return;
-
- Transformation transformation = new Transformation();
- float[] matrix = new float[9];
-
- animation.getTransformation(AnimationUtils.currentAnimationTimeMillis(), transformation);
- transformation.getMatrix().getValues(matrix);
-
- mAlpha = transformation.getAlpha();
- mTranslationX = matrix[Matrix.MTRANS_X];
- mTranslationY = matrix[Matrix.MTRANS_Y];
- }
-
- private void prepareForUpdate() {
- View view = mViewRef.get();
- if (view != null)
- computeRect(mBefore, view);
- }
-
- private void computeRect(final RectF r, View view) {
- final float w = view.getWidth();
- final float h = view.getHeight();
-
- r.set(0, 0, w, h);
-
- final Matrix m = mTempMatrix;
- m.reset();
- transformMatrix(m, view);
- mTempMatrix.mapRect(r);
-
- r.offset(view.getLeft(), view.getTop());
- }
-
- private void transformMatrix(Matrix m, View view) {
- m.postTranslate(mTranslationX, mTranslationY);
- }
-
- private void invalidateAfterUpdate() {
- View view = mViewRef.get();
- if (view == null || view.getParent() == null)
- return;
-
- final RectF after = mAfter;
- computeRect(after, view);
- after.union(mBefore);
-
- ((View)view.getParent()).invalidate(
- (int) Math.floor(after.left),
- (int) Math.floor(after.top),
- (int) Math.ceil(after.right),
- (int) Math.ceil(after.bottom));
- }
-
- @Override
- public float getAlpha() {
- return mAlpha;
- }
-
- @Override
- public void setAlpha(float alpha) {
- if (mAlpha == alpha)
- return;
-
- mAlpha = alpha;
-
- View view = mViewRef.get();
- if (view != null)
- view.invalidate();
- }
-
- @Override
- public float getTranslationX() {
- return mTranslationX;
- }
-
- @Override
- public void setTranslationX(float translationX) {
- if (mTranslationX == translationX)
- return;
-
- prepareForUpdate();
- mTranslationX = translationX;
- invalidateAfterUpdate();
- }
-
- @Override
- public float getTranslationY() {
- return mTranslationY;
- }
-
- @Override
- public void setTranslationY(float translationY) {
- if (mTranslationY == translationY)
- return;
-
- prepareForUpdate();
- mTranslationY = translationY;
- invalidateAfterUpdate();
- }
-
- @Override
- public View getView() {
- return mViewRef.get();
- }
-
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- View view = mViewRef.get();
- if (view != null) {
- t.setAlpha(mAlpha);
- transformMatrix(t.getMatrix(), view);
- }
- }
- }
-
private static class AnimatorProxyPostHC implements AnimatorProxyImpl {
private final WeakReference<View> mViewRef;
public AnimatorProxyPostHC(View view) {
mViewRef = new WeakReference<View>(view);
}
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
@@ -223,20 +223,16 @@ public class PropertyAnimator implements
}
}
public void stop() {
stop(true);
}
private boolean shouldEnableHardwareLayer(ElementHolder element) {
- if (Versions.preHC) {
- return false;
- }
-
if (!mUseHardwareLayer) {
return false;
}
if (!(element.view instanceof ViewGroup)) {
return false;
}
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeBanner.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeBanner.java
@@ -120,27 +120,16 @@ public class HomeBanner extends LinearLa
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
EventDispatcher.getInstance().unregisterGeckoThreadListener(this, "HomeBanner:Data");
}
- @Override
- public void setVisibility(int visibility) {
- // On pre-Honeycomb devices, setting the visibility to GONE won't actually
- // hide the view unless we clear animations first.
- if (Versions.preHC && visibility == View.GONE) {
- clearAnimation();
- }
-
- super.setVisibility(visibility);
- }
-
public void setScrollingPages(boolean scrollingPages) {
mScrollingPages = scrollingPages;
}
public void setOnDismissListener(OnDismissListener listener) {
mOnDismissListener = listener;
}
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -340,48 +340,16 @@ OnSharedPreferenceChangeListener
}
super.onCreate(savedInstanceState);
initActionBar();
// Use setResourceToOpen to specify these extras.
Bundle intentExtras = getIntent().getExtras();
- // For versions of Android lower than Honeycomb, use xml resources instead of
- // Fragments because of an Android bug in ActionBar (described in bug 866352 and
- // fixed in bug 833625).
- if (Versions.preHC) {
- // Write prefs to our custom GeckoSharedPrefs file.
- getPreferenceManager().setSharedPreferencesName(GeckoSharedPrefs.APP_PREFS_NAME);
-
- int res = 0;
- if (intentExtras != null && intentExtras.containsKey(INTENT_EXTRA_RESOURCES)) {
- // Fetch resource id from intent.
- final String resourceName = intentExtras.getString(INTENT_EXTRA_RESOURCES);
- Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, Method.SETTINGS, resourceName);
-
- if (resourceName != null) {
- res = getResources().getIdentifier(resourceName, "xml", getPackageName());
- if (res == 0) {
- Log.e(LOGTAG, "No resource found named " + resourceName);
- }
- }
- }
- if (res == 0) {
- // No resource specified, or the resource was invalid; use the default preferences screen.
- Log.e(LOGTAG, "Displaying default settings.");
- res = R.xml.preferences;
- Telemetry.startUISession(TelemetryContract.Session.SETTINGS);
- }
-
- // We don't include a title in the XML, so set it here, in a locale-aware fashion.
- updateTitleForPrefsResource(res);
- addPreferencesFromResource(res);
- }
-
EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener) this,
"Sanitize:Finished");
EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener) this,
"Snackbar:Show");
// Add handling for long-press click.
// This is only for Android 3.0 and below (which use the long-press-context-menu paradigm).
@@ -506,20 +474,16 @@ OnSharedPreferenceChangeListener
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
if (!hasFocus || mInitialized)
return;
mInitialized = true;
- if (Versions.preHC) {
- PreferenceScreen screen = getPreferenceScreen();
- mPrefsRequest = setupPreferences(screen);
- }
}
@Override
public void onBackPressed() {
super.onBackPressed();
if (NO_TRANSITIONS) {
overridePendingTransition(0, 0);
@@ -536,23 +500,16 @@ OnSharedPreferenceChangeListener
EventDispatcher.getInstance().unregisterGeckoThreadListener((NativeEventListener) this,
"Snackbar:Show");
if (mPrefsRequest != null) {
PrefsHelper.removeObserver(mPrefsRequest);
mPrefsRequest = null;
}
-
- // The intent extras will be null if this is the top-level settings
- // activity. In that case, we want to end the SETTINGS telmetry session.
- // For HC+ versions of Android this is handled in GeckoPreferenceFragment.
- if (Versions.preHC && getIntent().getExtras() == null) {
- Telemetry.stopUISession(TelemetryContract.Session.SETTINGS);
- }
}
@Override
public void onPause() {
// Symmetric with onResume.
if (Versions.feature11Plus) {
if (isMultiPane()) {
SharedPreferences prefs = GeckoSharedPrefs.forApp(this);
@@ -1579,19 +1536,15 @@ OnSharedPreferenceChangeListener
public static void setResourceToOpen(final Intent intent, final String resource) {
if (intent == null) {
throw new IllegalArgumentException("intent must not be null");
}
if (resource == null) {
return;
}
- if (Versions.preHC) {
- intent.putExtra("resource", resource);
- } else {
- intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, GeckoPreferenceFragment.class.getName());
+ intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, GeckoPreferenceFragment.class.getName());
- Bundle fragmentArgs = new Bundle();
- fragmentArgs.putString("resource", resource);
- intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
- }
+ Bundle fragmentArgs = new Bundle();
+ fragmentArgs.putString("resource", resource);
+ intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
@@ -231,24 +231,17 @@ public class PromptInput {
}
private static String formatDateString(String dateFormat, Calendar calendar) {
return new SimpleDateFormat(dateFormat).format(calendar.getTime());
}
@Override
public Object getValue() {
- if (Versions.preHC && mType.equals("date")) {
- // We can't use the custom DateTimePicker with a sdk older than 11.
- // Fallback on the native DatePicker.
- DatePicker dp = (DatePicker)mView;
- GregorianCalendar calendar =
- new GregorianCalendar(dp.getYear(),dp.getMonth(),dp.getDayOfMonth());
- return formatDateString("yyyy-MM-dd",calendar);
- } else if (mType.equals("time")) {
+ if (mType.equals("time")) {
TimePicker tp = (TimePicker)mView;
GregorianCalendar calendar =
new GregorianCalendar(0,0,0,tp.getCurrentHour(),tp.getCurrentMinute());
return formatDateString("HH:mm",calendar);
} else {
DateTimePicker dp = (DateTimePicker)mView;
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(dp.getTimeInMillis());
@@ -281,21 +274,17 @@ public class PromptInput {
public MenulistInput(JSONObject obj) {
super(obj);
mListitems = Prompt.getStringArray(obj, "values");
mSelected = obj.optInt("selected");
}
@Override
public View getView(final Context context) throws UnsupportedOperationException {
- if (Versions.preHC) {
- spinner = new Spinner(context);
- } else {
- spinner = new Spinner(context, Spinner.MODE_DIALOG);
- }
+ spinner = new Spinner(context, Spinner.MODE_DIALOG);
try {
if (mListitems.length > 0) {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_item, mListitems);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setSelection(mSelected);
}
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/TabInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/TabInput.java
@@ -64,24 +64,17 @@ public class TabInput extends PromptInpu
ListView listView = new ListView(context);
listView.setCacheColorHint(0);
listView.setOnItemClickListener(TabInput.this);
listView.setAdapter(adapter);
return listView;
}
});
- // On older android versions, we use a custom style for the tabs.
- if (Versions.preHC) {
- TextView textview = (TextView) inflater.inflate(R.layout.tab_prompt_tab, null);
- textview.setText(title);
- spec.setIndicator(textview);
- } else {
- spec.setIndicator(title);
- }
+ spec.setIndicator(title);
mHost.addTab(spec);
}
mView = mHost;
return mHost;
}
@Override
public Object getValue() {
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabsPanel.java
@@ -402,35 +402,26 @@ public class TabsPanel extends LinearLay
}
@Override
public boolean isShown() {
return mVisible;
}
public void setHWLayerEnabled(boolean enabled) {
- if (Versions.preHC) {
- return;
- }
if (enabled) {
mHeader.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mTabsContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
mHeader.setLayerType(View.LAYER_TYPE_NONE, null);
mTabsContainer.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
public void prepareTabsAnimation(PropertyAnimator animator) {
- // Not worth doing this on pre-Honeycomb without proper
- // hardware accelerated animations.
- if (Versions.preHC) {
- return;
- }
-
if (!mHeaderVisible) {
final Resources resources = getContext().getResources();
final int toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height);
final int translationY = (mVisible ? 0 : -toolbarHeight);
if (mVisible) {
ViewHelper.setTranslationY(mHeader, -toolbarHeight);
ViewHelper.setTranslationY(mTabsContainer, -toolbarHeight);
ViewHelper.setAlpha(mTabsContainer, 0.0f);
@@ -439,20 +430,16 @@ public class TabsPanel extends LinearLay
animator.attach(mTabsContainer, PropertyAnimator.Property.TRANSLATION_Y, translationY);
animator.attach(mHeader, PropertyAnimator.Property.TRANSLATION_Y, translationY);
}
setHWLayerEnabled(true);
}
public void finishTabsAnimation() {
- if (Versions.preHC) {
- return;
- }
-
setHWLayerEnabled(false);
// If the tray is now hidden, call hide() on current panel and unset it as the current panel
// to avoid hide() being called again when the layout is opened next.
if (!mVisible && mPanel != null) {
mPanel.hide();
mPanel = null;
}
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
@@ -157,18 +157,16 @@ public abstract class BrowserToolbar ext
protected Drawable getLWTDefaultStateSetDrawable() {
return getTheme().getDrawable(this);
}
public static BrowserToolbar create(final Context context, final AttributeSet attrs) {
final BrowserToolbar toolbar;
if (HardwareUtils.isTablet()) {
toolbar = new BrowserToolbarTablet(context, attrs);
- } else if (Versions.preHC) {
- toolbar = new BrowserToolbarPreHC(context, attrs);
} else {
toolbar = new BrowserToolbarPhone(context, attrs);
}
return toolbar;
}
protected BrowserToolbar(final Context context, final AttributeSet attrs) {
super(context, attrs);
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbarPreHC.java
+++ /dev/null
@@ -1,65 +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.toolbar;
-
-import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.animation.PropertyAnimator;
-import org.mozilla.gecko.animation.ViewHelper;
-import org.mozilla.gecko.util.HardwareUtils;
-
-import android.content.Context;
-import android.util.AttributeSet;
-
-/**
- * A toolbar implementation for pre-Honeycomb devices.
- * The toolbar changes editing mode state without animating.
- */
-class BrowserToolbarPreHC extends BrowserToolbarPhoneBase {
-
- public BrowserToolbarPreHC(final Context context, final AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- public boolean isAnimating() {
- return false;
- }
-
- @Override
- protected void triggerStartEditingTransition(final PropertyAnimator animator) {
- showUrlEditLayout();
- updateEditingState(true);
- }
-
- @Override
- protected void triggerStopEditingTransition() {
- hideUrlEditLayout();
- updateTabCountAndAnimate(Tabs.getInstance().getDisplayCount());
- updateEditingState(false);
- }
-
- private void updateEditingState(final boolean isEditing) {
- final int curveTranslation;
- final int entryTranslation;
- if (isEditing) {
- curveTranslation = getUrlBarCurveTranslation();
- entryTranslation = getUrlBarEntryTranslation();
- } else {
- curveTranslation = 0;
- entryTranslation = 0;
- }
-
- // Prevent taps through the editing mode cancel button (bug 1001243).
- tabsButton.setEnabled(!isEditing);
- menuButton.setEnabled(!isEditing);
-
- ViewHelper.setTranslationX(urlBarTranslatingEdge, entryTranslation);
- ViewHelper.setTranslationX(tabsButton, curveTranslation);
- ViewHelper.setTranslationX(tabsCounter, curveTranslation);
- ViewHelper.setTranslationX(menuButton, curveTranslation);
- ViewHelper.setTranslationX(menuIcon, curveTranslation);
- }
-}
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarProgressView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarProgressView.java
@@ -72,37 +72,16 @@ public class ToolbarProgressView extends
mPrivateBrowsingColorFilter = new PorterDuffColorFilter(
ContextCompat.getColor(ctx, R.color.private_browsing_purple), PorterDuff.Mode.SRC_IN);
mHandler = new ToolbarProgressHandler(this);
}
@Override
- public void setVisibility(int visibility) {
- // On GB/Froyo, setting the visibility to GONE/HIDDEN alone does not
- // work with translations. Calling clearAnimation acts as a workaround.
- if (Versions.preHC && visibility != VISIBLE) {
- clearAnimation();
- }
-
- super.setVisibility(visibility);
- }
-
- @Override
- public void setAnimation(Animation animation) {
- // On GB/Froyo, setting the animation after hiding the view causes it
- // to reappear. As a workaround, disallow setAnimation from being
- // called if the view is not shown.
- if (Versions.preHC && isShown()) {
- super.setAnimation(animation);
- }
- }
-
- @Override
public void onLayout(boolean f, int l, int t, int r, int b) {
mBounds.left = 0;
mBounds.right = (r - l) * mCurrentProgress / MAX_PROGRESS;
mBounds.top = 0;
mBounds.bottom = b - t;
}
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/util/PrefUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/PrefUtils.java
@@ -22,20 +22,16 @@ public class PrefUtils {
// Cross version compatible way to get a string set from a pref
public static Set<String> getStringSet(final SharedPreferences prefs,
final String key,
final Set<String> defaultVal) {
if (!prefs.contains(key)) {
return defaultVal;
}
- if (Versions.preHC) {
- return getFromJSON(prefs, key);
- }
-
// If this is Android version >= 11, try to use a Set<String>.
try {
return prefs.getStringSet(key, new HashSet<String>());
} catch(ClassCastException ex) {
// A ClassCastException means we've upgraded from a pre-v11 Android to a new one
final Set<String> val = getFromJSON(prefs, key);
SharedPreferences.Editor edit = prefs.edit();
putStringSet(edit, key, val).apply();
@@ -63,18 +59,12 @@ public class PrefUtils {
* @param editor to write to.
* @param key to write.
* @param vals comprising string set.
* @return
*/
public static SharedPreferences.Editor putStringSet(final SharedPreferences.Editor editor,
final String key,
final Set<String> vals) {
- if (Versions.preHC) {
- final JSONArray json = new JSONArray(vals);
- editor.putString(key, json.toString());
- } else {
- editor.putStringSet(key, vals);
- }
-
+ editor.putStringSet(key, vals);
return editor;
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/widget/AnchoredPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/AnchoredPopup.java
@@ -96,29 +96,16 @@ public abstract class AnchoredPopup exte
if (mAnchor != null) {
mAnchor.getLocationInWindow(anchorLocation);
}
// The doorhanger should overlap the bottom of the urlbar.
int offsetY = mContext.getResources().getDimensionPixelOffset(R.dimen.doorhanger_offsetY);
final View decorView = ((Activity) mContext).getWindow().getDecorView();
- // Hack for Gingerbread: showAtLocation ignores window layout parameters so we have to use
- // showAsDropDown() instead.
- // Height and width are always set to 0 dp.
- if (Versions.preHC) {
- setWidth(decorView.getWidth());
- offsetY = mContext.getResources().getDimensionPixelOffset(R.dimen.doorhanger_GB_offsetY);
- if (mAnchor == null) {
- mAnchor = decorView;
- }
- showAsDropDown(mAnchor, 0, -offsetY);
- return;
- }
-
final boolean validAnchor = (mAnchor != null) && (anchorLocation[1] > 0);
if (HardwareUtils.isTablet()) {
if (validAnchor) {
showAsDropDown(mAnchor, 0, 0);
} else {
// The anchor will be offscreen if the dynamic toolbar is hidden, so anticipate the re-shown position
// of the toolbar.
final int offsetX = mContext.getResources().getDimensionPixelOffset(R.dimen.doorhanger_offsetX);
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -236,19 +236,16 @@ public class DateTimePicker extends Fram
}
public DateTimePicker(Context context) {
this(context, "", "", PickersState.DATE, null, null);
}
public DateTimePicker(Context context, String dateFormat, String dateTimeValue, PickersState state, String minDateValue, String maxDateValue) {
super(context);
- if (Versions.preHC) {
- throw new UnsupportedOperationException("Custom DateTimePicker is only available for SDK > 10");
- }
setCurrentLocale(Locale.getDefault());
mState = state;
LayoutInflater inflater = LayoutInflater.from(context);
inflater.inflate(R.layout.datetime_picker, this, true);
mOnChangeListener = new OnValueChangeListener();
@@ -550,18 +547,17 @@ public class DateTimePicker extends Fram
}
}
void notifyDateChanged() {
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
}
public void toggleCalendar(boolean shown) {
- if (Versions.preHC ||
- (mState != PickersState.DATE && mState != PickersState.DATETIME) ||
+ if ((mState != PickersState.DATE && mState != PickersState.DATETIME) ||
mScreenWidth < SCREEN_SIZE_THRESHOLD) {
if (DEBUG) {
Log.d(LOGTAG, "Cannot display calendar on this device, in this state" +
": screen width :" + mScreenWidth);
}
return;
}
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/widget/GeckoViewFlipper.java
+++ /dev/null
@@ -1,46 +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.widget;
-
-import org.mozilla.gecko.AppConstants.Versions;
-import org.mozilla.gecko.animation.ViewHelper;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.ViewFlipper;
-
-/* This extends the normal ViewFlipper only to fix bug 956075 on < 3.0 devices.
- * i.e. It ignores touch events on the ViewFlipper when its hidden. */
-
-public class GeckoViewFlipper extends ViewFlipper {
- private final Rect mRect = new Rect();
-
- public GeckoViewFlipper(Context context) {
- super(context);
- }
-
- public GeckoViewFlipper(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- if (Versions.preHC) {
- // Fix bug 956075. Don't allow touching this View if its hidden.
- getHitRect(mRect);
- mRect.offset((int) ViewHelper.getTranslationX((View)getParent()), (int) ViewHelper.getTranslationY((View)getParent()));
-
- if (!mRect.contains((int) ev.getX(), (int) ev.getY())) {
- return false;
- }
- }
-
- return super.dispatchTouchEvent(ev);
- }
-}
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -562,17 +562,16 @@ gbjar.sources += ['java/org/mozilla/geck
'TextSelection.java',
'TextSelectionHandle.java',
'ThumbnailHelper.java',
'toolbar/AutocompleteHandler.java',
'toolbar/BackButton.java',
'toolbar/BrowserToolbar.java',
'toolbar/BrowserToolbarPhone.java',
'toolbar/BrowserToolbarPhoneBase.java',
- 'toolbar/BrowserToolbarPreHC.java',
'toolbar/BrowserToolbarTablet.java',
'toolbar/BrowserToolbarTabletBase.java',
'toolbar/CanvasDelegate.java',
'toolbar/ForwardButton.java',
'toolbar/NavButton.java',
'toolbar/PageActionLayout.java',
'toolbar/PhoneTabsButton.java',
'toolbar/ShapedButton.java',
@@ -606,17 +605,16 @@ gbjar.sources += ['java/org/mozilla/geck
'widget/ExternalIntentDuringPrivateBrowsingPromptFragment.java',
'widget/FadedMultiColorTextView.java',
'widget/FadedSingleColorTextView.java',
'widget/FadedTextView.java',
'widget/FaviconView.java',
'widget/FlowLayout.java',
'widget/GeckoActionProvider.java',
'widget/GeckoPopupMenu.java',
- 'widget/GeckoViewFlipper.java',
'widget/IconTabWidget.java',
'widget/LoginDoorHanger.java',
'widget/RecyclerViewClickSupport.java',
'widget/ResizablePathDrawable.java',
'widget/RoundedCornerLayout.java',
'widget/SiteLogins.java',
'widget/SquaredImageView.java',
'widget/SquaredRelativeLayout.java',
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -123,17 +123,17 @@
<ViewStub android:id="@+id/tablet_tab_strip"
android:inflatedId="@id/tablet_tab_strip"
android:layout="@layout/tab_strip"
android:layout_width="match_parent"
android:layout_height="@dimen/tablet_tab_strip_height"
android:visibility="gone"/>
- <org.mozilla.gecko.widget.GeckoViewFlipper
+ <ViewFlipper
android:id="@+id/browser_actionbar"
android:layout_width="match_parent"
android:layout_height="@dimen/browser_toolbar_height_flipper"
android:clickable="true"
android:focusable="true">
<org.mozilla.gecko.toolbar.BrowserToolbar
android:id="@+id/browser_toolbar"
@@ -144,17 +144,17 @@
android:focusable="true"
android:background="@drawable/url_bar_bg"/>
<org.mozilla.gecko.ActionModeCompatView android:id="@+id/actionbar"
android:layout_height="match_parent"
android:layout_width="match_parent"
style="@style/GeckoActionBar"/>
- </org.mozilla.gecko.widget.GeckoViewFlipper>
+ </ViewFlipper>
</LinearLayout>
<org.mozilla.gecko.toolbar.ToolbarProgressView android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="14dp"
android:layout_marginTop="-8dp"
android:layout_below="@id/browser_chrome"
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AppMenuComponent.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/components/AppMenuComponent.java
@@ -211,19 +211,19 @@ public class AppMenuComponent extends Ba
public void pressMenuItem(final PageMenuItem pageMenuItem) {
pressSubMenuItem(PageMenuItem.PARENT_MENU.getString(mSolo), pageMenuItem.getString(mSolo));
}
private void openAppMenu() {
assertMenuIsNotOpen();
- // This is a hack needed for tablets & GB where the OverflowMenuButton is always in the GONE state,
+ // This is a hack needed for tablets where the OverflowMenuButton is always in the GONE state,
// so we press the menu key instead.
- if (DeviceHelper.isTablet() || AppConstants.Versions.preHC) {
+ if (DeviceHelper.isTablet()) {
mSolo.sendKey(Solo.MENU);
} else {
pressOverflowMenuButton();
}
waitForMenuOpen();
}