当前位置: 首页>>代码示例>>Java>>正文


Java IcsListPopupWindow.setContentWidth方法代码示例

本文整理汇总了Java中com.actionbarsherlock.internal.widget.IcsListPopupWindow.setContentWidth方法的典型用法代码示例。如果您正苦于以下问题:Java IcsListPopupWindow.setContentWidth方法的具体用法?Java IcsListPopupWindow.setContentWidth怎么用?Java IcsListPopupWindow.setContentWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.actionbarsherlock.internal.widget.IcsListPopupWindow的用法示例。


在下文中一共展示了IcsListPopupWindow.setContentWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tryShow

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
public boolean tryShow() {
    mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle);
    mPopup.setOnDismissListener(this);
    mPopup.setOnItemClickListener(this);

    mAdapter = new MenuAdapter(mMenu);
    mPopup.setAdapter(mAdapter);
    mPopup.setModal(true);

    View anchor = mAnchorView;
    if (anchor != null) {
        final boolean addGlobalListener = mTreeObserver == null;
        mTreeObserver = anchor.getViewTreeObserver(); // Refresh to latest
        if (addGlobalListener) mTreeObserver.addOnGlobalLayoutListener(this);
        ((View_HasStateListenerSupport) anchor).addOnAttachStateChangeListener(this);
        mPopup.setAnchorView(anchor);
    } else {
        return false;
    }

    mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth));
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopup.show();
    mPopup.getListView().setOnKeyListener(this);
    return true;
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:27,代码来源:MenuPopupHelper.java

示例2: tryShow

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
public boolean tryShow() {
    mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle);
    mPopup.setOnDismissListener(this);
    mPopup.setOnItemClickListener(this);

    mAdapter = new MenuAdapter(mMenu);
    mPopup.setAdapter(mAdapter);
    mPopup.setModal(true);

    View anchor = mAnchorView;
    if (anchor != null) {
        final boolean addGlobalListener = mTreeObserver == null;
        mTreeObserver = anchor.getViewTreeObserver(); // Refresh to latest
        if (addGlobalListener) mTreeObserver.addOnGlobalLayoutListener(this);
        ((View_HasStateListenerSupport)anchor).addOnAttachStateChangeListener(this);
        mPopup.setAnchorView(anchor);
    } else {
        return false;
    }

    mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth));
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopup.show();
    mPopup.getListView().setOnKeyListener(this);
    return true;
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:27,代码来源:MenuPopupHelper.java

示例3: tryShow

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
public boolean tryShow() {
    mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle);
    mPopup.setOnDismissListener(this);
    mPopup.setOnItemClickListener(this);

    mAdapter = new MenuAdapter(mMenu);
    mPopup.setAdapter(mAdapter);
    mPopup.setModal(true);

    View anchor = mAnchorView;
    if (anchor != null) {
        // Don't attach to the VTO unless the anchor itself is attached to avoid VTO-related leaks.
        if (anchor.getWindowToken() != null) {
            ViewTreeObserver vto = anchor.getViewTreeObserver();
            if (vto != mTreeObserver) {
                if (mTreeObserver != null && mTreeObserver.isAlive()) {
                    mTreeObserver.removeGlobalOnLayoutListener(this);
                }
                if ((mTreeObserver = vto) != null) {
                    vto.addOnGlobalLayoutListener(this);
                }
            }
        } else if (anchor instanceof View_HasStateListenerSupport) {
            ((View_HasStateListenerSupport) anchor).addOnAttachStateChangeListener(this);
        }
        mPopup.setAnchorView(anchor);
    } else {
        return false;
    }

    mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth));
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopup.show();
    mPopup.getListView().setOnKeyListener(this);
    return true;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:37,代码来源:MenuPopupHelper.java

示例4: showPopupUnchecked

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
/**
 * Shows the popup no matter if it was already showing.
 *
 * @param maxActivityCount The max number of activities to display.
 */
private void showPopupUnchecked(int maxActivityCount) {
    if (mAdapter.getDataModel() == null) {
        throw new IllegalStateException("No data model. Did you call #setDataModel?");
    }

    getViewTreeObserver().addOnGlobalLayoutListener(mOnGlobalLayoutListener);

    final boolean defaultActivityButtonShown =
        mDefaultActivityButton.getVisibility() == VISIBLE;

    final int activityCount = mAdapter.getActivityCount();
    final int maxActivityCountOffset = defaultActivityButtonShown ? 1 : 0;
    if (maxActivityCount != ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED
            && activityCount > maxActivityCount + maxActivityCountOffset) {
        mAdapter.setShowFooterView(true);
        mAdapter.setMaxActivityCount(maxActivityCount - 1);
    } else {
        mAdapter.setShowFooterView(false);
        mAdapter.setMaxActivityCount(maxActivityCount);
    }

    IcsListPopupWindow popupWindow = getListPopupWindow();
    if (!popupWindow.isShowing()) {
        if (mIsSelectingDefaultActivity || !defaultActivityButtonShown) {
            mAdapter.setShowDefaultActivity(true, defaultActivityButtonShown);
        } else {
            mAdapter.setShowDefaultActivity(false, false);
        }
        final int contentWidth = Math.min(mAdapter.measureContentWidth(), mListPopupMaxWidth);
        popupWindow.setContentWidth(contentWidth);
        popupWindow.show();
        if (mProvider != null) {
            mProvider.subUiVisibilityChanged(true);
        }
        popupWindow.getListView().setContentDescription(mContext.getString(
                R.string.abs__activitychooserview_choose_application));
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:44,代码来源:ActivityChooserView.java

示例5: showPopupUnchecked

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
/**
 * Shows the popup no matter if it was already showing.
 *
 * @param maxActivityCount The max number of activities to display.
 */
private void showPopupUnchecked(int maxActivityCount) {
    if (mAdapter.getDataModel() == null) {
        throw new IllegalStateException("No data model. Did you call #setDataModel?");
    }

    getViewTreeObserver().addOnGlobalLayoutListener(mOnGlobalLayoutListener);

    final boolean defaultActivityButtonShown =
            mDefaultActivityButton.getVisibility() == VISIBLE;

    final int activityCount = mAdapter.getActivityCount();
    final int maxActivityCountOffset = defaultActivityButtonShown ? 1 : 0;
    if (maxActivityCount != ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED
            && activityCount > maxActivityCount + maxActivityCountOffset) {
        mAdapter.setShowFooterView(true);
        mAdapter.setMaxActivityCount(maxActivityCount - 1);
    } else {
        mAdapter.setShowFooterView(false);
        mAdapter.setMaxActivityCount(maxActivityCount);
    }

    IcsListPopupWindow popupWindow = getListPopupWindow();
    if (!popupWindow.isShowing()) {
        if (mIsSelectingDefaultActivity || !defaultActivityButtonShown) {
            mAdapter.setShowDefaultActivity(true, defaultActivityButtonShown);
        } else {
            mAdapter.setShowDefaultActivity(false, false);
        }
        final int contentWidth = Math.min(mAdapter.measureContentWidth(), mListPopupMaxWidth);
        popupWindow.setContentWidth(contentWidth);
        popupWindow.show();
        if (mProvider != null) {
            mProvider.subUiVisibilityChanged(true);
        }
        popupWindow.getListView().setContentDescription(mContext.getString(
                R.string.abs__activitychooserview_choose_application));
    }
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:44,代码来源:ActivityChooserView.java

示例6: tryShow

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
public boolean tryShow() {
    mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle);
    mPopup.setOnDismissListener(this);
    mPopup.setOnItemClickListener(this);

    mAdapter = new MenuAdapter(mMenu);
    mPopup.setAdapter(mAdapter);
    mPopup.setModal(true);

    View anchor = mAnchorView;
    if (anchor != null) {
        // Don't attach to the VTO unless the anchor itself is attached to avoid VTO-related leaks.
        if (anchor.getWindowToken() != null) {
            ViewTreeObserver vto = anchor.getViewTreeObserver();
            if (vto != mTreeObserver) {
                if (mTreeObserver != null && mTreeObserver.isAlive()) {
                    mTreeObserver.removeGlobalOnLayoutListener(this);
                }
                if ((mTreeObserver = vto) != null) {
                    vto.addOnGlobalLayoutListener(this);
                }
            }
        } else if (anchor instanceof View_HasStateListenerSupport) {
            ((View_HasStateListenerSupport) anchor).addOnAttachStateChangeListener(this);
        }
        mPopup.setAnchorView(anchor);
    } else {
        return false;
    }

    mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth));
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopup.show();
    mPopup.getListView().setOnKeyListener(this);
    mPopup.getListView().setId(0x1000);
    return true;
}
 
开发者ID:Aptoide,项目名称:aptoide-backup-apps,代码行数:38,代码来源:MenuPopupHelper.java

示例7: tryShow

import com.actionbarsherlock.internal.widget.IcsListPopupWindow; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public boolean tryShow() {
       mPopup = new IcsListPopupWindow(mContext, null, R.attr.popupMenuStyle);
       mPopup.setOnDismissListener(this);
       mPopup.setOnItemClickListener(this);

       mAdapter = new MenuAdapter(mMenu);
       mPopup.setAdapter(mAdapter);
       mPopup.setModal(true);

       View anchor = mAnchorView;
       if (anchor != null) {
           // Don't attach to the VTO unless the anchor itself is attached to avoid VTO-related leaks.
           if (anchor.getWindowToken() != null) {
               ViewTreeObserver vto = anchor.getViewTreeObserver();
               if (vto != mTreeObserver) {
                   if (mTreeObserver != null && mTreeObserver.isAlive()) {
                   	if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                   		mTreeObserver.removeGlobalOnLayoutListener(this);
                       } else {
                       	mTreeObserver.removeOnGlobalLayoutListener(this);
                       }
                   }
                   if ((mTreeObserver = vto) != null) {
                       vto.addOnGlobalLayoutListener(this);
                   }
               }
           } else if (anchor instanceof View_HasStateListenerSupport) {
               ((View_HasStateListenerSupport) anchor).addOnAttachStateChangeListener(this);
           }
           mPopup.setAnchorView(anchor);
       } else {
           return false;
       }

       mPopup.setContentWidth(Math.min(measureContentWidth(mAdapter), mPopupMaxWidth));
       mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
       mPopup.show();
       mPopup.getListView().setOnKeyListener(this);
       return true;
   }
 
开发者ID:Austin-Liang,项目名称:OurDailyBread,代码行数:42,代码来源:MenuPopupHelper.java


注:本文中的com.actionbarsherlock.internal.widget.IcsListPopupWindow.setContentWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。