kopia lustrzana https://github.com/SP8EBC/MeteoSystem
corrected formatting in WindRose activity and Trend
rodzic
8628529de0
commit
93aab76863
|
@ -122,6 +122,8 @@ public class FavouritesActivity extends AppCompatActivity {
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
adapter.stopUpdater();
|
if (adapter != null) {
|
||||||
|
adapter.stopUpdater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,12 +149,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
AndroidThreeTen.init(this);
|
AndroidThreeTen.init(this);
|
||||||
|
|
||||||
Locale locale = new Locale("pl");
|
// Locale locale = new Locale("pl");
|
||||||
Locale.setDefault(locale);
|
// Locale.setDefault(locale);
|
||||||
Resources resources = this.getResources();
|
// Resources resources = this.getResources();
|
||||||
Configuration config = resources.getConfiguration();
|
// Configuration config = resources.getConfiguration();
|
||||||
config.setLocale(locale);
|
// config.setLocale(locale);
|
||||||
resources.updateConfiguration(config, resources.getDisplayMetrics());
|
// resources.updateConfiguration(config, resources.getDisplayMetrics());
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class StationDetailsPlotsTemperature extends AppCompatActivity implements
|
||||||
// use wind speed label (on the left) to display the temperature
|
// use wind speed label (on the left) to display the temperature
|
||||||
if (this.textViewSpeed != null && this.textViewTimestamp != null) {
|
if (this.textViewSpeed != null && this.textViewTimestamp != null) {
|
||||||
this.textViewTimestamp.setText(date);
|
this.textViewTimestamp.setText(date);
|
||||||
this.textViewSpeed.setText(getString(R.string.temperature) + String.format(": %.1f°C", temperature));
|
this.textViewSpeed.setText(getString(R.string.temperature) + String.format(": %.1f°C", temperature).replace(',', '.'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -263,8 +263,8 @@ public class StationDetailsPlotsWind extends AppCompatActivity implements SeekBa
|
||||||
|
|
||||||
if (this.textViewGusts != null && this.textViewSpeed != null && this.textViewTimestamp != null) {
|
if (this.textViewGusts != null && this.textViewSpeed != null && this.textViewTimestamp != null) {
|
||||||
this.textViewTimestamp.setText(date);
|
this.textViewTimestamp.setText(date);
|
||||||
this.textViewSpeed.setText(getString(R.string.mean_value_short) + String.format(": %.1f%s", mean, unit));
|
this.textViewSpeed.setText(getString(R.string.mean_value_short) + String.format(": %.1f%s", mean, unit).replace(',', '.'));
|
||||||
this.textViewGusts.setText(getString(R.string.wind_gust_short) + String.format(": %.1f%s", gusts, unit));
|
this.textViewGusts.setText(getString(R.string.wind_gust_short) + String.format(": %.1f%s", gusts, unit).replace(',', '.'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -51,11 +51,11 @@ public class PressureTrendViewModel extends ViewModel {
|
||||||
stationName.postValue(trend.displayed_name);
|
stationName.postValue(trend.displayed_name);
|
||||||
|
|
||||||
if (!trend.current_qnh_qf.equals("NOT_AVALIABLE") && !trend.current_qnh_qf.equals("NO_DATA")) {
|
if (!trend.current_qnh_qf.equals("NOT_AVALIABLE") && !trend.current_qnh_qf.equals("NO_DATA")) {
|
||||||
currentValue.postValue(String.format("%.1f hPa", trend.pressure_trend.current_value));
|
currentValue.postValue(String.format("%shPa", trend.pressure_trend.getCurrentVal(true, false)));
|
||||||
twoHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.two_hours_value));
|
twoHoursValue.postValue(String.format("%shPa", trend.pressure_trend.getTwoHoursVal(true, false)));
|
||||||
fourHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.four_hours_value));
|
fourHoursValue.postValue(String.format("%shPa", trend.pressure_trend.getFourHoursVal(true, false)));
|
||||||
sixHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.six_hours_value));
|
sixHoursValue.postValue(String.format("%shPa", trend.pressure_trend.getSixHoursVal(true, false)));
|
||||||
eightHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.eight_hours_value));
|
eightHoursValue.postValue(String.format("%shPa", trend.pressure_trend.getEightHoursVal(true, false)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentValue.postValue("-- hPa");
|
currentValue.postValue("-- hPa");
|
||||||
|
|
|
@ -118,11 +118,11 @@ public class TemperatureTrendViewModel extends ViewModel {
|
||||||
if (!trend.current_humidity_qf.equals("NOT_AVALIABLE") && !trend.current_humidity_qf.equals("NO_DATA")) {
|
if (!trend.current_humidity_qf.equals("NOT_AVALIABLE") && !trend.current_humidity_qf.equals("NO_DATA")) {
|
||||||
|
|
||||||
|
|
||||||
currentHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.current_value));
|
currentHumidityValue.postValue(String.format("%s%%", trend.humidity_trend.getCurrentVal(true, true)));
|
||||||
twoHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.two_hours_value));
|
twoHoursHumidityValue.postValue(String.format("%s%%", trend.humidity_trend.getTwoHoursVal(true, true)));
|
||||||
fourHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.four_hours_value));
|
fourHoursHumidityValue.postValue(String.format("%s%%", trend.humidity_trend.getFourHoursVal(true, true)));
|
||||||
sixHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.six_hours_value));
|
sixHoursHumidityValue.postValue(String.format("%s%%", trend.humidity_trend.getSixHoursVal(true, true)));
|
||||||
eightHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.eight_hours_value));
|
eightHoursHumidityValue.postValue(String.format("%s%%", trend.humidity_trend.getEightHoursVal(true, true)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -136,11 +136,11 @@ public class TemperatureTrendViewModel extends ViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trend.current_temperature_qf.equals("NOT_AVALIABLE") && !trend.current_temperature_qf.equals("NO_DATA")) {
|
if (!trend.current_temperature_qf.equals("NOT_AVALIABLE") && !trend.current_temperature_qf.equals("NO_DATA")) {
|
||||||
currentTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.current_value));
|
currentTemperatureValue.postValue(String.format("%s°C", trend.temperature_trend.getCurrentVal(true, false)));
|
||||||
twoHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.two_hours_value));
|
twoHoursTemperatureValue.postValue(String.format("%s°C", trend.temperature_trend.getTwoHoursVal(true, false)));
|
||||||
fourHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.four_hours_value));
|
fourHoursTemperatureValue.postValue(String.format("%s°C", trend.temperature_trend.getFourHoursVal(true, false)));
|
||||||
sixHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.six_hours_value));
|
sixHoursTemperatureValue.postValue(String.format("%s°C", trend.temperature_trend.getSixHoursVal(true, false)));
|
||||||
eightHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.eight_hours_value));
|
eightHoursTemperatureValue.postValue(String.format("%s°C", trend.temperature_trend.getEightHoursVal(true, false)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentTemperatureValue.postValue("-- °C");
|
currentTemperatureValue.postValue("-- °C");
|
||||||
|
|
|
@ -121,33 +121,45 @@ public class WindTrendViewModel extends ViewModel {
|
||||||
displayedStationName.postValue(trend.displayed_name);
|
displayedStationName.postValue(trend.displayed_name);
|
||||||
|
|
||||||
if (!trend.current_wind_qf.equals("NOT_AVALIABLE") && !trend.current_wind_qf.equals("NO_DATA")) {
|
if (!trend.current_wind_qf.equals("NOT_AVALIABLE") && !trend.current_wind_qf.equals("NO_DATA")) {
|
||||||
if (AppConfiguration.replaceMsWithKnots) {
|
currentMeanValue.postValue(String.format("%sm/s", trend.average_wind_speed_trend.getCurrentVal(true, false)));
|
||||||
// if knots
|
twoHoursMeanValue.postValue(String.format("%sm/s", trend.average_wind_speed_trend.getTwoHoursVal(true, false)));
|
||||||
currentMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.current_value));
|
fourHoursMeanValue.postValue(String.format("%sm/s", trend.average_wind_speed_trend.getFourHoursVal(true, false)));
|
||||||
twoHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.two_hours_value));
|
sixHoursMeanValue.postValue(String.format("%sm/s", trend.average_wind_speed_trend.getSixHoursVal(true, false)));
|
||||||
fourHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.four_hours_value));
|
eightHoursMeanValue.postValue(String.format("%sm/s", trend.average_wind_speed_trend.getEightHoursVal(true, false)));
|
||||||
sixHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.six_hours_value));
|
|
||||||
eightHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.eight_hours_value));
|
|
||||||
|
|
||||||
currentGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.current_value));
|
currentGustValue.postValue(String.format("%sm/s", trend.maximum_wind_speed_trend.getCurrentVal(true, false)));
|
||||||
twoHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.two_hours_value));
|
twoHoursGustValue.postValue(String.format("%sm/s", trend.maximum_wind_speed_trend.getTwoHoursVal(true, false)));
|
||||||
fourHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.four_hours_value));
|
fourHoursGustValue.postValue(String.format("%sm/s", trend.maximum_wind_speed_trend.getFourHoursVal(true, false)));
|
||||||
sixHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.six_hours_value));
|
sixHoursGustValue.postValue(String.format("%sm/s", trend.maximum_wind_speed_trend.getSixHoursVal(true, false)));
|
||||||
eightHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.eight_hours_value));
|
eightHoursGustValue.postValue(String.format("%sm/s", trend.maximum_wind_speed_trend.getEightHoursVal(true, false)));
|
||||||
} else {
|
|
||||||
// if meters per second
|
|
||||||
currentMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.current_value));
|
|
||||||
twoHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.two_hours_value));
|
|
||||||
fourHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.four_hours_value));
|
|
||||||
sixHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.six_hours_value));
|
|
||||||
eightHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.eight_hours_value));
|
|
||||||
|
|
||||||
currentGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.current_value));
|
// if (AppConfiguration.replaceMsWithKnots) {
|
||||||
twoHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.two_hours_value));
|
// // if knots
|
||||||
fourHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.four_hours_value));
|
// currentMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.current_value));
|
||||||
sixHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.six_hours_value));
|
// twoHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.two_hours_value));
|
||||||
eightHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.eight_hours_value));
|
// fourHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.four_hours_value));
|
||||||
}
|
// sixHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.six_hours_value));
|
||||||
|
// eightHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.eight_hours_value));
|
||||||
|
//
|
||||||
|
// currentGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.current_value));
|
||||||
|
// twoHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.two_hours_value));
|
||||||
|
// fourHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.four_hours_value));
|
||||||
|
// sixHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.six_hours_value));
|
||||||
|
// eightHoursGustValue.postValue(String.format("%.0f kts", trend.maximum_wind_speed_trend.eight_hours_value));
|
||||||
|
// } else {
|
||||||
|
// // if meters per second
|
||||||
|
// currentMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.current_value));
|
||||||
|
// twoHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.two_hours_value));
|
||||||
|
// fourHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.four_hours_value));
|
||||||
|
// sixHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.six_hours_value));
|
||||||
|
// eightHoursMeanValue.postValue(String.format("%.1f m/s", trend.average_wind_speed_trend.eight_hours_value));
|
||||||
|
//
|
||||||
|
// currentGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.current_value));
|
||||||
|
// twoHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.two_hours_value));
|
||||||
|
// fourHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.four_hours_value));
|
||||||
|
// sixHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.six_hours_value));
|
||||||
|
// eightHoursGustValue.postValue(String.format("%.1f m/s", trend.maximum_wind_speed_trend.eight_hours_value));
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
currentMeanValue.postValue("--");
|
currentMeanValue.postValue("--");
|
||||||
twoHoursMeanValue.postValue("--");
|
twoHoursMeanValue.postValue("--");
|
||||||
|
|
|
@ -87,18 +87,18 @@ public class FavouritesStationDetailsUpdater implements Runnable {
|
||||||
|
|
||||||
// check if station transmits humidity
|
// check if station transmits humidity
|
||||||
if (summary.humidity_qf_native.equals(QualityFactor.FULL) || summary.humidity_qf_native.equals(QualityFactor.DEGRADED)) {
|
if (summary.humidity_qf_native.equals(QualityFactor.FULL) || summary.humidity_qf_native.equals(QualityFactor.DEGRADED)) {
|
||||||
str = String.format("%d°C %d%% %s %s max %s", Math.round(summary.avg_temperature), summary.humidity, summary.getWindDirStr(), summary.getWindspeedStr(), summary.getWindgustsStr());
|
str = String.format("%s %d%% %s %s max %s", summary.getTemperatureStr(false, true), summary.humidity, summary.getWindDirStr(), summary.getWindspeedStr(false), summary.getWindgustsStr(false));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = String.format("%d°C %s %s max %s", Math.round(summary.avg_temperature), summary.getWindDirStr(), summary.getWindspeedStr(), summary.getWindgustsStr());
|
str = String.format("%s %s %s max %s", summary.getTemperatureStr(false, true), summary.getWindDirStr(), summary.getWindspeedStr(false), summary.getWindgustsStr(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (summary.humidity_qf_native.equals(QualityFactor.FULL) || summary.humidity_qf_native.equals(QualityFactor.DEGRADED)) {
|
if (summary.humidity_qf_native.equals(QualityFactor.FULL) || summary.humidity_qf_native.equals(QualityFactor.DEGRADED)) {
|
||||||
str = String.format("%d°C %d%%", Math.round(summary.avg_temperature), summary.humidity);
|
str = String.format("%s %d%%", summary.getTemperatureStr(false, true), summary.humidity);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = String.format("%d°C", Math.round(summary.avg_temperature));
|
str = String.format("%s", summary.getTemperatureStr(false, true));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,14 +109,14 @@ public class StationSummaryActElements implements StationActivityElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE) && enabledForStation.windSpeed) {
|
if (!s.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE) && enabledForStation.windSpeed) {
|
||||||
wind_speed_val.setText(String.format("%s", s.getWindspeedStr()));
|
wind_speed_val.setText(String.format("%s", s.getWindspeedStr(true)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wind_speed_val.setText("---");
|
wind_speed_val.setText("---");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE) && enabledForStation.windGusts) {
|
if (!s.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE) && enabledForStation.windGusts) {
|
||||||
wind_gusts_val.setText(String.format("%s", s.getWindgustsStr()));
|
wind_gusts_val.setText(String.format("%s", s.getWindgustsStr(true)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wind_gusts_val.setText("---");
|
wind_gusts_val.setText("---");
|
||||||
|
@ -130,7 +130,7 @@ public class StationSummaryActElements implements StationActivityElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s.temperature_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
if (!s.temperature_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
||||||
temperature_val.setText(String.format("%.1f °C", s.avg_temperature));
|
temperature_val.setText(String.format("%s", s.getTemperatureStr(true, false)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
temperature_val.setText("---");
|
temperature_val.setText("---");
|
||||||
|
|
|
@ -94,8 +94,8 @@ public class StationWindRoseActElements implements StationActivityElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create strings with wind speed, gusts etc
|
// create strings with wind speed, gusts etc
|
||||||
String average_speed = String.format("%s", data.getWindspeedStr());
|
String average_speed = String.format("%s", data.getWindspeedStr(true));
|
||||||
String gusts_speed = String.format("%s", data.getWindgustsStr());
|
String gusts_speed = String.format("%s", data.getWindgustsStr(true));
|
||||||
|
|
||||||
// check if wind data is avaliable in the input data set
|
// check if wind data is avaliable in the input data set
|
||||||
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
||||||
|
@ -127,14 +127,14 @@ public class StationWindRoseActElements implements StationActivityElements {
|
||||||
|
|
||||||
// check if temperature is avaliable in input data set
|
// check if temperature is avaliable in input data set
|
||||||
if (!no_data && !data.temperature_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
if (!no_data && !data.temperature_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
||||||
temperature.setText(activity.getResources().getString(R.string.temperature_short) + '\n' + String.format("%.1f", data.avg_temperature) + "°C");
|
temperature.setText(activity.getResources().getString(R.string.temperature_short) + '\n' + String.format("%s", data.getTemperatureStr(true, false)));
|
||||||
} else {
|
} else {
|
||||||
temperature.setText(activity.getResources().getString(R.string.temperature_short) + '\n' + "---");
|
temperature.setText(activity.getResources().getString(R.string.temperature_short) + '\n' + "---");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_data && !old_data) {
|
if (!no_data && !old_data) {
|
||||||
String hour_max_gusts = String.format("%s", data.getHourWindgustsStr());
|
String hour_max_gusts = String.format("%s", data.getHourWindgustsStr(true));
|
||||||
String hour_min_avg = String.format("%s", data.getHourMinWindspeedStr());
|
String hour_min_avg = String.format("%s", data.getHourMinWindspeedStr(true));
|
||||||
|
|
||||||
pressure.setText(activity.getResources().getString(R.string.qnh) + ": " + String.format("%d hPa", data.qnh));
|
pressure.setText(activity.getResources().getString(R.string.qnh) + ": " + String.format("%d hPa", data.qnh));
|
||||||
maxGust.setText(activity.getResources().getString(R.string.max_1h_gust) + ": " + hour_max_gusts);
|
maxGust.setText(activity.getResources().getString(R.string.max_1h_gust) + ": " + hour_max_gusts);
|
||||||
|
|
|
@ -4,11 +4,14 @@ import cc.pogoda.mobile.pogodacc.config.AppConfiguration;
|
||||||
|
|
||||||
public class Summary {
|
public class Summary {
|
||||||
|
|
||||||
|
private static final String SPACE = " ";
|
||||||
|
private static final String NO_SPACE = "";
|
||||||
|
|
||||||
public long last_timestamp;
|
public long last_timestamp;
|
||||||
|
|
||||||
public int number_of_measurements;
|
public int number_of_measurements;
|
||||||
|
|
||||||
public float avg_temperature;
|
private float avg_temperature;
|
||||||
|
|
||||||
public String temperature_qf;
|
public String temperature_qf;
|
||||||
|
|
||||||
|
@ -48,78 +51,181 @@ public class Summary {
|
||||||
wind_qf_native = QualityFactor.UNSET;
|
wind_qf_native = QualityFactor.UNSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWindspeedStr() {
|
public float getAvgTemperature() {
|
||||||
|
return avg_temperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAverageSpeed() {
|
||||||
|
return average_speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getGusts() {
|
||||||
|
return gusts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getHourGusts() {
|
||||||
|
return hour_gusts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getHourMaxAverageSpeed() {
|
||||||
|
return hour_max_average_speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getHourMinAverageSpeed() {
|
||||||
|
return hour_min_average_speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemperatureStr(boolean space, boolean round) {
|
||||||
String out;
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (round) {
|
||||||
|
out = String.format("%d%s°C", Math.round(avg_temperature), s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = String.format("%.1f%s°C", avg_temperature, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWindspeedStr(boolean space) {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
if (AppConfiguration.replaceMsWithKnots) {
|
if (AppConfiguration.replaceMsWithKnots) {
|
||||||
float knots = this.average_speed * 1.94f;
|
float knots = this.average_speed * 1.94f;
|
||||||
|
|
||||||
out = String.format("%2d kn", Math.round(knots));
|
out = String.format("%2d%skn", Math.round(knots), s);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out = String.format("%4.1fm/s", this.average_speed);
|
out = String.format("%4.1f%sm/s", this.average_speed, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHourMinWindspeedStr() {
|
public String getHourMinWindspeedStr(boolean space) {
|
||||||
String out;
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
if (AppConfiguration.replaceMsWithKnots) {
|
if (AppConfiguration.replaceMsWithKnots) {
|
||||||
float knots = this.hour_min_average_speed * 1.94f;
|
float knots = this.hour_min_average_speed * 1.94f;
|
||||||
|
|
||||||
out = String.format("%2d kn", Math.round(knots));
|
out = String.format("%2d%skn", Math.round(knots), s);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out = String.format("%4.1fm/s", this.hour_min_average_speed);
|
out = String.format("%4.1f%sm/s", this.hour_min_average_speed, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHourMaxWindspeedStr() {
|
public String getHourMaxWindspeedStr(boolean space) {
|
||||||
String out;
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
if (AppConfiguration.replaceMsWithKnots) {
|
if (AppConfiguration.replaceMsWithKnots) {
|
||||||
float knots = this.hour_max_average_speed * 1.94f;
|
float knots = this.hour_max_average_speed * 1.94f;
|
||||||
|
|
||||||
out = String.format("%2d kn", Math.round(knots));
|
out = String.format("%2d%skn", Math.round(knots), s);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out = String.format("%4.1fm/s", this.hour_max_average_speed);
|
out = String.format("%4.1f%sm/s", this.hour_max_average_speed, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWindgustsStr() {
|
public String getWindgustsStr(boolean space) {
|
||||||
String out;
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
if (AppConfiguration.replaceMsWithKnots) {
|
if (AppConfiguration.replaceMsWithKnots) {
|
||||||
float knots = this.gusts * 1.94f;
|
float knots = this.gusts * 1.94f;
|
||||||
|
|
||||||
out = String.format("%2d kn", Math.round(knots));
|
out = String.format("%2d%skn", Math.round(knots), s);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out = String.format("%4.1fm/s", this.gusts);
|
out = String.format("%4.1f%sm/s", this.gusts, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHourWindgustsStr() {
|
public String getHourWindgustsStr(boolean space) {
|
||||||
String out;
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
if (AppConfiguration.replaceMsWithKnots) {
|
if (AppConfiguration.replaceMsWithKnots) {
|
||||||
float knots = this.hour_gusts * 1.94f;
|
float knots = this.hour_gusts * 1.94f;
|
||||||
|
|
||||||
out = String.format("%2d kn", Math.round(knots));
|
out = String.format("%2d%skn", Math.round(knots), s);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out = String.format("%4.1fm/s", this.hour_gusts);
|
out = String.format("%4.1f%sm/s", this.hour_gusts, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,138 @@ package cc.pogoda.mobile.pogodacc.type.web;
|
||||||
|
|
||||||
public class TrendData {
|
public class TrendData {
|
||||||
|
|
||||||
public float current_value;
|
private static final String SPACE = " ";
|
||||||
|
private static final String NO_SPACE = "";
|
||||||
|
|
||||||
public float two_hours_value;
|
private float current_value;
|
||||||
|
|
||||||
public float four_hours_value;
|
private float two_hours_value;
|
||||||
|
|
||||||
public float six_hours_value;
|
private float four_hours_value;
|
||||||
|
|
||||||
public float eight_hours_value;
|
private float six_hours_value;
|
||||||
|
|
||||||
|
private float eight_hours_value;
|
||||||
|
|
||||||
|
public String getCurrentVal(boolean space, boolean round) {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (round) {
|
||||||
|
out = String.format("%d%s", Math.round(current_value), s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = String.format("%.1f%s", current_value, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTwoHoursVal(boolean space, boolean round) {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (round) {
|
||||||
|
out = String.format("%d%s", Math.round(two_hours_value), s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = String.format("%.1f%s", two_hours_value, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFourHoursVal(boolean space, boolean round) {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (round) {
|
||||||
|
out = String.format("%d%s", Math.round(four_hours_value), s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = String.format("%.1f%s", four_hours_value, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSixHoursVal(boolean space, boolean round) {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (round) {
|
||||||
|
out = String.format("%d%s", Math.round(six_hours_value), s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = String.format("%.1f%s", six_hours_value, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEightHoursVal(boolean space, boolean round) {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
String s;
|
||||||
|
|
||||||
|
if (space) {
|
||||||
|
s = SPACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s = NO_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (round) {
|
||||||
|
out = String.format("%d%s", Math.round(eight_hours_value), s);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = String.format("%.1f%s", eight_hours_value, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.replace(',', '.');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
android:fontFamily="@font/alegreya_sans_sc_medium"
|
android:fontFamily="@font/alegreya_sans_sc_medium"
|
||||||
android:text="@string/max_1h_gust"
|
android:text="@string/max_1h_gust"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="24sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
@ -192,7 +192,7 @@
|
||||||
android:fontFamily="@font/alegreya_sans_sc_medium"
|
android:fontFamily="@font/alegreya_sans_sc_medium"
|
||||||
android:text="@string/min_1h_avg"
|
android:text="@string/min_1h_avg"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="24sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
@ -208,7 +208,7 @@
|
||||||
android:fontFamily="@font/alegreya_sans_sc_medium"
|
android:fontFamily="@font/alegreya_sans_sc_medium"
|
||||||
android:text="@string/qnh"
|
android:text="@string/qnh"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="24sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
|
Ładowanie…
Reference in New Issue