org.chromium.ui.DropdownPopupWindow Java Examples
The following examples show how to use
org.chromium.ui.DropdownPopupWindow.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectPopupDropdown.java From 365browser with Apache License 2.0 | 5 votes |
public SelectPopupDropdown(ContentViewCore contentViewCore, View anchorView, List<SelectPopupItem> items, int[] selected, boolean rightAligned) { mContentViewCore = contentViewCore; mContext = mContentViewCore.getContext(); mDropdownPopupWindow = new DropdownPopupWindow(mContext, anchorView); mDropdownPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { notifySelection(new int[] {position}); hide(false); } }); int initialSelection = -1; if (selected.length > 0) { initialSelection = selected[0]; } mDropdownPopupWindow.setInitialSelection(initialSelection); mDropdownPopupWindow.setAdapter(new DropdownAdapter( mContext, items, null /* separators */, null /* backgroundColor */, null /* dividerColor */, null /* dropdownItemHeight */, null /* margin */)); mDropdownPopupWindow.setRtl(rightAligned); mDropdownPopupWindow.setOnDismissListener( new PopupWindow.OnDismissListener() { @Override public void onDismiss() { notifySelection(null); } }); }