private void selectPreset(EditText editText, CharSequence[] presets) { ListPopupWindow menu = new ListPopupWindow(editText.getContext()); menu.setAnchorView(editText); menu.setAdapter(new ArrayAdapter<>(this, R.layout.activity_message_format_settings_preset, presets)); menu.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> { editText.setText(presets[position]); menu.dismiss(); }); menu.show(); }
}); popupWindow.setModal(true); popupWindow.show();
popupWindow.show();
private void performShowOptions() { final ListPopupWindow popupWindow = new ListPopupWindow(this); ArrayList<String> values = new ArrayList<>( Arrays.asList(getResources().getStringArray(R.array.search_options_labels))); String value = values.get(mCurrentOption); SimpleDropDownAdapter<Integer> adapter = new SimpleDropDownAdapter<>(this, values, values, mIcons, value); popupWindow.setAnchorView(mBinding.anchor); popupWindow.setDropDownGravity(GravityCompat.END); popupWindow.setAdapter(adapter); popupWindow.setContentWidth(adapter.measureContentWidth()); popupWindow.setOnItemClickListener((parent, view, position, id) -> { popupWindow.dismiss(); mCurrentOption = position; Preferences.setAccountSearchMode(this, mAccount, mCurrentOption); configureSearchHint(); mBinding.searchView.setCustomIcon(ContextCompat.getDrawable(this, mIcons[position])); clearSuggestions(); mHandler.removeMessages(FETCH_SUGGESTIONS_MESSAGE); mHandler.removeMessages(SHOW_HISTORY_MESSAGE); final Message msg = Message.obtain(mHandler, SHOW_HISTORY_MESSAGE); mHandler.sendMessageDelayed(msg, 500L); }); popupWindow.setModal(true); popupWindow.show(); }
popupWindow.show();
private void showDiffAgainstChooser(View anchor) { if (isLocked()) { return; } //noinspection ConstantConditions final ListPopupWindow popupWindow = new ListPopupWindow(getContext()); PatchSetsAdapter adapter = new PatchSetsAdapter(getContext(), mAllRevisionsWithBase, mResponse.mUnresolvedComments, mDiffAgainstRevision); popupWindow.setAnchorView(anchor); popupWindow.setAdapter(adapter); popupWindow.setContentWidth(adapter.measureContentWidth()); popupWindow.setOnItemClickListener((parent, view, position, id) -> { popupWindow.dismiss(); String commit = null; if (mAllRevisionsWithBase.get(position).commit != null) { commit = mAllRevisionsWithBase.get(position).commit.commit; } mDiffAgainstRevision = commit; forceRefresh(); }); popupWindow.setModal(true); popupWindow.show(); }
private void showPatchSetChooser(View anchor) { if (isLocked()) { return; } //noinspection ConstantConditions final ListPopupWindow popupWindow = new ListPopupWindow(getContext()); PatchSetsAdapter adapter = new PatchSetsAdapter(getContext(), mAllRevisions, mResponse.mUnresolvedComments, mCurrentRevision); popupWindow.setAnchorView(anchor); popupWindow.setAdapter(adapter); popupWindow.setContentWidth(adapter.measureContentWidth()); popupWindow.setOnItemClickListener((parent, view, position, id) -> { popupWindow.dismiss(); mCurrentRevision = mAllRevisions.get(position).commit.commit; //noinspection ConstantConditions ((BaseActivity) getActivity()).setAnalyticsBase(mCurrentRevision); // Restore diff against to base mDiffAgainstRevision = null; forceRefresh(); }); popupWindow.setModal(true); popupWindow.show(); }
private void performShowMoreAction(View anchor) { SimpleDropDownAdapter<Integer> adapter = createMoreActionsAdapter(); if (adapter == null) { return; } //noinspection ConstantConditions final ListPopupWindow popupWindow = new ListPopupWindow(getContext()); popupWindow.setAnchorView(anchor); popupWindow.setAdapter(adapter); popupWindow.setContentWidth(adapter.measureContentWidth()); popupWindow.setOnItemClickListener((parent, view, position, id) -> { popupWindow.dismiss(); performAction(adapter.getId(position), anchor); }); popupWindow.setModal(true); popupWindow.show(); }