From 4c87fd986f80247e347bbf65f6ac41af22b7d7bd Mon Sep 17 00:00:00 2001 From: Jakub Trzebiatowski Date: Thu, 26 Oct 2023 18:39:20 +0200 Subject: [PATCH] `TextAttributeProps`: Put the getters in a conventional places --- .../react/views/text/TextAttributeProps.java | 162 +++++++++--------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java index 95ed2d2419852f..f8d0cfe6fa2067 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java @@ -423,6 +423,11 @@ private void setFontSize(float fontSize) { mFontSize = (int) fontSize; } + @Override + public int getColor() { + return mColor; + } + private void setColor(@Nullable Integer color) { mIsColorSet = (color != null); if (mIsColorSet) { @@ -430,6 +435,16 @@ private void setColor(@Nullable Integer color) { } } + @Override + public boolean isColorSet() { + return mIsColorSet; + } + + @Override + public int getBackgroundColor() { + return mBackgroundColor; + } + private void setBackgroundColor(Integer color) { // TODO: Don't apply background color to anchor TextView since it will be applied on the View // directly @@ -441,6 +456,21 @@ private void setBackgroundColor(Integer color) { // } } + @Override + public boolean isBackgroundColorSet() { + return mIsBackgroundColorSet; + } + + @Override + public int getFontStyle() { + return mFontStyle; + } + + @Override + public String getFontFamily() { + return mFontFamily; + } + private void setFontFamily(@Nullable String fontFamily) { mFontFamily = fontFamily; } @@ -543,6 +573,16 @@ private void setFontVariant(@Nullable MapBuffer fontVariant) { mFontFeatureSettings = TextUtils.join(", ", features); } + @Override + public String getFontFeatureSettings() { + return mFontFeatureSettings; + } + + @Override + public int getFontWeight() { + return mFontWeight; + } + private void setFontWeight(@Nullable String fontWeightString) { mFontWeight = ReactTypefaceUtils.parseFontWeight(fontWeightString); } @@ -569,6 +609,16 @@ private void setTextDecorationLine(@Nullable String textDecorationLineString) { } } + @Override + public boolean isUnderlineTextDecorationSet() { + return mIsUnderlineTextDecorationSet; + } + + @Override + public boolean isLineThroughTextDecorationSet() { + return mIsLineThroughTextDecorationSet; + } + private void setTextShadowOffset(ReadableMap offsetMap) { mTextShadowOffsetDx = 0; mTextShadowOffsetDy = 0; @@ -587,10 +637,20 @@ private void setTextShadowOffset(ReadableMap offsetMap) { } } + @Override + public float getTextShadowOffsetDx() { + return mTextShadowOffsetDx; + } + private void setTextShadowOffsetDx(float dx) { mTextShadowOffsetDx = PixelUtil.toPixelFromDIP(dx); } + @Override + public float getTextShadowOffsetDy() { + return mTextShadowOffsetDy; + } + private void setTextShadowOffsetDy(float dy) { mTextShadowOffsetDy = PixelUtil.toPixelFromDIP(dy); } @@ -614,12 +674,22 @@ private void setLayoutDirection(@Nullable String layoutDirection) { mLayoutDirection = getLayoutDirection(layoutDirection); } + @Override + public float getTextShadowRadius() { + return mTextShadowRadius; + } + private void setTextShadowRadius(float textShadowRadius) { if (textShadowRadius != mTextShadowRadius) { mTextShadowRadius = textShadowRadius; } } + @Override + public int getTextShadowColor() { + return mTextShadowColor; + } + private void setTextShadowColor(int textShadowColor) { if (textShadowColor != mTextShadowColor) { mTextShadowColor = textShadowColor; @@ -641,6 +711,11 @@ private void setTextTransform(@Nullable String textTransform) { } } + @Override + public AccessibilityRole getAccessibilityRole() { + return mAccessibilityRole; + } + private void setAccessibilityRole(@Nullable String accessibilityRole) { if (accessibilityRole == null) { mAccessibilityRole = null; @@ -649,6 +724,12 @@ private void setAccessibilityRole(@Nullable String accessibilityRole) { } } + @Nullable + @Override + public Role getRole() { + return mRole; + } + private void setRole(@Nullable String role) { if (role == null) { mRole = null; @@ -696,85 +777,4 @@ public static int getHyphenationFrequency(@Nullable String hyphenationFrequency) } return androidHyphenationFrequency; } - - @Nullable - @Override - public Role getRole() { - return mRole; - } - - @Override - public AccessibilityRole getAccessibilityRole() { - return mAccessibilityRole; - } - - @Override - public boolean isBackgroundColorSet() { - return mIsBackgroundColorSet; - } - - @Override - public int getBackgroundColor() { - return mBackgroundColor; - } - - @Override - public boolean isColorSet() { - return mIsColorSet; - } - - @Override - public int getColor() { - return mColor; - } - - @Override - public int getFontStyle() { - return mFontStyle; - } - - @Override - public int getFontWeight() { - return mFontWeight; - } - - @Override - public String getFontFamily() { - return mFontFamily; - } - - @Override - public String getFontFeatureSettings() { - return mFontFeatureSettings; - } - - @Override - public boolean isUnderlineTextDecorationSet() { - return mIsUnderlineTextDecorationSet; - } - - @Override - public boolean isLineThroughTextDecorationSet() { - return mIsLineThroughTextDecorationSet; - } - - @Override - public float getTextShadowOffsetDx() { - return mTextShadowOffsetDx; - } - - @Override - public float getTextShadowOffsetDy() { - return mTextShadowOffsetDy; - } - - @Override - public float getTextShadowRadius() { - return mTextShadowRadius; - } - - @Override - public int getTextShadowColor() { - return mTextShadowColor; - } }