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

Commit a006c6de authored by Fan Zhang's avatar Fan Zhang
Browse files

Fix action bar background not wide enough on tablets

Change-Id: I82e444dc913429c77c768afada24e10c12c79160
Fix: 37475599
Test: make RunSettingsRoboTests
parent 526185c8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.support.annotation.IntDef;
@@ -220,9 +221,8 @@ public class AppHeaderController {
            Log.w(TAG, "No actionbar, cannot style actionbar.");
            return this;
        }
        final Drawable appHeaderBackground =
                mAppHeader.findViewById(R.id.app_snippet).getBackground();
        actionBar.setBackgroundDrawable(appHeaderBackground);
        actionBar.setBackgroundDrawable(
                new ColorDrawable(Utils.getColorAttr(activity, android.R.attr.colorSecondary)));
        actionBar.setElevation(0);

        return this;
+4 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ColorDrawable;
import android.os.UserHandle;
import android.support.v7.preference.Preference;
import android.view.LayoutInflater;
@@ -323,10 +323,11 @@ public class AppHeaderControllerTest {
        mController.styleActionBar(mActivity);

        verify(actionBar).setElevation(0);
        verify(actionBar).setBackgroundDrawable(any(Drawable.class));
        // Enforce a color drawable as background here, as image based drawables might not be
        // wide enough to cover entire action bar.
        verify(actionBar).setBackgroundDrawable(any(ColorDrawable.class));
    }


    @Test
    public void initAppHeaderController_appHeaderNull_useFragmentContext() {
        mController = new AppHeaderController(mContext, mFragment, null);