mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 22:25:30 +00:00
4343609ebb
CLOSED TREE
40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
/* 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 org.mozilla.gecko.widget.GeckoLinearLayout;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.StateListDrawable;
|
|
import android.util.AttributeSet;
|
|
|
|
public class BrowserToolbarBackground extends GeckoLinearLayout {
|
|
private final LightweightTheme mTheme;
|
|
|
|
public BrowserToolbarBackground(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
|
|
}
|
|
|
|
@Override
|
|
public void onLightweightThemeChanged() {
|
|
final Drawable drawable = mTheme.getDrawable(this);
|
|
if (drawable == null)
|
|
return;
|
|
|
|
final StateListDrawable stateList = new StateListDrawable();
|
|
stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.background_private));
|
|
stateList.addState(EMPTY_STATE_SET, drawable);
|
|
|
|
setBackgroundDrawable(stateList);
|
|
}
|
|
|
|
@Override
|
|
public void onLightweightThemeReset() {
|
|
setBackgroundResource(R.drawable.url_bar_bg);
|
|
}
|
|
}
|