Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e77c47d authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Elevation for action bars"

parents e1f57d6f 14d1fa4b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3159,6 +3159,7 @@ package android.app {
    method public abstract deprecated void addTab(android.app.ActionBar.Tab, int, boolean);
    method public abstract android.view.View getCustomView();
    method public abstract int getDisplayOptions();
    method public float getElevation();
    method public abstract int getHeight();
    method public int getHideOffset();
    method public abstract deprecated int getNavigationItemCount();
@@ -3190,6 +3191,7 @@ package android.app {
    method public abstract void setDisplayShowHomeEnabled(boolean);
    method public abstract void setDisplayShowTitleEnabled(boolean);
    method public abstract void setDisplayUseLogoEnabled(boolean);
    method public void setElevation(float);
    method public void setHideOffset(int);
    method public void setHideOnContentScrollEnabled(boolean);
    method public void setHomeActionContentDescription(java.lang.CharSequence);
+27 −0
Original line number Diff line number Diff line
@@ -993,6 +993,33 @@ public abstract class ActionBar {
        }
    }

    /**
     * Set the Z-axis elevation of the action bar in pixels.
     *
     * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher
     * values are closer to the user.</p>
     *
     * @param elevation Elevation value in pixels
     */
    public void setElevation(float elevation) {
        if (elevation != 0) {
            throw new UnsupportedOperationException("Setting a non-zero elevation is " +
                    "not supported in this action bar configuration.");
        }
    }

    /**
     * Get the Z-axis elevation of the action bar in pixels.
     *
     * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher
     * values are closer to the user.</p>
     *
     * @return Elevation value in pixels
     */
    public float getElevation() {
        return 0;
    }

    /** @hide */
    public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) {
    }
+10 −0
Original line number Diff line number Diff line
@@ -121,6 +121,16 @@ public class ToolbarActionBar extends ActionBar {
        // If the nav button on a Toolbar is present, it's enabled. No-op.
    }

    @Override
    public void setElevation(float elevation) {
        mToolbar.setElevation(elevation);
    }

    @Override
    public float getElevation() {
        return mToolbar.getElevation();
    }

    @Override
    public Context getThemedContext() {
        return mToolbar.getContext();
+17 −0
Original line number Diff line number Diff line
@@ -222,6 +222,10 @@ public class WindowDecorActionBar extends ActionBar implements
        if (a.getBoolean(R.styleable.ActionBar_hideOnContentScroll, false)) {
            setHideOnContentScrollEnabled(true);
        }
        final int elevation = a.getDimensionPixelSize(R.styleable.ActionBar_elevation, 0);
        if (elevation != 0) {
            setElevation(elevation);
        }
        a.recycle();
    }

@@ -236,6 +240,19 @@ public class WindowDecorActionBar extends ActionBar implements
        }
    }

    @Override
    public void setElevation(float elevation) {
        mContainerView.setElevation(elevation);
        if (mSplitView != null) {
            mSplitView.setElevation(elevation);
        }
    }

    @Override
    public float getElevation() {
        return mContainerView.getElevation();
    }

    public void onConfigurationChanged(Configuration newConfig) {
        setHasEmbeddedTabs(ActionBarPolicy.get(mContext).hasEmbeddedTabs());
    }
+10 −0
Original line number Diff line number Diff line
@@ -6783,10 +6783,20 @@
        <attr name="itemPadding" format="dimension" />
        <!-- Set true to hide the action bar on a vertical nested scroll of content. -->
        <attr name="hideOnContentScroll" format="boolean" />
        <!-- Minimum inset for content views within a bar. Navigation buttons and
             menu views are excepted. Only valid for some themes and configurations. -->
        <attr name="contentInsetStart" format="dimension" />
        <!-- Minimum inset for content views within a bar. Navigation buttons and
             menu views are excepted. Only valid for some themes and configurations. -->
        <attr name="contentInsetEnd" format="dimension" />
        <!-- Minimum inset for content views within a bar. Navigation buttons and
             menu views are excepted. Only valid for some themes and configurations. -->
        <attr name="contentInsetLeft" format="dimension" />
        <!-- Minimum inset for content views within a bar. Navigation buttons and
             menu views are excepted. Only valid for some themes and configurations. -->
        <attr name="contentInsetRight" format="dimension" />
        <!-- Elevation for the action bar itself -->
        <attr name="elevation" />
    </declare-styleable>

    <declare-styleable name="ActionMode">
Loading