mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1148390 - Dynamically add padding to share icon on GB devices. r=wesj
The ideal solution is to remove the whitespace from the action bar drawables (bug 1122752) but since I'm not sure where else these images might be used and how removing the padding will affect all of the different devices and configurations, it would be easier to uplift a solution where we *only* change the padding on the share icon and *only* on the affected devices. However, this solution is dangerous because we hard-code a filename: if we rename ab_share, things will break. Also, unnecessary special casing makes it ugly.
This commit is contained in:
parent
80e28a6798
commit
8c39d0bb7c
@ -4,6 +4,7 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils.BitmapLoader;
|
||||
import org.mozilla.gecko.gfx.Layer;
|
||||
@ -16,6 +17,7 @@ import org.mozilla.gecko.util.FloatUtils;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.ActionModeCompat.Callback;
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.app.Activity;
|
||||
@ -279,11 +281,23 @@ class TextSelection extends Layer implements GeckoEventListener {
|
||||
final int actionEnum = obj.optBoolean("showAsAction") ? GeckoMenuItem.SHOW_AS_ACTION_ALWAYS : GeckoMenuItem.SHOW_AS_ACTION_NEVER;
|
||||
menuitem.setShowAsAction(actionEnum, R.attr.menuItemActionModeStyle);
|
||||
|
||||
BitmapUtils.getDrawable(anchorHandle.getContext(), obj.optString("icon"), new BitmapLoader() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -213,6 +213,10 @@
|
||||
<dimen name="find_in_page_matchcase_padding">10dip</dimen>
|
||||
<dimen name="find_in_page_control_margin_top">2dip</dimen>
|
||||
|
||||
<!-- The share icon asset has no padding while the other action bar items do
|
||||
so we dynamically add padding to compensate. To be removed in bug 1122752. -->
|
||||
<dimen name="ab_share_padding">12dp</dimen>
|
||||
|
||||
<!-- This is a 4:7 ratio (as per UX decision). -->
|
||||
<item name="thumbnail_aspect_ratio" format="float" type="dimen">0.571</item>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user