Removing pre-API 21 code

Summary:
We don't support pre-API 21/Android <5/pre-Lollipop anymore; delete related code or checks.

No need for this to make it to the changelog, this announcement was already made.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24965249

fbshipit-source-id: e537e62e8eb18878c29afe17b8c7861d095a37b7
This commit is contained in:
Joshua Gross
2020-11-16 12:43:14 -08:00
committed by Facebook GitHub Bot
parent 0937f13cc3
commit bbd0f03481
4 changed files with 18 additions and 31 deletions
@@ -178,15 +178,12 @@ public abstract class ReactBaseTextShadowNode extends LayoutShadowNode {
new SetSpanOperation(
start, end, new ReactBackgroundColorSpan(textShadowNode.mBackgroundColor)));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
float effectiveLetterSpacing = textAttributes.getEffectiveLetterSpacing();
if (!Float.isNaN(effectiveLetterSpacing)
&& (parentTextAttributes == null
|| parentTextAttributes.getEffectiveLetterSpacing() != effectiveLetterSpacing)) {
ops.add(
new SetSpanOperation(
start, end, new CustomLetterSpacingSpan(effectiveLetterSpacing)));
}
float effectiveLetterSpacing = textAttributes.getEffectiveLetterSpacing();
if (!Float.isNaN(effectiveLetterSpacing)
&& (parentTextAttributes == null
|| parentTextAttributes.getEffectiveLetterSpacing() != effectiveLetterSpacing)) {
ops.add(
new SetSpanOperation(start, end, new CustomLetterSpacingSpan(effectiveLetterSpacing)));
}
int effectiveFontSize = textAttributes.getEffectiveFontSize();
if ( // `getEffectiveFontSize` always returns a value so don't need to check for anything like
@@ -139,12 +139,10 @@ public class TextLayoutManager {
new SetSpanOperation(
start, end, new ReactBackgroundColorSpan(textAttributes.mBackgroundColor)));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!Float.isNaN(textAttributes.getLetterSpacing())) {
ops.add(
new SetSpanOperation(
start, end, new CustomLetterSpacingSpan(textAttributes.getLetterSpacing())));
}
if (!Float.isNaN(textAttributes.getLetterSpacing())) {
ops.add(
new SetSpanOperation(
start, end, new CustomLetterSpacingSpan(textAttributes.getLetterSpacing())));
}
ops.add(
new SetSpanOperation(start, end, new ReactAbsoluteSizeSpan(textAttributes.mFontSize)));
@@ -654,12 +654,10 @@ public class ReactEditText extends AppCompatEditText
List<TextLayoutManager.SetSpanOperation> ops = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (!Float.isNaN(mTextAttributes.getLetterSpacing())) {
ops.add(
new TextLayoutManager.SetSpanOperation(
start, end, new CustomLetterSpacingSpan(mTextAttributes.getLetterSpacing())));
}
if (!Float.isNaN(mTextAttributes.getLetterSpacing())) {
ops.add(
new TextLayoutManager.SetSpanOperation(
start, end, new CustomLetterSpacingSpan(mTextAttributes.getLetterSpacing())));
}
ops.add(
new TextLayoutManager.SetSpanOperation(
@@ -947,11 +945,9 @@ public class ReactEditText extends AppCompatEditText
// `Float.NaN`.
setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextAttributes.getEffectiveFontSize());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
float effectiveLetterSpacing = mTextAttributes.getEffectiveLetterSpacing();
if (!Float.isNaN(effectiveLetterSpacing)) {
setLetterSpacing(effectiveLetterSpacing);
}
float effectiveLetterSpacing = mTextAttributes.getEffectiveLetterSpacing();
if (!Float.isNaN(effectiveLetterSpacing)) {
setLetterSpacing(effectiveLetterSpacing);
}
}
@@ -65,11 +65,7 @@ public class ReactDrawableHelper {
}
private static Drawable getDefaultThemeDrawable(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return context.getResources().getDrawable(sResolveOutValue.resourceId, context.getTheme());
} else {
return context.getResources().getDrawable(sResolveOutValue.resourceId);
}
return context.getResources().getDrawable(sResolveOutValue.resourceId, context.getTheme());
}
private static RippleDrawable getRippleDrawable(