Android环形菜单实现
参考https://github.com/Hitomis/CircleMenu ,在原自定义View 中修改了一些代码
效果图:
使用方式:
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private CircleMenuView circleMenu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
circleMenu = (CircleMenuView) findViewById(R.id.circle_menu);
circleMenu.setMainMenu(Color.parseColor("#CDCDCD"), R.mipmap.icon_menu, R.mipmap.icon_cancel)
.addSubMenu(Color.parseColor("#258CFF"), R.mipmap.p1)
.addSubMenu(Color.parseColor("#30A400"), R.mipmap.icon_search)
.addSubMenu(Color.parseColor("#FF4B32"), R.mipmap.icon_notify)
.addSubMenu(Color.parseColor("#8A39FF"), R.mipmap.icon_setting)
.addSubMenu(Color.parseColor("#FF6A00"), R.mipmap.icon_gps)
.setInterceptBackPressedEnable(true)
.setFeedbackListener(new CircleMenuView.OnCircleMenuFeedbackListener() {
@Override
public void onMenuSelected(int index) {
Snackbar.make(circleMenu, "点击了 [" + index + "]", Snackbar.LENGTH_SHORT).show();
}
@Override
public void onMenuCenterClicked() {
Snackbar.make(circleMenu, "点击了 [中心]", Snackbar.LENGTH_SHORT).show();
}
@Override
public void onMenuOpened() {
}
@Override
public void onMenuClosed() {
}
});
}
}
必要的注释都在代码里了,包括返回键的处理
主要是Path 绘制I的时候需要旋转Canvas
public class CircleMenuView extends View {
private static final String TAG = "CircleMenuView";
private static final int STATUS_MENU_OPEN = 1;
private static final int STATUS_MENU_OPENED = 1 << 1;
private static final int STATUS_MENU_CLOSE = 1 << 2;
private static final int STATUS_MENU_CLOSE_CLEAR = 1 << 3;
private static final int STATUS_MENU_CLOSED = 1 << 4;
private static final int STATUS_MENU_CANCEL = 1 << 5;
private static final int MAX_SUBMENU_NUM = 8;
private final int shadowRadius = 5;
private int partSize;
private int iconSize;
private float circleMenuRadius;
private int itemNum;
private float itemMenuRadius;
private float fraction, rFraction;
private float pathLength;
private int mainMenuColor;
private Drawable openMenuIconDrawable, closeMenuIconDrawable;
private List<Integer> subMenuColorList;
private List<Drawable> subMenuDrawableList;
private List<RectF> menuRectFList;
private int centerX, centerY;
private int clickIndex;
private int rotateAngle;
private int itemIconSize;
private int pressedColor;
private int state;
private boolean pressed;
private Paint oPaint, cPaint, sPaint;
private PathMeasure pathMeasure;
private Path path, dstPath;
private OnCircleMenuFeedbackListener mFeedbackListener;
public CircleMenuView(Context context) {
this(context, null);
}
public CircleMenuView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CircleMenuView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
state = STATUS_MENU_CLOSED;
init();
setFocusable(true);
setFocusableInTouchMode(true);
}
private void init() {
initTool();
mainMenuColor = Color.parseColor("#CDCDCD");
openMenuIconDrawable = new GradientDrawable();
closeMenuIconDrawable = new GradientDrawable();
subMenuColorList = new ArrayList<>();
subMenuDrawableList = new ArrayList<>();
menuRectFList = new ArrayList<>();
}
private void initTool() {
oPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
oPaint.setStyle(Paint.Style.FILL_AND_STROKE);
cPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
cPaint.setStyle(Paint.Style.STROKE);
cPaint.setStrokeCap(Paint.Cap.ROUND);
sPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
sPaint.setStyle(Paint.Style.FILL);
path = new Path();
dstPath = new Path();
pathMeasure = new PathMeasure();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
int measureWidthSize = width, measureHeightSize = height;
if (widthMode == MeasureSpec.AT_MOST) {
measureWidthSize = dip2px(20) * 10;
}
if (heightMode == MeasureSpec.AT_MOST) {
measureHeightSize = dip2px(20) * 10;
}
setMeasuredDimension(measureWidthSize, measureHeightSize);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
int minSize = Math.min(getMeasuredWidth(), getMeasuredHeight());
partSize = minSize / 10;
iconSize = partSize * 4 / 5;
circleMenuRadius = partSize * 3;
centerX = getMeasuredWidth() / 2;
centerY = getMeasuredHeight() / 2;
resetMainDrawableBounds();
path.addCircle(centerX, centerY, circleMenuRadius, Path.Direction.CW);
pathMeasure.setPath(path, true);
pathLength = pathMeasure.getLength();
RectF mainMenuRectF = new RectF(
centerX - partSize,
centerY - partSize,
centerX + partSize,
centerY + partSize);
menuRectFList.add(mainMenuRectF);
}
@Override
protected void onDraw(Canvas canvas) {
switch (state) {
case STATUS_MENU_CLOSED:
drawMainMenu(canvas);
break;
case STATUS_MENU_OPEN:
drawMainMenu(canvas);
drawSubMenu(canvas);
break;
case STATUS_MENU_OPENED:
drawMainMenu(canvas);
drawSubMenu(canvas);
break;
case STATUS_MENU_CLOSE:
drawMainMenu(canvas);
drawSubMenu(canvas);
drawCircleMenu(canvas);
break;
case STATUS_MENU_CLOSE_CLEAR:
drawMainMenu(canvas);
drawCircleMenu(canvas);
break;
case STATUS_MENU_CANCEL:
drawMainMenu(canvas);
drawSubMenu(canvas);
break;
}
}
private void drawCircleMenu(Canvas canvas) {
if (state == STATUS_MENU_CLOSE) {
drawCirclePath(canvas);
drawCircleIcon(canvas);
} else {
cPaint.setStrokeWidth(partSize * 2 + partSize * .5f * fraction);
cPaint.setColor(calcAlphaColor(getClickMenuColor(), true));
canvas.drawCircle(centerX, centerY, circleMenuRadius + partSize * .5f * fraction, cPaint);
}
}
private int getClickMenuColor() {
return clickIndex == 0 ? mainMenuColor : subMenuColorList.get(clickIndex - 1);
}
private void drawCircleIcon(Canvas canvas) {
canvas.save();
Drawable selDrawable = subMenuDrawableList.get(clickIndex - 1);
if (selDrawable == null) return;
int startAngle = (clickIndex - 1) * (360 / itemNum);
int endAngle = 360 + startAngle;
int itemX = (int) (centerX + Math.sin(Math.toRadians((endAngle - startAngle) * fraction + startAngle)) * circleMenuRadius);
int itemY = (int) (centerY - Math.cos(Math.toRadians((endAngle - startAngle) * fraction + startAngle)) * circleMenuRadius);
canvas.rotate(360 * fraction, itemX, itemY);
selDrawable.setBounds(itemX - iconSize / 2,
itemY - iconSize / 2,
itemX + iconSize / 2,
itemY + iconSize / 2);
selDrawable.draw(canvas);
canvas.restore();
}
private void drawCirclePath(Canvas canvas) {
canvas.save();
Log.d(TAG, "drawCirclePath: rotateAngle = " + rotateAngle);
canvas.rotate(rotateAngle, centerX, centerY);
dstPath.reset();
dstPath.lineTo(0, 0);
pathMeasure.getSegment(0, pathLength * fraction, dstPath, true);
cPaint.setStrokeWidth(partSize * 2);
cPaint.setColor(getClickMenuColor());
canvas.drawPath(dstPath, cPaint);
canvas.restore();
}
private void drawSubMenu(Canvas canvas) {
int itemX, itemY, angle;
final float offsetRadius = 1.5f;
RectF menuRectF;
for (int i = 0; i < itemNum; i++) {
angle = i * (360 / itemNum);
if (state == STATUS_MENU_OPEN) {
Log.d(TAG, "drawSubMenu: ");
itemX = (int) (centerX + Math.sin(Math.toRadians(angle)) * (circleMenuRadius - (1 - fraction) * partSize * offsetRadius));
itemY = (int) (centerY - Math.cos(Math.toRadians(angle)) * (circleMenuRadius - (1 - fraction) * partSize * offsetRadius));
oPaint.setColor(calcAlphaColor(subMenuColorList.get(i), false));
sPaint.setColor(calcAlphaColor(subMenuColorList.get(i), false));
} else if (state == STATUS_MENU_CANCEL) {
itemX = (int) (centerX + Math.sin(Math.toRadians(angle)) * (circleMenuRadius - fraction * partSize * offsetRadius));
itemY = (int) (centerY - Math.cos(Math.toRadians(angle)) * (circleMenuRadius - fraction * partSize * offsetRadius));
oPaint.setColor(calcAlphaColor(subMenuColorList.get(i), true));
sPaint.setColor(calcAlphaColor(subMenuColorList.get(i), true));
} else {
itemX = (int) (centerX + Math.sin(Math.toRadians(angle)) * circleMenuRadius);
itemY = (int) (centerY - Math.cos(Math.toRadians(angle)) * circleMenuRadius);
oPaint.setColor(subMenuColorList.get(i));
sPaint.setColor(subMenuColorList.get(i));
}
if (pressed && clickIndex - 1 == i) {
oPaint.setColor(pressedColor);
}
drawMenuShadow(canvas, itemX, itemY, itemMenuRadius);
canvas.drawCircle(itemX, itemY, itemMenuRadius, oPaint);
drawSubMenuIcon(canvas, itemX, itemY, i);
menuRectF = new RectF(itemX - partSize,
itemY - partSize,
itemX + partSize,
itemY + partSize);
if (menuRectFList.size() - 1 > i) {
menuRectFList.remove(i + 1);
}
menuRectFList.add(i + 1, menuRectF);
}
}
private void drawSubMenuIcon(Canvas canvas, int centerX, int centerY, int index) {
int diff;
if (state == STATUS_MENU_OPEN || state == STATUS_MENU_CANCEL) {
diff = itemIconSize / 2;
} else {
diff = iconSize / 2;
}
resetBoundsAndDrawIcon(canvas, subMenuDrawableList.get(index), centerX, centerY, diff);
}
private void resetBoundsAndDrawIcon(Canvas canvas, Drawable drawable, int centerX, int centerY, int diff) {
if (drawable == null) return;
drawable.setBounds(centerX - diff, centerY - diff, centerX + diff, centerY + diff);
drawable.draw(canvas);
}
private void drawMainMenu(Canvas canvas) {
float centerMenuRadius, realFraction;
if (state == STATUS_MENU_CLOSE) {
realFraction = (1 - fraction * 2) == 0 ? 0 : (1 - fraction * 2);
centerMenuRadius = partSize * realFraction;
} else if (state == STATUS_MENU_CLOSE_CLEAR) {
realFraction = fraction * 4 >= 1 ? 1 : fraction * 4;
centerMenuRadius = partSize * realFraction;
} else if (state == STATUS_MENU_CLOSED || state == STATUS_MENU_CANCEL) {
centerMenuRadius = partSize;
} else {
centerMenuRadius = partSize;
}
if (state == STATUS_MENU_OPEN || state == STATUS_MENU_OPENED || state == STATUS_MENU_CLOSE) {
oPaint.setColor(calcPressedEffectColor(0, .5f));
} else if (pressed && clickIndex == 0) {
oPaint.setColor(pressedColor);
} else {
oPaint.setColor(mainMenuColor);
sPaint.setColor(mainMenuColor);
}
drawMenuShadow(canvas, centerX, centerY, centerMenuRadius);
canvas.drawCircle(centerX, centerY, centerMenuRadius, oPaint);
drawMainMenuIcon(canvas);
}
private void drawMainMenuIcon(Canvas canvas) {
canvas.save();
switch (state) {
case STATUS_MENU_CLOSED:
if (openMenuIconDrawable != null)
openMenuIconDrawable.draw(canvas);
break;
case STATUS_MENU_OPEN:
canvas.rotate(45 * (fraction - 1), centerX, centerY);
resetBoundsAndDrawIcon(canvas, closeMenuIconDrawable, centerX, centerY, iconSize / 2);
break;
case STATUS_MENU_OPENED:
resetBoundsAndDrawIcon(canvas, closeMenuIconDrawable, centerX, centerY, iconSize / 2);
break;
case STATUS_MENU_CLOSE:
resetBoundsAndDrawIcon(canvas, closeMenuIconDrawable, centerX, centerY, itemIconSize / 2);
break;
case STATUS_MENU_CLOSE_CLEAR:
canvas.rotate(90 * (rFraction - 1), centerX, centerY);
resetBoundsAndDrawIcon(canvas, openMenuIconDrawable, centerX, centerY, itemIconSize / 2);
break;
case STATUS_MENU_CANCEL:
canvas.rotate(-45 * fraction, centerX, centerY);
if (closeMenuIconDrawable != null)
closeMenuIconDrawable.draw(canvas);
break;
}
canvas.restore();
}
private void drawMenuShadow(Canvas canvas, int centerX, int centerY, float radius) {
if (radius + shadowRadius > 0) {
sPaint.setShader(new RadialGradient(centerX, centerY, radius + shadowRadius,
Color.BLACK, Color.TRANSPARENT, Shader.TileMode.CLAMP));
canvas.drawCircle(centerX, centerY, radius + shadowRadius, sPaint);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (state == STATUS_MENU_CLOSE || state == STATUS_MENU_CLOSE_CLEAR) return true;
int index = clickWhichRectF(event.getX(), event.getY());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
pressed = true;
if (index != -1) {
clickIndex = index;
updatePressEffect(index, pressed);
}
break;
case MotionEvent.ACTION_MOVE:
if (index == -1) {
pressed = false;
invalidate();
}
break;
case MotionEvent.ACTION_UP:
pressed = false;
if (index != -1) {
clickIndex = index;
updatePressEffect(index, pressed);
}
if (index == 0) {
if (state == STATUS_MENU_CLOSED) {
state = STATUS_MENU_OPEN;
if (mFeedbackListener != null) {
mFeedbackListener.onMenuCenterClicked();
}
startOpenMenuAnima();
} else if (state == STATUS_MENU_OPENED) {
state = STATUS_MENU_CANCEL;
if (mFeedbackListener != null) {
mFeedbackListener.onMenuCenterClicked();
}
startCancelMenuAnima();
}
} else {
if (state == STATUS_MENU_OPENED && index != -1) {
state = STATUS_MENU_CLOSE;
if (mFeedbackListener != null) {
mFeedbackListener.onMenuSelected(index - 1);
}
rotateAngle = clickIndex * (360 / itemNum) - (360 / itemNum) - 90;
startCloseMeunAnima();
}
}
break;
}
return true;
}
private void updatePressEffect(int menuIndex, boolean press) {
if (press) {
pressedColor = calcPressedEffectColor(menuIndex, .15f);
}
invalidate();
}
private int calcPressedEffectColor(int menuIndex, float depth) {
int color = menuIndex == 0 ? mainMenuColor : subMenuColorList.get(menuIndex - 1);
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[2] *= (1.f - depth);
return Color.HSVToColor(hsv);
}
private int calcAlphaColor(int color, boolean reverse) {
int alpha;
if (reverse) {
alpha = (int) (255 * (1.f - fraction));
} else {
alpha = (int) (255 * fraction);
}
if (alpha >= 255) alpha = 255;
if (alpha <= 0) alpha = 0;
return ColorUtils.setAlphaComponent(color, alpha);
}
private void startOpenMenuAnima() {
ValueAnimator openAnima = ValueAnimator.ofFloat(1.f, 100.f);
openAnima.setDuration(500);
openAnima.setInterpolator(new OvershootInterpolator());
openAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
fraction = valueAnimator.getAnimatedFraction();
itemMenuRadius = fraction * partSize;
itemIconSize = (int) (fraction * iconSize);
invalidate();
}
});
openAnima.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
state = STATUS_MENU_OPENED;
if (mFeedbackListener != null) {
mFeedbackListener.onMenuOpened();
}
}
});
openAnima.start();
}
private void startCancelMenuAnima() {
ValueAnimator cancelAnima = ValueAnimator.ofFloat(1.f, 100.f);
cancelAnima.setDuration(500);
cancelAnima.setInterpolator(new AnticipateInterpolator());
cancelAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
fraction = valueAnimator.getAnimatedFraction();
itemMenuRadius = (1 - fraction) * partSize;
itemIconSize = (int) ((1 - fraction) * iconSize);
invalidate();
}
});
cancelAnima.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
state = STATUS_MENU_CLOSED;
if (mFeedbackListener != null)
mFeedbackListener.onMenuClosed();
}
});
cancelAnima.start();
}
private void startCloseMeunAnima() {
ValueAnimator aroundAnima = ValueAnimator.ofFloat(1.f, 100.f);
aroundAnima.setDuration(500);
aroundAnima.setInterpolator(new AccelerateDecelerateInterpolator());
aroundAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
fraction = valueAnimator.getAnimatedFraction();
float animaFraction = fraction * 2 >= 1 ? 1 : fraction * 2;
itemIconSize = (int) ((1 - animaFraction) * iconSize);
invalidate();
}
});
aroundAnima.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
state = STATUS_MENU_CLOSE_CLEAR;
}
});
ValueAnimator spreadAnima = ValueAnimator.ofFloat(1.f, 100.f);
spreadAnima.setInterpolator(new LinearInterpolator());
spreadAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
fraction = valueAnimator.getAnimatedFraction();
}
});
ValueAnimator rotateAnima = ValueAnimator.ofFloat(1.f, 100.f);
rotateAnima.setInterpolator(new OvershootInterpolator());
rotateAnima.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
rFraction = valueAnimator.getAnimatedFraction();
itemIconSize = (int) (rFraction * iconSize);
invalidate();
}
});
AnimatorSet closeAnimaSet = new AnimatorSet();
closeAnimaSet.setDuration(500);
closeAnimaSet.play(spreadAnima).with(rotateAnima);
closeAnimaSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
state = STATUS_MENU_CLOSED;
if (mFeedbackListener != null) {
mFeedbackListener.onMenuClosed();
}
}
});
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(aroundAnima).before(closeAnimaSet);
animatorSet.start();
}
private int clickWhichRectF(float x, float y) {
int which = -1;
for (RectF rectF : menuRectFList) {
if (rectF.contains(x, y)) {
which = menuRectFList.indexOf(rectF);
break;
}
}
return which;
}
private Drawable convertDrawable(int iconRes) {
return getResources().getDrawable(iconRes);
}
private Drawable convertBitmap(Bitmap bitmap) {
return new BitmapDrawable(getResources(), bitmap);
}
private void resetMainDrawableBounds() {
openMenuIconDrawable.setBounds(centerX - iconSize / 2, centerY - iconSize / 2,
centerX + iconSize / 2, centerY + iconSize / 2);
closeMenuIconDrawable.setBounds(centerX - iconSize / 2, centerY - iconSize / 2,
centerX + iconSize / 2, centerY + iconSize / 2);
}
public CircleMenuView setMainMenu(int mainMenuColor, int openMenuRes, int closeMenuRes) {
openMenuIconDrawable = convertDrawable(openMenuRes);
closeMenuIconDrawable = convertDrawable(closeMenuRes);
this.mainMenuColor = mainMenuColor;
return this;
}
public CircleMenuView setMainMenu(int mainMenuColor, Bitmap openMenuBitmap, Bitmap closeMenuBitmap) {
openMenuIconDrawable = convertBitmap(openMenuBitmap);
closeMenuIconDrawable = convertBitmap(closeMenuBitmap);
this.mainMenuColor = mainMenuColor;
return this;
}
public CircleMenuView setMainMenu(int mainMenuColor, Drawable openMenuDrawable, Drawable closeMenuDrawable) {
openMenuIconDrawable = openMenuDrawable;
closeMenuIconDrawable = closeMenuDrawable;
this.mainMenuColor = mainMenuColor;
return this;
}
public CircleMenuView addSubMenu(int menuColor, int menuRes) {
if (subMenuColorList.size() < MAX_SUBMENU_NUM && subMenuDrawableList.size() < MAX_SUBMENU_NUM) {
subMenuColorList.add(menuColor);
subMenuDrawableList.add(convertDrawable(menuRes));
itemNum = Math.min(subMenuColorList.size(), subMenuDrawableList.size());
} else {
throw new IllegalStateException("注意!最多添加8个子菜单!MAX_SUBMENU_NUM = 8");
}
return this;
}
public CircleMenuView addSubMenu(int menuColor, Bitmap menuBitmap) {
if (subMenuColorList.size() < MAX_SUBMENU_NUM && subMenuDrawableList.size() < MAX_SUBMENU_NUM) {
subMenuColorList.add(menuColor);
subMenuDrawableList.add(convertBitmap(menuBitmap));
itemNum = Math.min(subMenuColorList.size(), subMenuDrawableList.size());
}
return this;
}
public CircleMenuView addSubMenu(int menuColor, Drawable menuDrawable) {
if (subMenuColorList.size() < MAX_SUBMENU_NUM && subMenuDrawableList.size() < MAX_SUBMENU_NUM) {
subMenuColorList.add(menuColor);
subMenuDrawableList.add(menuDrawable);
itemNum = Math.min(subMenuColorList.size(), subMenuDrawableList.size());
}
return this;
}
public void openMenu() {
if (state == STATUS_MENU_CLOSED) {
state = STATUS_MENU_OPEN;
startOpenMenuAnima();
}
}
public void closeMenu() {
if (state == STATUS_MENU_OPENED) {
state = STATUS_MENU_CANCEL;
startCancelMenuAnima();
}
}
public boolean isOpened() {
return state == STATUS_MENU_OPENED;
}
private int dip2px(float dpValue) {
final float scale = getContext().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
public CircleMenuView setFeedbackListener(OnCircleMenuFeedbackListener listener) {
mFeedbackListener = listener;
return this;
}
public interface OnCircleMenuFeedbackListener {
void onMenuSelected(int index);
void onMenuCenterClicked();
void onMenuOpened();
void onMenuClosed();
}
public int getCurrentMenuState() {
return state;
}
public CircleMenuView setInterceptBackPressedEnable(boolean isEnable) {
if (isEnable) {
requestFocus();
setFocusable(true);
setFocusableInTouchMode(true);
}
return this;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && isOpened()) {
closeMenu();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
|