Skip to content

Commit

Permalink
TextAttributeProps: Put the getters in a conventional places
Browse files Browse the repository at this point in the history
  • Loading branch information
cubuspl42 committed Oct 26, 2023
1 parent 7844e24 commit 4c87fd9
Showing 1 changed file with 81 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,28 @@ 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) {
mColor = 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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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;
Expand All @@ -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);
}
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 4c87fd9

Please sign in to comment.