fix: column size with special char (ugly)
This commit is contained in:
parent
672d530f13
commit
82af876560
@ -30,9 +30,12 @@ class WeatherDisplayBasic implements WeatherDisplay {
|
|||||||
double max = 0;
|
double max = 0;
|
||||||
for (WeatherDataAPI api: weatherDataAPIArrayListHashMap.keySet()) {
|
for (WeatherDataAPI api: weatherDataAPIArrayListHashMap.keySet()) {
|
||||||
for (WeatherData w: weatherDataAPIArrayListHashMap.get(api)){
|
for (WeatherData w: weatherDataAPIArrayListHashMap.get(api)){
|
||||||
max = Math.max(max, w.toString().length());
|
// real str len with special chars
|
||||||
|
int strLen = w.toString().codePointCount(0, w.toString().length());
|
||||||
|
max = Math.max(max, strLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,14 +86,16 @@ class WeatherDisplayBasic implements WeatherDisplay {
|
|||||||
|
|
||||||
double sourceColumnSize = dayColumnSize;
|
double sourceColumnSize = dayColumnSize;
|
||||||
|
|
||||||
|
double dayColumnSizeSeparator = dayColumnSize - 1; // because arrows change string len but not display len TODO
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
displayHeader(days, sourceColumnSize, dayColumnSize);
|
displayHeader(days, sourceColumnSize, dayColumnSize);
|
||||||
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSize);
|
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSizeSeparator);
|
||||||
|
|
||||||
// Apis
|
// Apis
|
||||||
for (WeatherDataAPI api: weatherDataAPIArrayListHashMap.keySet()) {
|
for (WeatherDataAPI api: weatherDataAPIArrayListHashMap.keySet()) {
|
||||||
displayWeatherDatas(api.getAPIName(), weatherDataAPIArrayListHashMap.get(api), startColumnString, sourceColumnSize, dayColumnSize);
|
displayWeatherDatas(api.getAPIName(), weatherDataAPIArrayListHashMap.get(api), startColumnString, sourceColumnSize, dayColumnSize);
|
||||||
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSize);
|
this.displaySeparatorLine(days, sourceColumnSize, dayColumnSizeSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user