Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use AppCompat widgets #19768

Closed
wants to merge 12 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rn_android_library(
],
deps = [
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
react_native_dep("third-party/java/buck-android-support:buck-android-support"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rn_android_library(
"PUBLIC",
],
deps = [
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_dep("third-party/java/junit:junit"),
react_native_integration_tests_target("java/com/facebook/react/testing:testing"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ rn_android_library(
name = "checkbox",
srcs = glob(["*.java"]),
provided_deps = [
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
],
visibility = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ load("//ReactNative:DEFS.bzl", "react_native_dep", "react_native_target", "rn_an
rn_android_library(
name = "picker",
srcs = glob(["**/*.java"]),
provided_deps = [
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
],
visibility = [
"PUBLIC",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
import javax.annotation.Nullable;

import android.content.Context;
import android.support.v7.widget.AppCompatSpinner;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;

import com.facebook.react.common.annotations.VisibleForTesting;

public class ReactPicker extends Spinner {
public class ReactPicker extends AppCompatSpinner {

private int mMode = MODE_DIALOG;
private int mMode = Spinner.MODE_DIALOG;
private @Nullable Integer mPrimaryColor;
private boolean mSuppressNextEvent;
private @Nullable OnSelectListener mOnSelectListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
package com.facebook.react.views.slider;

import android.content.Context;
import android.support.v7.widget.AppCompatSeekBar;
import android.util.AttributeSet;
import android.widget.SeekBar;

import javax.annotation.Nullable;

Expand All @@ -23,7 +23,7 @@
* Note that the slider is _not_ a controlled component (setValue isn't called
* during dragging).
*/
public class ReactSlider extends SeekBar {
public class ReactSlider extends AppCompatSeekBar {

/**
* If step is 0 (unset) we default to this total number of steps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.SeekBar;

import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.LayoutShadowNode;
Expand Down Expand Up @@ -89,7 +90,7 @@ public long measure(
float height,
YogaMeasureMode heightMode) {
if (!mMeasured) {
SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
ReactSlider reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
final int spec = View.MeasureSpec.makeMeasureSpec(
ViewGroup.LayoutParams.WRAP_CONTENT,
View.MeasureSpec.UNSPECIFIED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rn_android_library(
],
deps = [
YOGA_TARGET,
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/bridge:bridge"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.widget.AppCompatTextView;
import android.text.Layout;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.TextView;
import com.facebook.react.uimanager.ReactCompoundView;
import com.facebook.react.uimanager.ViewDefaults;
import com.facebook.react.views.view.ReactViewBackgroundManager;
import javax.annotation.Nullable;

public class ReactTextView extends TextView implements ReactCompoundView {
public class ReactTextView extends AppCompatTextView implements ReactCompoundView {

private static final ViewGroup.LayoutParams EMPTY_LAYOUT_PARAMS =
new ViewGroup.LayoutParams(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rn_android_library(
name = "textinput",
srcs = glob(["*.java"]),
provided_deps = [
react_native_dep("third-party/android/support/v4:lib-support-v4"),
react_native_dep("third-party/android/support/v7/appcompat-orig:appcompat"),
],
required_for_source_only_abi = True,
visibility = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v7.widget.AppCompatEditText;
import android.text.Editable;
import android.text.InputType;
import android.text.SpannableStringBuilder;
Expand All @@ -30,7 +31,6 @@
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.uimanager.PixelUtil;
Expand All @@ -55,7 +55,7 @@
* has called this explicitly. This is the default behavior on other platforms as well.
* VisibleForTesting from {@link TextInputEventsTestCase}.
*/
public class ReactEditText extends EditText {
public class ReactEditText extends AppCompatEditText {

private final InputMethodManager mInputMethodManager;
// This flag is set to true when we set the text of the EditText explicitly. In that case, no
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//ReactNative:DEFS.bzl", "rn_android_library", "rn_android_resource", "rn_prebuilt_jar")
load("//ReactNative:DEFS.bzl", "react_native_dep", "rn_android_library", "rn_android_resource", "rn_prebuilt_jar")

# This is a bit messy and hopefully a temporary thing
# The problem is that Gradle extracts appcompat resources into app namespace, com.facebook.react
Expand All @@ -19,6 +19,8 @@ rn_android_library(
],
exported_deps = [
":classes-for-react-native",
react_native_dep("third-party/android/support-annotations:android-support-annotations"),
react_native_dep("third-party/android/support/v4:lib-support-v4"),
],
)

Expand Down