Skip to content

Commit

Permalink
fix(md-3896): expand row text color (#158)
Browse files Browse the repository at this point in the history
* fix: support indicators and text color in expand view

* fix: cleanup
  • Loading branch information
gruskal authored and enell committed Feb 9, 2023
1 parent 84d0f85 commit d423bd1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Expand Up @@ -111,7 +111,14 @@ public JSONObject toEvent() throws JSONException {
cell.put("rawRowIdx", rawRowIdx);
cell.put("rawColIdx", rawColIdx);
cell.put("isNumber", isNumber);

if(cellForegroundColorValid) {
String hexColor = String.format("#%06X", 0xFFFFFF & cellForegroundColor);
cell.put("cellForegroundColor", hexColor);
}
if(cellBackgroundColorValid) {
String hexColor = String.format("#%06X", 0xFFFFFF & cellBackgroundColor);
cell.put("cellBackgroundColor", hexColor);
}
if(qAttrExpValues != null) {
JSONObject qAttrExps = new JSONObject();
qAttrExps.put("qValues", qAttrExpValues.toEvent());
Expand Down
Expand Up @@ -14,11 +14,12 @@ public class Indicator {
String position = null;
boolean showTextValues = false;
char icon;
String iconKey;
boolean hasIcon = false;

Indicator(ReadableMap data) {
applySegmentColors = data.hasKey("applySegmentColors") ? data.getBoolean("applySegmentColors") : false;
showTextValues = data.hasKey("showTextValues") ? data.getBoolean("showTextValues") : false;
applySegmentColors = data.hasKey("applySegmentColors") && data.getBoolean("applySegmentColors");
showTextValues = data.hasKey("showTextValues") && data.getBoolean("showTextValues");
position = data.hasKey("position") ? data.getString("position") : null;
index = data.hasKey("index") ? data.getInt("index") : -1;
parseColor(data);
Expand All @@ -37,13 +38,16 @@ public JSONObject toEvent() throws JSONException {
json.put("showTextValues", showTextValues);
json.put("position", position);
json.put("index", index);
String hexColor = String.format("#%06X", 0xFFFFFF & color);
json.put("color", hexColor);
json.put("icon", iconKey);
return json;
}

private void getIcon(ReadableMap data) {
if (data.hasKey("icon")) {
hasIcon = true;
String iconKey = data.getString("icon");
iconKey = data.getString("icon");
switch (iconKey) {
case "m":
icon = 0xe96c;
Expand Down

0 comments on commit d423bd1

Please sign in to comment.