mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 956075 - Add a custom view flipper to avoid Gingerbread bugs with touching ViewGroups. r=lucasr
This commit is contained in:
parent
816a0e548e
commit
30dcc6058a
@ -362,6 +362,7 @@ gbjar.sources += [
|
||||
'widget/FlowLayout.java',
|
||||
'widget/GeckoActionProvider.java',
|
||||
'widget/GeckoPopupMenu.java',
|
||||
'widget/GeckoViewFlipper.java',
|
||||
'widget/IconTabWidget.java',
|
||||
'widget/SquaredImageView.java',
|
||||
'widget/TabRow.java',
|
||||
|
@ -75,7 +75,7 @@
|
||||
the root view, BrowserToolbar should be specified as low in the
|
||||
view hierarchy as possible. -->
|
||||
|
||||
<ViewFlipper android:id="@id/browser_actionbar"
|
||||
<org.mozilla.gecko.widget.GeckoViewFlipper android:id="@id/browser_actionbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/browser_toolbar_height"
|
||||
android:clickable="true"
|
||||
@ -95,7 +95,7 @@
|
||||
android:layout_width="fill_parent"
|
||||
style="@style/GeckoActionBar"/>
|
||||
|
||||
</ViewFlipper>
|
||||
</org.mozilla.gecko.widget.GeckoViewFlipper>
|
||||
|
||||
</view>
|
||||
|
||||
|
47
mobile/android/base/widget/GeckoViewFlipper.java
Normal file
47
mobile/android/base/widget/GeckoViewFlipper.java
Normal file
@ -0,0 +1,47 @@
|
||||
/* -*- 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.animation.ViewHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.ViewFlipper;
|
||||
import android.util.Log;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/* 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 static final String LOGTAG = "GeckoViewFlipper";
|
||||
private 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 (Build.VERSION.SDK_INT < 11) {
|
||||
// Fix bug 956075. Don't allow touching this View if its hidden.
|
||||
getHitRect(mRect);
|
||||
mRect.offset((int) ViewHelper.getTranslationX(this), (int) ViewHelper.getTranslationY(this));
|
||||
|
||||
if (!mRect.contains((int) ev.getX(), (int) ev.getY())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user