pull/1/head
Mateusz Lubecki 2021-02-06 21:58:07 +01:00
rodzic ee07ae5995
commit 091dd8c7d6
24 zmienionych plików z 1108 dodań i 73 usunięć

Wyświetl plik

@ -6,6 +6,8 @@ android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
apply plugin: "androidx.navigation.safeargs"
defaultConfig {
applicationId "cc.pogoda.mobile.pogodacc"
minSdkVersion 24

Wyświetl plik

@ -28,6 +28,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>

Wyświetl plik

@ -16,7 +16,6 @@ import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import org.threeten.bp.Instant;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZoneOffset;
@ -340,7 +339,7 @@ public class StationDetailsPlotsDirection extends AppCompatActivity implements S
valuesWindDirection = new ArrayList<>();
if (data != null) {
for (StationData d : data.listOfStationData) {
for (StationData d : data.list_of_station_data) {
valuesWindDirection.add(new Entry(d.epoch * 1000, d.winddir));
}
}

Wyświetl plik

@ -14,9 +14,6 @@ import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.formatter.IFillFormatter;
import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import org.threeten.bp.LocalDateTime;
@ -30,7 +27,6 @@ import java.util.ArrayList;
import cc.pogoda.mobile.pogodacc.R;
import cc.pogoda.mobile.pogodacc.activity.handler.PlotClickEvent;
import cc.pogoda.mobile.pogodacc.config.AppConfiguration;
import cc.pogoda.mobile.pogodacc.dao.LastStationDataDao;
import cc.pogoda.mobile.pogodacc.dao.StationDataDao;
import cc.pogoda.mobile.pogodacc.type.StationDetailsPlot;
@ -114,7 +110,7 @@ public class StationDetailsPlotsTemperature extends AppCompatActivity implements
}
if (data instanceof ListOfStationData) {
for (StationData d : data.listOfStationData) {
for (StationData d : data.list_of_station_data) {
valuesTemperature.add(new Entry(d.epoch * 1000, d.temperature));
}
}

Wyświetl plik

@ -218,7 +218,7 @@ public class StationDetailsPlotsWind extends AppCompatActivity implements SeekBa
valuesWindGusts = new ArrayList<>();
if (data instanceof ListOfStationData) {
for (StationData d : data.listOfStationData) {
for (StationData d : data.list_of_station_data) {
valuesWindSpeed.add(new Entry(d.epoch * 1000, d.windspeed));
valuesWindGusts.add(new Entry(d.epoch * 1000, d.windgusts));
}

Wyświetl plik

@ -7,6 +7,7 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavArgument;
import androidx.navigation.NavController;
import androidx.navigation.NavDirections;
import androidx.navigation.NavGraph;
import androidx.navigation.Navigation;
import androidx.navigation.fragment.NavHostFragment;
@ -15,9 +16,19 @@ import androidx.navigation.ui.NavigationUI;
import cc.pogoda.mobile.pogodacc.R;
import cc.pogoda.mobile.pogodacc.activity.trend.pressure.PressureTrendFragment;
import cc.pogoda.mobile.pogodacc.activity.trend.pressure.PressureTrendFragmentArgs;
import cc.pogoda.mobile.pogodacc.activity.trend.pressure.PressureTrendFragmentDirections;
import cc.pogoda.mobile.pogodacc.activity.trend.temperature.TemperatureTrendFragmentDirections;
import cc.pogoda.mobile.pogodacc.activity.trend.wind.WindTrendFragmentDirections;
public class TrendActivity extends AppCompatActivity {
public static String getStation() {
return station;
}
private static String station = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -26,9 +37,12 @@ public class TrendActivity extends AppCompatActivity {
NavArgument.Builder builder = new NavArgument.Builder();
Bundle bundle = new Bundle();
bundle.putString("station", stationName);
this.station = stationName;
BottomNavigationView navView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
@ -36,17 +50,24 @@ public class TrendActivity extends AppCompatActivity {
R.id.navigation_pressure, R.id.navigation_temperature, R.id.navigation_wind)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavGraph navGraph = navController.getNavInflater().inflate(R.navigation.mobile_navigation);
builder.setDefaultValue(stationName);
navGraph.addArgument("station", builder.build());
navController.setGraph(navGraph, bundle);
NavDirections temperature = TemperatureTrendFragmentDirections.actionNavigationTemperatureToNavigationPressure(stationName);
NavDirections wind = WindTrendFragmentDirections.actionNavigationWindToNavigationTemperature(stationName);
NavDirections pressure = PressureTrendFragmentDirections.actionNavigationPressureToNavigationWind(stationName);
//NavHostFragment.create(R.navigation.mobile_navigation, bundle);
// NavGraph navGraph = navController.getNavInflater().inflate(R.navigation.mobile_navigation);
// builder.setDefaultValue(stationName);
// navGraph.addArgument("station", builder.build());
// navController.setGraph(navGraph, bundle);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);
//navController.navigate(temperature);
//
// NavArgument.Builder builder = new NavArgument.Builder();
// builder.setDefaultValue(stationName);
// navGraph.addArgument("station", builder.build());
// // navController.get
// navController.setGraph(navGraph);
}

Wyświetl plik

@ -13,6 +13,7 @@ import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import cc.pogoda.mobile.pogodacc.R;
import cc.pogoda.mobile.pogodacc.activity.TrendActivity;
public class PressureTrendFragment extends Fragment {
@ -32,23 +33,20 @@ public class PressureTrendFragment extends Fragment {
ViewGroup container, Bundle savedInstanceState) {
pressureTrendViewModel =
new ViewModelProvider(this).get(PressureTrendViewModel.class);
pressureTrendViewModel.setStation(TrendActivity.getStation());
// inflate the main layout of the fragment
View root = inflater.inflate(R.layout.fragment_pressure, container, false);
Bundle arg = this.getArguments();
if (arg != null) {
station = arg.getString("station");
}
station = TrendActivity.getStation();
// load all elements from the layout
stationName = root.findViewById(R.id.textViewPressureTrendStationName);
lastDataTimestamp = root.findViewById(R.id.textViewPressureTrendLastTimestampValue);
currentValue = root.findViewById(R.id.textViewPressureTrendCurrentValue);
twoHours = root.findViewById(R.id.textViewPressureTrendTwoHoursValue);
fourHours = root.findViewById(R.id.textViewPressureTrendTwoHoursValue);
fourHours = root.findViewById(R.id.textViewPressureTrendFourHoursValue);
sixHours = root.findViewById(R.id.textViewPressureTrendSixHoursValue);
eightHours = root.findViewById(R.id.textViewPressureTrendEightHoursVal);
@ -80,7 +78,12 @@ public class PressureTrendFragment extends Fragment {
eightHours.setText(s);
});
//pressureTrendViewModel.updateData();
try {
pressureTrendViewModel.updateData();
}
catch (Exception e) {
;
}
return root;
}

Wyświetl plik

@ -43,10 +43,31 @@ public class PressureTrendViewModel extends ViewModel {
public void updateData() {
Trend trend = trendDao.getStationTrend(station);
// format the time and date according to current locale
String dt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT).format(LocalDateTime.ofEpochSecond(trend.last_timestamp, 0, ZoneOffset.UTC).atOffset(ZoneOffset.UTC).atZoneSameInstant(ZoneOffset.systemDefault()));
if (trend != null) {
// format the time and date according to current locale
String dt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT).format(LocalDateTime.ofEpochSecond(trend.last_timestamp, 0, ZoneOffset.UTC).atOffset(ZoneOffset.UTC).atZoneSameInstant(ZoneOffset.systemDefault()));
lastMeasuremenetTime.postValue(dt);
lastMeasuremenetTime.postValue(dt);
stationName.postValue(trend.displayed_name);
if (!trend.current_qnh_qf.equals("NOT_AVALIABLE")) {
currentValue.postValue(String.format("%.1f hPa", trend.pressure_trend.current_value));
twoHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.two_hours_value));
fourHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.four_hours_value));
sixHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.six_hours_value));
eightHoursValue.postValue(String.format("%.1f hPa", trend.pressure_trend.eight_hours_value));
}
else {
currentValue.postValue("-- hPa");
twoHoursValue.postValue("-- hPa");
fourHoursValue.postValue("-- hPa");
sixHoursValue.postValue("-- hPa");
eightHoursValue.postValue("-- hPa");
}
}
else {
}
}
public void setStation(String station) {

Wyświetl plik

@ -12,24 +12,118 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import org.w3c.dom.Text;
import cc.pogoda.mobile.pogodacc.R;
import cc.pogoda.mobile.pogodacc.activity.TrendActivity;
public class TemperatureTrendFragment extends Fragment {
private TemperatureTrendViewModel temperatureTrendViewModel;
private TextView textViewTemperatureTrendLastTimestampValue;
private TextView textViewTemperatureTrendStationName;
private TextView textViewTemperatureTrendCurrentTValue;
private TextView textViewTemperatureTrendCurrentHValue;
private TextView textViewTemperatureTrendTwoHoursTValue;
private TextView textViewTemperatureTrendTwoHoursHValue;
private TextView textViewTemperatureTrendFourHoursTValue;
private TextView textViewTemperatureTrendFourHoursHValue;
private TextView textViewTemperatureTrendSixHoursTValue;
private TextView textViewTemperatureTrendSixHoursHValue;
private TextView textViewTemperatureTrendTrendEightHoursTVal;
private TextView textViewTemperatureTrendEightHoursHVal;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
String station = TrendActivity.getStation();
temperatureTrendViewModel =
new ViewModelProvider(this).get(TemperatureTrendViewModel.class);
View root = inflater.inflate(R.layout.fragment_temperature, container, false);
final TextView textView = root.findViewById(R.id.text_dashboard);
temperatureTrendViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
//
temperatureTrendViewModel.setStation(station);
textViewTemperatureTrendLastTimestampValue = root.findViewById(R.id.textViewTemperatureTrendLastTimestampValue);
textViewTemperatureTrendStationName = root.findViewById(R.id.textViewTemperatureTrendStationName);
textViewTemperatureTrendCurrentTValue = root.findViewById(R.id.textViewTemperatureTrendCurrentTValue);
textViewTemperatureTrendCurrentHValue = root.findViewById(R.id.textViewTemperatureTrendCurrentHValue);
textViewTemperatureTrendTwoHoursTValue = root.findViewById(R.id.textViewTemperatureTrendTwoHoursTValue);
textViewTemperatureTrendTwoHoursHValue = root.findViewById(R.id.textViewTemperatureTrendTwoHoursHValue);
textViewTemperatureTrendFourHoursTValue = root.findViewById(R.id.textViewTemperatureTrendFourHoursTValue);
textViewTemperatureTrendFourHoursHValue = root.findViewById(R.id.textViewTemperatureTrendFourHoursHValue);
textViewTemperatureTrendSixHoursTValue = root.findViewById(R.id.textViewTemperatureTrendSixHoursTValue);
textViewTemperatureTrendSixHoursHValue = root.findViewById(R.id.textViewTemperatureTrendSixHoursHValue);
textViewTemperatureTrendTrendEightHoursTVal = root.findViewById(R.id.textViewTemperatureTrendTrendEightHoursTVal);
textViewTemperatureTrendEightHoursHVal = root.findViewById(R.id.textViewTemperatureTrendEightHoursHVal);
temperatureTrendViewModel.getDisplayedStationName().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendStationName.setText(s);
});
temperatureTrendViewModel.getLastMeasuremenetTime().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendLastTimestampValue.setText(s);
});
// current values
temperatureTrendViewModel.getCurrentTemperatureValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendCurrentTValue.setText(s);
});
temperatureTrendViewModel.getCurrentHumidityValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendCurrentHValue.setText(s);
});
// two hours ago
temperatureTrendViewModel.getTwoHoursTemperatureValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendTwoHoursTValue.setText(s);
});
temperatureTrendViewModel.getTwoHoursHumidityValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendTwoHoursHValue.setText(s);
});
// four hours ago
temperatureTrendViewModel.getFourHoursTemperatureValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendFourHoursTValue.setText(s);
});
temperatureTrendViewModel.getFourHoursHumidityValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendFourHoursHValue.setText(s);
});
// six hours ago
temperatureTrendViewModel.getSixHoursTemperatureValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendSixHoursTValue.setText(s);
});
temperatureTrendViewModel.getSixHoursHumidityValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendSixHoursHValue.setText(s);
});
//eight hours ago
temperatureTrendViewModel.getEightHoursTemperatureValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendTrendEightHoursTVal.setText(s);
});
temperatureTrendViewModel.getEightHoursHumidityValue().observe(getViewLifecycleOwner(), s -> {
textViewTemperatureTrendEightHoursHVal.setText(s);
});
temperatureTrendViewModel.getData();
return root;
}
}

Wyświetl plik

@ -4,16 +4,142 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.ZoneOffset;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.format.FormatStyle;
import cc.pogoda.mobile.pogodacc.dao.TrendDao;
import cc.pogoda.mobile.pogodacc.type.web.Trend;
public class TemperatureTrendViewModel extends ViewModel {
private MutableLiveData<String> mText;
public void setStation(String station) {
this.station = station;
}
private String station = "";
private TrendDao trendDao;
private MutableLiveData<String> displayedStationName;
public MutableLiveData<String> getDisplayedStationName() {
return displayedStationName;
}
public MutableLiveData<String> getLastMeasuremenetTime() {
return lastMeasuremenetTime;
}
public MutableLiveData<String> getCurrentTemperatureValue() {
return currentTemperatureValue;
}
public MutableLiveData<String> getTwoHoursTemperatureValue() {
return twoHoursTemperatureValue;
}
public MutableLiveData<String> getFourHoursTemperatureValue() {
return fourHoursTemperatureValue;
}
public MutableLiveData<String> getSixHoursTemperatureValue() {
return sixHoursTemperatureValue;
}
public MutableLiveData<String> getEightHoursTemperatureValue() {
return eightHoursTemperatureValue;
}
public MutableLiveData<String> getCurrentHumidityValue() {
return currentHumidityValue;
}
public MutableLiveData<String> getTwoHoursHumidityValue() {
return twoHoursHumidityValue;
}
public MutableLiveData<String> getFourHoursHumidityValue() {
return fourHoursHumidityValue;
}
public MutableLiveData<String> getSixHoursHumidityValue() {
return sixHoursHumidityValue;
}
public MutableLiveData<String> getEightHoursHumidityValue() {
return eightHoursHumidityValue;
}
private MutableLiveData<String> lastMeasuremenetTime;
private MutableLiveData<String> currentTemperatureValue;
private MutableLiveData<String> twoHoursTemperatureValue;
private MutableLiveData<String> fourHoursTemperatureValue;
private MutableLiveData<String> sixHoursTemperatureValue;
private MutableLiveData<String> eightHoursTemperatureValue;
private MutableLiveData<String> currentHumidityValue;
private MutableLiveData<String> twoHoursHumidityValue;
private MutableLiveData<String> fourHoursHumidityValue;
private MutableLiveData<String> sixHoursHumidityValue;
private MutableLiveData<String> eightHoursHumidityValue;
public TemperatureTrendViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment");
trendDao = new TrendDao();
lastMeasuremenetTime = new MutableLiveData<String>();
displayedStationName = new MutableLiveData<String>();
currentTemperatureValue = new MutableLiveData<String>();
twoHoursTemperatureValue = new MutableLiveData<String>();
fourHoursTemperatureValue = new MutableLiveData<String>();
sixHoursTemperatureValue = new MutableLiveData<String>();
eightHoursTemperatureValue = new MutableLiveData<String>();
currentHumidityValue = new MutableLiveData<String>();
twoHoursHumidityValue = new MutableLiveData<String>();
fourHoursHumidityValue = new MutableLiveData<String>();
sixHoursHumidityValue = new MutableLiveData<String>();
eightHoursHumidityValue = new MutableLiveData<String>();
}
public LiveData<String> getText() {
return mText;
public void getData() {
Trend trend = trendDao.getStationTrend(this.station);
if (trend != null) {
// format the time and date according to current locale
String dt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT).format(LocalDateTime.ofEpochSecond(trend.last_timestamp, 0, ZoneOffset.UTC).atOffset(ZoneOffset.UTC).atZoneSameInstant(ZoneOffset.systemDefault()));
lastMeasuremenetTime.postValue(dt);
displayedStationName.postValue(trend.displayed_name);
currentTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.current_value));
twoHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.two_hours_value));
fourHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.four_hours_value));
sixHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.six_hours_value));
eightHoursTemperatureValue.postValue(String.format("%.1f °C", trend.temperature_trend.eight_hours_value));
if (!trend.current_humidity_qf.equals("NOT_AVALIABLE")) {
currentHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.current_value));
twoHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.two_hours_value));
fourHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.four_hours_value));
sixHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.six_hours_value));
eightHoursHumidityValue.postValue(String.format("%.1f %%", trend.humidity_trend.eight_hours_value));
}
else {
currentHumidityValue.postValue(String.format("-- %%"));
twoHoursHumidityValue.postValue(String.format("-- %%"));
fourHoursHumidityValue.postValue(String.format("-- %%"));
sixHoursHumidityValue.postValue(String.format("-- %%"));
eightHoursHumidityValue.postValue(String.format("-- %%"));
}
}
else {
;
}
}
}

Wyświetl plik

@ -7,37 +7,114 @@ import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import cc.pogoda.mobile.pogodacc.R;
import cc.pogoda.mobile.pogodacc.activity.TrendActivity;
public class WindTrendFragment extends Fragment {
private WindTrendViewModel windTrendViewModel;
TextView textViewWindTrendStationName = null;
TextView textViewWindTrendLastTimestampValue = null;
TextView textViewWindTrendCurrentAverageValue = null;
TextView textViewWindTrendCurrentGustValue = null;
TextView textViewWindTrendTwoHoursAverageValue = null;
TextView textViewWindTrendTwoHoursGustsValue = null;
//TextView eightHours = null;
TextView textViewWindTrendFourHoursAverageValue = null;
TextView textViewWindTrendFourHoursGustValue = null;
TextView textViewWindTrendSixHoursAverageValue = null;
TextView textViewWindTrendSixHoursGustValue = null;
TextView textViewWindTrendEightHoursAverageVal = null;
TextView textViewWindTrendEightHoursGustsVal = null;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
String station = "";
String station = TrendActivity.getStation();
windTrendViewModel =
new ViewModelProvider(this).get(WindTrendViewModel.class);
View root = inflater.inflate(R.layout.fragment_wind, container, false);
final TextView textView = root.findViewById(R.id.text_home);
windTrendViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
Bundle arg = this.getArguments();
if (arg != null) {
station = arg.getString("station");
}
windTrendViewModel.setStation(TrendActivity.getStation());
// load layoyt elements
textViewWindTrendStationName = root.findViewById(R.id.textViewTemperatureTrendStationName);
textViewWindTrendLastTimestampValue = root.findViewById(R.id.textViewTemperatureTrendLastTimestampValue);
textViewWindTrendCurrentAverageValue = root.findViewById(R.id.textViewTemperatureTrendCurrentTValue);
textViewWindTrendCurrentGustValue = root.findViewById(R.id.textViewTemperatureTrendCurrentHValue);
textViewWindTrendTwoHoursAverageValue = root.findViewById(R.id.textViewTemperatureTrendTwoHoursTValue);
textViewWindTrendTwoHoursGustsValue = root.findViewById(R.id.textViewTemperatureTrendTwoHoursHValue);
textViewWindTrendFourHoursAverageValue = root.findViewById(R.id.textViewTemperatureTrendFourHoursTValue);
textViewWindTrendFourHoursGustValue = root.findViewById(R.id.textViewTemperatureTrendFourHoursHValue);
textViewWindTrendSixHoursAverageValue = root.findViewById(R.id.textViewTemperatureTrendSixHoursTValue);
textViewWindTrendSixHoursGustValue = root.findViewById(R.id.textViewTemperatureTrendSixHoursHValue);
textViewWindTrendEightHoursAverageVal = root.findViewById(R.id.textViewTemperatureTrendTrendEightHoursTVal);
textViewWindTrendEightHoursGustsVal = root.findViewById(R.id.textViewTemperatureTrendEightHoursHVal);
windTrendViewModel.getDisplayedStationName().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendStationName.setText(s);
});
windTrendViewModel.getLastMeasuremenetTime().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendLastTimestampValue.setText(s);
});
// current values
windTrendViewModel.getCurrentMeanValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendCurrentAverageValue.setText(s);
});
windTrendViewModel.getCurrentGustValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendCurrentGustValue.setText(s);
});
// two hours ago
windTrendViewModel.getTwoHoursMeanValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendTwoHoursAverageValue.setText(s);
});
windTrendViewModel.getTwoHoursGustValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendTwoHoursGustsValue.setText(s);
});
// four hours ago
windTrendViewModel.getFourHoursMeanValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendFourHoursAverageValue.setText(s);
});
windTrendViewModel.getFourHoursGustValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendFourHoursGustValue.setText(s);
});
// six hours ago
windTrendViewModel.getSixHoursMeanValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendSixHoursAverageValue.setText(s);
});
windTrendViewModel.getSixHoursGustValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendSixHoursGustValue.setText(s);
});
//eight hours ago
windTrendViewModel.getEightHoursMeanValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendEightHoursAverageVal.setText(s);
});
windTrendViewModel.getEightHoursGustValue().observe(getViewLifecycleOwner(), s -> {
textViewWindTrendEightHoursGustsVal.setText(s);
});
windTrendViewModel.updateData();
return root;
}

Wyświetl plik

@ -4,16 +4,162 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.ZoneOffset;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.format.FormatStyle;
import cc.pogoda.mobile.pogodacc.config.AppConfiguration;
import cc.pogoda.mobile.pogodacc.dao.TrendDao;
import cc.pogoda.mobile.pogodacc.type.web.Trend;
public class WindTrendViewModel extends ViewModel {
private MutableLiveData<String> mText;
public void setStation(String station) {
this.station = station;
}
private String station = "";
private TrendDao trendDao;
private MutableLiveData<String> displayedStationName;
private MutableLiveData<String> lastMeasuremenetTime;
private MutableLiveData<String> currentMeanValue;
private MutableLiveData<String> twoHoursMeanValue;
private MutableLiveData<String> fourHoursMeanValue;
private MutableLiveData<String> sixHoursMeanValue;
private MutableLiveData<String> eightHoursMeanValue;
private MutableLiveData<String> currentGustValue;
private MutableLiveData<String> twoHoursGustValue;
private MutableLiveData<String> fourHoursGustValue;
private MutableLiveData<String> sixHoursGustValue;
private MutableLiveData<String> eightHoursGustValue;
public MutableLiveData<String> getDisplayedStationName() {
return displayedStationName;
}
public MutableLiveData<String> getLastMeasuremenetTime() {
return lastMeasuremenetTime;
}
public MutableLiveData<String> getCurrentMeanValue() {
return currentMeanValue;
}
public MutableLiveData<String> getTwoHoursMeanValue() {
return twoHoursMeanValue;
}
public MutableLiveData<String> getFourHoursMeanValue() {
return fourHoursMeanValue;
}
public MutableLiveData<String> getSixHoursMeanValue() {
return sixHoursMeanValue;
}
public MutableLiveData<String> getEightHoursMeanValue() {
return eightHoursMeanValue;
}
public MutableLiveData<String> getCurrentGustValue() {
return currentGustValue;
}
public MutableLiveData<String> getTwoHoursGustValue() {
return twoHoursGustValue;
}
public MutableLiveData<String> getFourHoursGustValue() {
return fourHoursGustValue;
}
public MutableLiveData<String> getSixHoursGustValue() {
return sixHoursGustValue;
}
public MutableLiveData<String> getEightHoursGustValue() {
return eightHoursGustValue;
}
public WindTrendViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is home fragment");
trendDao = new TrendDao();
displayedStationName = new MutableLiveData<String>();
lastMeasuremenetTime = new MutableLiveData<String>();
currentMeanValue = new MutableLiveData<String>();
twoHoursMeanValue = new MutableLiveData<String>();
fourHoursMeanValue = new MutableLiveData<String>();
sixHoursMeanValue = new MutableLiveData<String>();
eightHoursMeanValue = new MutableLiveData<String>();
currentGustValue = new MutableLiveData<String>();
twoHoursGustValue = new MutableLiveData<String>();
fourHoursGustValue = new MutableLiveData<String>();
sixHoursGustValue = new MutableLiveData<String>();
eightHoursGustValue = new MutableLiveData<String>();
}
public LiveData<String> getText() {
return mText;
public void updateData() {
Trend trend = trendDao.getStationTrend(station);
// format the time and date according to current locale
String dt = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.SHORT).format(LocalDateTime.ofEpochSecond(trend.last_timestamp, 0, ZoneOffset.UTC).atOffset(ZoneOffset.UTC).atZoneSameInstant(ZoneOffset.systemDefault()));
if (trend != null) {
lastMeasuremenetTime.postValue(dt);
displayedStationName.postValue(trend.displayed_name);
if (!trend.current_wind_qf.equals("NOT_AVALIABLE")) {
if (AppConfiguration.replaceMsWithKnots) {
// if knots
currentMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.current_value));
twoHoursMeanValue.postValue(String.format("%.0f kts", trend.average_wind_speed_trend.two_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 {
currentMeanValue.postValue("--");
twoHoursMeanValue.postValue("--");
fourHoursMeanValue.postValue("--");
sixHoursMeanValue.postValue("--");
eightHoursMeanValue.postValue("--");
currentGustValue.postValue("--");
twoHoursGustValue.postValue("--");
fourHoursGustValue.postValue("--");
sixHoursGustValue.postValue("--");
eightHoursGustValue.postValue("--");
}
}
}
}

Wyświetl plik

@ -2,5 +2,5 @@ package cc.pogoda.mobile.pogodacc.type.web;
public class ListOfStationData {
public StationData[] listOfStationData;
public StationData[] list_of_station_data;
}

Wyświetl plik

@ -4,6 +4,8 @@ public class Trend {
public long last_timestamp;
public String displayed_name;
public String current_temperature_qf;
public String current_qnh_qf;

Wyświetl plik

@ -2,9 +2,11 @@ package cc.pogoda.mobile.pogodacc.web;
import cc.pogoda.mobile.pogodacc.type.web.Trend;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface TrendConsumer {
@GET("meteo_backend/trend/")
Call<Trend> getTrendForStation(@Query("station")String station);
}

Wyświetl plik

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Alegreya Sans&amp;weight=300"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

Wyświetl plik

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Alegreya Sans SC&amp;weight=500"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

Wyświetl plik

@ -23,6 +23,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/last_data_timestamp"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
@ -32,11 +33,14 @@
android:id="@+id/textViewPressureTrendLastTimestampValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="140dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewPressureTrendLastTimestamp" />
@ -46,6 +50,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/current_value"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
@ -69,6 +74,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h2_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewPressureTrendCurrentValue" />
@ -90,6 +96,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h4_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewPressureTrendTwoHoursValue" />
@ -111,6 +118,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h6_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewPressureTrendFourHoursValue" />
@ -132,6 +140,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h8_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewPressureTrendSixHoursValue" />

Wyświetl plik

@ -7,16 +7,250 @@
tools:context=".activity.trend.temperature.TemperatureTrendFragment">
<TextView
android:id="@+id/text_dashboard"
android:layout_width="match_parent"
android:id="@+id/textViewTemperatureTrendStationName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="128dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textSize="38sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textViewTemperatureTrendLastTimestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/last_data_timestamp"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendStationName" />
<TextView
android:id="@+id/textViewTemperatureTrendLastTimestampValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendLastTimestamp" />
<TextView
android:id="@+id/textViewTemperatureTrendCurrent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/current_value"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendLastTimestampValue" />
<TextView
android:id="@+id/textViewTemperatureTrendCurrentTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="30sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendCurrentHValue"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendTLabel"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrent" />
<TextView
android:id="@+id/textViewTemperatureTrendCurrentHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="32dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="30sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendHLabel"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendCurrentTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrent" />
<TextView
android:id="@+id/textViewTemperatureTrendTwoHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h2_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrentTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendTwoHoursTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendTwoHoursHValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHours" />
<TextView
android:id="@+id/textViewTemperatureTrendTwoHoursHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendTwoHoursTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHours" />
<TextView
android:id="@+id/textViewTemperatureTrendFourHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h4_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHoursTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendFourHoursTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendFourHoursHValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHours" />
<TextView
android:id="@+id/textViewTemperatureTrendFourHoursHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendFourHoursTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHours" />
<TextView
android:id="@+id/textViewTemperatureTrendSixHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h6_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHoursTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendSixHoursTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendSixHoursHValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHours" />
<TextView
android:id="@+id/textViewTemperatureTrendSixHoursHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendSixHoursTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHours" />
<TextView
android:id="@+id/textViewTemperatureTrendEightHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h8_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHoursTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendTrendEightHoursTVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendEightHoursHVal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendEightHours" />
<TextView
android:id="@+id/textViewTemperatureTrendEightHoursHVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendTrendEightHoursTVal"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendEightHours" />
<TextView
android:id="@+id/textViewTemperatureTrendTLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/temperature"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewTemperatureTrendCurrent" />
<TextView
android:id="@+id/textViewTemperatureTrendHLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/humidity"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewTemperatureTrendCurrent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -7,16 +7,250 @@
tools:context=".activity.trend.wind.WindTrendFragment">
<TextView
android:id="@+id/text_home"
android:layout_width="match_parent"
android:id="@+id/textViewTemperatureTrendStationName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="128dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:textSize="38sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textViewTemperatureTrendLastTimestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/last_data_timestamp"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendStationName" />
<TextView
android:id="@+id/textViewTemperatureTrendLastTimestampValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendLastTimestamp" />
<TextView
android:id="@+id/textViewTemperatureTrendCurrent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/current_value"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendLastTimestampValue" />
<TextView
android:id="@+id/textViewTemperatureTrendCurrentTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="30sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendCurrentHValue"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendTLabel"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrent" />
<TextView
android:id="@+id/textViewTemperatureTrendCurrentHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="32dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="30sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendHLabel"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendCurrentTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrent" />
<TextView
android:id="@+id/textViewTemperatureTrendTwoHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h2_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrentTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendTwoHoursTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendTwoHoursHValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHours" />
<TextView
android:id="@+id/textViewTemperatureTrendTwoHoursHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendTwoHoursTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHours" />
<TextView
android:id="@+id/textViewTemperatureTrendFourHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h4_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHoursTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendFourHoursTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendFourHoursHValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHours" />
<TextView
android:id="@+id/textViewTemperatureTrendFourHoursHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendFourHoursTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHours" />
<TextView
android:id="@+id/textViewTemperatureTrendSixHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="17dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h6_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHoursTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendSixHoursTValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendSixHoursHValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHours" />
<TextView
android:id="@+id/textViewTemperatureTrendSixHoursHValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendSixHoursTValue"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHours" />
<TextView
android:id="@+id/textViewTemperatureTrendEightHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h8_value"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHoursTValue" />
<TextView
android:id="@+id/textViewTemperatureTrendTrendEightHoursTVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/textViewTemperatureTrendEightHoursHVal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendEightHours" />
<TextView
android:id="@+id/textViewTemperatureTrendEightHoursHVal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:fontFamily="sans-serif-black"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textViewTemperatureTrendTrendEightHoursTVal"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendEightHours" />
<TextView
android:id="@+id/textViewTemperatureTrendTLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/wind_speed"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewTemperatureTrendCurrent" />
<TextView
android:id="@+id/textViewTemperatureTrendHLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/wind_gusts"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewTemperatureTrendCurrent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -5,6 +5,10 @@
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_wind">
<action
android:id="@+id/action_global_mobile_navigation"
app:destination="@id/navigation_wind" />
<fragment
android:id="@+id/navigation_wind"
android:name="cc.pogoda.mobile.pogodacc.activity.trend.wind.WindTrendFragment"
@ -13,6 +17,13 @@
<argument
android:name="station"
app:argType="string" />
<action
android:id="@+id/action_navigation_wind_to_navigation_temperature"
app:destination="@id/navigation_temperature">
<argument
android:name="station"
app:argType="string" />
</action>
</fragment>
<fragment
@ -23,6 +34,13 @@
<argument
android:name="station"
app:argType="string" />
<action
android:id="@+id/action_navigation_temperature_to_navigation_pressure"
app:destination="@id/navigation_pressure">
<argument
android:name="station"
app:argType="string" />
</action>
</fragment>
<fragment
@ -32,6 +50,14 @@
tools:layout="@layout/fragment_pressure" >
<argument
android:name="station"
app:argType="string" />
app:argType="string">
</argument>
<action
android:id="@+id/action_navigation_pressure_to_navigation_wind"
app:destination="@id/navigation_wind">
<argument
android:name="station"
app:argType="string" />
</action>
</fragment>
</navigation>

Wyświetl plik

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>@array/com_google_android_gms_fonts_certs_dev</item>
<item>@array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
</item>
</string-array>
<string-array name="com_google_android_gms_fonts_certs_prod">
<item>
MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
</item>
</string-array>
</resources>

Wyświetl plik

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>@font/alegreya_sans_light</item>
<item>@font/alegreya_sans_sc_medium</item>
</array>
</resources>

Wyświetl plik

@ -6,6 +6,7 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files