use of net.studymongolian.mongollibrary.MongolMenu in project mongol-library by suragch.
the class MongolMenuActivity method onNoIconsClick.
public void onNoIconsClick(View view) {
MongolMenu menu = new MongolMenu(this);
menu.add(new MongolMenuItem("ᠨᠢᠭᠡ"));
menu.add(new MongolMenuItem("ᠬᠤᠶᠠᠷ"));
menu.add(new MongolMenuItem("ᠭᠤᠷᠪᠠ"));
menu.setOnMenuItemClickListener(new MongolMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MongolMenuItem item) {
MongolToast.makeText(MongolMenuActivity.this, item.getTitle(), MongolToast.LENGTH_SHORT).show();
return true;
}
});
menu.showAsDropDown(view, 0, 0);
}
use of net.studymongolian.mongollibrary.MongolMenu in project mongol-library by suragch.
the class MongolMenuActivity method onShowAtLocationClick.
public void onShowAtLocationClick(View view) {
MongolMenu menu = getMenu();
menu.showAtLocation(view, Gravity.CENTER, 0, 0);
}
use of net.studymongolian.mongollibrary.MongolMenu in project mongol-library by suragch.
the class MongolMenuActivity method getMenu.
private MongolMenu getMenu() {
MongolMenu menu = new MongolMenu(this);
menu.add(new MongolMenuItem("ᠨᠢᠭᠡ", R.drawable.ic_sun));
menu.add(new MongolMenuItem("ᠬᠤᠶᠠᠷ", R.drawable.ic_moon));
menu.add(new MongolMenuItem("ᠭᠤᠷᠪᠠ", R.drawable.ic_star));
menu.setOnMenuItemClickListener(new MongolMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MongolMenuItem item) {
MongolToast.makeText(MongolMenuActivity.this, item.getTitle(), MongolToast.LENGTH_SHORT).show();
return true;
}
});
return menu;
}
use of net.studymongolian.mongollibrary.MongolMenu in project mongol-library by suragch.
the class MongolEditTextActivity method getMongolEditTextContextMenu.
@Override
public MongolMenu getMongolEditTextContextMenu(MongolEditText met) {
// This is a demo menu only
// You will need to implement your own functionality
// See the MongolEditText source code for examples
MongolMenu menu = new MongolMenu(this);
menu.add(new MongolMenuItem("ᠨᠢᠭᠡ", R.drawable.ic_sun));
menu.add(new MongolMenuItem("ᠬᠤᠶᠠᠷ", R.drawable.ic_moon));
menu.add(new MongolMenuItem("ᠭᠤᠷᠪᠠ", R.drawable.ic_star));
menu.setOnMenuItemClickListener(new MongolMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MongolMenuItem item) {
MongolToast.makeText(MongolEditTextActivity.this, item.getTitle(), MongolToast.LENGTH_SHORT).show();
return true;
}
});
return menu;
}
use of net.studymongolian.mongollibrary.MongolMenu in project mongol-library by suragch.
the class MongolMenuActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch(item.getItemId()) {
case R.id.action_menu:
// any view is ok
View menuButton = findViewById(R.id.action_menu);
int[] location = new int[2];
menuButton.getLocationInWindow(location);
int gravity = Gravity.TOP | Gravity.RIGHT;
int marginPx = convertDpToPx(MARGIN_DP);
int yOffset = location[1] + marginPx;
MongolMenu menu = getMenu();
menu.showAtLocation(menuButton, gravity, marginPx, yOffset);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Aggregations