diff options
| author | Diego Perez <diegoperez@google.com> | 2015-05-07 00:49:57 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-07 00:49:57 +0000 |
| commit | c000db78d7dabc244e9bda42d33977fc4d259b20 (patch) | |
| tree | c4c01b4dd4f045b0df0ec1fd30803c2da748b532 /tools | |
| parent | 9207b8567af2ea3913aec6085e8e610a70925e09 (diff) | |
| parent | 9af506fb5b5f1c7f36fb439c2b120ad2b0cda602 (diff) | |
| download | frameworks_base-c000db78d7dabc244e9bda42d33977fc4d259b20.zip frameworks_base-c000db78d7dabc244e9bda42d33977fc4d259b20.tar.gz frameworks_base-c000db78d7dabc244e9bda42d33977fc4d259b20.tar.bz2 | |
am 9af506fb: am 143eaa81: am 2ea82244: am 263e6dfa: Merge "Make status and navigation bars widgets and usable from layouts" into lmp-mr1-dev
* commit '9af506fb5b5f1c7f36fb439c2b120ad2b0cda602':
Make status and navigation bars widgets and usable from layouts
Diffstat (limited to 'tools')
3 files changed, 36 insertions, 2 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java index 9f9b968..dc89d0c 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/Config.java @@ -74,7 +74,7 @@ public class Config { } public static String getTime(int platformVersion) { - if (platformVersion == 0) { + if (isGreaterOrEqual(platformVersion, LOLLIPOP_MR1)) { return "5:10"; } if (platformVersion < GINGERBREAD) { @@ -117,7 +117,7 @@ public class Config { } public static String getWifiIconType(int platformVersion) { - return platformVersion == 0 ? "xml" : "png"; + return isGreaterOrEqual(platformVersion, LOLLIPOP) ? "xml" : "png"; } /** diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java index 9450b6c..04aadff 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java @@ -21,6 +21,10 @@ import com.android.resources.Density; 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.TextView; @@ -29,6 +33,21 @@ public class NavigationBar extends CustomBar { /** Navigation bar background color attribute name. */ 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, boolean rtlEnabled, int simulatedPlatformVersion) throws XmlPullParserException { super(context, orientation, "/bars/navigation_bar.xml", "navigation_bar.xml", diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java index 60e9cc8..a0ed0e8 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/StatusBar.java @@ -25,7 +25,9 @@ import com.android.resources.Density; import org.xmlpull.v1.XmlPullParserException; +import android.content.Context; import android.graphics.drawable.Drawable; +import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.widget.ImageView; @@ -41,6 +43,19 @@ public class StatusBar extends CustomBar { /** Status bar background color attribute name. */ 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, int simulatedPlatformVersion) throws XmlPullParserException { // FIXME: if direction is RTL but it's not enabled in application manifest, mirror this bar. |
