Search in sources :

Example 1 with ActionBarContextView

use of com.actionbarsherlock.internal.widget.ActionBarContextView in project cw-omnibus by commonsguy.

the class ActionBarSherlockCompat method installDecor.

private void installDecor() {
    if (BuildConfig.DEBUG)
        Log.d(TAG, "[installDecor]");
    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        //Since we are not operating at the window level we need to take
        //into account the fact that the true decor may have already been
        //initialized and had content attached to it. If that is the case,
        //copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            //Usually there's only one child
            views = new ArrayList<View>(1);
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }
        mContentParent = generateLayout();
        //Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }
        wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
        if (wActionBar != null) {
            wActionBar.setWindowCallback(this);
            if (wActionBar.getTitle() == null) {
                wActionBar.setWindowTitle(mActivity.getTitle());
            }
            if (hasFeature(Window.FEATURE_PROGRESS)) {
                wActionBar.initProgress();
            }
            if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                wActionBar.initIndeterminateProgress();
            }
            //Since we don't require onCreate dispatching, parse for uiOptions here
            int uiOptions = loadUiOptionsFromManifest(mActivity);
            if (uiOptions != 0) {
                mUiOptions = uiOptions;
            }
            boolean splitActionBar = false;
            final boolean splitWhenNarrow = (mUiOptions & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
            if (splitWhenNarrow) {
                splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
            } else {
                splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme).getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
            }
            final ActionBarContainer splitView = (ActionBarContainer) mDecor.findViewById(R.id.abs__split_action_bar);
            if (splitView != null) {
                wActionBar.setSplitView(splitView);
                wActionBar.setSplitActionBar(splitActionBar);
                wActionBar.setSplitWhenNarrow(splitWhenNarrow);
                mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                mActionModeView.setSplitView(splitView);
                mActionModeView.setSplitActionBar(splitActionBar);
                mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
            } else if (splitActionBar) {
                Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
            }
            // Post the panel invalidate for later; avoid application onCreateOptionsMenu
            // being called in the middle of onCreate or similar.
            mDecor.post(new Runnable() {

                @Override
                public void run() {
                    //Invalidate if the panel menu hasn't been created before this.
                    if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                        dispatchInvalidateOptionsMenu();
                    }
                }
            });
        }
    }
}
Also used : ActionBarContainer(com.actionbarsherlock.internal.widget.ActionBarContainer) ActionBarContextView(com.actionbarsherlock.internal.widget.ActionBarContextView) ActionBarView(com.actionbarsherlock.internal.widget.ActionBarView) View(android.view.View)

Example 2 with ActionBarContextView

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

the class ActionBarSherlockCompat method installDecor.

private void installDecor() {
    if (ActionBarSherlock.DEBUG)
        Log.d(TAG, "[installDecor]");
    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        //Since we are not operating at the window level we need to take
        //into account the fact that the true decor may have already been
        //initialized and had content attached to it. If that is the case,
        //copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            //Usually there's only one child
            views = new ArrayList<View>(1);
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }
        mContentParent = generateLayout();
        //Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }
        wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
        if (wActionBar != null) {
            wActionBar.setWindowCallback(this);
            if (wActionBar.getTitle() == null) {
                wActionBar.setWindowTitle(mActivity.getTitle());
            }
            if (hasFeature(Window.FEATURE_PROGRESS)) {
                wActionBar.initProgress();
            }
            if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                wActionBar.initIndeterminateProgress();
            }
            //Since we don't require onCreate dispatching, parse for uiOptions here
            int uiOptions = loadUiOptionsFromManifest(mActivity);
            if (uiOptions != 0) {
                mUiOptions = uiOptions;
            }
            boolean splitActionBar = false;
            final boolean splitWhenNarrow = (mUiOptions & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
            if (splitWhenNarrow) {
                splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
            } else {
                splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme).getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
            }
            final ActionBarContainer splitView = (ActionBarContainer) mDecor.findViewById(R.id.abs__split_action_bar);
            if (splitView != null) {
                wActionBar.setSplitView(splitView);
                wActionBar.setSplitActionBar(splitActionBar);
                wActionBar.setSplitWhenNarrow(splitWhenNarrow);
                mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                mActionModeView.setSplitView(splitView);
                mActionModeView.setSplitActionBar(splitActionBar);
                mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
            } else if (splitActionBar) {
                Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
            }
            // Post the panel invalidate for later; avoid application onCreateOptionsMenu
            // being called in the middle of onCreate or similar.
            mDecor.post(new Runnable() {

                @Override
                public void run() {
                    //Invalidate if the panel menu hasn't been created before this.
                    if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                        dispatchInvalidateOptionsMenu();
                    }
                }
            });
        }
    }
}
Also used : ActionBarContainer(com.actionbarsherlock.internal.widget.ActionBarContainer) ActionBarContextView(com.actionbarsherlock.internal.widget.ActionBarContextView) ActionBarView(com.actionbarsherlock.internal.widget.ActionBarView) View(android.view.View)

Example 3 with ActionBarContextView

use of com.actionbarsherlock.internal.widget.ActionBarContextView in project little-bear-dictionary by daimajia.

the class ActionBarSherlockCompat method installDecor.

private void installDecor() {
    if (DEBUG)
        Log.d(TAG, "[installDecor]");
    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        //Since we are not operating at the window level we need to take
        //into account the fact that the true decor may have already been
        //initialized and had content attached to it. If that is the case,
        //copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            //Usually there's only one child
            views = new ArrayList<View>(1);
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }
        mContentParent = generateLayout();
        //Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }
        mTitleView = (TextView) mDecor.findViewById(android.R.id.title);
        if (mTitleView != null) {
            if (hasFeature(Window.FEATURE_NO_TITLE)) {
                mTitleView.setVisibility(View.GONE);
                if (mContentParent instanceof FrameLayout) {
                    ((FrameLayout) mContentParent).setForeground(null);
                }
            } else {
                mTitleView.setText(mTitle);
            }
        } else {
            wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
            if (wActionBar != null) {
                wActionBar.setWindowCallback(this);
                if (wActionBar.getTitle() == null) {
                    wActionBar.setWindowTitle(mActivity.getTitle());
                }
                if (hasFeature(Window.FEATURE_PROGRESS)) {
                    wActionBar.initProgress();
                }
                if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                    wActionBar.initIndeterminateProgress();
                }
                //Since we don't require onCreate dispatching, parse for uiOptions here
                int uiOptions = loadUiOptionsFromManifest(mActivity);
                if (uiOptions != 0) {
                    mUiOptions = uiOptions;
                }
                boolean splitActionBar = false;
                final boolean splitWhenNarrow = (mUiOptions & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
                if (splitWhenNarrow) {
                    splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
                } else {
                    splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme).getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
                }
                final ActionBarContainer splitView = (ActionBarContainer) mDecor.findViewById(R.id.abs__split_action_bar);
                if (splitView != null) {
                    wActionBar.setSplitView(splitView);
                    wActionBar.setSplitActionBar(splitActionBar);
                    wActionBar.setSplitWhenNarrow(splitWhenNarrow);
                    mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                    mActionModeView.setSplitView(splitView);
                    mActionModeView.setSplitActionBar(splitActionBar);
                    mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
                } else if (splitActionBar) {
                    Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
                }
                // Post the panel invalidate for later; avoid application onCreateOptionsMenu
                // being called in the middle of onCreate or similar.
                mDecor.post(new Runnable() {

                    @Override
                    public void run() {
                        //Invalidate if the panel menu hasn't been created before this.
                        if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                            dispatchInvalidateOptionsMenu();
                        }
                    }
                });
            }
        }
    }
}
Also used : ActionBarContainer(com.actionbarsherlock.internal.widget.ActionBarContainer) FrameLayout(android.widget.FrameLayout) ActionBarContextView(com.actionbarsherlock.internal.widget.ActionBarContextView) ActionBarView(com.actionbarsherlock.internal.widget.ActionBarView) View(android.view.View) TextView(android.widget.TextView)

Example 4 with ActionBarContextView

use of com.actionbarsherlock.internal.widget.ActionBarContextView in project httpclient by pixmob.

the class ActionBarSherlockCompat method installDecor.

private void installDecor() {
    if (DEBUG)
        Log.d(TAG, "[installDecor]");
    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        // Since we are not operating at the window level we need to take
        // into account the fact that the true decor may have already been
        // initialized and had content attached to it. If that is the case,
        // copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            // Usually there's only one child
            views = new ArrayList<View>(1);
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }
        mContentParent = generateLayout();
        // Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }
        mTitleView = (TextView) mDecor.findViewById(android.R.id.title);
        if (mTitleView != null) {
            if (hasFeature(Window.FEATURE_NO_TITLE)) {
                mTitleView.setVisibility(View.GONE);
                if (mContentParent instanceof FrameLayout) {
                    ((FrameLayout) mContentParent).setForeground(null);
                }
            } else {
                mTitleView.setText(mTitle);
            }
        } else {
            wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
            if (wActionBar != null) {
                wActionBar.setWindowCallback(this);
                if (wActionBar.getTitle() == null) {
                    wActionBar.setWindowTitle(mActivity.getTitle());
                }
                if (hasFeature(Window.FEATURE_PROGRESS)) {
                    wActionBar.initProgress();
                }
                if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                    wActionBar.initIndeterminateProgress();
                }
                // Since we don't require onCreate dispatching, parse for uiOptions here
                int uiOptions = loadUiOptionsFromManifest(mActivity);
                if (uiOptions != 0) {
                    mUiOptions = uiOptions;
                }
                boolean splitActionBar = false;
                final boolean splitWhenNarrow = (mUiOptions & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
                if (splitWhenNarrow) {
                    splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
                } else {
                    splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme).getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
                }
                final ActionBarContainer splitView = (ActionBarContainer) mDecor.findViewById(R.id.abs__split_action_bar);
                if (splitView != null) {
                    wActionBar.setSplitView(splitView);
                    wActionBar.setSplitActionBar(splitActionBar);
                    wActionBar.setSplitWhenNarrow(splitWhenNarrow);
                    mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                    mActionModeView.setSplitView(splitView);
                    mActionModeView.setSplitActionBar(splitActionBar);
                    mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
                } else if (splitActionBar) {
                    Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
                }
                // Post the panel invalidate for later; avoid application onCreateOptionsMenu
                // being called in the middle of onCreate or similar.
                mDecor.post(new Runnable() {

                    @Override
                    public void run() {
                        // Invalidate if the panel menu hasn't been created before this.
                        if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                            dispatchInvalidateOptionsMenu();
                        }
                    }
                });
            }
        }
    }
}
Also used : ActionBarContainer(com.actionbarsherlock.internal.widget.ActionBarContainer) FrameLayout(android.widget.FrameLayout) ActionBarContextView(com.actionbarsherlock.internal.widget.ActionBarContextView) ActionBarView(com.actionbarsherlock.internal.widget.ActionBarView) View(android.view.View) TextView(android.widget.TextView)

Example 5 with ActionBarContextView

use of com.actionbarsherlock.internal.widget.ActionBarContextView in project Libraries-for-Android-Developers by eoecn.

the class ActionBarSherlockCompat method installDecor.

private void installDecor() {
    if (ActionBarSherlock.DEBUG)
        Log.d(TAG, "[installDecor]");
    if (mDecor == null) {
        mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
    }
    if (mContentParent == null) {
        //Since we are not operating at the window level we need to take
        //into account the fact that the true decor may have already been
        //initialized and had content attached to it. If that is the case,
        //copy over its children to our new content container.
        List<View> views = null;
        if (mDecor.getChildCount() > 0) {
            //Usually there's only one child
            views = new ArrayList<View>(1);
            for (int i = 0, children = mDecor.getChildCount(); i < children; i++) {
                View child = mDecor.getChildAt(0);
                mDecor.removeView(child);
                views.add(child);
            }
        }
        mContentParent = generateLayout();
        //Copy over the old children. See above for explanation.
        if (views != null) {
            for (View child : views) {
                mContentParent.addView(child);
            }
        }
        wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar);
        if (wActionBar != null) {
            wActionBar.setWindowCallback(this);
            if (wActionBar.getTitle() == null) {
                wActionBar.setWindowTitle(mActivity.getTitle());
            }
            if (hasFeature(Window.FEATURE_PROGRESS)) {
                wActionBar.initProgress();
            }
            if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
                wActionBar.initIndeterminateProgress();
            }
            //Since we don't require onCreate dispatching, parse for uiOptions here
            int uiOptions = loadUiOptionsFromManifest(mActivity);
            if (uiOptions != 0) {
                mUiOptions = uiOptions;
            }
            boolean splitActionBar = false;
            final boolean splitWhenNarrow = (mUiOptions & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0;
            if (splitWhenNarrow) {
                splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow);
            } else {
                splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme).getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false);
            }
            final ActionBarContainer splitView = (ActionBarContainer) mDecor.findViewById(R.id.abs__split_action_bar);
            if (splitView != null) {
                wActionBar.setSplitView(splitView);
                wActionBar.setSplitActionBar(splitActionBar);
                wActionBar.setSplitWhenNarrow(splitWhenNarrow);
                mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar);
                mActionModeView.setSplitView(splitView);
                mActionModeView.setSplitActionBar(splitActionBar);
                mActionModeView.setSplitWhenNarrow(splitWhenNarrow);
            } else if (splitActionBar) {
                Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request.");
            }
            // Post the panel invalidate for later; avoid application onCreateOptionsMenu
            // being called in the middle of onCreate or similar.
            mDecor.post(new Runnable() {

                @Override
                public void run() {
                    //Invalidate if the panel menu hasn't been created before this.
                    if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                        dispatchInvalidateOptionsMenu();
                    }
                }
            });
        }
    }
}
Also used : ActionBarContainer(com.actionbarsherlock.internal.widget.ActionBarContainer) ActionBarContextView(com.actionbarsherlock.internal.widget.ActionBarContextView) ActionBarView(com.actionbarsherlock.internal.widget.ActionBarView) View(android.view.View)

Aggregations

View (android.view.View)7 ActionBarContainer (com.actionbarsherlock.internal.widget.ActionBarContainer)7 ActionBarContextView (com.actionbarsherlock.internal.widget.ActionBarContextView)7 ActionBarView (com.actionbarsherlock.internal.widget.ActionBarView)7 FrameLayout (android.widget.FrameLayout)2 TextView (android.widget.TextView)2