List of usage examples for android.widget ListPopupWindow ListPopupWindow
public ListPopupWindow(@NonNull Context context)
From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.tablet.TracksDropdownFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_tracks_dropdown, null); mTitle = (TextView) mRootView.findViewById(R.id.track_title); mAbstract = (TextView) mRootView.findViewById(R.id.track_abstract); mRootView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { mListPopupWindow = new ListPopupWindow(getActivity()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setModal(true); mListPopupWindow.setContentWidth(400); mListPopupWindow.setAnchorView(mRootView); mListPopupWindow.setOnItemClickListener(TracksDropdownFragment.this); mListPopupWindow.show();//ww w. j av a 2 s.c o m mListPopupWindow.setOnDismissListener(TracksDropdownFragment.this); } }); return mRootView; }
From source file:com.duy.pascal.ui.editor.view.CodeSuggestsEditText.java
private void setupCodeSuggestsEditText(Context context) { mTokenizer = new SymbolsTokenizer(); setTokenizer(mTokenizer);/* w w w.j a v a 2 s .c o m*/ // setThreshold(1); calculateCharHeight(); mDropDownAnchorId = View.NO_ID; mPopup = new ListPopupWindow(context); mPopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW); mPopup.setOnItemClickListener(new DropDownItemClickListener()); mPopup.setAnimationStyle(android.R.style.Animation_Dialog); onDropdownChangeSize(getWidth(), getHeight()); }
From source file:com.geozen.smarttrail.ui.tablet.AreasDropdownFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_areas_dropdown, null); mTitle = (TextView) mRootView.findViewById(R.id.area_title); mAbstract = (TextView) mRootView.findViewById(R.id.area_abstract); mRootView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { mListPopupWindow = new ListPopupWindow(getActivity()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setModal(true); mListPopupWindow.setContentWidth(400); mListPopupWindow.setAnchorView(mRootView); mListPopupWindow.setOnItemClickListener(AreasDropdownFragment.this); mListPopupWindow.show();/* w w w . j ava2 s . co m*/ mListPopupWindow.setOnDismissListener(AreasDropdownFragment.this); } }); return mRootView; }
From source file:com.goliathonline.android.kegbot.ui.tablet.TracksDropdownFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_tracks_dropdown, null); mTitle = (TextView) mRootView.findViewById(R.id.track_title); mAbstract = (TextView) mRootView.findViewById(R.id.track_abstract); mRootView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { mListPopupWindow = new ListPopupWindow(getActivity()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setModal(true); mListPopupWindow.setContentWidth(400); mListPopupWindow.setAnchorView(mRootView); mListPopupWindow.setOnItemClickListener(TracksDropdownFragment.this); mListPopupWindow.show();//from w w w . j a v a2 s.c o m mListPopupWindow.setOnDismissListener(TracksDropdownFragment.this); } }); return mRootView; }
From source file:net.abcdroid.devfest12.ui.tablet.TracksDropdownFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_tracks_dropdown, null); mTitle = (TextView) mRootView.findViewById(R.id.track_title); mAbstract = (TextView) mRootView.findViewById(R.id.track_abstract); mRootView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { mListPopupWindow = new ListPopupWindow(getActivity()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setModal(true); mListPopupWindow//w w w .j a v a 2s . c om .setContentWidth(getResources().getDimensionPixelSize(R.dimen.track_dropdown_width)); mListPopupWindow.setAnchorView(mRootView); mListPopupWindow.setOnItemClickListener(TracksDropdownFragment.this); mListPopupWindow.show(); mListPopupWindow.setOnDismissListener(TracksDropdownFragment.this); } }); return mRootView; }
From source file:com.conferenceengineer.android.iosched.ui.tablet.TracksDropdownFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_tracks_dropdown, null); mIcon = (ImageView) mRootView.findViewById(R.id.track_icon); mTitle = (TextView) mRootView.findViewById(R.id.track_title); mAbstract = (TextView) mRootView.findViewById(R.id.track_abstract); mRootView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { mListPopupWindow = new ListPopupWindow(getActivity()); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setModal(true); mListPopupWindow// w w w . j ava2 s .c o m .setContentWidth(getResources().getDimensionPixelSize(R.dimen.track_dropdown_width)); mListPopupWindow.setAnchorView(mRootView); mListPopupWindow.setOnItemClickListener(TracksDropdownFragment.this); mListPopupWindow.show(); mListPopupWindow.setOnDismissListener(TracksDropdownFragment.this); } }); return mRootView; }
From source file:com.android.settings.users.EditUserPhotoController.java
private void showUpdatePhotoPopup() { final boolean canTakePhoto = canTakePhoto(); final boolean canChoosePhoto = canChoosePhoto(); if (!canTakePhoto && !canChoosePhoto) { return;//from ww w .ja v a 2s.c om } final Context context = mImageView.getContext(); final List<EditUserPhotoController.RestrictedMenuItem> items = new ArrayList<>(); if (canTakePhoto) { final String title = context.getString(R.string.user_image_take_photo); final Runnable action = new Runnable() { @Override public void run() { takePhoto(); } }; items.add(new RestrictedMenuItem(context, title, UserManager.DISALLOW_SET_USER_ICON, action)); } if (canChoosePhoto) { final String title = context.getString(R.string.user_image_choose_photo); final Runnable action = new Runnable() { @Override public void run() { choosePhoto(); } }; items.add(new RestrictedMenuItem(context, title, UserManager.DISALLOW_SET_USER_ICON, action)); } final ListPopupWindow listPopupWindow = new ListPopupWindow(context); listPopupWindow.setAnchorView(mImageView); listPopupWindow.setModal(true); listPopupWindow.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED); listPopupWindow.setAdapter(new RestrictedPopupMenuAdapter(context, items)); final int width = Math.max(mImageView.getWidth(), context.getResources().getDimensionPixelSize(R.dimen.update_user_photo_popup_min_width)); listPopupWindow.setWidth(width); listPopupWindow.setDropDownGravity(Gravity.START); listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { listPopupWindow.dismiss(); final RestrictedMenuItem item = (RestrictedMenuItem) parent.getAdapter().getItem(position); item.doAction(); } }); listPopupWindow.show(); }
From source file:com.pizidea.imagepicker.ui.ImagesGridFragment.java
/** * ListView/*from w w w. j a va 2 s .c o m*/ */ private void createPopupFolderList(int width, int height) { mFolderPopupWindow = new ListPopupWindow(mContext); //mFolderPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mFolderPopupWindow.setAdapter(mImageSetAdapter); mFolderPopupWindow.setContentWidth(width); mFolderPopupWindow.setWidth(width); mFolderPopupWindow.setHeight(height * 5 / 8); mFolderPopupWindow.setAnchorView(mFooterView); mFolderPopupWindow.setModal(true); mFolderPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { backgroundAlpha(1f); } }); mFolderPopupWindow.setAnimationStyle(R.style.popupwindow_anim_style); mFolderPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { mImageSetAdapter.setSelectIndex(i); androidImagePicker.setCurrentSelectedImageSetPosition(i); final int index = i; final AdapterView tempAdapterView = adapterView; new Handler().postDelayed(new Runnable() { @Override public void run() { mFolderPopupWindow.dismiss(); ImageSet imageSet = (ImageSet) tempAdapterView.getAdapter().getItem(index); if (null != imageSet) { mAdapter.refreshData(imageSet.imageItems); btnDir.setText(imageSet.name); } // scroll to the top mGridView.smoothScrollToPosition(0); } }, 100); } }); }
From source file:com.mgfypy.imagelibrary.ui.ImagesGridFragment.java
/** * ListView/* w w w . j a v a2s. c om*/ */ private void createPopupFolderList(int width, int height) { mFolderPopupWindow = new ListPopupWindow(mContext); //mFolderPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mFolderPopupWindow.setAdapter(mImageSetAdapter); mFolderPopupWindow.setContentWidth(width); mFolderPopupWindow.setWidth(width); mFolderPopupWindow.setHeight(height * 5 / 8); mFolderPopupWindow.setAnchorView(mFooterView); mFolderPopupWindow.setModal(true); mFolderPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { backgroundAlpha(1f); } }); mFolderPopupWindow.setAnimationStyle(R.style.popupwindow_anim_style); mFolderPopupWindow.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { mImageSetAdapter.setSelectIndex(i); androidImagePicker.setCurrentSelectedImageSetPosition(i); final int index = i; final AdapterView tempAdapterView = adapterView; new Handler().postDelayed(new Runnable() { @Override public void run() { mFolderPopupWindow.dismiss(); ImageSet imageSet = (ImageSet) tempAdapterView.getAdapter().getItem(index); if (null != imageSet) { mAdapter.refreshData(imageSet.imageItems); btnDir.setText(imageSet.name); } // scroll to the top mGridView.smoothScrollToPosition(0); } }, 100); } }); }
From source file:com.ruesga.rview.fragments.DownloadDialogFragment.java
private void showDownloadTypeChooser(View anchor) { final ListPopupWindow popupWindow = new ListPopupWindow(getContext()); SimpleDropDownAdapter adapter = new SimpleDropDownAdapter(getContext(), mDownloadTypes, mModel.downloadType);/*from w w w .j ava2s .com*/ popupWindow.setAnchorView(anchor); popupWindow.setAdapter(adapter); popupWindow.setContentWidth(adapter.measureContentWidth()); popupWindow.setOnItemClickListener((parent, view, position, id) -> { popupWindow.dismiss(); // Update the view mModel.downloadType = mDownloadTypes.get(position); mBinding.downloadCommands.from(mDownloadCommands.get(mModel.downloadType)).update(); mBinding.setModel(mModel); mBinding.executePendingBindings(); }); popupWindow.setModal(true); popupWindow.show(); }