com.qmuiteam.qmui.widget.popup.QMUIPopup Java Examples

The following examples show how to use com.qmuiteam.qmui.widget.popup.QMUIPopup. 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: QMUIPopupActivity.java    From BaseUIFrame with MIT License 6 votes vote down vote up
@OnClick({R.id.actiontBtn1,R.id.actiontBtn2})
public void click(View v){
    switch (v.getId()){
        case R.id.actiontBtn1:
            initNormalPopupIfNeed();
            mNormalPopup.setAnimStyle(QMUIPopup.ANIM_AUTO);
            mNormalPopup.setPreferredDirection(QMUIPopup.DIRECTION_TOP);
            mNormalPopup.show(v);
            mActionButton1.setText("NormalPopup正在展示");
            break;
        case R.id.actiontBtn2:
            initListPopupIfNeed();
            mListPopup.setAnimStyle(QMUIPopup.ANIM_GROW_FROM_CENTER);
            mListPopup.setPreferredDirection(QMUIPopup.DIRECTION_TOP);
            mListPopup.show(v);
            mActionButton2.setText("ListPopup正在展示");
            break;
    }
}
 
Example #2
Source File: QMUIPopupActivity.java    From BaseUIFrame with MIT License 5 votes vote down vote up
private void initListPopupIfNeed() {
    if (mListPopup == null) {

        String[] listItems = new String[]{
                "Item 1",
                "Item 2",
                "Item 3",
                "Item 4",
                "Item 5",
        };
        List<String> data = new ArrayList<>();

        Collections.addAll(data, listItems);

        ArrayAdapter adapter = new ArrayAdapter<>(mActivity, android.R.layout.simple_list_item_1, data);

        mListPopup = new QMUIListPopup(mActivity, QMUIPopup.DIRECTION_NONE, adapter);
        mListPopup.create(QMUIDisplayHelper.dp2px(mActivity, 250), QMUIDisplayHelper.dp2px(mActivity, 200), new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                ToastUtil.showToast("Item " + (i + 1));
                mListPopup.dismiss();
            }
        });
        mListPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                mActionButton2.setText("显示列表浮层");
            }
        });
    }
}