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

Commit 0c19aaae authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "On-screen navigation bar (separate from the status bar)."

parents 65b96059 8956dbbc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -387,6 +387,12 @@ public interface WindowManager extends ViewManager {
         */
        public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;

        /**
         * Window type: Navigation bar (when distinct from status bar)
         * @hide
         */
        public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;

        /**
         * End of types of system windows.
         */
+124 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/* apps/common/assets/default/default/skins/StatusBar.xml
**
** Copyright 2011, 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.
*/
-->

<com.android.systemui.statusbar.phone.NavigationBarView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    >

    <LinearLayout android:id="@+id/rot0"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:paddingLeft="8dip"
        android:paddingRight="8dip"
        android:background="#FF000000"
        android:orientation="horizontal"
        >

        <!-- navigation controls -->
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/ic_sysbar_back"
            systemui:keyCode="4"
            android:layout_weight="1"
            />
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/ic_sysbar_home"
            systemui:keyCode="3"
            android:layout_weight="1"
            />
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/ic_sysbar_menu"
            systemui:keyCode="82"
            android:layout_weight="1"
            />
    </LinearLayout>

    <LinearLayout android:id="@+id/rot90"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:background="#FF000000"
        android:orientation="vertical"
        android:visibility="gone"
        >

        <!-- navigation controls -->
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_sysbar_menu"
            systemui:keyCode="82"
            android:layout_weight="1"
            />
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_sysbar_home"
            systemui:keyCode="3"
            android:layout_weight="1"
            />
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_sysbar_back"
            systemui:keyCode="4"
            android:layout_weight="1"
            />
    </LinearLayout>

    <LinearLayout android:id="@+id/rot270"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:background="#FF000000"
        android:orientation="vertical"
        android:visibility="gone"
        >

        <!-- navigation controls -->
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_sysbar_back"
            systemui:keyCode="4"
            android:layout_weight="1"
            />
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_sysbar_home"
            systemui:keyCode="3"
            android:layout_weight="1"
            />
        <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_sysbar_menu"
            systemui:keyCode="82"
            android:layout_weight="1"
            />
    </LinearLayout>
</com.android.systemui.statusbar.phone.NavigationBarView>
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
 * Copyright (c) 2011, 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.
*/
-->
<resources>
    <!-- thickness (width) of the navigation bar on phones that require it -->
    <dimen name="navigation_bar_size">42dp</dimen>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -31,5 +31,7 @@
    <!-- Width of scrollable area in recents -->
    <dimen name="status_bar_recents_width">356dp</dimen>

    <!-- thickness (height) of the navigation bar on phones that require it -->
    <dimen name="navigation_bar_size">42dp</dimen>
</resources>
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 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.
 */

package com.android.systemui.statusbar.phone;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.view.Surface;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.content.res.Configuration;

import com.android.systemui.R;

public class NavigationBarView extends LinearLayout {
    final Display mDisplay;
    View[] mRotatedViews = new View[4];

    public NavigationBarView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mDisplay = ((WindowManager)context.getSystemService(
                Context.WINDOW_SERVICE)).getDefaultDisplay();
    }

    public void onFinishInflate() {
        mRotatedViews[Surface.ROTATION_0] = 
        mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);

        mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
        
        mRotatedViews[Surface.ROTATION_270] = findViewById(R.id.rot270);
    }

    public void reorient() {
        final int rot = mDisplay.getRotation();
        for (int i=0; i<4; i++) {
            mRotatedViews[i].setVisibility(View.GONE);
        }
        mRotatedViews[rot].setVisibility(View.VISIBLE);

        android.util.Log.d("NavigationBarView", "reorient(): rot=" + mDisplay.getRotation());
    }
}
Loading