mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix lints warnings in RN Android
Summary: Fix lints warnings in RN Android changelog: [internal] internal Reviewed By: RSNara Differential Revision: D43544495 fbshipit-source-id: 046cf00a99a443a2a515540e0029a19997247eb6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
64835590ca
commit
c1304d938d
@@ -16,6 +16,7 @@ import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.facebook.react.modules.core.PermissionAwareActivity;
|
||||
@@ -85,7 +86,7 @@ public class ReactFragment extends Fragment implements PermissionAwareActivity {
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
mReactDelegate.loadApp();
|
||||
return mReactDelegate.getReactRootView();
|
||||
}
|
||||
@@ -140,7 +141,7 @@ public class ReactFragment extends Fragment implements PermissionAwareActivity {
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(
|
||||
int requestCode, String[] permissions, int[] grantResults) {
|
||||
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (mPermissionListener != null
|
||||
&& mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
|
||||
@@ -170,8 +171,8 @@ public class ReactFragment extends Fragment implements PermissionAwareActivity {
|
||||
/** Builder class to help instantiate a ReactFragment */
|
||||
public static class Builder {
|
||||
|
||||
String mComponentName;
|
||||
Bundle mLaunchOptions;
|
||||
@Nullable String mComponentName;
|
||||
@Nullable Bundle mLaunchOptions;
|
||||
|
||||
public Builder() {
|
||||
mComponentName = null;
|
||||
|
||||
+3
@@ -8,9 +8,12 @@
|
||||
package com.facebook.react.perflogger;
|
||||
|
||||
import com.facebook.jni.HybridData;
|
||||
import com.facebook.jni.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
public abstract class NativeModulePerfLogger {
|
||||
@DoNotStrip
|
||||
@SuppressWarnings("unused")
|
||||
private final HybridData mHybridData;
|
||||
|
||||
private static volatile boolean sIsSoLibraryLoaded;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react.shell;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.TurboReactPackage;
|
||||
import com.facebook.react.animated.NativeAnimatedModule;
|
||||
@@ -148,6 +149,7 @@ public class MainReactPackage extends TurboReactPackage {
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
List<ViewManager> viewManagers = new ArrayList<>();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.views.text;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
@@ -22,18 +23,19 @@ public class ReactRawTextManager extends ViewManager<View, ReactRawTextShadowNod
|
||||
|
||||
@VisibleForTesting public static final String REACT_CLASS = "RCTRawText";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return REACT_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReactTextView createViewInstance(ThemedReactContext context) {
|
||||
public ReactTextView createViewInstance(@NonNull ThemedReactContext context) {
|
||||
throw new IllegalStateException("Attempt to create a native view for RCTRawText");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtraData(View view, Object extraData) {}
|
||||
public void updateExtraData(@NonNull View view, Object extraData) {}
|
||||
|
||||
@Override
|
||||
public Class<ReactRawTextShadowNode> getShadowNodeClass() {
|
||||
|
||||
+4
-1
@@ -9,6 +9,7 @@ package com.facebook.react.views.unimplementedview;
|
||||
|
||||
import static com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager.REACT_CLASS;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
@@ -24,11 +25,13 @@ public class ReactUnimplementedViewManager extends ViewGroupManager<ReactUnimple
|
||||
|
||||
public static final String REACT_CLASS = "UnimplementedNativeView";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ReactUnimplementedView createViewInstance(ThemedReactContext reactContext) {
|
||||
protected ReactUnimplementedView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
||||
return new ReactUnimplementedView(reactContext);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return REACT_CLASS;
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
public class ReactDrawableHelper {
|
||||
|
||||
private static final TypedValue sResolveOutValue = new TypedValue();
|
||||
private static final String BORDERLESS_KEY = "borderless";
|
||||
private static final String RIPPLE_RADIUS_KEY = "rippleRadius";
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public static Drawable createDrawableFromJSDescription(
|
||||
@@ -80,10 +82,10 @@ public class ReactDrawableHelper {
|
||||
|
||||
private static Drawable setRadius(ReadableMap drawableDescriptionDict, Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& drawableDescriptionDict.hasKey("rippleRadius")
|
||||
&& drawableDescriptionDict.hasKey(RIPPLE_RADIUS_KEY)
|
||||
&& drawable instanceof RippleDrawable) {
|
||||
RippleDrawable rippleDrawable = (RippleDrawable) drawable;
|
||||
double rippleRadius = drawableDescriptionDict.getDouble("rippleRadius");
|
||||
double rippleRadius = drawableDescriptionDict.getDouble(RIPPLE_RADIUS_KEY);
|
||||
rippleDrawable.setRadius((int) PixelUtil.toPixelFromDIP(rippleRadius));
|
||||
}
|
||||
return drawable;
|
||||
@@ -106,9 +108,9 @@ public class ReactDrawableHelper {
|
||||
}
|
||||
|
||||
private static @Nullable Drawable getMask(ReadableMap drawableDescriptionDict) {
|
||||
if (!drawableDescriptionDict.hasKey("borderless")
|
||||
|| drawableDescriptionDict.isNull("borderless")
|
||||
|| !drawableDescriptionDict.getBoolean("borderless")) {
|
||||
if (!drawableDescriptionDict.hasKey(BORDERLESS_KEY)
|
||||
|| drawableDescriptionDict.isNull(BORDERLESS_KEY)
|
||||
|| !drawableDescriptionDict.getBoolean(BORDERLESS_KEY)) {
|
||||
return new ColorDrawable(Color.WHITE);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user