FileDocCategorySizeDatePackage
ActionBarPolicy.javaAPI DocAndroid 5.1 API3110Thu Mar 12 22:22:10 GMT 2015com.android.internal.view

ActionBarPolicy

public class ActionBarPolicy extends Object
Allows components to query for various configuration policy decisions about how the action bar should lay out and behave on the current device.

Fields Summary
private android.content.Context
mContext
Constructors Summary
private ActionBarPolicy(android.content.Context context)

        mContext = context;
    
Methods Summary
public booleanenableHomeButtonByDefault()

        // Older apps get the home button interaction enabled by default.
        // Newer apps need to enable it explicitly.
        return mContext.getApplicationInfo().targetSdkVersion <
                Build.VERSION_CODES.ICE_CREAM_SANDWICH;
    
public static com.android.internal.view.ActionBarPolicyget(android.content.Context context)

        return new ActionBarPolicy(context);
    
public intgetEmbeddedMenuWidthLimit()

        return mContext.getResources().getDisplayMetrics().widthPixels / 2;
    
public intgetMaxActionButtons()

        return mContext.getResources().getInteger(R.integer.max_action_buttons);
    
public intgetStackedTabMaxWidth()

        return mContext.getResources().getDimensionPixelSize(
                R.dimen.action_bar_stacked_tab_max_width);
    
public intgetTabContainerHeight()

        TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar,
                com.android.internal.R.attr.actionBarStyle, 0);
        int height = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
        Resources r = mContext.getResources();
        if (!hasEmbeddedTabs()) {
            // Stacked tabs; limit the height
            height = Math.min(height,
                    r.getDimensionPixelSize(R.dimen.action_bar_stacked_max_height));
        }
        a.recycle();
        return height;
    
public booleanhasEmbeddedTabs()

        final int targetSdk = mContext.getApplicationInfo().targetSdkVersion;
        if (targetSdk >= Build.VERSION_CODES.JELLY_BEAN) {
            return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs);
        }

        // The embedded tabs policy changed in Jellybean; give older apps the old policy
        // so they get what they expect.
        return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs_pre_jb);
    
public booleanshowsOverflowMenuButton()

        return true;