Skip to content

Commit

Permalink
fix: removed annotation from color in ViewUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
xeewii committed Jun 3, 2024
1 parent 970e275 commit 4228124
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ public void setViewSize(int height, int topOffset) {
*
* @param slide Story.Slide
*/
@SuppressLint("ResourceType")
public void update(Slide slide, int position, String code, int story_id) {
slide.setPrepared(false);

Expand Down Expand Up @@ -470,7 +469,6 @@ private void updateProducts(ProductsElement element, String slideId, int storyId
}
}

@SuppressLint("ResourceType")
private void updateButton(ButtonElement element) {
button.setVisibility(VISIBLE);
button.setText(element.getTitle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public TextBlockView(@NonNull Context context) {
super(context);
}

@SuppressLint("ResourceType")
public void updateView(TextBlockElement element, int parentHeight, int parentTopOffset) {
var layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
setLayoutParams(layoutParams);
Expand Down Expand Up @@ -71,7 +70,6 @@ private static int getTextAlignment(String textAlign) {
};
}

@SuppressLint("ResourceType")
private void setBackgroundColor(String colorString, String colorOpacityString) {
if( !colorString.startsWith("#") ) {
colorString = "#FFFFFF";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.IdRes;

public class ViewUtils {

public static final int MAX_COLOR_CHANNEL_VALUE = 255;

public static int getColor(Context context, String colorString, @IdRes int defaultColorId) {
public static int getColor(Context context, String colorString, int defaultColorId) {
if (colorString == null) {
return getColor(context, defaultColorId);
}
Expand All @@ -29,7 +27,7 @@ public static int getColor(Context context, String colorString, @IdRes int defau
return color;
}

public static int getColor(Context context, @IdRes int colorId) {
public static int getColor(Context context, int colorId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return context.getResources().getColor(colorId, context.getTheme());
}
Expand All @@ -38,7 +36,7 @@ public static int getColor(Context context, @IdRes int colorId) {
}
}

public static void setTextColor(Context context, TextView textView, String colorString, @IdRes int defaultColorId) {
public static void setTextColor(Context context, TextView textView, String colorString, int defaultColorId) {
var color = getColor(context, colorString, defaultColorId);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Expand All @@ -48,7 +46,7 @@ public static void setTextColor(Context context, TextView textView, String color
}
}

public static void setTextColor(Context context, Button button, String colorString, @IdRes int defaultColorId) {
public static void setTextColor(Context context, Button button, String colorString, int defaultColorId) {
var color = getColor(context, colorString, defaultColorId);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Expand All @@ -58,7 +56,7 @@ public static void setTextColor(Context context, Button button, String colorStri
}
}

public static void setBackgroundColor(Context context, Button button, String colorString, @IdRes int defaultColorId) {
public static void setBackgroundColor(Context context, Button button, String colorString, int defaultColorId) {
var backgroundColor = getColor(context, colorString, defaultColorId);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Expand Down

0 comments on commit 4228124

Please sign in to comment.