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

Commit 48a285ce authored by Diego Perez's avatar Diego Perez
Browse files

Fix status and nav bar translucency

Bug: http://b.android.com/204831
Test: Added new UI tests
Change-Id: I992f4ccc391d9a4a0dda941689ec29fb44acf69b
parent 82ddb5e1
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -166,13 +166,13 @@ class Layout extends RelativeLayout {
        FrameLayout contentRoot = new FrameLayout(getContext());
        LayoutParams params = createLayoutParams(MATCH_PARENT, MATCH_PARENT);
        int rule = mBuilder.isNavBarVertical() ? START_OF : ABOVE;
        if (mBuilder.hasNavBar() && mBuilder.solidBars()) {
        if (mBuilder.hasSolidNavBar()) {
            params.addRule(rule, getId(ID_NAV_BAR));
        }
        int below = -1;
        if (mBuilder.mActionBarSize <= 0 && mBuilder.mTitleBarSize > 0) {
            below = getId(ID_TITLE_BAR);
        } else if (mBuilder.hasStatusBar() && mBuilder.solidBars()) {
        } else if (mBuilder.hasSolidStatusBar()) {
            below = getId(ID_STATUS_BAR);
        }
        if (below != -1) {
@@ -241,10 +241,10 @@ class Layout extends RelativeLayout {
        }
        LayoutParams layoutParams = createLayoutParams(MATCH_PARENT, MATCH_PARENT);
        int rule = mBuilder.isNavBarVertical() ? START_OF : ABOVE;
        if (mBuilder.hasNavBar() && mBuilder.solidBars()) {
        if (mBuilder.hasSolidNavBar()) {
            layoutParams.addRule(rule, getId(ID_NAV_BAR));
        }
        if (mBuilder.hasStatusBar() && mBuilder.solidBars()) {
        if (mBuilder.hasSolidStatusBar()) {
            layoutParams.addRule(BELOW, getId(ID_STATUS_BAR));
        }
        actionBar.getRootView().setLayoutParams(layoutParams);
@@ -257,10 +257,10 @@ class Layout extends RelativeLayout {
            int simulatedPlatformVersion) {
        TitleBar titleBar = new TitleBar(context, title, simulatedPlatformVersion);
        LayoutParams params = createLayoutParams(MATCH_PARENT, mBuilder.mTitleBarSize);
        if (mBuilder.hasStatusBar() && mBuilder.solidBars()) {
        if (mBuilder.hasSolidStatusBar()) {
            params.addRule(BELOW, getId(ID_STATUS_BAR));
        }
        if (mBuilder.isNavBarVertical() && mBuilder.solidBars()) {
        if (mBuilder.isNavBarVertical() && mBuilder.hasSolidNavBar()) {
            params.addRule(START_OF, getId(ID_NAV_BAR));
        }
        titleBar.setLayoutParams(params);
@@ -419,11 +419,17 @@ class Layout extends RelativeLayout {
        }

        /**
         * Return true if the status bar or nav bar are present, they are not translucent (i.e
         * content doesn't overlap with them).
         * Return true if the nav bar is present and not translucent
         */
        private boolean solidBars() {
            return !(hasNavBar() && mTranslucentNav) && !(hasStatusBar() && mTranslucentStatus);
        private boolean hasSolidNavBar() {
            return hasNavBar() && !mTranslucentNav;
        }

        /**
         * Return true if the status bar is present and not translucent
         */
        private boolean hasSolidStatusBar() {
            return hasStatusBar() && !mTranslucentStatus;
        }

        private boolean hasNavBar() {
+4.49 KiB
Loading image diff...
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:textSize="40sp"
        android:text="Bottom Text" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:textSize="40sp"
        android:text="Top text" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:textSize="40sp"
        android:text="Start text" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_centerVertical="true"
        android:textSize="40sp"
        android:text="End text" />
</RelativeLayout>
 No newline at end of file
Loading