Search in sources :

Example 6 with IcsListPopupWindow

use of com.actionbarsherlock.internal.widget.IcsListPopupWindow in project AndroidTraining by mixi-inc.

the class ActivityChooserView method showPopupUnchecked.

/**
     * 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));
    }
}
Also used : IcsListPopupWindow(com.actionbarsherlock.internal.widget.IcsListPopupWindow)

Example 7 with IcsListPopupWindow

use of com.actionbarsherlock.internal.widget.IcsListPopupWindow in project ActionBarSherlock by JakeWharton.

the class ActivityChooserView method showPopupUnchecked.

/**
     * 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));
    }
}
Also used : IcsListPopupWindow(com.actionbarsherlock.internal.widget.IcsListPopupWindow)

Example 8 with IcsListPopupWindow

use of com.actionbarsherlock.internal.widget.IcsListPopupWindow in project ActionBarSherlock by JakeWharton.

the class ActivityChooserView method getListPopupWindow.

/**
     * Gets the list popup window which is lazily initialized.
     *
     * @return The popup.
     */
private IcsListPopupWindow getListPopupWindow() {
    if (mListPopupWindow == null) {
        mListPopupWindow = new IcsListPopupWindow(getContext());
        mListPopupWindow.setAdapter(mAdapter);
        mListPopupWindow.setAnchorView(ActivityChooserView.this);
        mListPopupWindow.setModal(true);
        mListPopupWindow.setOnItemClickListener(mCallbacks);
        mListPopupWindow.setOnDismissListener(mCallbacks);
    }
    return mListPopupWindow;
}
Also used : IcsListPopupWindow(com.actionbarsherlock.internal.widget.IcsListPopupWindow)

Example 9 with IcsListPopupWindow

use of com.actionbarsherlock.internal.widget.IcsListPopupWindow in project Ushahidi_Android by ushahidi.

the class ActivityChooserView method getListPopupWindow.

/**
     * Gets the list popup window which is lazily initialized.
     *
     * @return The popup.
     */
private IcsListPopupWindow getListPopupWindow() {
    if (mListPopupWindow == null) {
        mListPopupWindow = new IcsListPopupWindow(getContext());
        mListPopupWindow.setAdapter(mAdapter);
        mListPopupWindow.setAnchorView(ActivityChooserView.this);
        mListPopupWindow.setModal(true);
        mListPopupWindow.setOnItemClickListener(mCallbacks);
        mListPopupWindow.setOnDismissListener(mCallbacks);
    }
    return mListPopupWindow;
}
Also used : IcsListPopupWindow(com.actionbarsherlock.internal.widget.IcsListPopupWindow)

Example 10 with IcsListPopupWindow

use of com.actionbarsherlock.internal.widget.IcsListPopupWindow in project Ushahidi_Android by ushahidi.

the class ActivityChooserView method showPopupUnchecked.

/**
     * 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));
    }
}
Also used : IcsListPopupWindow(com.actionbarsherlock.internal.widget.IcsListPopupWindow)

Aggregations

IcsListPopupWindow (com.actionbarsherlock.internal.widget.IcsListPopupWindow)21 View (android.view.View)7 AdapterView (android.widget.AdapterView)7 View_HasStateListenerSupport (com.actionbarsherlock.internal.view.View_HasStateListenerSupport)7 ViewTreeObserver (android.view.ViewTreeObserver)3