1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Added a "DELETE" keybinding in the FolderMessageList

This commit is contained in:
Jesse Vincent 2008-10-28 01:12:03 +00:00
parent 822b3b3daa
commit a6956b5bae

View File

@ -17,6 +17,7 @@ import android.os.Process;
import android.util.Config; import android.util.Config;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -449,6 +450,27 @@ public class FolderMessageList extends ExpandableListActivity {
} }
} }
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
int group = mListView.getPackedPositionGroup(mListView.getSelectedId());
int item =(mListView.getSelectedItemPosition() -1 );
if (item >= 0) { // Guard against hitting delete on group names
switch (keyCode) {
case KeyEvent.KEYCODE_DEL: {
if (true) {
MessageInfoHolder message = (MessageInfoHolder) mAdapter.getChild(group, item);
onDelete(message);
}
return true;
}
}
}
return super.onKeyDown(keyCode, event);
}
@Override @Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) { int childPosition, long id) {