Fix app shelf being visible during setup wizard

* Introduce a LinearLayout to hold the app shelf widgets
* Hide it when the home button is hidden. If you can't go home
(launch the launcher) you shouldn't be able to use the shelf
to launch apps either.

Bug: 22206506
Change-Id: I5118e40786a0d26d6292850fef31f2b57c1880cd
This commit is contained in:
James Cook
2015-07-08 15:10:33 -07:00
parent d2c9d0d92c
commit 968403dd13
2 changed files with 124 additions and 108 deletions

View File

@@ -69,62 +69,65 @@
android:contentDescription="@string/accessibility_home"
/>
<com.android.systemui.statusbar.phone.NavigationBarApps
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
<ImageView android:id="@+id/app_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/nav_app_divider"
/>
<!-- TODO: Build the list of icons dynamically. -->
<com.android.systemui.statusbar.phone.NavigationBarRecents
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<ImageView android:id="@+id/recent0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
</com.android.systemui.statusbar.phone.NavigationBarRecents>
<Space
android:layout_width="match_parent"
<!-- Container for the app shelf. -->
<LinearLayout
android:id="@+id/app_shelf"
android:orientation="horizontal"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
>
<com.android.systemui.statusbar.phone.NavigationBarApps
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
<ImageView android:id="@+id/app_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/nav_app_divider"
/>
<!-- TODO: Build the list of icons dynamically. -->
<com.android.systemui.statusbar.phone.NavigationBarRecents
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<ImageView android:id="@+id/recent0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
</com.android.systemui.statusbar.phone.NavigationBarRecents>
</LinearLayout>
<FrameLayout
android:layout_width="@dimen/navigation_extra_key_width"
@@ -262,62 +265,65 @@
android:contentDescription="@string/accessibility_home"
/>
<com.android.systemui.statusbar.phone.NavigationBarApps
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
<ImageView android:id="@+id/app_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/nav_app_divider"
/>
<!-- TODO: Build the list of icons dynamically. -->
<com.android.systemui.statusbar.phone.NavigationBarRecents
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<ImageView android:id="@+id/recent0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
</com.android.systemui.statusbar.phone.NavigationBarRecents>
<Space
android:layout_width="match_parent"
<!-- Container for the app shelf. -->
<LinearLayout
android:id="@+id/app_shelf"
android:orientation="horizontal"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
/>
>
<com.android.systemui.statusbar.phone.NavigationBarApps
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
<ImageView android:id="@+id/app_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/nav_app_divider"
/>
<!-- TODO: Build the list of icons dynamically. -->
<com.android.systemui.statusbar.phone.NavigationBarRecents
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<ImageView android:id="@+id/recent0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
<ImageView android:id="@+id/recent2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:padding="6dp"
android:layout_gravity="center"
android:scaleType="centerInside"
android:visibility="invisible"
/>
</com.android.systemui.statusbar.phone.NavigationBarRecents>
</LinearLayout>
<FrameLayout
android:layout_width="@dimen/navigation_extra_key_width"

View File

@@ -243,6 +243,10 @@ public class NavigationBarView extends LinearLayout {
return mCurrentView.findViewById(R.id.ime_switcher);
}
public View getAppShelf() {
return mCurrentView.findViewById(R.id.app_shelf);
}
private void getIcons(Resources res) {
mBackIcon = res.getDrawable(R.drawable.ic_sysbar_back);
mBackLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_land);
@@ -341,6 +345,12 @@ public class NavigationBarView extends LinearLayout {
getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
// The app shelf, if it exists, follows the visibility of the home button.
View appShelf = getAppShelf();
if (appShelf != null) {
appShelf.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
}
}
private boolean inLockTask() {