am 5078ad32: am 6b1b651f: Fix imports. [DO NOT MERGE]

* commit '5078ad325b0da36fe798df1df428d12732548217':
  Fix imports. [DO NOT MERGE]
This commit is contained in:
Deepanshu Gupta
2015-08-26 20:21:55 +00:00
committed by Android Git Automerger
3 changed files with 12 additions and 23 deletions

View File

@@ -18,14 +18,12 @@ package com.android.layoutlib.bridge.android.support;
import com.android.ide.common.rendering.api.LayoutLog; import com.android.ide.common.rendering.api.LayoutLog;
import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.view.View; import android.view.View;
import java.lang.reflect.Method;
import static com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
import static com.android.layoutlib.bridge.util.ReflectionUtils.getMethod; import static com.android.layoutlib.bridge.util.ReflectionUtils.getMethod;
import static com.android.layoutlib.bridge.util.ReflectionUtils.invoke; import static com.android.layoutlib.bridge.util.ReflectionUtils.invoke;
@@ -53,10 +51,7 @@ public class DesignLibUtil {
return; return;
} }
try { try {
Method setTitle = getMethod(view.getClass(), "setTitle", CharSequence.class); invoke(getMethod(view.getClass(), "setTitle", CharSequence.class), view, title);
if (setTitle != null) {
invoke(setTitle, view, title);
}
} catch (ReflectionException e) { } catch (ReflectionException e) {
Bridge.getLog().warning(LayoutLog.TAG_INFO, Bridge.getLog().warning(LayoutLog.TAG_INFO,
"Error occurred while trying to set title.", e); "Error occurred while trying to set title.", e);

View File

@@ -21,16 +21,13 @@ import com.android.ide.common.rendering.api.LayoutlibCallback;
import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.android.BridgeContext; import com.android.layoutlib.bridge.android.BridgeContext;
import com.android.layoutlib.bridge.android.RenderParamsFlags; import com.android.layoutlib.bridge.android.RenderParamsFlags;
import com.android.layoutlib.bridge.util.ReflectionUtils; import com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import java.lang.reflect.Method;
import static com.android.layoutlib.bridge.util.ReflectionUtils.ReflectionException;
import static com.android.layoutlib.bridge.util.ReflectionUtils.getCause; import static com.android.layoutlib.bridge.util.ReflectionUtils.getCause;
import static com.android.layoutlib.bridge.util.ReflectionUtils.getMethod; import static com.android.layoutlib.bridge.util.ReflectionUtils.getMethod;
import static com.android.layoutlib.bridge.util.ReflectionUtils.invoke; import static com.android.layoutlib.bridge.util.ReflectionUtils.invoke;
@@ -98,8 +95,7 @@ public class RecyclerViewUtil {
@Nullable @Nullable
private static Object getLayoutManager(View recyclerView) throws ReflectionException { private static Object getLayoutManager(View recyclerView) throws ReflectionException {
Method getLayoutManager = getMethod(recyclerView.getClass(), "getLayoutManager"); return invoke(getMethod(recyclerView.getClass(), "getLayoutManager"), recyclerView);
return getLayoutManager != null ? invoke(getLayoutManager, recyclerView) : null;
} }
@Nullable @Nullable
@@ -127,10 +123,7 @@ public class RecyclerViewUtil {
private static void setProperty(@NonNull Object object, @NonNull Class<?> propertyClass, private static void setProperty(@NonNull Object object, @NonNull Class<?> propertyClass,
@Nullable Object propertyValue, @NonNull String propertySetter) @Nullable Object propertyValue, @NonNull String propertySetter)
throws ReflectionException { throws ReflectionException {
Method setter = getMethod(object.getClass(), propertySetter, propertyClass); invoke(getMethod(object.getClass(), propertySetter, propertyClass), object, propertyValue);
if (setter != null) {
invoke(setter, object, propertyValue);
}
} }
/** /**

View File

@@ -45,6 +45,7 @@ import android.widget.RelativeLayout;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.widget.LinearLayout.VERTICAL; import static android.widget.LinearLayout.VERTICAL;
import static com.android.layoutlib.bridge.impl.ResourceHelper.getBooleanThemeValue;
/** /**
* The Layout used to create the system decor. * The Layout used to create the system decor.
@@ -325,7 +326,7 @@ class Layout extends RelativeLayout {
mParams = params; mParams = params;
mContext = context; mContext = context;
mResources = mParams.getResources(); mResources = mParams.getResources();
mWindowIsFloating = ResourceHelper.getBooleanThemeValue(mResources, ATTR_WINDOW_FLOATING, true, true); mWindowIsFloating = getBooleanThemeValue(mResources, ATTR_WINDOW_FLOATING, true, true);
findBackground(); findBackground();
findStatusBar(); findStatusBar();
@@ -342,11 +343,11 @@ class Layout extends RelativeLayout {
private void findStatusBar() { private void findStatusBar() {
boolean windowFullScreen = boolean windowFullScreen =
ResourceHelper.getBooleanThemeValue(mResources, ATTR_WINDOW_FULL_SCREEN, true, false); getBooleanThemeValue(mResources, ATTR_WINDOW_FULL_SCREEN, true, false);
if (!windowFullScreen && !mWindowIsFloating) { if (!windowFullScreen && !mWindowIsFloating) {
mStatusBarSize = mStatusBarSize =
getDimension(ATTR_STATUS_BAR_HEIGHT, true, DEFAULT_STATUS_BAR_HEIGHT); getDimension(ATTR_STATUS_BAR_HEIGHT, true, DEFAULT_STATUS_BAR_HEIGHT);
mTranslucentStatus = ResourceHelper.getBooleanThemeValue(mResources, mTranslucentStatus = getBooleanThemeValue(mResources,
ATTR_WINDOW_TRANSLUCENT_STATUS, true, false); ATTR_WINDOW_TRANSLUCENT_STATUS, true, false);
} }
} }
@@ -356,14 +357,14 @@ class Layout extends RelativeLayout {
return; return;
} }
// Check if an actionbar is needed // Check if an actionbar is needed
boolean windowActionBar = ResourceHelper.getBooleanThemeValue(mResources, ATTR_WINDOW_ACTION_BAR, boolean windowActionBar = getBooleanThemeValue(mResources, ATTR_WINDOW_ACTION_BAR,
!isThemeAppCompat(), true); !isThemeAppCompat(), true);
if (windowActionBar) { if (windowActionBar) {
mActionBarSize = getDimension(ATTR_ACTION_BAR_SIZE, true, DEFAULT_TITLE_BAR_HEIGHT); mActionBarSize = getDimension(ATTR_ACTION_BAR_SIZE, true, DEFAULT_TITLE_BAR_HEIGHT);
} else { } else {
// Maybe the gingerbread era title bar is needed // Maybe the gingerbread era title bar is needed
boolean windowNoTitle = boolean windowNoTitle =
ResourceHelper.getBooleanThemeValue(mResources, ATTR_WINDOW_NO_TITLE, true, false); getBooleanThemeValue(mResources, ATTR_WINDOW_NO_TITLE, true, false);
if (!windowNoTitle) { if (!windowNoTitle) {
mTitleBarSize = mTitleBarSize =
getDimension(ATTR_WINDOW_TITLE_SIZE, true, DEFAULT_TITLE_BAR_HEIGHT); getDimension(ATTR_WINDOW_TITLE_SIZE, true, DEFAULT_TITLE_BAR_HEIGHT);
@@ -391,7 +392,7 @@ class Layout extends RelativeLayout {
mNavBarOrientation = barOnBottom ? LinearLayout.HORIZONTAL : VERTICAL; mNavBarOrientation = barOnBottom ? LinearLayout.HORIZONTAL : VERTICAL;
mNavBarSize = getDimension(barOnBottom ? ATTR_NAV_BAR_HEIGHT : ATTR_NAV_BAR_WIDTH, mNavBarSize = getDimension(barOnBottom ? ATTR_NAV_BAR_HEIGHT : ATTR_NAV_BAR_WIDTH,
true, DEFAULT_NAV_BAR_SIZE); true, DEFAULT_NAV_BAR_SIZE);
mTranslucentNav = ResourceHelper.getBooleanThemeValue(mResources, mTranslucentNav = getBooleanThemeValue(mResources,
ATTR_WINDOW_TRANSLUCENT_NAV, true, false); ATTR_WINDOW_TRANSLUCENT_NAV, true, false);
} }
} }