gecko/mobile/android/base/BrowserToolbarBackground.java
Nick Alexander 6fcd9b0d05 Bug 924232 - Part 2: Move preprocessed Gecko*.java.in to widget package. r=mfinkle
--HG--
rename : mobile/android/base/GeckoEditText.java.in => mobile/android/base/widget/GeckoEditText.java.in
rename : mobile/android/base/GeckoImageButton.java.in => mobile/android/base/widget/GeckoImageButton.java.in
rename : mobile/android/base/GeckoImageView.java.in => mobile/android/base/widget/GeckoImageView.java.in
rename : mobile/android/base/GeckoLinearLayout.java.in => mobile/android/base/widget/GeckoLinearLayout.java.in
rename : mobile/android/base/GeckoRelativeLayout.java.in => mobile/android/base/widget/GeckoRelativeLayout.java.in
rename : mobile/android/base/GeckoTextSwitcher.java.in => mobile/android/base/widget/GeckoTextSwitcher.java.in
rename : mobile/android/base/GeckoTextView.java.in => mobile/android/base/widget/GeckoTextView.java.in
rename : mobile/android/base/GeckoView.java.frag => mobile/android/base/widget/GeckoView.java.frag
2013-10-10 11:53:14 -07:00

45 lines
1.5 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.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
public class BrowserToolbarBackground extends GeckoLinearLayout {
private GeckoActivity mActivity;
public BrowserToolbarBackground(Context context, AttributeSet attrs) {
super(context, attrs);
mActivity = (GeckoActivity) context;
}
@Override
public void onLightweightThemeChanged() {
Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
if (drawable == null)
return;
StateListDrawable stateList = new StateListDrawable();
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(mActivity.getResources().getColor(R.color.background_private)));
stateList.addState(new int[] {}, drawable);
setBackgroundDrawable(stateList);
}
@Override
public void onLightweightThemeReset() {
setBackgroundResource(R.drawable.url_bar_bg);
}
}