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

Commit 55488171 authored by Diego Perez's avatar Diego Perez Committed by Android (Google) Code Review
Browse files

Merge "Ignore ?attr/windowActionBar when displaying menus"

parents 9c142c0e c7c3636c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -360,7 +360,9 @@ class Layout extends RelativeLayout {
                return;
            }
            // Check if an actionbar is needed
            boolean windowActionBar = getBooleanThemeValue(mResources, ATTR_WINDOW_ACTION_BAR,
            boolean isMenu = "menu".equals(mParams.getFlag(RenderParamsFlags.FLAG_KEY_ROOT_TAG));
            boolean windowActionBar = isMenu ||
                    getBooleanThemeValue(mResources, ATTR_WINDOW_ACTION_BAR,
                            !mContext.isAppCompatTheme(), true);
            if (windowActionBar) {
                mActionBarSize = getDimension(ATTR_ACTION_BAR_SIZE, true, DEFAULT_TITLE_BAR_HEIGHT);
+1.55 KiB
Loading image diff...
+32 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2016 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:paddingTop="@dimen/activity_vertical_margin"
                android:paddingBottom="@dimen/activity_vertical_margin">

    <TextView
        android:text="@string/hello_world"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        android:background="#FF0000"
        android:id="@+id/text1"/>

</RelativeLayout>
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
@@ -320,6 +320,35 @@ public class Main {
        }
    }

    @Test
    public void testActivityActionBar() throws ClassNotFoundException {
        LayoutPullParser parser = createLayoutPullParser("simple_activity.xml");
        LayoutLibTestCallback layoutLibCallback = new LayoutLibTestCallback(getLogger());
        layoutLibCallback.initResources();

        SessionParams params = getSessionParams(parser, ConfigGenerator.NEXUS_5,
                layoutLibCallback, "Theme.Material.Light.NoActionBar", false,
                RenderingMode.V_SCROLL, 22);

        renderAndVerify(params, "simple_activity_noactionbar.png");

        parser = createLayoutPullParser("simple_activity.xml");
        params = getSessionParams(parser, ConfigGenerator.NEXUS_5,
                layoutLibCallback, "Theme.Material.Light", false,
                RenderingMode.V_SCROLL, 22);

        renderAndVerify(params, "simple_activity.png");

        // This also tests that a theme with "NoActionBar" DOES HAVE an action bar when we are
        // displaying menus.
        parser = createLayoutPullParser("simple_activity.xml");
        params = getSessionParams(parser, ConfigGenerator.NEXUS_5,
                layoutLibCallback, "Theme.Material.Light.NoActionBar", false,
                RenderingMode.V_SCROLL, 22);
        params.setFlag(RenderParamsFlags.FLAG_KEY_ROOT_TAG, "menu");
        renderAndVerify(params, "simple_activity.png");
    }

    /** Test allwidgets.xml */
    @Test
    public void testAllWidgets() throws ClassNotFoundException {