2012-08-31 18:59:50 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
package org.mozilla.gecko;
|
|
|
|
|
|
|
|
import android.content.Context;
|
2012-11-01 05:12:02 +00:00
|
|
|
import android.content.res.TypedArray;
|
2012-08-31 18:59:50 +00:00
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Path;
|
|
|
|
import android.graphics.PorterDuff.Mode;
|
2013-02-13 16:50:56 +00:00
|
|
|
import android.graphics.drawable.ColorDrawable;
|
2012-11-01 05:12:02 +00:00
|
|
|
import android.graphics.drawable.Drawable;
|
2012-11-16 05:28:38 +00:00
|
|
|
import android.graphics.drawable.StateListDrawable;
|
2012-08-31 18:59:50 +00:00
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
2013-03-14 22:35:38 +00:00
|
|
|
public class BrowserToolbarBackground extends GeckoLinearLayout {
|
2012-11-01 05:12:02 +00:00
|
|
|
private GeckoActivity mActivity;
|
2012-08-31 18:59:50 +00:00
|
|
|
|
|
|
|
public BrowserToolbarBackground(Context context, AttributeSet attrs) {
|
|
|
|
super(context, attrs);
|
2012-11-01 05:12:02 +00:00
|
|
|
mActivity = (GeckoActivity) context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLightweightThemeChanged() {
|
|
|
|
Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
|
|
|
|
if (drawable == null)
|
|
|
|
return;
|
|
|
|
|
2012-11-16 05:28:38 +00:00
|
|
|
StateListDrawable stateList = new StateListDrawable();
|
2013-02-13 16:50:56 +00:00
|
|
|
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(mActivity.getResources().getColor(R.color.background_private)));
|
2012-11-16 05:28:38 +00:00
|
|
|
stateList.addState(new int[] {}, drawable);
|
|
|
|
|
|
|
|
setBackgroundDrawable(stateList);
|
2012-11-01 05:12:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLightweightThemeReset() {
|
|
|
|
setBackgroundResource(R.drawable.address_bar_bg);
|
2012-12-03 10:50:41 +00:00
|
|
|
}
|
2012-08-31 18:59:50 +00:00
|
|
|
}
|