Java Code Examples for android.widget.ListPopupWindow#setHeight()

The following examples show how to use android.widget.ListPopupWindow#setHeight() . 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: TransactionDetailActivity.java    From BlockExplorer with Apache License 2.0 6 votes vote down vote up
private void init() {

        loading = new AppLoading(this, false, R.string.loading);
        tv_type.setText(Tdp.blockType + "");
        tv_type.setOnClickListener(this);
        btn_search.setOnClickListener(this);
        tv_tag.setVisibility(View.VISIBLE);
        et_hash.setHint("请输入交易Hash");

        mPopup = new ListPopupWindow(this);
        ArrayAdapter adapter = new ArrayAdapter(this, R.layout.layout_block_popup_item, Tdp.blockTypes);
        mPopup.setAdapter(adapter);
        mPopup.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
        mPopup.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        mPopup.setModal(true);
        mPopup.setOnItemClickListener(this);

        tv_to.setOnClickListener(this);
        tv_from.setOnClickListener(this);
        transactionHash = "";
        if (getIntent() != null && getIntent().hasExtra("transactionHash")) {
            transactionHash = getIntent().getStringExtra("transactionHash");
            searchRequest(transactionHash);
        }
    }
 
Example 2
Source File: TransactionListActivity.java    From BlockExplorer with Apache License 2.0 5 votes vote down vote up
private void initView() {
    loading = new AppLoading(this, false, R.string.loading);
    mPopup = new ListPopupWindow(this);
    ArrayAdapter adapter = new ArrayAdapter(this, R.layout.layout_block_popup_item, Tdp.blockTypes);
    mPopup.setAdapter(adapter);
    mPopup.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
    mPopup.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
    mPopup.setModal(true);
    mPopup.setOnItemClickListener(this);

    refreshLayout.setOnRefreshListener(this);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(recyclerView.getContext());
    mAdapter = new TransactionAdapter(this, Tdp.blockType);
    tv_type = mAdapter.getTypeTextView();
    mAdapter.setOnClickListener(this);
    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setAdapter(mAdapter);
    recyclerView.setOnLoadMoreListener(mLayoutManager, mAdapter, new LoadMoreRecycleView.OnLoadMoreListener() {
        @Override
        public void loadMore() {
            if (mAdapter.isHasMore()) {
                loadData();
            }
        }
    });

}
 
Example 3
Source File: ExplorerActivity.java    From BlockExplorer with Apache License 2.0 5 votes vote down vote up
private void initView() {
    tv_type.setOnClickListener(this);
    btn_search.setOnClickListener(this);

    mPopup = new ListPopupWindow(this);
    ArrayAdapter adapter = new ArrayAdapter(this, R.layout.layout_block_popup_item, Tdp.blockTypes);
    mPopup.setAdapter(adapter);
    mPopup.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
    mPopup.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
    mPopup.setModal(true);
    mPopup.setOnItemClickListener(this);
}
 
Example 4
Source File: SelectorView.java    From NovelReader with MIT License 5 votes vote down vote up
private void createPopWindow(){
    popupWindow = new ListPopupWindow(getContext());
    popupAdapter = new SelectorAdapter();
    popupWindow.setAnchorView(parent.getChildAt(0));
    popupWindow.setAdapter(popupAdapter);
    popupWindow.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    //获取焦点
    popupWindow.setModal(true);

    popupWindow.setOnItemClickListener(this);
    popupWindow.setOnDismissListener(this);
}
 
Example 5
Source File: EditSpinner.java    From EditSpinner with Apache License 2.0 5 votes vote down vote up
private void initPopupWindow() {
    popupWindow = new ListPopupWindow(mContext) {

        @Override
        public void show() {
            super.show();
            mRightImageTopView.setClickable(true);
            mRightIv.startAnimation(mAnimation);
        }

        @Override
        public void dismiss() {
            super.dismiss();
        }

    };
    popupWindow.setOnItemClickListener(this);
    popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    popupWindow.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);
    popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setAnchorView(editText);
    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            popupWindowHideTime = System.currentTimeMillis();
            mRightIv.startAnimation(mResetAnimation);
        }
    });
}
 
Example 6
Source File: GalleryActivity.java    From TLint with Apache License 2.0 5 votes vote down vote up
private void createPopupFolderList() {
    mFolderPopupWindow = new ListPopupWindow(this);
    mFolderPopupWindow.setAdapter(mFolderAdapter);
    mFolderPopupWindow.setContentWidth(ListPopupWindow.MATCH_PARENT);
    mFolderPopupWindow.setWidth(ListPopupWindow.MATCH_PARENT);
    mFolderPopupWindow.setHeight(ListPopupWindow.MATCH_PARENT);
    mFolderPopupWindow.setAnchorView(toolbar);
    mFolderPopupWindow.setModal(true);
    mFolderPopupWindow.setAnimationStyle(R.style.popwindow_anim_style);
    mFolderPopupWindow.setOnItemClickListener(this);
}
 
Example 7
Source File: ButtonFragment.java    From holoaccent with Apache License 2.0 5 votes vote down vote up
@Override public boolean onLongClick(View v) {
	String[] versions = { "Camera", "Laptop", "Watch", "Smartphone",
			"Television" };
	final ListPopupWindow listPopupWindow = new ListPopupWindow(
			getActivity());
	listPopupWindow.setAdapter(new ArrayAdapter<String>(getActivity(),
			android.R.layout.simple_dropdown_item_1line, versions));
	listPopupWindow.setAnchorView(mListPopupButton);
	listPopupWindow.setWidth(300);
	listPopupWindow.setHeight(400);

	listPopupWindow.setModal(true);
	listPopupWindow.show();
	return false;
}
 
Example 8
Source File: EditSpinner.java    From Edit-Spinner with Apache License 2.0 4 votes vote down vote up
private void initFromAttributes(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.EditSpinner, defStyleAttr, defStyleRes);

    mPopup = new ListPopupWindow(context, attrs);
    mPopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    mPopup.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);

    Drawable selector = a.getDrawable(R.styleable.EditSpinner_dropDownSelector);
    if (selector != null) {
        mPopup.setListSelector(selector);
    }

    int dropDownAnimStyleResId = a.getResourceId(R.styleable.EditSpinner_dropDownAnimStyle, -1);
    if (dropDownAnimStyleResId > 0) {
        setDropDownAnimationStyle(dropDownAnimStyleResId);
    }

    mDropDownDrawable = a.getDrawable(R.styleable.EditSpinner_dropDownDrawable);
    int dropDownDrawableSpacing = a.getDimensionPixelOffset(R.styleable.EditSpinner_dropDownDrawableSpacing, 0);

    if (mDropDownDrawable != null) {
        int dropDownDrawableWidth = a.getDimensionPixelOffset(R.styleable.EditSpinner_dropDownDrawableWidth, -1);
        int dropDownDrawableHeight = a.getDimensionPixelOffset(R.styleable.EditSpinner_dropDownDrawableHeight, -1);
        setDropDownDrawable(mDropDownDrawable, dropDownDrawableWidth, dropDownDrawableHeight);
        setDropDownDrawableSpacing(dropDownDrawableSpacing);
    }

    // Get the anchor's id now, but the view won't be ready, so wait to actually get the
    // view and store it in mDropDownAnchorView lazily in getDropDownAnchorView later.
    // Defaults to NO_ID, in which case the getDropDownAnchorView method will simply return
    // this TextView, as a default anchoring point.
    mDropDownAnchorId = a.getResourceId(R.styleable.EditSpinner_dropDownAnchor,
            View.NO_ID);


    // For dropdown width, the developer can specify a specific width, or MATCH_PARENT
    // (for full screen width) or WRAP_CONTENT (to match the width of the anchored view).
    mPopup.setWidth(a.getLayoutDimension(R.styleable.EditSpinner_dropDownWidth,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    mPopup.setHeight(a.getLayoutDimension(R.styleable.EditSpinner_dropDownHeight,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    mPopup.setOnItemClickListener(new DropDownItemClickListener());
    mPopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            mLastDismissTime = SystemClock.elapsedRealtime();
            if (mOnDismissListener != null) {
                mOnDismissListener.onDismiss();
            }
        }
    });
    a.recycle();

    mIsEditable = getKeyListener() != null;

    setFocusable(true);
    addTextChangedListener(new MyWatcher());

    Log.d(TAG, "mIsEditable = " + mIsEditable);
}
 
Example 9
Source File: ImageSelectorFragment.java    From Android-ImagesPickers with Apache License 2.0 4 votes vote down vote up
private void createPopupFolderList(int width, int height) {
	
    folderPopupWindow = new ListPopupWindow(getActivity());
    folderPopupWindow.setBackgroundDrawable(null);
    folderPopupWindow.setAdapter(folderAdapter);
    folderPopupWindow.setContentWidth(width);
    folderPopupWindow.setWidth(width);
    folderPopupWindow.setHeight(height * 5 / 8);
    folderPopupWindow.setAnchorView(popupAnchorView);
    folderPopupWindow.setModal(true);
    folderPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            folderAdapter.setSelectIndex(i);

            final int index = i;
            final AdapterView v = adapterView;

            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    folderPopupWindow.dismiss();

                    if (index == 0) {
                        getActivity().getSupportLoaderManager().restartLoader(LOADER_ALL, null, mLoaderCallback);
                        category_button.setText(R.string.all_folder);
                        callback.onChangeAlbum(context.getResources().getString(R.string.all_folder));
                        if (imageConfig.isShowCamera()) {
                            imageAdapter.setShowCamera(true);
                        } else {
                            imageAdapter.setShowCamera(false);
                        }
                    } 
                    else {
                        Folder folder = (Folder) v.getAdapter().getItem(index);
                        if (null != folder) {
                            imageList.clear();
                            imageList.addAll(folder.images);
                            imageAdapter.notifyDataSetChanged();

                            category_button.setText(folder.name);
                            callback.onChangeAlbum(folder.name);
                            if (resultList != null && resultList.size() > 0) {
                                imageAdapter.setDefaultSelected(resultList);
                            }
                        }
                        imageAdapter.setShowCamera(false);
                    }

                    grid_image.smoothScrollToPosition(0);
                }
            }, 100);
        }
    });
    
}