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

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

Merge "Now showing: Navigation Bar, The Final Layout"

parents ad13897a 5c8da949
Loading
Loading
Loading
Loading
+61 −39
Original line number Diff line number Diff line
@@ -35,32 +35,52 @@
        <LinearLayout android:id="@+id/rot0"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:paddingLeft="8dip"
            android:paddingRight="8dip"
            android:orientation="horizontal"
            >

            <!-- navigation controls -->
            <View
                android:layout_width="32dp"
                android:layout_height="match_parent"
                android:layout_weight="0"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                android:layout_width="wrap_content"
                android:layout_width="54dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_back"
                android:src="@drawable/ic_sysbar_back_default"
                systemui:keyCode="4"
                android:layout_weight="0"
                />
            <View 
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                android:layout_width="wrap_content"
                android:layout_width="54dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_home"
                android:src="@drawable/ic_sysbar_home_default"
                systemui:keyCode="3"
                android:layout_weight="0"
                />
            <View 
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                />
            <ImageView android:id="@+id/recent_apps"
                android:layout_width="54dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_recent_default"
                android:layout_weight="0"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
                android:layout_width="wrap_content"
                android:layout_width="32dp"
                android:layout_height="match_parent"
                android:src="@drawable/ic_sysbar_menu"
                android:src="@drawable/ic_sysbar_menu_default"
                systemui:keyCode="82"
                android:layout_weight="1"
                android:layout_weight="0"
                android:visibility="invisible"
                />
        </LinearLayout>

@@ -69,29 +89,52 @@
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:visibility="gone"
            android:paddingTop="24dp"
            >
            
            <!-- navigation controls -->
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
                android:layout_height="32dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_sysbar_menu"
                android:src="@drawable/ic_sysbar_menu_default_land"
                systemui:keyCode="82"
                android:layout_weight="0"
                android:visibility="invisible"
                />
            <ImageView android:id="@+id/recent_apps"
                android:layout_height="54dp"
                android:layout_width="match_parent"
                android:src="@drawable/ic_sysbar_recent_default_land"
                android:layout_weight="0"
                />
            <View 
                android:layout_height="match_parent"
                android:layout_width="match_parent"
                android:layout_weight="1"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                android:layout_height="54dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_sysbar_home"
                android:src="@drawable/ic_sysbar_home_default_land"
                systemui:keyCode="3"
                android:layout_weight="0"
                />
            <View 
                android:layout_height="match_parent"
                android:layout_width="match_parent"
                android:layout_weight="1"
                />
            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                android:layout_height="54dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_sysbar_back"
                android:src="@drawable/ic_sysbar_back_default_land"
                systemui:keyCode="4"
                android:layout_weight="1"
                android:layout_weight="0"
                />
            <View
                android:layout_height="32dp"
                android:layout_width="match_parent"
                android:layout_weight="0"
                />
        </LinearLayout>

@@ -102,28 +145,7 @@
            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"
                />
            <!-- not used -->
        </LinearLayout>
    
    </FrameLayout>
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
    <dimen name="peek_window_y_offset">-12dp</dimen>

    <!-- thickness (height) of the navigation bar on phones that require it -->
    <dimen name="navigation_bar_size">42dp</dimen>
    <dimen name="navigation_bar_size">32dp</dimen>

    <!-- thickness (height) of each notification row, including any separators or padding -->
    <dimen name="notification_height">65dp</dimen>
+13 −1
Original line number Diff line number Diff line
@@ -40,10 +40,19 @@ public class NavigationBarView extends LinearLayout {

    protected IStatusBarService mBarService;
    final Display mDisplay;
    View mCurrentView = null;
    View[] mRotatedViews = new View[4];
    View mBackground;
    Animator mLastAnimator = null;

    public View getRecentsButton() {
        return mCurrentView.findViewById(R.id.recent_apps);
    }

    public View getMenuButton() {
        return mCurrentView.findViewById(R.id.menu);
    }

    public NavigationBarView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mDisplay = ((WindowManager)context.getSystemService(
@@ -93,6 +102,8 @@ public class NavigationBarView extends LinearLayout {
        mRotatedViews[Surface.ROTATION_270] = NAVBAR_ALWAYS_AT_RIGHT
                                                ? findViewById(R.id.rot90)
                                                : findViewById(R.id.rot270);

        mCurrentView = mRotatedViews[Surface.ROTATION_0];
    }

    @Override
@@ -107,7 +118,8 @@ public class NavigationBarView extends LinearLayout {
        for (int i=0; i<4; i++) {
            mRotatedViews[i].setVisibility(View.GONE);
        }
        mRotatedViews[rot].setVisibility(View.VISIBLE);
        mCurrentView = mRotatedViews[rot];
        mCurrentView.setVisibility(View.VISIBLE);

        android.util.Log.d("NavigationBarView", "reorient(): rot=" + mDisplay.getRotation());
    }
+25 −1
Original line number Diff line number Diff line
@@ -372,11 +372,20 @@ public class PhoneStatusBar extends StatusBar {
        return res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
    }

    private View.OnClickListener mRecentsClickListener = new View.OnClickListener() {
        public void onClick(View v) {
            toggleRecentApps();
        }
    };

    // For small-screen devices (read: phones) that lack hardware navigation buttons
    private void addNavigationBar() {
        if (mNavigationBarView == null) return;
        
        mNavigationBarView.reorient();
 
        mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener);

        WindowManagerImpl.getDefault().addView(
                mNavigationBarView, getNavigationBarLayoutParams());
    }
@@ -385,6 +394,9 @@ public class PhoneStatusBar extends StatusBar {
        if (mNavigationBarView == null) return;
        
        mNavigationBarView.reorient();

        mNavigationBarView.getRecentsButton().setOnClickListener(mRecentsClickListener);

        WindowManagerImpl.getDefault().updateViewLayout(
                mNavigationBarView, getNavigationBarLayoutParams());
    }
@@ -1230,8 +1242,20 @@ public class PhoneStatusBar extends StatusBar {
        }
    }

    public void topAppWindowChanged(boolean showMenu) {
        if (DEBUG) {
            Slog.d(TAG, (showMenu?"showing":"hiding") + " the MENU button");
        }
        if (mNavigationBarView != null) {
            mNavigationBarView.getMenuButton().setVisibility(showMenu
                ? View.VISIBLE : View.INVISIBLE);
        }

        // See above re: lights-out policy for legacy apps.
        if (showMenu) setLightsOn(true);
    }

    // Not supported
    public void topAppWindowChanged(boolean visible) { }
    public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { }
    @Override
    public void setHardKeyboardStatus(boolean available, boolean enabled) { }
+4 −4
Original line number Diff line number Diff line
@@ -1001,14 +1001,14 @@ public class TabletStatusBar extends StatusBar implements
        mHandler.sendEmptyMessage(on ? MSG_SHOW_CHROME : MSG_HIDE_CHROME);
    }

    public void topAppWindowChanged(boolean windowVisible) {
    public void topAppWindowChanged(boolean showMenu) {
        if (DEBUG) {
            Slog.d(TAG, (windowVisible?"showing":"hiding") + " the MENU button");
            Slog.d(TAG, (showMenu?"showing":"hiding") + " the MENU button");
        }
        mMenuButton.setVisibility(windowVisible ? View.VISIBLE : View.GONE);
        mMenuButton.setVisibility(showMenu ? View.VISIBLE : View.GONE);

        // See above re: lights-out policy for legacy apps.
        if (windowVisible) setLightsOn(true);
        if (showMenu) setLightsOn(true);

        mCompatModeButton.refresh();
        if (mCompatModeButton.getVisibility() == View.VISIBLE) {