Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
up from the file to lint until it find an AndroidManifest with a minSdkVersion. This is then used
as the min SDK to lint the file.-->
<uses-sdk
android:minSdkVersion="24"
android:minSdkVersion="27"
android:targetSdkVersion="36"
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
Expand Down Expand Up @@ -141,7 +140,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
if (WindowUtilKt.isEdgeToEdgeFeatureFlagOn()) {
WindowUtilKt.enableEdgeToEdge(window);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isWideColorGamutEnabled()) {
if (isWideColorGamutEnabled()) {
window.setColorMode(ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import com.facebook.react.common.ReactConstants

public object ColorPropConverter {

private fun supportWideGamut(): Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O

private const val JSON_KEY = "resource_paths"
private const val PREFIX_RESOURCE = "@"
private const val PREFIX_ATTR = "?"
Expand Down Expand Up @@ -78,14 +76,14 @@ public object ColorPropConverter {
return null
}

if (supportWideGamut() && value is Double) {
if (value is Double) {
return Color.valueOf(value.toInt())
}

checkNotNull(context)

if (value is ReadableMap) {
if (supportWideGamut() && value.hasKey("space")) {
if (value.hasKey("space")) {
val rawColorSpace = value.getString("space")
val isDisplayP3 = rawColorSpace == "display-p3"
val space =
Expand All @@ -108,7 +106,7 @@ public object ColorPropConverter {

for (i in 0 until resourcePaths.size()) {
val result = resolveResourcePath(context, resourcePaths.getString(i))
if (supportWideGamut() && result != null) {
if (result != null) {
return Color.valueOf(result)
}
}
Expand All @@ -124,11 +122,9 @@ public object ColorPropConverter {
@JvmStatic
public fun getColor(value: Any?, context: Context): Int? {
try {
if (supportWideGamut()) {
val color = getColorInstance(value, context)
if (color != null) {
return color.toArgb()
}
val color = getColorInstance(value, context)
if (color != null) {
return color.toArgb()
}
} catch (ex: JSApplicationCausedNativeException) {
FLog.w(ReactConstants.TAG, ex, "Error extracting color from WideGamut")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal class DebugOverlayController(private val reactContext: ReactContext) {
WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowOverlayCompat.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ internal class FrameTimingsObserver(
}

private suspend fun captureScreenshot(): String? = suspendCoroutine { continuation ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
continuation.resume(null)
return@suspendCoroutine
}

val decorView = window.decorView
val width = decorView.width
val height = decorView.height
Expand Down Expand Up @@ -119,18 +114,11 @@ internal class FrameTimingsObserver(

fun start() {
frameCounter = 0
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return
}

window.addOnFrameMetricsAvailableListener(frameMetricsListener, handler)
}

fun stop() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return
}

window.removeOnFrameMetricsAvailableListener(frameMetricsListener)
handler.removeCallbacksAndMessages(null)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ internal class VibrationModule(reactContext: ReactApplicationContext) :
override fun vibrate(durationDouble: Double) {
val duration = durationDouble.toInt()
val v = getVibrator() ?: return
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createOneShot(duration.toLong(), VibrationEffect.DEFAULT_AMPLITUDE))
} else {
@Suppress("DEPRECATION") v.vibrate(duration.toLong())
}
v.vibrate(VibrationEffect.createOneShot(duration.toLong(), VibrationEffect.DEFAULT_AMPLITUDE))
}

override fun vibrateByPattern(pattern: ReadableArray, repeatDouble: Double) {
Expand All @@ -40,11 +36,7 @@ internal class VibrationModule(reactContext: ReactApplicationContext) :
for (i in 0 until pattern.size()) {
patternLong[i] = pattern.getInt(i).toLong()
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
v.vibrate(VibrationEffect.createWaveform(patternLong, repeat))
} else {
@Suppress("DEPRECATION") v.vibrate(patternLong, repeat)
}
v.vibrate(VibrationEffect.createWaveform(patternLong, repeat))
}

override fun cancel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import android.graphics.PixelFormat
import android.graphics.PointF
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.Region
import android.graphics.drawable.Drawable
import android.os.Build
import com.facebook.react.uimanager.FloatUtil.floatsEqual
import com.facebook.react.uimanager.LengthPercentage
import com.facebook.react.uimanager.PixelUtil.dpToPx
Expand Down Expand Up @@ -413,12 +411,8 @@ internal class BorderDrawable(
borderPaint.style = Paint.Style.FILL

// Clip inner border
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
canvas.clipOutPath(checkNotNull(innerClipPathForBorderRadius))
} else {
@Suppress("DEPRECATION")
canvas.clipPath(checkNotNull(innerClipPathForBorderRadius), Region.Op.DIFFERENCE)
}
canvas.clipOutPath(checkNotNull(innerClipPathForBorderRadius))

val outerClipTempRect = checkNotNull(outerClipTempRectForBorderRadius)
val left = outerClipTempRect.left
val right = outerClipTempRect.right
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import android.animation.Animator
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Point
import android.os.Build
import android.view.View
import android.view.ViewGroup
import android.widget.OverScroller
import androidx.annotation.RequiresApi
import androidx.core.view.ViewCompat.FocusDirection
import androidx.core.view.ViewCompat.FocusRealDirection
import com.facebook.common.logging.FLog
Expand Down Expand Up @@ -236,7 +234,6 @@ public object ReactScrollViewHelper {
scrollListeners.add(WeakReference(listener))
}

@RequiresApi(Build.VERSION_CODES.N)
@JvmStatic
public fun removeScrollListener(listener: ScrollListener) {
// Avoid using removeIf, only available in API 26+
Expand All @@ -255,7 +252,6 @@ public object ReactScrollViewHelper {
layoutChangeListeners.add(WeakReference(listener))
}

@RequiresApi(Build.VERSION_CODES.N)
@JvmStatic
public fun removeLayoutChangeListener(listener: LayoutChangeListener) {
// Avoid using removeIf, only available in API 26+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Build;
import android.text.Layout;
import android.text.Spannable;
import android.text.SpannableString;
Expand Down Expand Up @@ -118,9 +117,7 @@ private void initView() {
// https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/widget/TextView.java#L1061
setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE);
setMovementMethod(getDefaultMovementMethod());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setJustificationMode(Layout.JUSTIFICATION_MODE_NONE);
}
setJustificationMode(Layout.JUSTIFICATION_MODE_NONE);

// reset text
setLayoutParams(EMPTY_LAYOUT_PARAMS);
Expand Down Expand Up @@ -149,9 +146,7 @@ private void initView() {
// mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED |
// LAYOUT_DIRECTION_INHERIT;
setEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setFocusable(View.FOCUSABLE_AUTO);
}
setFocusable(View.FOCUSABLE_AUTO);

setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE);
updateView(); // call after changing ellipsizeLocation in particular
Expand Down Expand Up @@ -357,7 +352,7 @@ protected void onDraw(Canvas canvas) {
// always passing ALIGN_NORMAL here should be fine, since this method doesn't depend on
// how exactly lines are aligned, just their width
Layout.Alignment.ALIGN_NORMAL,
(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) ? -1 : getJustificationMode(),
getJustificationMode(),
getPaint());
setText(spanned);
}
Expand Down Expand Up @@ -402,10 +397,8 @@ public void setText(ReactTextUpdate update) {
if (getBreakStrategy() != update.getTextBreakStrategy()) {
setBreakStrategy(update.getTextBreakStrategy());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (getJustificationMode() != update.getJustificationMode()) {
setJustificationMode(update.getJustificationMode());
}
if (getJustificationMode() != update.getJustificationMode()) {
setJustificationMode(update.getJustificationMode());
}

// Ensure onLayout is called so the inline views can be repositioned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package com.facebook.react.views.text

import android.os.Build
import android.text.Layout
import android.text.Spannable
import android.text.Spanned
Expand Down Expand Up @@ -164,15 +163,13 @@ public constructor(
TextAttributeProps.getTextBreakStrategy(
paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY)
)
val currentJustificationMode =
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) 0 else view.justificationMode

return ReactTextUpdate(
spanned,
-1, // UNUSED FOR TEXT
TextLayoutManager.getTextGravity(attributedString, spanned),
textBreakStrategy,
TextAttributeProps.getJustificationMode(props, currentJustificationMode),
TextAttributeProps.getJustificationMode(props, view.justificationMode),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package com.facebook.react.views.text

import android.os.Build
import android.text.Layout
import android.text.TextUtils.TruncateAt
import android.util.LayoutDirection
Expand Down Expand Up @@ -387,8 +386,7 @@ public class TextAttributeProps private constructor() {
private const val PROP_TEXT_TRANSFORM = "textTransform"

private const val DEFAULT_TEXT_SHADOW_COLOR = 0x55000000
private val DEFAULT_JUSTIFICATION_MODE =
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) 0 else Layout.JUSTIFICATION_MODE_NONE
private const val DEFAULT_JUSTIFICATION_MODE = Layout.JUSTIFICATION_MODE_NONE
private const val DEFAULT_BREAK_STRATEGY = Layout.BREAK_STRATEGY_HIGH_QUALITY
private const val DEFAULT_HYPHENATION_FREQUENCY = Layout.HYPHENATION_FREQUENCY_NONE

Expand Down Expand Up @@ -499,7 +497,7 @@ public class TextAttributeProps private constructor() {
}

val textAlignPropValue = props.getString(ViewProps.TEXT_ALIGN)
if ("justify" == textAlignPropValue && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if ("justify" == textAlignPropValue) {
return Layout.JUSTIFICATION_MODE_INTER_WORD
}
return DEFAULT_JUSTIFICATION_MODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ internal object TextLayoutManager {
}

private fun getTextJustificationMode(alignmentAttr: String?): Int {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return -1
}

if (alignmentAttr != null && alignmentAttr == "justified") {
return Layout.JUSTIFICATION_MODE_INTER_WORD
}
Expand Down Expand Up @@ -715,9 +711,7 @@ internal object TextLayoutManager {
builder.setEllipsize(ellipsizeMode).setMaxLines(maxNumberOfLines)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setJustificationMode(justificationMode)
}
builder.setJustificationMode(justificationMode)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
builder.setUseLineSpacingFromFallbacks(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ public open class ReactEditText public constructor(context: Context) : AppCompat

// Turn off hardware acceleration for Oreo (T40484798)
// see https://issuetracker.google.com/issues/67102093
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1
) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1) {
setLayerType(LAYER_TYPE_SOFTWARE, null)
}

Expand Down
Loading
Loading