Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): fixed some TiConvert.toColor warnings #13630

Merged
merged 1 commit into from
Nov 3, 2022
Merged
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 @@ -226,7 +226,7 @@ public boolean forwardDelete(View view, Editable content, int keyCode, KeyEvent
TextInputLayout.LayoutParams.MATCH_PARENT, TextInputLayout.LayoutParams.MATCH_PARENT));

if (hasPropertyAndNotNull(TiC.PROPERTY_COLOR)) {
editText.setTextColor(TiConvert.toColor(getProperty(TiC.PROPERTY_COLOR).toString()));
editText.setTextColor(TiConvert.toColor(getProperty(TiC.PROPERTY_COLOR).toString(), activity));
}

return textInputLayout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public ColorProxy getColorResource(Object idOrName)
@Kroll.method
public String harmonizedColor(String value)
{
int color = TiConvert.toColor(value);
int color = TiConvert.toColor(value, TiApplication.getAppCurrentActivity());
return String.format("#%06X",
(0xFFFFFF & MaterialColors.harmonizeWithPrimary(TiApplication.getAppCurrentActivity(), color)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollFunction;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiDimension;
import org.appcelerator.titanium.proxy.TiViewProxy;
Expand Down Expand Up @@ -229,11 +230,12 @@ public void applyOptions(HashMap options)
}

if (options.containsKey(TiC.PROPERTY_BACKGROUND_COLOR)) {
backgroundColor = TiConvert.toColor(options, TiC.PROPERTY_BACKGROUND_COLOR);
backgroundColor = TiConvert.toColor(options, TiC.PROPERTY_BACKGROUND_COLOR,
TiApplication.getAppCurrentActivity());
}

if (options.containsKey(TiC.PROPERTY_COLOR)) {
color = TiConvert.toColor(options, TiC.PROPERTY_COLOR);
color = TiConvert.toColor(options, TiC.PROPERTY_COLOR, TiApplication.getAppCurrentActivity());
}

if (options.containsKey(TiC.PROPERTY_ELEVATION)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiDimension;
import org.appcelerator.titanium.TiPoint;
import org.appcelerator.titanium.util.TiConvert;
Expand Down Expand Up @@ -299,7 +300,7 @@ private void loadColors(Object[] colors)
// We were given a Titanium "GradientColorRef" dictionary. Fetch its color.
@SuppressWarnings({ "rawtypes", "unchecked" })
HashMap<String, Object> colorRefObject = (HashMap) color;
this.colors[i] = TiConvert.toColor(colorRefObject, "color");
this.colors[i] = TiConvert.toColor(colorRefObject, "color", TiApplication.getAppCurrentActivity());

// Fetch the offset from the "GradientColorRef" dictionary.
// Note: Make sure value does not exceed the 0.0 - 1.0 normalized range.
Expand All @@ -319,7 +320,7 @@ private void loadColors(Object[] colors)
}
} else {
// Fetch the color value from the array.
this.colors[i] = TiConvert.toColor(color.toString());
this.colors[i] = TiConvert.toColor(color.toString(), TiApplication.getAppCurrentActivity());
}
}

Expand Down