StatusBarpublic class StatusBar extends CustomBar
Fields Summary |
---|
private final android.content.Context | mContext | private final int | mSimulatedPlatformVersion |
Constructors Summary |
---|
public StatusBar(android.content.Context context, com.android.resources.Density density, int direction, boolean RtlEnabled, int simulatedPlatformVersion)
// FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar.
super(context, LinearLayout.HORIZONTAL, "/bars/status_bar.xml", "status_bar.xml",
simulatedPlatformVersion);
mContext = context;
mSimulatedPlatformVersion = simulatedPlatformVersion;
// FIXME: use FILL_H?
setGravity(Gravity.START | Gravity.TOP | Gravity.RIGHT);
setBackgroundColor(Config.getStatusBarColor(simulatedPlatformVersion));
// Cannot access the inside items through id because no R.id values have been
// created for them.
// We do know the order though.
// 0 is the spacer
loadIcon(1, "stat_sys_wifi_signal_4_fully."
+ Config.getWifiIconType(simulatedPlatformVersion), density);
loadIcon(2, "stat_sys_battery_100.png", density);
setText(3, Config.getTime(simulatedPlatformVersion), false)
.setTextColor(Config.getTimeColor(simulatedPlatformVersion));
|
Methods Summary |
---|
protected android.widget.TextView | getStyleableTextView()
return null;
| protected void | loadIcon(int index, java.lang.String iconName, com.android.resources.Density density)
if (!iconName.endsWith(".xml")) {
super.loadIcon(index, iconName, density);
return;
}
View child = getChildAt(index);
if (child instanceof ImageView) {
ImageView imageView = (ImageView) child;
// The xml is stored only in xhdpi.
IconLoader iconLoader = new IconLoader(iconName, Density.XHIGH,
mSimulatedPlatformVersion, null);
InputStream stream = iconLoader.getIcon();
if (stream != null) {
try {
BridgeXmlBlockParser parser = new BridgeXmlBlockParser(
ParserFactory.create(stream, null), (BridgeContext) mContext, true);
Drawable drawable = Drawable.createFromXml(mContext.getResources(), parser);
if (drawable != null) {
imageView.setImageDrawable(drawable);
}
} catch (XmlPullParserException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
null);
} catch (IOException e) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, "Unable to draw wifi icon", e,
null);
}
}
}
|
|