Merge "Make status and navigation bars widgets and usable from layouts" into lmp-mr1-dev
This commit is contained in:
@@ -74,7 +74,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getTime(int platformVersion) {
|
public static String getTime(int platformVersion) {
|
||||||
if (platformVersion == 0) {
|
if (isGreaterOrEqual(platformVersion, LOLLIPOP_MR1)) {
|
||||||
return "5:10";
|
return "5:10";
|
||||||
}
|
}
|
||||||
if (platformVersion < GINGERBREAD) {
|
if (platformVersion < GINGERBREAD) {
|
||||||
@@ -117,7 +117,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getWifiIconType(int platformVersion) {
|
public static String getWifiIconType(int platformVersion) {
|
||||||
return platformVersion == 0 ? "xml" : "png";
|
return isGreaterOrEqual(platformVersion, LOLLIPOP) ? "xml" : "png";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ import com.android.resources.Density;
|
|||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -29,6 +33,21 @@ public class NavigationBar extends CustomBar {
|
|||||||
/** Navigation bar background color attribute name. */
|
/** Navigation bar background color attribute name. */
|
||||||
private static final String ATTR_COLOR = "navigationBarColor";
|
private static final String ATTR_COLOR = "navigationBarColor";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to be used when creating the {@link NavigationBar} as a regular control.
|
||||||
|
* This is currently used by the theme editor.
|
||||||
|
*/
|
||||||
|
public NavigationBar(Context context, AttributeSet attrs)
|
||||||
|
throws XmlPullParserException {
|
||||||
|
this((BridgeContext) context,
|
||||||
|
Density.getEnum(((BridgeContext) context).getMetrics().densityDpi),
|
||||||
|
LinearLayout.HORIZONTAL, // In this mode, it doesn't need to be render vertically
|
||||||
|
((BridgeContext) context).getConfiguration().getLayoutDirection() ==
|
||||||
|
View.LAYOUT_DIRECTION_RTL,
|
||||||
|
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_SUPPORTS_RTL) != 0,
|
||||||
|
context.getApplicationInfo().targetSdkVersion);
|
||||||
|
}
|
||||||
|
|
||||||
public NavigationBar(BridgeContext context, Density density, int orientation, boolean isRtl,
|
public NavigationBar(BridgeContext context, Density density, int orientation, boolean isRtl,
|
||||||
boolean rtlEnabled, int simulatedPlatformVersion) throws XmlPullParserException {
|
boolean rtlEnabled, int simulatedPlatformVersion) throws XmlPullParserException {
|
||||||
super(context, orientation, "/bars/navigation_bar.xml", "navigation_bar.xml",
|
super(context, orientation, "/bars/navigation_bar.xml", "navigation_bar.xml",
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import com.android.resources.Density;
|
|||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -41,6 +43,19 @@ public class StatusBar extends CustomBar {
|
|||||||
/** Status bar background color attribute name. */
|
/** Status bar background color attribute name. */
|
||||||
private static final String ATTR_COLOR = "statusBarColor";
|
private static final String ATTR_COLOR = "statusBarColor";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to be used when creating the {@link StatusBar} as a regular control. This
|
||||||
|
* is currently used by the theme editor.
|
||||||
|
*/
|
||||||
|
public StatusBar(Context context, AttributeSet attrs) throws XmlPullParserException {
|
||||||
|
this((BridgeContext) context,
|
||||||
|
Density.getEnum(((BridgeContext) context).getMetrics().densityDpi),
|
||||||
|
LinearLayout.HORIZONTAL, // In this mode, it doesn't need to be render vertically
|
||||||
|
((BridgeContext) context).getConfiguration().getLayoutDirection() ==
|
||||||
|
View.LAYOUT_DIRECTION_RTL,
|
||||||
|
context.getApplicationInfo().targetSdkVersion);
|
||||||
|
}
|
||||||
|
|
||||||
public StatusBar(BridgeContext context, Density density, int direction, boolean RtlEnabled,
|
public StatusBar(BridgeContext context, Density density, int direction, boolean RtlEnabled,
|
||||||
int simulatedPlatformVersion) throws XmlPullParserException {
|
int simulatedPlatformVersion) throws XmlPullParserException {
|
||||||
// FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar.
|
// FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar.
|
||||||
|
|||||||
Reference in New Issue
Block a user