From d876a16893ccac91bca53e3d96a290009493e4b7 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Wed, 12 Sep 2012 20:44:57 -0400 Subject: [PATCH] Add a helper helper so we can get click events on message list menu items --- src/com/fsck/k9/helper/MenuPopup.java | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/com/fsck/k9/helper/MenuPopup.java diff --git a/src/com/fsck/k9/helper/MenuPopup.java b/src/com/fsck/k9/helper/MenuPopup.java new file mode 100644 index 000000000..d46dd54b9 --- /dev/null +++ b/src/com/fsck/k9/helper/MenuPopup.java @@ -0,0 +1,33 @@ + +package com.fsck.k9.helper; + +import android.content.Context; +import android.view.View; +import android.widget.AdapterView; +import com.actionbarsherlock.internal.view.menu.MenuBuilder; +import com.actionbarsherlock.internal.view.menu.MenuPopupHelper; +public class MenuPopup extends MenuPopupHelper { + + OnMenuItemClickListener onMenuItemClickListener; + + public MenuPopup(Context context, MenuBuilder menu, View anchorView) { + super(context, menu, anchorView); + } + + public void setOnMenuItemClickListener( + OnMenuItemClickListener onMenuItemClickListener) { + this.onMenuItemClickListener = onMenuItemClickListener; + } + + @Override + public void onItemClick(AdapterView parent, View view, int position, + long id) { + super.onItemClick(parent, view, position, id); + if (onMenuItemClickListener != null) + onMenuItemClickListener.onMenuItemClick(position); + } + + public interface OnMenuItemClickListener{ + public void onMenuItemClick(int itemID); + } +}