mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
467455c197
--HG-- extra : rebase_source : aceef27c2fd841965f614f4c0157cdcbccf152e7
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);
|
|
}
|
|
}
|