mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 843557: Revert part of 7547bf5fe166 (bug 843313). [r=kats]
This commit is contained in:
parent
3f2a3ef563
commit
c18fe71662
@ -18,12 +18,17 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
private static final String LOGTAG = "GeckoMenuItem";
|
||||
|
||||
public static interface Layout {
|
||||
public void setId(int id);
|
||||
public void setIcon(Drawable icon);
|
||||
public void setIcon(int iconRes);
|
||||
public void setTitle(CharSequence title);
|
||||
public void setEnabled(boolean enabled);
|
||||
public void setCheckable(boolean checkable);
|
||||
public void setChecked(boolean checked);
|
||||
public void setOnClickListener(View.OnClickListener listener);
|
||||
public void setSubMenuIndicator(boolean hasSubMenu);
|
||||
public void setVisibility(int visible);
|
||||
public View getView();
|
||||
}
|
||||
|
||||
public static interface OnShowAsActionChangedListener {
|
||||
@ -38,7 +43,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
private Context mContext;
|
||||
private int mId;
|
||||
private int mOrder;
|
||||
private GeckoMenuItem.Layout mLayout;
|
||||
private Layout mLayout;
|
||||
private boolean mActionItem;
|
||||
private CharSequence mTitle;
|
||||
private CharSequence mTitleCondensed;
|
||||
@ -57,7 +62,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
public GeckoMenuItem(Context context, int id) {
|
||||
mContext = context;
|
||||
mLayout = (MenuItemDefault) LayoutInflater.from(mContext).inflate(R.layout.menu_item, null);
|
||||
((View) mLayout).setId(id);
|
||||
mLayout.setId(id);
|
||||
|
||||
mId = id;
|
||||
mOrder = 0;
|
||||
@ -127,7 +132,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
}
|
||||
|
||||
public View getLayout() {
|
||||
return (View) mLayout;
|
||||
return mLayout.getView();
|
||||
}
|
||||
|
||||
public void setMenu(GeckoMenu menu) {
|
||||
@ -231,7 +236,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
@Override
|
||||
public MenuItem setEnabled(boolean enabled) {
|
||||
mEnabled = enabled;
|
||||
((View) mLayout).setEnabled(enabled);
|
||||
mLayout.setEnabled(enabled);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -296,8 +301,8 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
|
||||
mActionItem = (actionEnum > 0);
|
||||
|
||||
((View) mLayout).setId(mId);
|
||||
((View) mLayout).setOnClickListener(this);
|
||||
mLayout.setId(mId);
|
||||
mLayout.setOnClickListener(this);
|
||||
|
||||
setTitle(mTitle);
|
||||
setVisible(mVisible);
|
||||
@ -347,7 +352,7 @@ public class GeckoMenuItem implements MenuItem, View.OnClickListener {
|
||||
@Override
|
||||
public MenuItem setVisible(boolean visible) {
|
||||
mVisible = visible;
|
||||
((View) mLayout).setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
mLayout.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (mVisibilityChangedListener != null)
|
||||
mVisibilityChangedListener.onVisibilityChanged(this, visible);
|
||||
|
@ -28,6 +28,11 @@ public class MenuItemActionBar extends ImageButton
|
||||
setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(Drawable icon) {
|
||||
if (icon != null) {
|
||||
|
@ -61,6 +61,11 @@ public class MenuItemDefault extends TextView
|
||||
return drawableState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(Drawable icon) {
|
||||
mIcon = icon;
|
||||
|
Loading…
Reference in New Issue
Block a user