Loading tools/layoutlib/bridge/resources/bars/action_bar.xml +4 −6 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView <include layout="@android:layout/action_bar_home" /> android:layout_height="wrap_content" android:layout_width="wrap_content"/> <TextView <TextView android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content"/> android:layout_height="wrap_content"/> Loading tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -474,7 +474,7 @@ public final class Matrix_Delegate { } } Matrix_Delegate other = sManager.getDelegate(other_matrix); Matrix_Delegate other = sManager.getDelegate(other_matrix); if (d == null) { if (other == null) { return false; return false; } } Loading Loading @@ -570,7 +570,7 @@ public final class Matrix_Delegate { } } Matrix_Delegate other = sManager.getDelegate(other_matrix); Matrix_Delegate other = sManager.getDelegate(other_matrix); if (d == null) { if (other == null) { return false; return false; } } Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java +50 −12 Original line number Original line Diff line number Diff line Loading @@ -145,6 +145,14 @@ abstract class CustomBar extends LinearLayout { } } } } protected void loadIconById(int id, String iconReference) { ResourceValue value = getResourceValue(iconReference); if (value != null) { loadIconById(id, value); } } protected Drawable loadIcon(int index, ResourceType type, String name) { protected Drawable loadIcon(int index, ResourceType type, String name) { BridgeContext bridgeContext = (BridgeContext) mContext; BridgeContext bridgeContext = (BridgeContext) mContext; RenderResources res = bridgeContext.getRenderResources(); RenderResources res = bridgeContext.getRenderResources(); Loading @@ -162,32 +170,62 @@ abstract class CustomBar extends LinearLayout { if (child instanceof ImageView) { if (child instanceof ImageView) { ImageView imageView = (ImageView) child; ImageView imageView = (ImageView) child; Drawable drawable = ResourceHelper.getDrawable( return loadIcon(imageView, value); value, (BridgeContext) mContext); if (drawable != null) { imageView.setBackgroundDrawable(drawable); } } return drawable; return null; } private Drawable loadIconById(int id, ResourceValue value) { View child = findViewById(id); if (child instanceof ImageView) { ImageView imageView = (ImageView) child; return loadIcon(imageView, value); } } return null; return null; } } private Drawable loadIcon(ImageView imageView, ResourceValue value) { Drawable drawable = ResourceHelper.getDrawable(value, (BridgeContext) mContext); if (drawable != null) { imageView.setImageDrawable(drawable); } return drawable; } protected TextView setText(int index, String stringReference) { protected TextView setText(int index, String stringReference) { View child = getChildAt(index); View child = getChildAt(index); if (child instanceof TextView) { if (child instanceof TextView) { TextView textView = (TextView) child; TextView textView = (TextView) child; setText(textView, stringReference); return textView; } return null; } protected TextView setTextById(int id, String stringReference) { View child = findViewById(id); if (child instanceof TextView) { TextView textView = (TextView) child; setText(textView, stringReference); return textView; } return null; } private void setText(TextView textView, String stringReference) { ResourceValue value = getResourceValue(stringReference); ResourceValue value = getResourceValue(stringReference); if (value != null) { if (value != null) { textView.setText(value.getValue()); textView.setText(value.getValue()); } else { } else { textView.setText(stringReference); textView.setText(stringReference); } } return textView; } return null; } } protected void setStyle(String themeEntryName) { protected void setStyle(String themeEntryName) { Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/FakeActionBar.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,7 @@ public class FakeActionBar extends CustomBar { // Cannot access the inside items through id because no R.id values have been // Cannot access the inside items through id because no R.id values have been // created for them. // created for them. // We do know the order though. // We do know the order though. loadIcon(0, icon); loadIconById(android.R.id.home, icon); mTextView = setText(1, label); mTextView = setText(1, label); setStyle("actionBarStyle"); setStyle("actionBarStyle"); Loading Loading
tools/layoutlib/bridge/resources/bars/action_bar.xml +4 −6 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <ImageView <include layout="@android:layout/action_bar_home" /> android:layout_height="wrap_content" android:layout_width="wrap_content"/> <TextView <TextView android:layout_width="wrap_content" android:layout_width="wrap_content" android:layout_height="wrap_content"/> android:layout_height="wrap_content"/> Loading
tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -474,7 +474,7 @@ public final class Matrix_Delegate { } } Matrix_Delegate other = sManager.getDelegate(other_matrix); Matrix_Delegate other = sManager.getDelegate(other_matrix); if (d == null) { if (other == null) { return false; return false; } } Loading Loading @@ -570,7 +570,7 @@ public final class Matrix_Delegate { } } Matrix_Delegate other = sManager.getDelegate(other_matrix); Matrix_Delegate other = sManager.getDelegate(other_matrix); if (d == null) { if (other == null) { return false; return false; } } Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/CustomBar.java +50 −12 Original line number Original line Diff line number Diff line Loading @@ -145,6 +145,14 @@ abstract class CustomBar extends LinearLayout { } } } } protected void loadIconById(int id, String iconReference) { ResourceValue value = getResourceValue(iconReference); if (value != null) { loadIconById(id, value); } } protected Drawable loadIcon(int index, ResourceType type, String name) { protected Drawable loadIcon(int index, ResourceType type, String name) { BridgeContext bridgeContext = (BridgeContext) mContext; BridgeContext bridgeContext = (BridgeContext) mContext; RenderResources res = bridgeContext.getRenderResources(); RenderResources res = bridgeContext.getRenderResources(); Loading @@ -162,32 +170,62 @@ abstract class CustomBar extends LinearLayout { if (child instanceof ImageView) { if (child instanceof ImageView) { ImageView imageView = (ImageView) child; ImageView imageView = (ImageView) child; Drawable drawable = ResourceHelper.getDrawable( return loadIcon(imageView, value); value, (BridgeContext) mContext); if (drawable != null) { imageView.setBackgroundDrawable(drawable); } } return drawable; return null; } private Drawable loadIconById(int id, ResourceValue value) { View child = findViewById(id); if (child instanceof ImageView) { ImageView imageView = (ImageView) child; return loadIcon(imageView, value); } } return null; return null; } } private Drawable loadIcon(ImageView imageView, ResourceValue value) { Drawable drawable = ResourceHelper.getDrawable(value, (BridgeContext) mContext); if (drawable != null) { imageView.setImageDrawable(drawable); } return drawable; } protected TextView setText(int index, String stringReference) { protected TextView setText(int index, String stringReference) { View child = getChildAt(index); View child = getChildAt(index); if (child instanceof TextView) { if (child instanceof TextView) { TextView textView = (TextView) child; TextView textView = (TextView) child; setText(textView, stringReference); return textView; } return null; } protected TextView setTextById(int id, String stringReference) { View child = findViewById(id); if (child instanceof TextView) { TextView textView = (TextView) child; setText(textView, stringReference); return textView; } return null; } private void setText(TextView textView, String stringReference) { ResourceValue value = getResourceValue(stringReference); ResourceValue value = getResourceValue(stringReference); if (value != null) { if (value != null) { textView.setText(value.getValue()); textView.setText(value.getValue()); } else { } else { textView.setText(stringReference); textView.setText(stringReference); } } return textView; } return null; } } protected void setStyle(String themeEntryName) { protected void setStyle(String themeEntryName) { Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/FakeActionBar.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,7 @@ public class FakeActionBar extends CustomBar { // Cannot access the inside items through id because no R.id values have been // Cannot access the inside items through id because no R.id values have been // created for them. // created for them. // We do know the order though. // We do know the order though. loadIcon(0, icon); loadIconById(android.R.id.home, icon); mTextView = setText(1, label); mTextView = setText(1, label); setStyle("actionBarStyle"); setStyle("actionBarStyle"); Loading