android.widget.PopupWindow Java Examples
The following examples show how to use
android.widget.PopupWindow.
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: AlbumCommentDetailActivity.java From letv with Apache License 2.0 | 6 votes |
public void showPopupWindow(View target) { if (target != null) { if (this.morePopupWindow == null) { this.morePopupWindow = new PopupWindow(BaseApplication.getInstance()); this.morePopupWindow.setBackgroundDrawable(new BitmapDrawable()); this.morePopupWindow.setWidth(UIsUtils.zoomWidth(60)); this.morePopupWindow.setHeight(UIsUtils.zoomWidth(40)); this.morePopupWindow.setOutsideTouchable(true); this.morePopupWindow.setFocusable(true); this.morePopupWindow.setContentView(this.popupContentView); } int[] location = new int[2]; target.getLocationOnScreen(location); LogInfo.log("Emerson", "-----------location[1] = " + location[1]); this.morePopupWindow.showAtLocation(target, 0, location[0] + ((target.getWidth() - UIsUtils.dipToPx(40.0f)) / 2), (location[1] + (target.getHeight() / 2)) - UIsUtils.dipToPx(60.0f)); this.morePopupWindow.update(); } }
Example #2
Source File: PopshowAtLocationActivity.java From AndroidSamples with Apache License 2.0 | 6 votes |
private void showPopupWindow() { View contentView = LayoutInflater.from(PopshowAtLocationActivity.this).inflate(R.layout.show_at_location_activity_popup, null); mPopWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); mPopWindow.setBackgroundDrawable(new BitmapDrawable()); mPopWindow.setOutsideTouchable(true); TextView tv1 = contentView.findViewById(R.id.pop_computer); TextView tv2 = contentView.findViewById(R.id.pop_financial); TextView tv3 = contentView.findViewById(R.id.pop_manage); tv1.setOnClickListener(this); tv2.setOnClickListener(this); tv3.setOnClickListener(this); View rootview = LayoutInflater.from(PopshowAtLocationActivity.this).inflate(R.layout.show_at_location_activity, null); mPopWindow.showAtLocation(rootview, Gravity.BOTTOM, 0, 0); }
Example #3
Source File: BeerActivity.java From ratebeer with GNU General Public License v3.0 | 6 votes |
private void addBeerToCustomList(Beer beer, long listId, PopupWindow popup) { Db.getCustomListBeer(this, listId, beer._id) .compose(bindToLifecycle()) .defaultIfEmpty(null) .subscribe(existingBeerOnList -> { if (existingBeerOnList == null) { CustomListBeer addBeer = new CustomListBeer(); addBeer.listId = listId; addBeer.beerId = beer._id; addBeer.beerName = beer.name; rxdb(this).put(addBeer); listAddButton.setChecked(true); } else { rxdb(this).delete(existingBeerOnList); listAddButton.setChecked(false); } }); popup.dismiss(); }
Example #4
Source File: ProgressHintDelegate.java From progresshint with Apache License 2.0 | 6 votes |
private void initHintPopup() { String popupText = null; if (mHintAdapter != null) { popupText = mHintAdapter.getHint(mSeekBar, mSeekBar.getProgress()); } // init views LayoutInflater inflater = (LayoutInflater) mSeekBar.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); mPopupView = inflater.inflate(mPopupLayout, null); mPopupView.measure(makeMeasureSpec(0, UNSPECIFIED), makeMeasureSpec(0, UNSPECIFIED)); mPopupTextView = mPopupView.findViewById(android.R.id.text1); mPopupTextView.setText(popupText != null ? popupText : String.valueOf(mSeekBar.getProgress())); // init popup mPopup = new PopupWindow(mPopupView, WRAP_CONTENT, WRAP_CONTENT, false); mPopup.setAnimationStyle(mPopupAnimStyle); }
Example #5
Source File: WebViewActivity.java From Simpler with Apache License 2.0 | 6 votes |
/** * 显示PopupWindow:WebView操作 * * @param view */ private void showWebViewOpWindow(View view) { View contentView = getLayoutInflater().inflate(R.layout.window_webview_op, null); // 设置Item的点击事件 LinearLayout llRefresh = (LinearLayout) contentView.findViewById(R.id.llRefresh); LinearLayout llCopyUrl = (LinearLayout) contentView.findViewById(R.id.llCopyUrl); LinearLayout llOpen = (LinearLayout) contentView.findViewById(R.id.llOpen); final PopupWindow popupWindow = new PopupWindow(contentView, RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT, true); OpClickListener listener = new OpClickListener(popupWindow); llRefresh.setOnClickListener(listener); llCopyUrl.setOnClickListener(listener); llOpen.setOnClickListener(listener); // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框 popupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.popup_transparent_bg)); // 设置好参数之后再show popupWindow.showAsDropDown(view); }
Example #6
Source File: JUIHelper.java From connectivity-samples with Apache License 2.0 | 6 votes |
public void closeWidget(final View view) { JUIForwardingPopupWindow window = null; // Check if the control has dummy popupwindow to forward user inputs try { Method method = view.getClass().getMethod("getDummyWindow"); window = (JUIForwardingPopupWindow) method.invoke(view); } catch (Exception e) { } final PopupWindow closingWindow = window; activity_.runOnUiThread(new Runnable() { @Override public void run() { if (closingWindow != null) { dummyWindows_.remove(closingWindow); closingWindow.dismiss(); } JUIRelativeLayout_.removeView(view); } }); return; }
Example #7
Source File: ProductDetailsActivity.java From ShoppingCartDemo with MIT License | 6 votes |
private void initViews() { mTVList = (TextView) findViewById(R.id.tv_activity_product_details_list); mTVDetails = (TextView) findViewById(R.id.tv_activity_product_details_details); mBtnAddToCart = (Button) findViewById(R.id.btn_activity_product_details_add_to_cart); mImgDetails = (ImageView) findViewById(R.id.img_activity_product); mTVTopPrice = (TextView) findViewById(R.id.tv_activity_product_details_price); mPop = LayoutInflater.from(this).inflate(R.layout.popup_add_to_cart, null); mImgIcon = (ImageView) mPop.findViewById(R.id.img_pop_icon); mBtnOK = (Button) mPop.findViewById(R.id.btn_pop_ok); mBtnMinute = (Button) mPop.findViewById(R.id.btn_pop_minute); mBtnPlus = (Button) mPop.findViewById(R.id.btn_pop_plus); mImgClose = (ImageView) mPop.findViewById(R.id.img_pop_close); mTVNumber = (TextView) mPop.findViewById(R.id.tv_pop_number); mTVPopDetails = (TextView) mPop.findViewById(R.id.tv_pop_details); mTVPrice = (TextView) mPop.findViewById(R.id.tv_pop_price); mTVPopCategory = (TextView) mPop.findViewById(R.id.tv_pop_category); mPopupWindow = new PopupWindow(mPop, getWindow().getAttributes().width, 1080); }
Example #8
Source File: AnimationToast.java From NewsMe with Apache License 2.0 | 6 votes |
public AnimationToast(Context context, View view, int bgResId, int textSizeResId) { if (view instanceof TextView) { mTextView = (TextView) view; } // mPopToast = new PopupWindow(view, width, height); mPopToast = new PopupWindow(view); // mPopToast.setAnimationStyle(DEFAULT_ANIMATION_STYLE); mPopToast.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); // int drawableBg = context.getResources().getIdentifier( // "toast_animation_bg", "drawable", context.getPackageName()); Resources resources = context.getResources(); float value = resources.getDisplayMetrics().scaledDensity; mTextView.setTextSize(resources.getDimension(textSizeResId) / value); mPopToast.setBackgroundDrawable(resources.getDrawable(bgResId)); mPopToast.setFocusable(false); // mPopToast.setOutsideTouchable(true); }
Example #9
Source File: ReadActivity.java From Jreader with GNU General Public License v2.0 | 6 votes |
/** * 初始化所有POPUPWINDOW */ private void setPop() { popupwindwow = this.getLayoutInflater().inflate(R.layout.bookpop, null); toolpop = this.getLayoutInflater().inflate(R.layout.toolpop, null); mPopupWindow = new PopupWindow(popupwindwow, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); // mPopupWindow.setAnimationStyle(R.style.popwin_anim_style); mToolpop = new PopupWindow(toolpop, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); toolpop1 = this.getLayoutInflater().inflate(R.layout.tool_size, null); mToolpop1 = new PopupWindow(toolpop1, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); toolpop2 = this.getLayoutInflater().inflate(R.layout.tool_light, null); mToolpop2 = new PopupWindow(toolpop2, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); toolpop3 = this.getLayoutInflater().inflate(R.layout.tool_mark, null); mToolpop3 = new PopupWindow(toolpop3, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); toolpop4 = this.getLayoutInflater().inflate(R.layout.tool_jump, null); mToolpop4 = new PopupWindow(toolpop4, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); playView = this.getLayoutInflater().inflate(R.layout.play_pop, null); playpop = new PopupWindow(playView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); }
Example #10
Source File: SelectableTextView.java From AdvancedTextView with Apache License 2.0 | 6 votes |
/** * 长按弹出菜单 * * @param offsetY * @param actionMenu * @return 菜单创建成功,返回true */ private void showActionMenu(int offsetY, ActionMenu actionMenu) { mActionMenuPopupWindow = new PopupWindow(actionMenu, WindowManager.LayoutParams.WRAP_CONTENT, mActionMenuHeight, true); mActionMenuPopupWindow.setFocusable(true); mActionMenuPopupWindow.setOutsideTouchable(false); mActionMenuPopupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000)); mActionMenuPopupWindow.showAtLocation(this, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY); mActionMenuPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { Selection.removeSelection(getEditableText()); // 如果设置了分散对齐,ActionMenu销毁后,强制刷新一次,防止出现文字背景未消失的情况 if (isTextJustify) SelectableTextView.this.postInvalidate(); } }); }
Example #11
Source File: SelectionLayout.java From fangzhuishushenqi with Apache License 2.0 | 6 votes |
private void createPopupWindow() { mListPopupWindow = new ListPopupWindow(mContext); mAdapter = new SelAdapter(mContext, data); mListPopupWindow.setAdapter(mAdapter); mListPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT); mListPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); mListPopupWindow.setAnchorView(parent.getChildAt(0)); mListPopupWindow.setForceIgnoreOutsideTouch(false); mListPopupWindow.setOnItemClickListener(this); mListPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { ivArrow.startAnimation(operatingAnim2); isOpen = false; } }); mListPopupWindow.setModal(true); }
Example #12
Source File: MainActivity.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
public void doClick(View view) { //AlertDialog���� // 1.����AlertDialog // AlertDialog dialog = new AlertDialog.Builder(this).setTitle("title") // .setMessage("message").create(); // 2.ͨ��Dialog��ȡWindow // Window window = dialog.getWindow(); // window.setGravity(Gravity.BOTTOM); // �˴���������dialog��ʾ��λ�� // 3.��Window�������ö������ // window.setWindowAnimations(R.style.dialogWindowAnim); // ��Ӷ��� // ��ʾ�Ի��� // dialog.show(); //popupwindow�Ķ��� View popupwindow = getLayoutInflater().inflate( R.layout.popupwindow_layout, null); PopupWindow pop = new PopupWindow(popupwindow, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); pop.setAnimationStyle(R.style.dialogWindowAnim); pop.showAsDropDown(view); }
Example #13
Source File: MainActivity.java From cwac-security with Apache License 2.0 | 6 votes |
protected void showPopupWindow() { Button popupContent=new Button(this); popupContent.setText(R.string.label_click); popupContent.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); popupContent.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); final PopupWindow popup= new PopupWindow(popupContent, popupContent.getMeasuredWidth(), popupContent.getMeasuredHeight(), true); popupContent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popup.dismiss(); } }); popup.showAsDropDown(popupAnchor); }
Example #14
Source File: MainActivity.java From UseTimeStatistic with MIT License | 6 votes |
private void showPopWindow(){ View contentView = LayoutInflater.from(MainActivity.this).inflate(R.layout.popuplayout, null); mPopupWindow = new PopupWindow(contentView); mPopupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT); mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); mRvSelectDate = contentView.findViewById(R.id.rv_select_date); SelectDateAdapter adapter = new SelectDateAdapter(mDateList); adapter.setOnItemClickListener(new SelectDateAdapter.OnRecyclerViewItemClickListener() { @Override public void onItemClick(View view, int position) { mUseTimeDataManager.refreshData(position); showView(position); mPopupWindow.dismiss(); isShowing = false; } }); mRvSelectDate.setAdapter(adapter); mRvSelectDate.setLayoutManager(new LinearLayoutManager(this)); mPopupWindow.showAsDropDown(mBtnDate); isShowing = true; }
Example #15
Source File: PopupWindows.java From fanfouapp-opensource with Apache License 2.0 | 6 votes |
/** * Constructor. * * @param context * Context */ public PopupWindows(final Context context) { mContext = context; mWindow = new PopupWindow(context); mWindow.setTouchInterceptor(new OnTouchListener() { @Override public boolean onTouch(final View v, final MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { mWindow.dismiss(); return true; } return false; } }); mWindowManager = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); }
Example #16
Source File: BigImgView.java From Android-Application-ZJB with Apache License 2.0 | 6 votes |
public BigImgView(final Context context, String url, final View view) { // 一个自定义的布局,作为显示的内容 final View contentView = LayoutInflater.from(context).inflate( R.layout.vw_bigimg, null); popupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true); popupWindow.setOutsideTouchable(true); popupWindow.setTouchable(true); ImageView imageView = (ImageView) contentView.findViewById(R.id.bigImg_img); ViewUtils.showImage(imageView, url); Logger.i("显示图片:"+url); imageView.setOnClickListener(this); contentView.findViewById(R.id.bigImgPop_layout).setOnClickListener(this); // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框 // 我觉得这里是API的一个bug popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.showAtLocation(view, Gravity.NO_GRAVITY, 0, 0); }
Example #17
Source File: HomePageSearchFragment.java From tysq-android with GNU General Public License v3.0 | 6 votes |
private void showPopupWindow() { View window = getLayoutInflater() .inflate(R.layout.fragment_home_page_search_popupwindow, null); window.findViewById(R.id.tv_article).setOnClickListener(this); window.findViewById(R.id.tv_label).setOnClickListener(this); window.findViewById(R.id.tv_admin).setOnClickListener(this); mTypeWindow = new PopupWindow(window, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); mTypeWindow.setOutsideTouchable(true); mTypeWindow.showAsDropDown(tvType, -tvType.getWidth() / 2, tvType.getHeight() / 2); }
Example #18
Source File: PictureSelectorActivity.java From imsdk-android with MIT License | 6 votes |
/** * 初始化展示文件夹的popupWindw */ private void initListDirPopupWindw() { mListImageDirPopupWindow = new ListImageDirPopupWindow( ViewGroup.LayoutParams.MATCH_PARENT, (int) (mScreenHeight * 0.7), mImageFloders, LayoutInflater.from(PictureSelectorActivity.this) .inflate(R.layout.atom_ui_layout_popmenu_list_dir, null)); mListImageDirPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { // 设置背景颜色变暗 WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.alpha = 1.0f; getWindow().setAttributes(lp); } }); // 设置选择文件夹的回调 mListImageDirPopupWindow.setOnImageDirSelected(this); }
Example #19
Source File: EditTextWithCustomError.java From WidgyWidgets with Apache License 2.0 | 6 votes |
private void chooseSize(PopupWindow pop, CharSequence text, TextView tv) { int wid = tv.getPaddingLeft() + tv.getPaddingRight(); int ht = tv.getPaddingTop() + tv.getPaddingBottom(); /* * Figure out how big the text would be if we laid it out to the * full width of this view minus the border. */ int cap = getWidth() - wid; if (cap < 0) { cap = 200; // We must not be measured yet -- setFrame() will fix it. } Layout l = new StaticLayout(text, tv.getPaint(), cap, Layout.Alignment.ALIGN_NORMAL, 1, 0, true); float max = 0; for (int i = 0; i < l.getLineCount(); i++) { max = Math.max(max, l.getLineWidth(i)); } /* * Now set the popup size to be big enough for the text plus the border. */ pop.setWidth(wid + (int) Math.ceil(max)); pop.setHeight(ht + l.getHeight()); }
Example #20
Source File: UiHelper.java From meiShi with Apache License 2.0 | 5 votes |
/** * 创建一个简单的PopupWindow只显示一行文字 * * @return */ public static PopupWindow createSimplePopupWindow(String text, int backgroundColorId) { View popView = LayoutInflater.from(App.getInstance()).inflate(R.layout.view_popwindow_text, null); TextView textView = (TextView) popView.findViewById(R.id.textView); int color = ResourcesUtils.getColor(popView, backgroundColorId); textView.setBackgroundColor(color); textView.setText(text); PopupWindow popupWindow = new PopupWindow(popView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setOutsideTouchable(true); return popupWindow; }
Example #21
Source File: CommunicationFlowHandler.java From secure-quick-reliable-login with MIT License | 5 votes |
public void setupAskPopupWindow(LayoutInflater layoutInflater, Handler handler) { View popupView = layoutInflater.inflate(R.layout.fragment_ask_dialog, null); askPopupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, false); final TextView txtAskQuestion = popupView.findViewById(R.id.txtAskQuestion); final Button btnAskFirstButton = popupView.findViewById(R.id.btnAskFirstButton); final Button btnAskSecondButton = popupView.findViewById(R.id.btnAskSecondButton); final ImageButton btnCloseAsk = popupView.findViewById(R.id.btnCloseAsk); btnAskFirstButton.setOnClickListener(v -> { askPopupWindow.dismiss(); commHandler.setAskButton("1"); }); btnAskSecondButton.setOnClickListener(v -> { askPopupWindow.dismiss(); commHandler.setAskButton("2"); }); btnCloseAsk.setOnClickListener(v -> { askPopupWindow.dismiss(); commHandler.setAskButton("3"); }); commHandler.setAskDialogService(new AskDialogService( handler, askPopupWindow, txtAskQuestion, btnAskFirstButton, btnAskSecondButton )); }
Example #22
Source File: BusFragment.java From FakeWeather with Apache License 2.0 | 5 votes |
public void showAsDropDown(PopupWindow window, View anchor) { if (Build.VERSION.SDK_INT >= 24) { Rect visibleFrame = new Rect(); anchor.getGlobalVisibleRect(visibleFrame); int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom; window.setHeight(height); } popupWindow.showAsDropDown(anchor); }
Example #23
Source File: BaseFragmentActivity.java From android-project-wo2b with Apache License 2.0 | 5 votes |
/** * 显示底部菜单栏 * * @param popupWindow */ public void showBottomPopupMenu(final PopupWindow popupWindow, final int background) { popupWindow.showAtLocation(rocky_rootView, Gravity.BOTTOM, 0, 0); getUiHandler().postDelayed(new Runnable() { @Override public void run() { setBottomPopupMenuBackground(background); setBottomPopupMenuVisibility(View.VISIBLE); } }, 500); }
Example #24
Source File: PopupWindowManager.java From PlayTogether with Apache License 2.0 | 5 votes |
public static PopupWindow getPopupWindow(View contentView, int width, int height, final View dimView, final onCloseListener listener) { final PopupWindow mPopupWindow = new PopupWindow(contentView, width, height, true); mPopupWindow.setTouchable(true); mPopupWindow.setAnimationStyle(R.style.selectPopupWindowAnim); mPopupWindow.setBackgroundDrawable(new BitmapDrawable()); mPopupWindow.setTouchInterceptor(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { mPopupWindow.dismiss(); return true; } return false; } }); mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { if (dimView != null) toggleLight(false, dimView); if (listener != null) listener.onClose(); } }); return mPopupWindow; }
Example #25
Source File: AutoRunCommandListEditText.java From revolution-irc with GNU General Public License v3.0 | 5 votes |
private void init() { mCommandAdapter = new CommandListSuggestionsAdapter(getContext()); mCommandAdapter.setClickListener(this); List<CommandAliasManager.CommandAlias> additionalItems = new ArrayList<>(); additionalItems.add(CommandAliasManager.CommandAlias.raw("wait", "<seconds>", "")); additionalItems.add(CommandAliasManager.CommandAlias.raw("wait-for", "<channel>", "")); mCommandAdapter.setAdditionalItems(additionalItems); mSuggestionsList = new RecyclerView(getContext()); mSuggestionsList.setAdapter(mCommandAdapter); mSuggestionsList.setLayoutManager(new LinearLayoutManager(getContext())); mPopupAnchor = new View(getContext()); mPopupWindow = new PopupWindow(getContext(), null, android.R.attr.listPopupWindowStyle); mPopupWindow.setContentView(mSuggestionsList); mPopupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); mPopupItemHeight = StyledAttributesHelper.getDimensionPixelSize(getContext(), android.R.attr.listPreferredItemHeightSmall, 0); mMaxPopupHeight = getResources().getDimensionPixelSize(R.dimen.list_popup_max_height); addTextChangedListener(new SimpleTextWatcher((Editable s) -> { if (enoughToFilter()) performFiltering(false); else dismissDropDown(); })); }
Example #26
Source File: KlineActivity.java From kAndroid with Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kline); mUnbinder = ButterKnife.bind(this); mContext = KlineActivity.this; width = getWindowManager().getDefaultDisplay().getWidth(); rvChoosemhPopuWindow = new RvChoosemhPopuWindow(this); //针对最后一个设置展开关闭回复初始 rvChoosemhPopuWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { rvList.get(6).setMoreOpon(false); rvChoosemhAdapter.setData(rvList); } }); //持仓量与成交量的弹框 invOrVolumeaPopwindow = new InvOrVolumeaPopwindow(this); invOrVolumeaPopwindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { ivDownOrUp.setImageResource(R.mipmap.iv_chart_details_nor); } }); setRvChoosemh(); setShowDialog(); showMinuteView(); //默认显示分时图 setToCanvas(false); }
Example #27
Source File: RateActivity.java From ratebeer with GNU General Public License v3.0 | 5 votes |
private void bindPopup(final View button, final TextView text, int layout) { RxView.clicks(button).subscribe(clicked -> { ViewGroup content = (ViewGroup) getLayoutInflater().inflate(layout, null); PopupWindow popup = new PopupWindow(content, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); applyClickListeners(content, view -> { text.setText(((TextView) view).getText()); popup.dismiss(); }); //noinspection deprecation Hack to have the background transparent popup.setBackgroundDrawable(new BitmapDrawable()); popup.setOutsideTouchable(true); popup.showAsDropDown(button); }); }
Example #28
Source File: BaseActivity.java From secure-quick-reliable-login with MIT License | 5 votes |
protected void setupProgressPopupWindow(LayoutInflater layoutInflater) { View popupView = layoutInflater.inflate(R.layout.fragment_progress, null); progressPopupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, false); final ProgressBar progressBar = popupView.findViewById(R.id.pbEntropy); final TextView lblProgressTitle = popupView.findViewById(R.id.lblProgressTitle); final TextView lblProgressText = popupView.findViewById(R.id.lblProgressText); SQRLStorage storage = SQRLStorage.getInstance(BaseActivity.this.getApplicationContext()); storage.setProgressionUpdater(new ProgressionUpdater(handler, lblProgressTitle, progressBar, lblProgressText)); }
Example #29
Source File: IndexActivity.java From dttv-android with GNU General Public License v3.0 | 5 votes |
public void open_pager(View v) { /*Intent intent = new Intent(); intent.setClass(this, MainActivity.class); startActivity(intent);*/ /*PopWindowCompnent compnent = new PopWindowCompnent(this,this); compnent.show(v, true);*/ View view = LayoutInflater.from(this).inflate(R.layout.effect_popwindow, null); ListView listView = (ListView) view.findViewById(R.id.pop_listview); TextView textView = (TextView) view.findViewById(R.id.pop_window_txt); float textSize = textView.getTextSize(); Log.i("textSize", "----textSize is:" + textSize); textView.setTextSize(textSize < 18 ? 18 : 21); PopupWindow popupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); //popupWindow.setBackgroundDrawable(R.drawable.) ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Constant.gEqulizerPresets); popupWindow.setAnimationStyle(R.style.pop_win_style); ColorDrawable dw = new ColorDrawable(0xb0000000); popupWindow.setBackgroundDrawable(dw); listView.setAdapter(adapter); //popupWindow.showAsDropDown(v); int location[] = new int[2]; v.getLocationOnScreen(location); int _x = location[0]; int _y = location[1] - popupWindow.getHeight(); popupWindow.showAtLocation(v, Gravity.NO_GRAVITY, _x, _y); //popupWindow.showAsDropDown(v, _x, _y); }
Example #30
Source File: SearchResultPop.java From mobile-manager-tool with MIT License | 5 votes |
public SearchResultPop(Context context, final FileListAdapter adapter){ this.adapter = adapter; WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutInflater.inflate(R.layout.search_result_pop, null); GridView gridView = (GridView) view.findViewById(R.id.gridView); gridView.setAdapter(adapter); gridView.requestFocus(); // EditText 与 popwindow焦点冲突 // gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { // public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // popupWindow.setFocusable(true); // listener.onClick((FileInfo)adapter.getItem(arg2), arg2); // } // }); popupWindow = new PopupWindow(view, windowManager.getDefaultDisplay().getWidth(), windowManager.getDefaultDisplay().getHeight()*4/5); // 使其聚集 //popupWindow.setFocusable(true); // 解决popupWindow挡住虚拟键盘 popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); // 设置允许在外点击消失 popupWindow.setOutsideTouchable(false); // 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景 popupWindow.setBackgroundDrawable(new BitmapDrawable()); }