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

Commit 07b2e870 authored by Daichi Hirono's avatar Daichi Hirono Committed by Android (Google) Code Review
Browse files

Merge "Revert "Make status bar translucent. Make drawer appera below status bar."" into nyc-dev

parents dff0e820 08c97870
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -36,8 +36,6 @@
        <item name="android:windowActionBar">false</item>
        <item name="android:windowActionModeOverlay">true</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:fitsSystemWindows">false</item>

        <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>
    </style>
+0 −1
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@ public abstract class BaseActivity extends Activity
        mSearchManager = new SearchViewManager(this, icicle);

        DocumentsToolbar toolbar = (DocumentsToolbar) findViewById(R.id.toolbar);
        Display.adjustToolbar(toolbar, this);
        setActionBar(toolbar);
        mNavigator = new NavigationView(
                mDrawer,
+5 −36
Original line number Diff line number Diff line
@@ -20,15 +20,13 @@ import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.util.TypedValue;
import android.view.WindowManager;
import android.widget.Toolbar;

/*
 * Convenience class for getting display related attributes
 */
public final class Display {
    /*
     * Returns the screen width in raw pixels.
     * Returns the screen width in pixels.
     */
    public static float screenWidth(Activity activity) {
        Point size = new Point();
@@ -44,44 +42,15 @@ public final class Display {
    }

    /*
     * Returns action bar height in raw pixels.
     * Returns action bar height in pixels.
     */
    public static float actionBarHeight(Context context) {
        int height = 0;
        int actionBarHeight = 0;
        TypedValue tv = new TypedValue();
        if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
            height = TypedValue.complexToDimensionPixelSize(tv.data,
            actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
                    context.getResources().getDisplayMetrics());
        }
        return height;
    }

    /*
     * Returns status bar height in raw pixels.
     */
    private static int statusBarHeight(Context context) {
        int height = 0;
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen",
                "android");
        if (resourceId > 0) {
            height = context.getResources().getDimensionPixelSize(resourceId);
        }
        return height;
    }

    /*
     * Adjusts toolbar for the layout with translucent status bar. Increases the
     * height of the toolbar and adds padding at the top to accommodate status bar visible above
     * toolbar.
     */
    public static void adjustToolbar(Toolbar toolbar, Activity activity) {
        if ((activity.getWindow().getAttributes().flags
                & WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) != 0) {
            int statusBarHeight = Display.statusBarHeight(activity);
            toolbar.getLayoutParams().height = (int) (Display.actionBarHeight(activity)
                    + statusBarHeight);
            toolbar.setPadding(toolbar.getPaddingLeft(), statusBarHeight, toolbar.getPaddingRight(),
                    toolbar.getPaddingBottom());
        }
        return actionBarHeight;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ abstract class DrawerController implements DrawerListener {

        View drawer = activity.findViewById(R.id.drawer_roots);
        Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar);
        Display.adjustToolbar(toolbar, activity);

        drawer.getLayoutParams().width = calculateDrawerWidth(activity);

        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(