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

[TIMOB-18053] Android: fix picker row text color #8651

Merged
merged 3 commits into from
Dec 5, 2016
Merged
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 @@ -25,7 +25,6 @@
import ti.modules.titanium.ui.PickerProxy;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
Expand All @@ -42,6 +41,7 @@ public class TiUINativePicker extends TiUIPicker
{
private static final String TAG = "TiUINativePicker";
private boolean firstSelectedFired = false;
private static int defaultTextColor = 0;

public static class TiSpinnerAdapter<T> extends ArrayAdapter<T>
{
Expand Down Expand Up @@ -74,16 +74,21 @@ public void setFontProperties(KrollDict d)
}

private void styleTextView(int position, TextView tv) {
TiViewProxy rowProxy = (TiViewProxy) this.getItem(position);
if (fontProperties != null) {
TiUIHelper.styleText(tv, fontProperties[TiUIHelper.FONT_FAMILY_POSITION],
fontProperties[TiUIHelper.FONT_SIZE_POSITION], fontProperties[TiUIHelper.FONT_WEIGHT_POSITION],
fontProperties[TiUIHelper.FONT_STYLE_POSITION]);
}
if (rowProxy.hasProperty(TiC.PROPERTY_COLOR)) {
final int color = TiConvert.toColor(rowProxy.getProperties(), TiC.PROPERTY_COLOR);
tv.setTextColor(color);
}
TiViewProxy rowProxy = (TiViewProxy) this.getItem(position);
if (fontProperties != null) {
TiUIHelper.styleText(tv, fontProperties[TiUIHelper.FONT_FAMILY_POSITION],
fontProperties[TiUIHelper.FONT_SIZE_POSITION], fontProperties[TiUIHelper.FONT_WEIGHT_POSITION],
fontProperties[TiUIHelper.FONT_STYLE_POSITION]);
}
if (rowProxy.hasProperty(TiC.PROPERTY_COLOR)) {
final int color = TiConvert.toColor(rowProxy.getProperties(), TiC.PROPERTY_COLOR);
if (defaultTextColor != color) {
defaultTextColor = tv.getCurrentTextColor();
}
tv.setTextColor(color);
} else {
tv.setTextColor(defaultTextColor);
}
}
}

Expand Down