Skip to content

Commit

Permalink
Enable account-switcher to render into the status-bar.
Browse files Browse the repository at this point in the history
Added android:fitsSystemWindows attribute to the navigation drawer
(attribute was already set in containing window, but also needed here).
Made the status-bar transparent so the navigation-drawer can render into
it.
Added a method to the AccountSwitcher interface, so the Google
implementation can apply the correct level of overlap.

BUG=517688

Review URL: https://codereview.chromium.org/1395683002

Cr-Commit-Position: refs/heads/master@{#353228}
  • Loading branch information
lambroslambrou authored and Commit bot committed Oct 9, 2015
1 parent ab93f81 commit d4df518
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion remoting/android/java/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="start"
android:background="@android:color/background_light">
android:background="@android:color/background_light"
android:fitsSystemWindows="true">
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
5 changes: 5 additions & 0 deletions remoting/android/java/res/values-v17/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<item name="windowNoTitle">true</item>
<!--suppress NewApi -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<!-- The status bar is normally fully opaque and rendered above the
activity. Make it fully transparent to allow the DrawerLayout to
control the rendering of the status bar background -->
<!--suppress NewApi -->
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

<style name="EmptyStateText" parent="@android:style/TextAppearance.Large">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position,
mAccountSwitcher = AccountSwitcherFactory.getInstance().createAccountSwitcher(this, this);
mAccountSwitcher.setNavigation(navigationMenu);
LinearLayout navigationDrawer = (LinearLayout) findViewById(R.id.navigation_drawer);
mAccountSwitcher.setDrawer(navigationDrawer);
View switcherView = mAccountSwitcher.getView();
switcherView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public interface Callback {
*/
void setNavigation(View view);

/**
* Sets the view that holds the navigation drawer. The account-switcher may register with
* {@link View.setOnApplyWindowInsetsListener} in order to render into the status-bar area.
*/
void setDrawer(View drawerView);

/**
* Sets the user preferences for the currently-selected and most-recently-used accounts.
* The caller is responsible for loading these preferences when the activity is started. This
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public void setNavigation(View view) {
mContainer.addView(view);
}

@Override
public void setDrawer(View drawerView) {
}

@Override
public void setSelectedAndRecentAccounts(String selected, String[] recents) {
// This implementation does not support recents.
Expand Down

0 comments on commit d4df518

Please sign in to comment.