зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1098459 - Remove dead area on the right of "new tab" button (r=mcomella)
This commit is contained in:
Родитель
ce9855e1b3
Коммит
eccb65d5a0
|
@ -12,6 +12,8 @@
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingTop="4dp"/>
|
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
|
<ImageButton
|
||||||
android:id="@+id/add_tab"
|
android:id="@+id/add_tab"
|
||||||
style="@style/UrlBar.ImageButton"
|
style="@style/UrlBar.ImageButton"
|
||||||
|
|
|
@ -6,9 +6,12 @@
|
||||||
package org.mozilla.gecko.tabs;
|
package org.mozilla.gecko.tabs;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.TouchDelegate;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import org.mozilla.gecko.R;
|
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();
|
tabsListener = new TabsListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче