2012-08-31 11:59:50 -07: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-10-31 22:12:02 -07:00
|
|
|
import android.content.res.TypedArray;
|
2012-08-31 11:59:50 -07:00
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Path;
|
|
|
|
import android.graphics.PorterDuff.Mode;
|
2013-02-13 08:50:56 -08:00
|
|
|
import android.graphics.drawable.ColorDrawable;
|
2012-10-31 22:12:02 -07:00
|
|
|
import android.graphics.drawable.Drawable;
|
2012-11-15 21:28:38 -08:00
|
|
|
import android.graphics.drawable.StateListDrawable;
|
2012-08-31 11:59:50 -07:00
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
2013-03-14 15:35:38 -07:00
|
|
|
public class BrowserToolbarBackground extends GeckoLinearLayout {
|
2012-10-31 22:12:02 -07:00
|
|
|
private GeckoActivity mActivity;
|
2012-08-31 11:59:50 -07:00
|
|
|
|
|
|
|
public BrowserToolbarBackground(Context context, AttributeSet attrs) {
|
|
|
|
super(context, attrs);
|
2012-10-31 22:12:02 -07:00
|
|
|
mActivity = (GeckoActivity) context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLightweightThemeChanged() {
|
|
|
|
Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
|
|
|
|
if (drawable == null)
|
|
|
|
return;
|
|
|
|
|
2012-11-15 21:28:38 -08:00
|
|
|
StateListDrawable stateList = new StateListDrawable();
|
2013-02-13 08:50:56 -08:00
|
|
|
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(mActivity.getResources().getColor(R.color.background_private)));
|
2012-11-15 21:28:38 -08:00
|
|
|
stateList.addState(new int[] {}, drawable);
|
|
|
|
|
|
|
|
setBackgroundDrawable(stateList);
|
2012-10-31 22:12:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLightweightThemeReset() {
|
|
|
|
setBackgroundResource(R.drawable.address_bar_bg);
|
2012-12-03 02:50:41 -08:00
|
|
|
}
|
2012-08-31 11:59:50 -07:00
|
|
|
}
|