mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1098459 - Remove dead area on the right of "new tab" button (r=mcomella)
This commit is contained in:
parent
d6bfdd8853
commit
d45053fb34
@ -12,6 +12,8 @@
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="4dp"/>
|
||||
|
||||
<!-- The right margin creates a "dead area" on the right side of the button
|
||||
which we compensate for with a touch delegate. See TabStrip -->
|
||||
<ImageButton
|
||||
android:id="@+id/add_tab"
|
||||
style="@style/UrlBar.ImageButton"
|
||||
|
@ -6,9 +6,12 @@
|
||||
package org.mozilla.gecko.tabs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.TouchDelegate;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import org.mozilla.gecko.R;
|
||||
@ -51,6 +54,25 @@ public class TabStrip extends ThemedLinearLayout {
|
||||
}
|
||||
});
|
||||
|
||||
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
|
||||
final Rect r = new Rect();
|
||||
r.left = addTabButton.getRight();
|
||||
r.right = getWidth();
|
||||
r.top = 0;
|
||||
r.bottom = getHeight();
|
||||
|
||||
// Redirect touch events between the 'new tab' button and the edge
|
||||
// of the screen to the 'new tab' button.
|
||||
setTouchDelegate(new TouchDelegate(r, addTabButton));
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tabsListener = new TabsListener();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user