Search in sources :

Example 1 with EditTextMenu

use of carbon.internal.EditTextMenu in project Carbon by ZieIony.

the class MarshmallowEditText method createMenu.

private void createMenu(Menu menu) {
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(R.attr.carbon_editMenuTheme, outValue, true);
    int theme = outValue.resourceId;
    Context themedContext = new ContextThemeWrapper(getContext(), theme);
    popupMenu = new EditTextMenu(themedContext);
    popupMenu.setOnDismissListener(new PopupWindow.OnDismissListener() {

        @Override
        public void onDismiss() {
            isShowingPopup = false;
        }
    });
    popupMenu.initCopy(menu.findItem(ID_COPY));
    popupMenu.initCut(menu.findItem(ID_CUT));
    popupMenu.initPaste(menu.findItem(ID_PASTE));
    popupMenu.initSelectAll(menu.findItem(ID_SELECT_ALL));
//menu.clear();
/*try {
            mIgnoreActionUpEventField.set(editor, true);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }*/
}
Also used : Context(android.content.Context) ContextThemeWrapper(android.support.v7.view.ContextThemeWrapper) PopupWindow(android.widget.PopupWindow) EditTextMenu(carbon.internal.EditTextMenu) TypedValue(android.util.TypedValue)

Aggregations

Context (android.content.Context)1 ContextThemeWrapper (android.support.v7.view.ContextThemeWrapper)1 TypedValue (android.util.TypedValue)1 PopupWindow (android.widget.PopupWindow)1 EditTextMenu (carbon.internal.EditTextMenu)1