diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/common/ViewHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/common/ViewHelper.java deleted file mode 100644 index b827ff629db4c1..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/common/ViewHelper.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -package com.facebook.react.views.common; - -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.view.View; - -/** Helper class for Views */ -public class ViewHelper { - - /** - * Set the background to a given Drawable, or remove the background. It calls {@link - * View#setBackground(Drawable)} or {@link View#setBackgroundDrawable(Drawable)} based on the sdk - * version. - * - * @param view {@link View} to apply the background. - * @param drawable {@link Drawable} The Drawable to use as the background, or null to remove the - * background - */ - public static void setBackground(View view, Drawable drawable) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - view.setBackground(drawable); - } else { - view.setBackgroundDrawable(drawable); - } - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK b/ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK index f236ae338f2a4c..3043e4d36290f7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/BUCK @@ -6,6 +6,9 @@ rn_android_library( visibility = [ "PUBLIC", ], + provided_deps = [ + react_native_dep("third-party/android/support/v4:lib-support-v4"), + ], deps = [ YOGA_TARGET, react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java index fd9db9afea24df..7249c0933fdd74 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java @@ -8,8 +8,8 @@ import android.graphics.Color; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; +import android.support.v4.view.ViewCompat; import android.view.View; -import com.facebook.react.views.common.ViewHelper; import javax.annotation.Nullable; /** Class that manages the background for views and borders. */ @@ -26,15 +26,15 @@ private ReactViewBackgroundDrawable getOrCreateReactViewBackground() { if (mReactBackgroundDrawable == null) { mReactBackgroundDrawable = new ReactViewBackgroundDrawable(mView.getContext()); Drawable backgroundDrawable = mView.getBackground(); - ViewHelper.setBackground( + ViewCompat.setBackground( mView, null); // required so that drawable callback is cleared before we add the // drawable back as a part of LayerDrawable if (backgroundDrawable == null) { - ViewHelper.setBackground(mView, mReactBackgroundDrawable); + ViewCompat.setBackground(mView, mReactBackgroundDrawable); } else { LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] {mReactBackgroundDrawable, backgroundDrawable}); - ViewHelper.setBackground(mView, layerDrawable); + ViewCompat.setBackground(mView, layerDrawable); } } return mReactBackgroundDrawable;