Porównaj commity

...

18 Commity
0.10 ... master

Autor SHA1 Wiadomość Data
Mateusz Lubecki 4641945295 better colours in night mode 2023-10-03 11:32:57 +02:00
Mateusz Lubecki f8dbcff362 compileSdkVersion increased to 31 2023-02-07 16:57:04 +01:00
Mateusz Lubecki 4f192e9a15 application icon 2022-07-15 20:13:29 +02:00
Mateusz Lubecki b6123ec677 version 2022-06-24 21:28:34 +02:00
Rafal Woloszyn 4c3b17fbfe
feat: Search view in all station activity (#4)
* feat: Search view in all station activity

* Fix searchbar width and animation
2022-06-24 21:08:58 +02:00
Mateusz Lubecki a2dd3149e9 version number increased in gradle config 2022-05-11 17:26:53 +02:00
SP8EBC ea23e7b5fb
Do not wait for network I/O to complete during activity creation (#3)
* downloading available params and summary refactored to separate thread

* downloading available parameters only when they are required instead of all at once during startup

* magic numbers extracted to separate static and final ints

* displaying loading prompt in values row on favourites list

* application renamed
2022-05-11 17:04:21 +02:00
Mateusz Lubecki 57fe1bfbfd speed up FavouritesStationSummaryUpdater in case of empty favs list 2022-05-08 17:26:47 +02:00
Mateusz Lubecki 5a211da64e credits added 2022-05-08 17:02:48 +02:00
Rafal Woloszyn 34d43825f9
Add JobIntentService for getting list of all stations + add refresh l… (#2)
* Add JobIntentService for getting list of all stations + add refresh listners

* Fix favourites list while all stations is still refreshing

* Add PL translation string

* Remove all files from commit.

* null reference access check in AvailableParametersDao, required to solve crash on very slow connection

Co-authored-by: rwoloszyn <rafal.woloszyn@iqvia.com>
2022-05-08 16:42:45 +02:00
Mateusz Lubecki 6bcdf9fdbb more fixing of handling http errors during updating favourites list 2022-05-03 19:56:00 +02:00
Mateusz Lubecki 1c7c805d58 Merge branch 'master' of github.com:SP8EBC/MeteoSystem 2022-05-03 17:39:29 +02:00
Mateusz Lubecki 89b08a3d11 bugfix in FavouritesStationDetailsOnListUpdater which sometimes crashed the application on ontry to favs list 2022-05-03 17:38:36 +02:00
SP8EBC 898e85d3bc
Update README.md 2022-01-09 22:19:48 +01:00
SP8EBC 1294a51f64
Update README.md 2022-01-09 22:17:33 +01:00
SP8EBC 1ab918a996
Update README.md 2022-01-07 09:38:30 +01:00
Mateusz Lubecki c15939a415 increased versionCode in gradle configuration 2022-01-07 09:22:18 +01:00
Mateusz Lubecki ed675f0233 changes to ux according to google play review 2022-01-07 09:20:48 +01:00
83 zmienionych plików z 1324 dodań i 488 usunięć

Wyświetl plik

@ -1 +0,0 @@
Pogoda.cc

Wyświetl plik

@ -12,6 +12,6 @@
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-12-10T12:55:19.222514Z" />
<timeTargetWasSelectedWithDropDown value="2023-10-01T07:46:55.840082Z" />
</component>
</project>

Wyświetl plik

@ -4,6 +4,7 @@
<option name="filePathToZoomLevelMap">
<map>
<entry key="../../../../../layout/custom_preview.xml" value="0.2171875" />
<entry key="app/src/main/res/drawable/button_border.xml" value="0.38125" />
<entry key="app/src/main/res/layout/activity_all_stations.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_all_stations_linear_layout.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_export_data.xml" value="0.25" />
@ -11,14 +12,19 @@
<entry key="app/src/main/res/layout/activity_favourites_empty.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_favourites_linear_layout.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_favourites_linear_layout_data.xml" value="0.5" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.5451010886469674" />
<entry key="app/src/main/res/layout/activity_settings.xml" value="0.67" />
<entry key="app/src/main/res/layout/activity_station_details.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_station_details.xml" value="0.33" />
<entry key="app/src/main/res/layout/activity_station_details_plots.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_station_details_summary.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/layout/activity_station_details_wind_rose.xml" value="0.5" />
<entry key="app/src/main/res/layout/activity_trend.xml" value="0.3645833333333333" />
<entry key="app/src/main/res/layout/fragment_pressure.xml" value="0.3645833333333333" />
<entry key="app/src/main/res/layout/fragment_temperature.xml" value="0.3645833333333333" />
<entry key="app/src/main/res/layout/fragment_wind.xml" value="0.3645833333333333" />
<entry key="app/src/main/res/layout/spinner_item.xml" value="0.28306159420289856" />
<entry key="app/src/main/res/menu/main_activity_menu.xml" value="0.3651041666666667" />
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_icon.xml" value="0.3335" />
</map>
</option>
</component>

Wyświetl plik

@ -1,3 +1,25 @@
# MeteoSystem
An Android application which displays meteo information from few APRS weather stations. Now mostly from Beskids mountins in Poland, but let's hope that it will widespread a little bit firther ;) The app was initialy called Pogoda.cc but then it was renamed to something more suitable for international use.
Google Play link to this software: https://play.google.com/store/apps/details?id=cc.pogoda.mobile.meteosystem
A list of currently avaliable weather stations (with APRS callsign in brackets) are below, with english or german site name after the comma. As for now all of them are located in southern Poland, mostly in Beskids Mountains but also in Low Beskids (located in SW Poland) and Oppelner Schlesien land.
- Skrzyczne (SR9NSK), Rauhkogel
- Jaworzyna Skrzyczneńska (SR9NSK-5)
- Kozia Góra (SR9WXS), Ziegenbock
- Magurka Wilkowicka (SR9WXM)
- Bezmiechowa Górna (SR8WXB)
- Góra Chełm (SR9WXG)
- Dukla, Wzgórze 534 (SR8WXD)
- Polska Nowa Wieś (SR6WXP), Polnisch Neudorf
- Leskowiec (SR9WXL)
- Markowe Szczawiny (SR9WXM)
- Jezioro Żywieckie (SR9WXZ)
- Międzybrodzie Żywieckie
This application is a part of bigger weather station system. The rest of it is formed by:
1. API: https://github.com/SP8EBC/meteo_backend
2. Receiving data from stations via APRS and storing in DB: https://github.com/SP8EBC/aprs2rrd-se
3. Firmware for APRS weather station controller and it's design: https://github.com/SP8EBC/ParaTNC

Wyświetl plik

@ -3,7 +3,7 @@ plugins {
}
android {
compileSdkVersion 30
compileSdkVersion 33
buildToolsVersion "30.0.3"
apply plugin: "androidx.navigation.safeargs"
@ -11,9 +11,9 @@ android {
defaultConfig {
applicationId "cc.pogoda.mobile.meteosystem"
minSdkVersion 24
targetSdkVersion 30
versionCode 10
versionName "0.10-beta"
targetSdkVersion 33
versionCode 19
versionName "0.19"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Wyświetl plik

@ -6,41 +6,73 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission
android:name="android.permission.MANAGE_DOCUMENTS"
tools:ignore="ProtectedPermissions" />
<application
android:name=".Main"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_icon"
android:icon="@drawable/sun_rays_cloud"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_icon_foreground"
android:supportsRtl="true"
android:name=".Main"
android:theme="@style/Theme.Meteosystem">
<service
android:name=".service.GetAllStationsService"
android:permission="android.permission.BIND_JOB_SERVICE"/>
<activity
android:name="cc.pogoda.mobile.meteosystem.activity.SettingsActivity"
android:name=".activity.SettingsActivity"
android:exported="true" />
<activity
android:name="cc.pogoda.mobile.meteosystem.activity.ExportDataActivity"
android:name=".activity.ExportDataActivity"
android:exported="true" />
<activity
android:name="cc.pogoda.mobile.meteosystem.activity.TrendActivity"
android:name=".activity.TrendActivity"
android:exported="true"
android:label="@string/title_activity_trend" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsWindRoseActivity" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsPlotsWind" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsPlotsDirection" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsPlotsTemperature" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsPlotsHumidity" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsSummaryActivity" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.StationDetailsActivity" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.AllStationsActivity" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.FavouritesActivity" />
<activity android:name="cc.pogoda.mobile.meteosystem.activity.MainActivity">
<activity
android:name=".activity.StationDetailsWindRoseActivity"
android:exported="true" />
<activity
android:name=".activity.StationDetailsPlotsWind"
android:exported="true" />
<activity
android:name=".activity.StationDetailsPlotsDirection"
android:exported="true" />
<activity
android:name=".activity.StationDetailsPlotsTemperature"
android:exported="true" />
<activity
android:name=".activity.StationDetailsPlotsHumidity"
android:exported="true" />
<activity
android:name=".activity.StationDetailsSummaryActivity"
android:exported="true" />
<activity
android:name=".activity.StationDetailsActivity"
android:exported="true" />
<activity
android:name=".activity.AllStationsActivity"
android:launchMode="singleTop"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity
android:name=".activity.FavouritesActivity"
android:exported="true" />
<activity
android:name=".activity.MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Wyświetl plik

@ -2,9 +2,9 @@ package cc.pogoda.mobile.meteosystem;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.Intent;
import androidx.annotation.NonNull;
import com.jakewharton.threetenabp.AndroidThreeTen;
import org.greenrobot.eventbus.EventBus;
@ -17,19 +17,22 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import cc.pogoda.mobile.meteosystem.activity.updater.FavouritesStationSummaryUpdater;
import cc.pogoda.mobile.meteosystem.config.AppConfiguration;
import cc.pogoda.mobile.meteosystem.dao.AllStationsDao;
import cc.pogoda.mobile.meteosystem.activity.updater.thread.FavouritesStationSummaryUpdaterThread;
import cc.pogoda.mobile.meteosystem.file.ConfigurationFile;
import cc.pogoda.mobile.meteosystem.file.FavouritiesFile;
import cc.pogoda.mobile.meteosystem.file.FileNames;
import cc.pogoda.mobile.meteosystem.service.GetAllStationsService;
import cc.pogoda.mobile.meteosystem.type.AllStationsReceivedEvent;
import cc.pogoda.mobile.meteosystem.type.AvailableParameters;
import cc.pogoda.mobile.meteosystem.type.ThemeColours;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
import cc.pogoda.mobile.meteosystem.type.WeatherStationListEvent;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
public class Main extends Application {
private static String TAG = Main.class.getSimpleName();
private File directory;
@ -63,12 +66,26 @@ public class Main extends Application {
* This download summary for all stations stored on favourites list and stores results
* in 'HashMap<String, Summary> stationSystemNameToSummary'
*/
private FavouritesStationSummaryUpdater favsSummaryUpdater = null;
private FavouritesStationSummaryUpdaterThread favsSummaryUpdater = null;
/**
* This map stores summary for all favourites station
*/
private HashMap<String, Summary> stationSystemNameToSummary = null;
private HashMap<String, Summary> hashmapFavStationSystemNameToSummary = null;
/**
* This hash map stores available parameters for all stations defined in the system
*/
private HashMap<String, AvailableParameters> hashmapAllStationSystemNameToAvailParameters = null;
public ThemeColours getThemeColours() {
return themeColours;
}
/**
* Used everywhere, where a colour of any element is set programatically (not globally from the theme)
*/
private ThemeColours themeColours;
public File getDirectory() {
return directory;
@ -82,8 +99,12 @@ public class Main extends Application {
return confFile;
}
public HashMap<String, Summary> getStationSystemNameToSummary() {
return stationSystemNameToSummary;
public HashMap<String, Summary> getHashmapFavStationSystemNameToSummary() {
return hashmapFavStationSystemNameToSummary;
}
public HashMap<String, AvailableParameters> getHashmapAllStationSystemNameToAvailParameters() {
return hashmapAllStationSystemNameToAvailParameters;
}
@Override
@ -119,23 +140,26 @@ public class Main extends Application {
confFile.restoreFromFile();
stationSystemNameToSummary = new HashMap<>();
hashmapFavStationSystemNameToSummary = new HashMap<>();
hashmapAllStationSystemNameToAvailParameters = new HashMap<>();
fileNames = new FileNames(ctx);
favouritiesFile = new FavouritiesFile(fileNames);
// download all stations from API
listOfAllStations = new AllStationsDao().getAllStations();
themeColours = new ThemeColours();
Logger.info("[Main][onCreate][listOfAllStations.size() = " + listOfAllStations.size() + "]");
// Download all stations from API in background via JobIntentService. Results are send
//back with Broadcast receiver.
startGetAllStationsService();
// recreate list of favorites
recreateListOfFavs();
favsSummaryUpdater = new FavouritesStationSummaryUpdater(stationSystemNameToSummary);
favsSummaryUpdater = new FavouritesStationSummaryUpdaterThread(hashmapFavStationSystemNameToSummary, hashmapAllStationSystemNameToAvailParameters);
favsSummaryUpdater.start(100);
favsSummaryUpdater.start(50);
// if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
// Logger.debug("[Main][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
@ -149,8 +173,20 @@ public class Main extends Application {
// }
}
@Override
public void onTerminate() {
super.onTerminate();
EventBus.getDefault().unregister(this);
}
private void recreateListOfFavs() {
if(listOfAllStations == null) {
Logger.info("[listOfAllStations=null]");
return;
}
// check if this is a first call after application start
if (favs == null) {
favs = favouritiesFile.loadFavourites();
@ -194,7 +230,7 @@ public class Main extends Application {
// as a list does not make a copy of the object. It (ArrayList) keeps
// only a reference to an object
stationSystemNameToSummary.put(fromAllStations.getSystemName(), null);
hashmapFavStationSystemNameToSummary.put(fromAllStations.getSystemName(), null);
}
}
@ -202,7 +238,7 @@ public class Main extends Application {
@Subscribe(threadMode = ThreadMode.MAIN)
public void weatherStationListHandler(WeatherStationListEvent serviceEvent) {
Logger.info("[Main][weatherStationListHandler][serviceEvent = " + serviceEvent + "]");
Logger.info("[serviceEvent = " + serviceEvent + "]");
switch (serviceEvent.getEventReason()) {
@ -243,22 +279,20 @@ public class Main extends Application {
}
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void allStationsEventHandler(@NonNull AllStationsReceivedEvent event) {
Logger.info("[event = " + event.toString() +"]");
this.listOfAllStations = event.getStations();
recreateListOfFavs();
}
public boolean listOfAllStationsReady() {
if (listOfAllStations != null && listOfAllStations.size() > 0) {
return true;
}
else {
return false;
}
return listOfAllStations != null && listOfAllStations.size() > 0;
}
public boolean listOfFavsReady() {
if (favs != null/* && favs.size() > 0*/) {
return true;
}
else {
return false;
}
/* && favs.size() > 0*/
return favs != null;
}
public boolean checkIsOnFavsList(String _system_name) {
@ -274,4 +308,10 @@ public class Main extends Application {
return out;
}
public void startGetAllStationsService () {
Intent mIntent = new Intent(this, GetAllStationsService.class);
GetAllStationsService.enqueueWork(this, mIntent);
}
}

Wyświetl plik

@ -1,48 +1,152 @@
package cc.pogoda.mobile.meteosystem.activity;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.widget.SearchView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import cc.pogoda.mobile.meteosystem.Main;
import cc.pogoda.mobile.meteosystem.R;
import cc.pogoda.mobile.meteosystem.adapter.WeatherStationRecyclerViewAdapter;
import cc.pogoda.mobile.meteosystem.type.AllStationsReceivedEvent;
import cc.pogoda.mobile.meteosystem.type.ParceableFavsCallReason;
import cc.pogoda.mobile.meteosystem.type.StartStationsRefreshEvent;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
import android.os.Bundle;
import java.util.List;
public class AllStationsActivity extends AppCompatActivity {
RecyclerView recyclerViewAllStations;
Summary test;
private List<WeatherStation> allStationsList;
Main main;
private SwipeRefreshLayout refreshLayout;
private WeatherStationRecyclerViewAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_all_stations);
main = (Main) getApplication();
//allStationsList = getIntent().getParcelableExtra("all_stations");
allStationsList = main.getListOfAllStations();
recyclerViewAllStations = findViewById(R.id.recyclerViewAllStations);
WeatherStationRecyclerViewAdapter adapter = null;
adapter = new WeatherStationRecyclerViewAdapter(allStationsList, this, ParceableFavsCallReason.Reason.ALL_STATIONS);
refreshLayout = findViewById(R.id.refreshAllStationsView);
refreshLayout.setOnRefreshListener(
() -> ((Main) getApplication()).startGetAllStationsService()
);
RecyclerView recyclerViewAllStations = findViewById(R.id.recyclerViewAllStations);
adapter = new WeatherStationRecyclerViewAdapter(
new LinkedList<>(), this, ParceableFavsCallReason.Reason.ALL_STATIONS);
recyclerViewAllStations.setAdapter(adapter);
recyclerViewAllStations.setLayoutManager(new LinearLayoutManager(this));
handleIntent(getIntent());
}
private void handleIntent(Intent intent) {
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
filterStationList(query);
}
}
private void filterStationList(String searchQuery) {
if (allStationsList == null || allStationsList.isEmpty())
return;
if(searchQuery.isEmpty())
adapter.update(allStationsList);
List<WeatherStation> newList = allStationsList.stream()
.filter(station -> station.getDisplayedName()
.toLowerCase(Locale.ROOT).contains(searchQuery.toLowerCase(Locale.ROOT)))
.collect(Collectors.toList());
adapter.update(newList);
}
@Override
protected void onResume() {
super.onResume();
EventBus.getDefault().register(this);
updateStationList(((Main) getApplication()).getListOfAllStations());
}
@Override
protected void onPause() {
super.onPause();
EventBus.getDefault().unregister(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_all_stations, menu);
// Associate searchable configuration with the SearchView
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView =
(SearchView) menu.findItem(R.id.search).getActionView();
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
filterStationList(s);
return false;
}
});
searchView.setOnCloseListener(() -> {
adapter.update(allStationsList);
return false;
});
return true;
}
private void updateStationList(List<WeatherStation> stations) {
if (stations != null) {
refreshLayout.setRefreshing(false);
allStationsList = stations;
adapter.update(stations);
} else {
EventBus.getDefault().post(new StartStationsRefreshEvent());
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void allStationsEventHandler(@NonNull AllStationsReceivedEvent event) {
updateStationList(event.getStations());
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void startStationsRefreshEventHandler(@NonNull StartStationsRefreshEvent event) {
refreshLayout.setRefreshing(true);
Toast.makeText(this, R.string.refreshing_station_list, Toast.LENGTH_SHORT).show();
}
}

Wyświetl plik

@ -1,33 +1,50 @@
package cc.pogoda.mobile.meteosystem.activity;
import android.app.PendingIntent;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.tinylog.Logger;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import cc.pogoda.mobile.meteosystem.Main;
import cc.pogoda.mobile.meteosystem.R;
import cc.pogoda.mobile.meteosystem.adapter.WeatherStationRecyclerViewAdapter;
import cc.pogoda.mobile.meteosystem.type.AllStationsReceivedEvent;
import cc.pogoda.mobile.meteosystem.type.ParceableFavsCallReason;
import cc.pogoda.mobile.meteosystem.type.ParceableStationsList;
import cc.pogoda.mobile.meteosystem.type.StartStationsRefreshEvent;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
public class FavouritesActivity extends AppCompatActivity {
Main main;
RecyclerView recyclerViewFavourites;
List<WeatherStation> favourites, sortedFavourites;
private SwipeRefreshLayout refreshLayout;
List<WeatherStation> favourites = new LinkedList<>();
List<WeatherStation> sortedFavourites;
boolean sorting = false;
@ -35,14 +52,11 @@ public class FavouritesActivity extends AppCompatActivity {
ParceableFavsCallReason callReason;
private class WxStationComparator implements Comparator<WeatherStation> {
private static class WxStationComparator implements Comparator<WeatherStation> {
@Override
public int compare(WeatherStation station, WeatherStation t1) {
String name = station.getDisplayedName();
String name1 = t1.getDisplayedName();
return (name.compareTo(name1));
return (station.getDisplayedName().compareTo(t1.getDisplayedName()));
}
}
@ -82,8 +96,6 @@ public class FavouritesActivity extends AppCompatActivity {
recyclerViewFavourites.setAdapter(adapter);
}
break;
case R.id.fav_remove_noext:
break;
}
@ -93,43 +105,68 @@ public class FavouritesActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_favourites);
//favourites = getIntent().getParcelableExtra("favs");
main = (Main)getApplication();
favourites = main.getFavs();
sortedFavourites = new ArrayList<>(favourites);
sortedFavourites.sort(new WxStationComparator());
recyclerViewFavourites = findViewById(R.id.recyclerViewFavourites);
refreshLayout = findViewById(R.id.refreshViewFavourites);
refreshLayout.setOnRefreshListener(
() -> ((Main) getApplication()).startGetAllStationsService()
);
callReason = getIntent().getParcelableExtra("callReason");
adapter = new WeatherStationRecyclerViewAdapter(favourites,
this, callReason.getReason());
recyclerViewFavourites.setAdapter(adapter);
recyclerViewFavourites.setLayoutManager(new LinearLayoutManager(this));
}
if (favourites == null || favourites.size() == 0) {
setContentView(R.layout.activity_favourites_empty);
}
else {
setContentView(R.layout.activity_favourites);
@Override
protected void onResume() {
Logger.debug("[onResume]");
recyclerViewFavourites = findViewById(R.id.recyclerViewFavourites);
super.onResume();
EventBus.getDefault().register(this);
updateStationList();
}
if (recyclerViewFavourites != null) {
adapter = new WeatherStationRecyclerViewAdapter(favourites, this, callReason.getReason());
adapter.createAndStartUpdater();
recyclerViewFavourites.setAdapter(adapter);
recyclerViewFavourites.setLayoutManager(new LinearLayoutManager(this));
}
}
@Override
protected void onPause() {
super.onPause();
EventBus.getDefault().unregister(this);
}
@Override
protected void onDestroy() {
adapter.stopUpdater();
super.onDestroy();
}
if (adapter != null) {
adapter.stopUpdater();
private void updateStationList() {
List favList = ((Main) getApplication()).getFavs();
if(favList != null) {
favourites.clear();
favourites.addAll(favList);
refreshLayout.setRefreshing(false);
sortedFavourites = new ArrayList<>(favourites);
sortedFavourites.sort(new WxStationComparator());
adapter.notifyDataSetChanged();
if (!favList.isEmpty()) {
adapter.createAndStartUpdater();
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void allStationsEventHandler(@NonNull AllStationsReceivedEvent event) {
Logger.info("[event = " + event.toString() +"]");
updateStationList();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void startStationsRefreshEventHandler(@NonNull StartStationsRefreshEvent event) {
refreshLayout.setRefreshing(true);
Toast.makeText(this, R.string.refreshing_station_list, Toast.LENGTH_SHORT).show();
}
}

Wyświetl plik

@ -2,38 +2,32 @@ package cc.pogoda.mobile.meteosystem.activity;
// https://www.softicons.com/web-icons/vector-stylish-weather-icons-by-bartosz-kaszubowski/sun-rays-cloud-icon#google_vignette
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.os.strictmode.Violation;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageButton;
import com.jakewharton.threetenabp.AndroidThreeTen;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.color.MaterialColors;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import org.tinylog.Logger;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import cc.pogoda.mobile.meteosystem.Main;
@ -43,38 +37,18 @@ import cc.pogoda.mobile.meteosystem.activity.handler.MainActImageButtonExportCli
import cc.pogoda.mobile.meteosystem.activity.handler.MainActImageButtonFavouritesClickEvent;
import cc.pogoda.mobile.meteosystem.activity.handler.MainActImageButtonSettingsClickEvent;
import cc.pogoda.mobile.meteosystem.config.AppConfiguration;
import cc.pogoda.mobile.meteosystem.dao.AllStationsDao;
import cc.pogoda.mobile.meteosystem.file.ConfigurationFile;
import cc.pogoda.mobile.meteosystem.file.CopyLog;
import cc.pogoda.mobile.meteosystem.file.FavouritiesFile;
import cc.pogoda.mobile.meteosystem.file.FileNames;
import cc.pogoda.mobile.meteosystem.type.ParceableStationsList;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
import cc.pogoda.mobile.meteosystem.type.WeatherStationListEvent;
import cc.pogoda.mobile.meteosystem.type.ThemeColours;
public class MainActivity extends AppCompatActivity {
private Main main;
private Context baseContext;
private MainActImageButtonFavouritesClickEvent mainActImageButtonFavouritesClickEvent = null;
private ImageButton imageButtonFavourites;
private ImageButton exportButton;
private ImageButton settingsButton;
public MainActivity() {
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
Logger.info("[MainActivity][onDestroy]");
Logger.info("[onDestroy]");
}
/**
@ -83,7 +57,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
Logger.info("[MainActivity][onResume]");
Logger.info("[onResume]");
}
@ -91,53 +65,75 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Logger.info("[MainActivity][onCreate]");
Logger.info("[onCreate]");
main = (Main) getApplication();
baseContext = getApplicationContext();
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[MainActivity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default")) {
Logger.debug("[AppConfiguration.locale = "
+ AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();
Configuration config = resources.getConfiguration();
config.setLocale(locale);
Logger.debug("[MainActivity][onCreate][locale = " + locale.toLanguageTag() + "]");
Logger.debug("[locale = " + locale.toLanguageTag() + "]");
resources.updateConfiguration(config, resources.getDisplayMetrics());
}
// create an event handler fired when a user click 'favourites' button
mainActImageButtonFavouritesClickEvent = new MainActImageButtonFavouritesClickEvent(this);
// assign on click listener
if (imageButtonFavourites != null) {
imageButtonFavourites.setOnClickListener(mainActImageButtonFavouritesClickEvent);
}
setContentView(R.layout.activity_main);
ImageButton imageButtonAllStations = (ImageButton)findViewById(R.id.imageButtonAllStations);
if (imageButtonAllStations != null)
imageButtonAllStations.setOnClickListener(new MainActImageButtonAllStationsClickEvent(this));
ImageButton imageButtonAllStations = findViewById(R.id.imageButtonAllStations);
imageButtonAllStations.setOnClickListener(
new MainActImageButtonAllStationsClickEvent(this));
imageButtonFavourites = (ImageButton)findViewById(R.id.imageButtonFavourites);
if (imageButtonFavourites != null) {
imageButtonFavourites.setOnClickListener(new MainActImageButtonFavouritesClickEvent(this));
}
ImageButton imageButtonFavourites = findViewById(R.id.imageButtonFavourites);
imageButtonFavourites.setOnClickListener(
new MainActImageButtonFavouritesClickEvent(this));
// set an action for clicking on export data button
exportButton = (ImageButton)findViewById(R.id.imageButtonExport);
if (exportButton != null) {
exportButton.setOnClickListener(new MainActImageButtonExportClickEvent(this));
}
ImageButton exportButton = findViewById(R.id.imageButtonExport);
exportButton.setOnClickListener(new MainActImageButtonExportClickEvent(this));
settingsButton = (ImageButton) findViewById(R.id.imageButtonSettings);
if (settingsButton != null) {
settingsButton.setOnClickListener(new MainActImageButtonSettingsClickEvent(this, main.getConfFile()));
}
ImageButton settingsButton = findViewById(R.id.imageButtonSettings);
settingsButton.setOnClickListener(
new MainActImageButtonSettingsClickEvent(this, main.getConfFile()));
ThemeColours colours = ((Main) getApplication()).getThemeColours();
TypedValue typedValue = new TypedValue();
Resources.Theme theme = getTheme();
//MaterialColors.getColor(, R.attr.colorOnPrimary);
theme.resolveAttribute(R.attr.colorPrimary, typedValue, true);
TypedArray arr = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimary});
colours.colorPrimary = arr.getColor(0, -1);
arr.recycle();
theme.resolveAttribute(R.attr.colorPrimaryVariant, typedValue, true);
arr = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorPrimaryVariant});
colours.colorPrimaryVariant = arr.getColor(0, -1);
arr.recycle();
theme.resolveAttribute(R.attr.colorOnPrimary, typedValue, true);
arr = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorOnPrimary});
colours.colorOnPrimary = arr.getColor(0, -1);
arr.recycle();
theme.resolveAttribute(R.attr.colorSecondary, typedValue, true);
arr = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorSecondary});
colours.colorSecondary = arr.getColor(0, -1);
arr.recycle();
theme.resolveAttribute(R.attr.colorSecondaryVariant, typedValue, true);
arr = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorSecondaryVariant});
colours.colorSecondaryVariant = arr.getColor(0, -1);
arr.recycle();
theme.resolveAttribute(R.attr.colorOnSecondary, typedValue, true);
arr = obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorOnSecondary});
colours.colorOnSecondary = arr.getColor(0, -1);
arr.recycle();
}
@Override
@ -146,21 +142,23 @@ public class MainActivity extends AppCompatActivity {
if (requestCode == 123 && resultCode == RESULT_OK) {
Uri uri = data.getData();
Logger.debug("[MainActivity][onActivityResult][requestCode = 123][uri.getPath() = " + uri.getPath() +"]");
Logger.debug("[requestCode = 123][uri.getPath() = "
+ uri.getPath() + "]");
grantUriPermission(getPackageName(), uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
grantUriPermission(getPackageName(), uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
getContentResolver().takePersistableUriPermission(uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
try {
CopyLog.forDay(main.getFileNames(), LocalDateTime.now(), getContentResolver().openOutputStream(uri));
CopyLog.forDay(main.getFileNames(), LocalDateTime.now(),
getContentResolver().openOutputStream(uri));
} catch (FileNotFoundException e) {
Logger.error("[MainActivity][onActivityResult][FileNotFoundException]");
Logger.error("[FileNotFoundException][e = " + e.toString() +"]");
}
// getContentResolver().openOutputStream(exportUri)
//exportUri = uri;
}
super.onActivityResult(requestCode, resultCode, data);
@ -182,8 +180,9 @@ public class MainActivity extends AppCompatActivity {
builder.setMessage("ENG: Mateusz Lubecki\r\n" +
"CZE: Sylwiusz Pachel\r\n" +
"GER: Jakub Fiałek\r\n" +
"LAT: Andris Stikáns\r\n" +
"UKR, RUS: Влад Поливач \r\n(Wład Polywacz)\r\n\r\nProgram Icon: Bartosz Kaszubowski");
"LAT: Andris Stikāns\r\n" +
"UKR, RUS: Влад Поливач \r\n" +
"(Wład Polywacz)\r\n\r\nProgram Icon: Bartosz Kaszubowski");
builder.setPositiveButton(R.string.ok, (DialogInterface var1, int var2) -> {
var1.dismiss();
});
@ -193,11 +192,12 @@ public class MainActivity extends AppCompatActivity {
break;
}
case (R.id.menu_item_log_export) : {
case (R.id.menu_item_log_export): {
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TITLE, LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + ".log");
intent.putExtra(Intent.EXTRA_TITLE, "meteosystem_" +
LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + ".log");
startActivityForResult(intent, 123);
@ -209,21 +209,11 @@ public class MainActivity extends AppCompatActivity {
}
public boolean listOfAllStationsReady() {
if (main != null) {
return main.listOfAllStationsReady();
}
else {
return false;
}
return main.listOfAllStationsReady() && main != null;
}
public boolean listOfAllFavsReady() {
if (main != null) {
return main.listOfFavsReady();
}
else {
return false;
}
return main.listOfFavsReady() && main != null;
}
}

Wyświetl plik

@ -38,7 +38,7 @@ public class SettingsActivity extends AppCompatActivity {
private static String languageNameFromShort(String shortName) {
Logger.info("[SettingsActivity][languageNameFromShort][shortName = " + shortName +"]");
Logger.info("[shortName = " + shortName +"]");
switch (shortName) {
case "en-rUS": return "English";
@ -70,7 +70,7 @@ public class SettingsActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Logger.info("[SettingsActivity][onCreate]");
Logger.info("[onCreate]");
confFile = new ConfigurationFile(getBaseContext());
@ -148,7 +148,7 @@ public class SettingsActivity extends AppCompatActivity {
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
String languageSelected = adapterView.getItemAtPosition(i).toString();
Logger.debug("[SettingsActivity][onCreate][AdapterView.OnItemSelectedListener()][languageSelected = " + languageSelected +"]");
Logger.debug("[AdapterView.OnItemSelectedListener()][languageSelected = " + languageSelected +"]");
switch (languageSelected) {
case "English": AppConfiguration.locale = "en-rUS"; break;

Wyświetl plik

@ -167,10 +167,10 @@ public class StationDetailsActivity extends AppCompatActivity {
act = this;
station = (WeatherStation) getIntent().getSerializableExtra("station");
Logger.info("[StationDetailsActivity][onCreate][station.getSystemName() = " + station.getSystemName() +"]");
Logger.info("[station.getSystemName() = " + station.getSystemName() +"]");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[StationDetailsActivity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
Logger.debug("[AppConfiguration.locale = " + AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();

Wyświetl plik

@ -132,10 +132,10 @@ public class StationDetailsPlotsDirection extends AppCompatActivity implements S
station = (WeatherStation) getIntent().getSerializableExtra("station");
Logger.info("[StationDetailsPlotsDirection][onCreate][station.getSystemName() = " + station.getSystemName() +"][dataLn = " + dataLn +"]");
Logger.info("[station.getSystemName() = " + station.getSystemName() +"][dataLn = " + dataLn +"]");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[StationDetailsActivity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
Logger.debug("[AppConfiguration.locale = " + AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();
@ -342,7 +342,7 @@ public class StationDetailsPlotsDirection extends AppCompatActivity implements S
// utc timestamp
long utcTimestamp = utcTime.toEpochSecond();
Logger.debug("[StationDetailsPlotsDirection][downloadDataFromWebservice][station.getSystemName() = " + station.getSystemName() +"]");
Logger.debug("[station.getSystemName() = " + station.getSystemName() +"]");
if (this.dataLn < 0 || this.dataLn > 2) {
// last 2000 points of data, regardless the timescale
@ -365,7 +365,7 @@ public class StationDetailsPlotsDirection extends AppCompatActivity implements S
if (data != null) {
Logger.debug("[StationDetailsPlotsDirection][downloadDataFromWebservice][data.list_of_station_data.length = " + data.list_of_station_data.length +"]");
Logger.debug("[data.list_of_station_data.length = " + data.list_of_station_data.length +"]");
for (StationData d : data.list_of_station_data) {
valuesWindDirection.add(new Entry(d.epoch * 1000, d.winddir));

Wyświetl plik

@ -153,7 +153,7 @@ public class StationDetailsPlotsHumidity extends AppCompatActivity implements Se
dataLn = (int)getIntent().getExtras().get("data_ln");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[StationDetailsPlotsHumidity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
Logger.debug("[AppConfiguration.locale = " + AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();

Wyświetl plik

@ -96,7 +96,7 @@ public class StationDetailsPlotsTemperature extends AppCompatActivity implements
// utc timestamp
long utcTimestamp = utcTime.toEpochSecond();
Logger.debug("[StationDetailsPlotsTemperature][downloadDataFromWebservice][station.getSystemName() = " + station.getSystemName() +"]");
Logger.debug("[station.getSystemName() = " + station.getSystemName() +"]");
if (this.dataLn < 0 || this.dataLn > 2) {
// last 2000 points of data, regardless the timescale
@ -117,7 +117,7 @@ public class StationDetailsPlotsTemperature extends AppCompatActivity implements
if (data instanceof ListOfStationData) {
Logger.debug("[StationDetailsPlotsTemperature][downloadDataFromWebservice][data.list_of_station_data.length = " + data.list_of_station_data.length +"]");
Logger.debug("[data.list_of_station_data.length = " + data.list_of_station_data.length +"]");
for (StationData d : data.list_of_station_data) {
valuesTemperature.add(new Entry(d.epoch * 1000, d.temperature));

Wyświetl plik

@ -105,10 +105,10 @@ public class StationDetailsPlotsWind extends AppCompatActivity implements SeekBa
station = (WeatherStation) getIntent().getSerializableExtra("station");
Logger.info("[StationDetailsPlotsWind][onCreate][station.getSystemName() = " + station.getSystemName() +"][dataLn = " + dataLn +"]");
Logger.info("[station.getSystemName() = " + station.getSystemName() +"][dataLn = " + dataLn +"]");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[StationDetailsPlotsHumidity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
Logger.debug("[AppConfiguration.locale = " + AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();
@ -218,7 +218,7 @@ public class StationDetailsPlotsWind extends AppCompatActivity implements SeekBa
// utc timestamp
long utcTimestamp = utcTime.toEpochSecond();
Logger.debug("[StationDetailsPlotsWind][downloadDataFromWebservice][station.getSystemName() = " + station.getSystemName() +"]");
Logger.debug("[station.getSystemName() = " + station.getSystemName() +"]");
if (this.dataLn < 0 || this.dataLn > 2) {
// last 2000 points of data, regardless the timescale
@ -242,7 +242,7 @@ public class StationDetailsPlotsWind extends AppCompatActivity implements SeekBa
if (data instanceof ListOfStationData) {
Logger.debug("[StationDetailsPlotsWind][downloadDataFromWebservice][data.list_of_station_data.length = " + data.list_of_station_data.length +"]");
Logger.debug("[data.list_of_station_data.length = " + data.list_of_station_data.length +"]");
for (StationData d : data.list_of_station_data) {
valuesWindSpeed.add(new Entry(d.epoch * 1000, d.windspeed));

Wyświetl plik

@ -16,8 +16,9 @@ import java.util.Locale;
import cc.pogoda.mobile.meteosystem.Main;
import cc.pogoda.mobile.meteosystem.R;
import cc.pogoda.mobile.meteosystem.activity.updater.StationDetailsValuesOnActivityFromSummaryUpdater;
import cc.pogoda.mobile.meteosystem.activity.updater.StationDetailsValuesOnActivityFromFavsUpdater;
import cc.pogoda.mobile.meteosystem.activity.updater.StationDetailsValuesOnActivityUpdater;
import cc.pogoda.mobile.meteosystem.activity.updater.thread.StationSummaryUpdaterThread;
import cc.pogoda.mobile.meteosystem.config.AppConfiguration;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.StationSummaryActElements;
@ -30,9 +31,11 @@ public class StationDetailsSummaryActivity extends AppCompatActivity {
WeatherStation station = null;
StationSummaryUpdaterThread updaterThread = null;
StationDetailsValuesOnActivityUpdater valuesOnActUpdater = null;
StationDetailsValuesOnActivityFromSummaryUpdater valuesFromSummaryUpdater = null;
StationDetailsValuesOnActivityFromFavsUpdater valuesFromFavsSummaryUpdater = null;
Handler handler = null;
@ -45,7 +48,7 @@ public class StationDetailsSummaryActivity extends AppCompatActivity {
elems = new StationSummaryActElements();
int color = ContextCompat.getColor(this, android.R.color.secondary_text_light);
int color = main.getThemeColours().colorOnSecondary;
Summary summary = null;
SummaryDao summary_dao = new SummaryDao();
@ -54,10 +57,10 @@ public class StationDetailsSummaryActivity extends AppCompatActivity {
station = (WeatherStation) getIntent().getSerializableExtra("station");
Logger.info("[StationDetailsSummaryActivity][onCreate][station.getSystemName() = " + station.getSystemName() +"]");
Logger.info("[station.getSystemName() = " + station.getSystemName() +"]");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[StationDetailsPlotsHumidity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
Logger.debug("[AppConfiguration.locale = " + AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();
@ -89,11 +92,6 @@ public class StationDetailsSummaryActivity extends AppCompatActivity {
elems.goodColor = color;
elems.badColor = Color.RED;
// get the summary data for this station
summary = summary_dao.getStationSummary(station.getSystemName());
elems.updateFromSummary(summary, station.getAvailableParameters());
// create a handler to update station data in background
handler = new Handler();
@ -101,24 +99,42 @@ public class StationDetailsSummaryActivity extends AppCompatActivity {
boolean onFavs = main.checkIsOnFavsList(station.getSystemName());
if (onFavs) {
valuesFromSummaryUpdater = new StationDetailsValuesOnActivityFromSummaryUpdater(elems, handler, station, main.getStationSystemNameToSummary());
valuesFromFavsSummaryUpdater = new StationDetailsValuesOnActivityFromFavsUpdater(elems, handler, station, main.getHashmapFavStationSystemNameToSummary());
if (handler != null && valuesFromSummaryUpdater != null) {
handler.post(valuesFromSummaryUpdater);
if (handler != null && valuesFromFavsSummaryUpdater != null) {
handler.post(valuesFromFavsSummaryUpdater);
}
}
else {
updaterThread = new StationSummaryUpdaterThread(station.getSystemName());
// create a copy of updater class for this station
valuesOnActUpdater = new StationDetailsValuesOnActivityUpdater(elems, handler, station.getSystemName(), station);
valuesOnActUpdater = new StationDetailsValuesOnActivityUpdater(elems, handler, updaterThread, station);
if (handler != null && valuesOnActUpdater != null) {
handler.post(valuesOnActUpdater);
updaterThread.start(50);
handler.postDelayed(valuesOnActUpdater, 500);
}
}
}
@Override
protected void onPause() {
super.onPause();
if (updaterThread != null) {
updaterThread.stop();
}
}
@Override
protected void onResume() {
super.onResume();
if (updaterThread != null) {
updaterThread.start(50);
}
}
@Override
@ -128,6 +144,20 @@ public class StationDetailsSummaryActivity extends AppCompatActivity {
handler.removeCallbacks(valuesOnActUpdater);
}
if (updaterThread != null) {
updaterThread.stop();
}
super.onStop();
}
@Override
protected void onDestroy() {
if (updaterThread != null) {
updaterThread.stop();
}
super.onDestroy();
}
}

Wyświetl plik

@ -2,6 +2,7 @@ package cc.pogoda.mobile.meteosystem.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
@ -9,8 +10,9 @@ import org.tinylog.Logger;
import cc.pogoda.mobile.meteosystem.Main;
import cc.pogoda.mobile.meteosystem.R;
import cc.pogoda.mobile.meteosystem.activity.updater.StationDetailsValuesOnActivityFromSummaryUpdater;
import cc.pogoda.mobile.meteosystem.activity.updater.StationDetailsValuesOnActivityFromFavsUpdater;
import cc.pogoda.mobile.meteosystem.activity.updater.StationDetailsValuesOnActivityUpdater;
import cc.pogoda.mobile.meteosystem.activity.updater.thread.StationSummaryUpdaterThread;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.StationWindRoseActElements;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
@ -22,9 +24,11 @@ public class StationDetailsWindRoseActivity extends AppCompatActivity {
Summary summary;
StationSummaryUpdaterThread updaterThread = null;
StationDetailsValuesOnActivityUpdater onActivityUpdater = null;
StationDetailsValuesOnActivityFromSummaryUpdater fromSummaryUpdater = null;
StationDetailsValuesOnActivityFromFavsUpdater fromSummaryUpdater = null;
Handler handler = null;
@ -43,7 +47,7 @@ public class StationDetailsWindRoseActivity extends AppCompatActivity {
station = (WeatherStation) getIntent().getSerializableExtra("station");
Logger.info("[StationDetailsWindRoseActivity][onCreate][station.getSystemName() = " + station.getSystemName() +"]");
Logger.info("[station.getSystemName() = " + station.getSystemName() +"]");
main = (Main)getApplication();
@ -57,6 +61,8 @@ public class StationDetailsWindRoseActivity extends AppCompatActivity {
elements.maxGust = findViewById(R.id.textViewWindRoseMaxHourGust);
elements.minAverage = findViewById(R.id.textViewWindRoseMinHourSpeed);
elements.pressure = findViewById(R.id.textViewWindRosePressure);
elements.goodColor = ((Main) getApplication()).getThemeColours().colorOnSecondary;
elements.badColor = Color.RED;
elements.setActivity(this);
// create the handler which will update the screen in background
@ -64,36 +70,52 @@ public class StationDetailsWindRoseActivity extends AppCompatActivity {
SummaryDao summary_dao = new SummaryDao();
// get the set of current values to preconfigure all elements on this activity
summary = summary_dao.getStationSummary(station.getSystemName());
// update parameters (like turn the wind direction arrow)
elements.updateFromSummary(summary, station.getAvailableParameters());
handler = new Handler();
// check if this station is on favourites list
boolean onFavs = main.checkIsOnFavsList(station.getSystemName());
if (onFavs) {
fromSummaryUpdater = new StationDetailsValuesOnActivityFromSummaryUpdater(elements, handler, station, main.getStationSystemNameToSummary());
fromSummaryUpdater = new StationDetailsValuesOnActivityFromFavsUpdater(elements, handler, station, main.getHashmapFavStationSystemNameToSummary());
if (handler != null && fromSummaryUpdater != null) {
handler.post(fromSummaryUpdater);
}
}
else {
onActivityUpdater = new StationDetailsValuesOnActivityUpdater(elements, handler, station.getSystemName(), station);
updaterThread = new StationSummaryUpdaterThread(station.getSystemName());
onActivityUpdater = new StationDetailsValuesOnActivityUpdater(elements, handler, updaterThread, station);
if (handler != null && onActivityUpdater != null) {
updaterThread.start(50);
// start the handler to update the wind rose activity in background
handler.post(onActivityUpdater);
handler.postDelayed(onActivityUpdater, 500);
}
}
}
@Override
protected void onPause() {
super.onPause();
if (updaterThread != null) {
updaterThread.stop();
}
}
@Override
protected void onResume() {
super.onResume();
if (updaterThread != null && updaterThread.isEnabled() == false) {
updaterThread.start(50);
}
}
@Override
protected void onStop() {
@ -102,6 +124,19 @@ public class StationDetailsWindRoseActivity extends AppCompatActivity {
handler.removeCallbacks(onActivityUpdater);
}
if (updaterThread != null) {
updaterThread.stop();
}
super.onStop();
}
@Override
protected void onDestroy() {
if (updaterThread != null) {
updaterThread.stop();
}
super.onDestroy();
}
}

Wyświetl plik

@ -38,7 +38,7 @@ public class TrendActivity extends AppCompatActivity {
String stationName = (String)getIntent().getExtras().get("station");
if (AppConfiguration.locale != null && !AppConfiguration.locale.equals("default") ) {
Logger.debug("[StationDetailsPlotsHumidity][onCreate][AppConfiguration.locale = " + AppConfiguration.locale + "]");
Logger.debug("[AppConfiguration.locale = " + AppConfiguration.locale + "]");
Locale locale = new Locale(AppConfiguration.locale);
Locale.setDefault(locale);
Resources resources = this.getResources();

Wyświetl plik

@ -12,27 +12,15 @@ import cc.pogoda.mobile.meteosystem.type.ParceableStationsList;
public class MainActImageButtonAllStationsClickEvent implements View.OnClickListener {
MainActivity parent;
Intent intent;
public MainActImageButtonAllStationsClickEvent(MainActivity parent) {
this.parent = parent;
intent = new Intent(this.parent, AllStationsActivity.class);
}
@Override
public void onClick(View v) {
if (parent.listOfAllStationsReady()) {
launchActivity();
}
return;
}
private void launchActivity() {
parent.startActivity(intent);
}
}

Wyświetl plik

@ -25,7 +25,7 @@ public class MainActImageButtonExportClickEvent implements View.OnClickListener{
@Override
public void onClick(View view) {
Logger.info("[MainActImageButtonExportClickEvent][onClick]");
Logger.info("[onClick]");
parent.startActivity(intent);
}

Wyświetl plik

@ -27,9 +27,6 @@ public class MainActImageButtonFavouritesClickEvent implements View.OnClickListe
@Override
public void onClick(View view) {
if (parent.listOfAllFavsReady()) {
parent.startActivity(intent);
}
parent.startActivity(intent);
}
}

Wyświetl plik

@ -1,5 +1,8 @@
package cc.pogoda.mobile.meteosystem.activity.updater;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.DETAILS_ON_FAVS_LIST_DEFAULT_UPDATE;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.DETAILS_ON_FAVS_LIST_REUPDATE;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Handler;
@ -12,15 +15,17 @@ import java.util.Map;
import java.util.Set;
import java.util.Vector;
import cc.pogoda.mobile.meteosystem.activity.updater.thread.FavouritesStationSummaryUpdaterThread;
import cc.pogoda.mobile.meteosystem.dao.AvailableParametersDao;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.AvailableParameters;
import cc.pogoda.mobile.meteosystem.type.ThemeColours;
import cc.pogoda.mobile.meteosystem.type.web.AvailableParametersWeb;
import cc.pogoda.mobile.meteosystem.type.web.QualityFactor;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
/**
* This class is used to update entries (TextView) on Favourites list using HashMap
* which is updated by {@link FavouritesStationSummaryUpdater}
* which is updated by {@link FavouritesStationSummaryUpdaterThread}
*/
public class FavouritesStationDetailsOnListUpdater implements Runnable {
@ -38,10 +43,11 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
/**
*
*/
private AvailableParametersDao availableParametersDao = null;
//private AvailableParametersDao availableParametersDao = null;
private HashMap<String, AvailableParameters> availParams;
/**
* This map comes from 'Main' class and it is shared with @link{{@link FavouritesStationSummaryUpdater}}
* This map comes from 'Main' class and it is shared with @link{{@link FavouritesStationSummaryUpdaterThread}}
*/
HashMap<String, Summary> stationNameSummary = null;
@ -51,11 +57,17 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
*/
private boolean enabled;
public FavouritesStationDetailsOnListUpdater(Handler _handler, HashMap<String, Summary> _station_system_name_to_summary) {
/**
* Used everywhere, where a colour of any element is set programatically (not globally from the theme)
*/
private ThemeColours themeColours;
public FavouritesStationDetailsOnListUpdater(Handler _handler, HashMap<String, Summary> _station_system_name_to_summary, HashMap<String, AvailableParameters> _avail_params, ThemeColours _themeColours) {
handler = _handler;
stationsToUpdate = new HashMap<>();
availableParametersDao = new AvailableParametersDao();
availParams = _avail_params;
stationNameSummary = _station_system_name_to_summary;
themeColours = _themeColours;
}
public boolean isEnabled() {
@ -74,6 +86,8 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
@Override
public void run() {
int nextExecutionDelay = DETAILS_ON_FAVS_LIST_DEFAULT_UPDATE;
if (stationNameSummary != null && enabled && stationsToUpdate != null && stationsToUpdate.size() > 0) {
// get a set of all elements stored in the map
@ -92,20 +106,20 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
// query web service for station data
Summary summary = stationNameSummary.get(stationSystemName);
Logger.debug("[FavouritesStationDetailsOnListUpdater][run][stationSystemName = " + stationSystemName +"][summary.last_timestamp = " + summary.last_timestamp +"]");
// query for available parameters
AvailableParametersWeb params = availableParametersDao.getAvaliableParamsByStationName(stationSystemName);
AvailableParameters params = availParams.get(stationSystemName);
// if data has been collected
if (summary != null) {
if (summary != null && params != null) {
Logger.debug("[stationSystemName = " + stationSystemName +"][summary.last_timestamp = " + summary.last_timestamp +"]");
String str;
// check if this station transmits wind information
if (params.hasWind) {
if (params.windSpeed) {
// check if station transmits humidity
if (params.hasHumidity) {
if (params.humidity) {
str = String.format("%s %d%% %s %s max %s", summary.getTemperatureStr(false, true), summary.humidity, summary.getWindDirStr(), summary.getWindspeedStr(false), summary.getWindgustsStr(false));
}
else {
@ -113,7 +127,7 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
}
}
else {
if (params.hasHumidity) {
if (params.humidity) {
str = String.format("%s %d%%", summary.getTemperatureStr(false, true), summary.humidity);
}
else {
@ -125,19 +139,23 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
// update text view on the favourites list
toUpdate.setText(str);
if ( (params.hasHumidity && summary.humidity_qf_native.equals(QualityFactor.NOT_AVALIABLE)) ||
if ( (params.humidity && summary.humidity_qf_native.equals(QualityFactor.NOT_AVALIABLE)) ||
(summary.temperature_qf_native.equals(QualityFactor.NOT_AVALIABLE)) ||
(params.hasWind && summary.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)))
(params.windSpeed && summary.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)))
{
toUpdate.setTextColor(Color.RED);
}
else {
toUpdate.setTextColor(androidx.activity.R.color.secondary_text_default_material_light);
toUpdate.setTextColor(themeColours.colorPrimary);
}
}
else {
Logger.error("[stationSystemName = " + stationSystemName + "][summary object is null!! Maybe the API responds exceptionally slow?]");
nextExecutionDelay = DETAILS_ON_FAVS_LIST_REUPDATE;
}
}
handler.postDelayed(this, 60000);
handler.postDelayed(this, nextExecutionDelay);
}
}
}

Wyświetl plik

@ -0,0 +1,56 @@
package cc.pogoda.mobile.meteosystem.activity.updater;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.NORMAL_UPDATE_VALUES_ON_ACTIVITY;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL;
import android.os.Handler;
import org.tinylog.Logger;
import java.util.HashMap;
import cc.pogoda.mobile.meteosystem.activity.updater.thread.FavouritesStationSummaryUpdaterThread;
import cc.pogoda.mobile.meteosystem.type.StationActivityElements;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
/**
* This class uses external HashMap updated by @link{{@link FavouritesStationSummaryUpdaterThread}}
*/
public class StationDetailsValuesOnActivityFromFavsUpdater implements Runnable {
HashMap<String, Summary> mapWithSummary;
StationActivityElements elementsToUpdate;
Handler handler;
WeatherStation stationToUpdate;
public StationDetailsValuesOnActivityFromFavsUpdater(StationActivityElements elems, Handler h, WeatherStation station, HashMap<String, Summary> _map_with_summary_data) {
stationToUpdate = station;
handler = h;
elementsToUpdate = elems;
mapWithSummary = _map_with_summary_data;
}
@Override
public void run() {
if (mapWithSummary != null && elementsToUpdate != null) {
Logger.info("[stationToUpdate.getSystemName() = " + stationToUpdate.getSystemName() +"]");
Summary summary = mapWithSummary.get(stationToUpdate.getSystemName());
if (summary != null) {
elementsToUpdate.updateFromSummary(summary, stationToUpdate.getAvailableParameters());
handler.postDelayed(this, NORMAL_UPDATE_VALUES_ON_ACTIVITY);
}
else {
handler.postDelayed(this, REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL);
}
}
}
}

Wyświetl plik

@ -1,45 +0,0 @@
package cc.pogoda.mobile.meteosystem.activity.updater;
import android.os.Handler;
import org.tinylog.Logger;
import java.util.HashMap;
import cc.pogoda.mobile.meteosystem.type.StationActivityElements;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
/**
* This class uses external HashMap updated by @link{{@link FavouritesStationSummaryUpdater}}
*/
public class StationDetailsValuesOnActivityFromSummaryUpdater implements Runnable {
HashMap<String, Summary> mapWithSummary;
StationActivityElements elementsToUpdate;
Handler handler;
WeatherStation stationToUpdate;
public StationDetailsValuesOnActivityFromSummaryUpdater(StationActivityElements elems, Handler h, WeatherStation station, HashMap<String, Summary> _map_with_summary_data) {
stationToUpdate = station;
handler = h;
elementsToUpdate = elems;
mapWithSummary = _map_with_summary_data;
}
@Override
public void run() {
if (mapWithSummary != null && elementsToUpdate != null) {
Logger.info("[StationDetailsValuesOnActivityFromSummaryUpdater][run][stationToUpdate.getSystemName() = " + stationToUpdate.getSystemName() +"]");
elementsToUpdate.updateFromSummary(mapWithSummary.get(stationToUpdate.getSystemName()), stationToUpdate.getAvailableParameters());
handler.postDelayed(this, 90000);
}
}
}

Wyświetl plik

@ -1,9 +1,13 @@
package cc.pogoda.mobile.meteosystem.activity.updater;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.NORMAL_UPDATE_VALUES_ON_ACTIVITY;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL;
import android.os.Handler;
import org.tinylog.Logger;
import cc.pogoda.mobile.meteosystem.activity.updater.thread.StationSummaryUpdaterThread;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.StationActivityElements;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
@ -23,16 +27,19 @@ public class StationDetailsValuesOnActivityUpdater implements Runnable {
SummaryDao dao = null;
StationSummaryUpdaterThread updater_thread;
Summary station_summary = null;
String station_name;
WeatherStation station;
public StationDetailsValuesOnActivityUpdater(StationActivityElements elems, Handler h, String station_name, WeatherStation station) {
public StationDetailsValuesOnActivityUpdater(StationActivityElements elems, Handler h, StationSummaryUpdaterThread updaterThread, WeatherStation station) {
elements = elems;
handler = h;
this.station_name = station_name;
updater_thread = updaterThread;
this.station_name = station.getSystemName();
this.station = station;
dao = new SummaryDao();
@ -42,19 +49,26 @@ public class StationDetailsValuesOnActivityUpdater implements Runnable {
@Override
public void run() {
if (elements == null) {
if (elements == null || updater_thread == null) {
Logger.error("[something is null even if it shouldn't!!!!]");
return;
}
else {
// get the current data from the Web Service
station_summary = dao.getStationSummary(station_name);
station_summary = updater_thread.getSummary();
Logger.debug("[StationDetailsValuesOnActivityUpdater][run][station_name = " + station_name +"]");
Logger.debug("[station_name = " + station_name +"]");
// null check is done inside this call
elements.updateFromSummary(station_summary, station.getAvailableParameters());
handler.postDelayed(this, 90000);
if (station_summary != null) {
// null check is done inside this call
elements.updateFromSummary(station_summary, station.getAvailableParameters());
handler.postDelayed(this, NORMAL_UPDATE_VALUES_ON_ACTIVITY);
}
else {
// 'station_summary' might be null if internet connection is poor and background
// thread wasn't able to download a summary on time
handler.postDelayed(this, REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL);
}
}
}

Wyświetl plik

@ -1,4 +1,6 @@
package cc.pogoda.mobile.meteosystem.activity.updater;
package cc.pogoda.mobile.meteosystem.activity.updater.thread;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL;
import android.os.Handler;
import android.telephony.SubscriptionManager;
@ -15,19 +17,26 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import cc.pogoda.mobile.meteosystem.dao.AvailableParametersDao;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.AvailableParameters;
import cc.pogoda.mobile.meteosystem.type.web.AvailableParametersWeb;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
/**
* This class is a runnable executed from background Thread by ScheduledExecuter
* which periodically download current Summary for all stations stored on favourites list
*/
public class FavouritesStationSummaryUpdater implements Runnable {
public class FavouritesStationSummaryUpdaterThread implements Runnable {
private HashMap<String, Summary> map;
private HashMap<String, AvailableParameters> availableParametersHashMap;
private SummaryDao summaryDao;
private AvailableParametersDao availableParametersDao;
private ScheduledExecutorService executor;
private ScheduledFuture scheduledTask;
@ -39,9 +48,12 @@ public class FavouritesStationSummaryUpdater implements Runnable {
*/
private boolean forceUpdate = false;
public FavouritesStationSummaryUpdater(HashMap<String, Summary> _out_map) {
public FavouritesStationSummaryUpdaterThread(HashMap<String, Summary> _out_map, HashMap<String, AvailableParameters> _avail_params_map) {
map = _out_map;
availableParametersHashMap = _avail_params_map;
summaryDao = new SummaryDao();
availableParametersDao = new AvailableParametersDao();
executor = Executors.newScheduledThreadPool(5);
}
@ -51,6 +63,8 @@ public class FavouritesStationSummaryUpdater implements Runnable {
// check if map was set so something
if (map != null && map.size() > 0) {
Logger.info("[map.size() = " + map.size() +"]");
// get a set of all stations from favourites
Set<Map.Entry<String, Summary>> _set_of_stations_names = map.entrySet();
@ -66,14 +80,32 @@ public class FavouritesStationSummaryUpdater implements Runnable {
Summary summary = summaryDao.getStationSummary(station_name);
Logger.debug("[FavouritesStationSummaryUpdater][run][station_name = " + station_name +"][summary.last_timestamp = " + summary.last_timestamp +"]");
// check if summary was returned (as it will not in case on HTTP 500 or something else)
if (summary != null) {
Logger.info("[station_name = " + station_name + "][summary.last_timestamp = " + summary.last_timestamp + "]");
// put the summary back into the map
map.put(station_name, summary);
// put the summary back into the map
map.put(station_name, summary);
}
AvailableParameters parameters = AvailableParameters.fromWebData(availableParametersDao.getAvaliableParamsByStationName(station_name));
if (parameters != null) {
availableParametersHashMap.put(station_name, parameters);
}
}
}
else {
// no station to update may be caused by two reasons
// 1. there is no weather station to update
// 2. API responds very slow or there is a problem with internet connection
Logger.info("[no station to update]");
stop();
start(REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL);
}
if (forceUpdate) {
forceUpdate = false;
@ -92,7 +124,7 @@ public class FavouritesStationSummaryUpdater implements Runnable {
public void start(int _initial_delay) {
Logger.debug("[FavouritesStationSummaryUpdater][start][_initial_delay = " + _initial_delay +"]");
Logger.debug("[_initial_delay = " + _initial_delay +"]");
if (enabled) {
stop();

Wyświetl plik

@ -0,0 +1,89 @@
package cc.pogoda.mobile.meteosystem.activity.updater.thread;
import static cc.pogoda.mobile.meteosystem.config.ConstAppConfiguration.REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL;
import androidx.annotation.NonNull;
import org.tinylog.Logger;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
import cc.pogoda.mobile.meteosystem.type.web.Summary;
/**
* This class is simmilar to {@link FavouritesStationSummaryUpdaterThread}, but it
* downloads summary data for any defined weather station
*/
public class StationSummaryUpdaterThread implements Runnable {
public boolean isEnabled() {
return enabled;
}
boolean enabled = false;
@NonNull
String systemName;
ScheduledExecutorService executorService;
ScheduledFuture scheduledTask;
Summary summary = null;
public Summary getSummary() {
return summary;
}
public StationSummaryUpdaterThread(@NonNull String stationSystemName) {
systemName = stationSystemName;
executorService = Executors.newScheduledThreadPool(3);
}
@Override
public void run() {
if (systemName != null) {
Logger.info("[StationSummaryUpdaterThread][run][systemName = " + systemName +"]");
SummaryDao summaryDao = new SummaryDao();
summary = summaryDao.getStationSummary(systemName);
if (summary == null) {
// no ssummary data may be caused by two reasons
// 1. there is no weather station to update
// 2. API responds very slow or there is a problem with internet connection
Logger.info("[no station to update]");
stop();
start(REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL);
}
}
}
public void start(int _initial_delay) {
Logger.info("[_initial_delay = " + _initial_delay +"]");
if (enabled) {
stop();
}
scheduledTask = executorService.scheduleAtFixedRate(this, _initial_delay, 60000, TimeUnit.MILLISECONDS);
enabled = true;
}
public void stop() {
if (enabled) {
Logger.info("[systemName = " + systemName +"]");
scheduledTask.cancel(true);
enabled = false;
}
}
}

Wyświetl plik

@ -21,23 +21,17 @@ import cc.pogoda.mobile.meteosystem.R;
import cc.pogoda.mobile.meteosystem.activity.handler.AllStationsActRecyclerViewButtonClickEvent;
import cc.pogoda.mobile.meteosystem.activity.updater.FavouritesStationDetailsOnListUpdater;
import cc.pogoda.mobile.meteosystem.activity.view.AllStationsActRecyclerViewHolder;
import cc.pogoda.mobile.meteosystem.dao.AvailableParametersDao;
import cc.pogoda.mobile.meteosystem.dao.SummaryDao;
import cc.pogoda.mobile.meteosystem.type.ParceableFavsCallReason;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllStationsActRecyclerViewHolder> {
public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<WeatherStation> stations;
final private List<WeatherStation> stations;
AppCompatActivity activity;
ParceableFavsCallReason.Reason reason;
SummaryDao summaryDao;
AvailableParametersDao paramsDao;
/**
* This updater takes data stored in the hashmap and then updates TextViews on View Holders on
* Favourites list
@ -51,81 +45,116 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
*/
Main main;
public WeatherStationRecyclerViewAdapter(List<WeatherStation> stations, AppCompatActivity parentActivity, ParceableFavsCallReason.Reason callReason) {
private static final int VIEW_TYPE_EMPTY_LIST = 0;
private static final int VIEW_TYPE_OBJECT = 1;
public WeatherStationRecyclerViewAdapter(
List<WeatherStation> stations,
AppCompatActivity parentActivity,
ParceableFavsCallReason.Reason callReason) {
this.stations = stations;
this.activity = parentActivity;
this.reason = callReason;
this.summaryDao = new SummaryDao();
this.paramsDao = new AvailableParametersDao();
this.main = (Main) parentActivity.getApplication();
}
@NonNull
@Override
public AllStationsActRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
Context context = parent.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View view;
// check the call reason
if (reason.equals(ParceableFavsCallReason.Reason.FAVOURITES)) {
// inflate custom layout
view = inflater.inflate(R.layout.activity_favourites_linear_layout_data, parent, false);
}
else {
// Inflate the custom layout without current data
view = inflater.inflate(R.layout.activity_all_stations_linear_layout, parent, false);
}
switch (viewType){
case VIEW_TYPE_OBJECT:
// check the call reason
if (reason.equals(ParceableFavsCallReason.Reason.FAVOURITES)) {
// inflate custom layout
view = inflater.inflate(R.layout.activity_favourites_linear_layout_data,
parent, false);
}
else {
// Inflate the custom layout without current data
view = inflater.inflate(R.layout.activity_all_stations_linear_layout,
parent, false);
}
return new AllStationsActRecyclerViewHolder(view, reason);
// Return a new holder instance
AllStationsActRecyclerViewHolder viewHolder = new AllStationsActRecyclerViewHolder(view, reason);
return viewHolder;
case VIEW_TYPE_EMPTY_LIST:
default:
if (reason.equals(ParceableFavsCallReason.Reason.FAVOURITES)) {
view = inflater.inflate(R.layout.activity_favourites_empty, parent,
false);
} else {
view = inflater.inflate(R.layout.activity_all_stations_empty, parent,
false);
}
return new EmptyViewHolder(view);
}
}
@Override
public void onBindViewHolder(@NonNull AllStationsActRecyclerViewHolder holder, int position) {
// this TextView shows the station name
TextView textView = holder.textView;
public int getItemViewType(int position) {
if (stations.isEmpty()) {
return VIEW_TYPE_EMPTY_LIST;
} else {
return VIEW_TYPE_OBJECT;
}
}
// this TextView shows station data if this is favourites list
TextView textViewData = holder.textViewData;
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
// button to go to the StationDetailsActivity
Button button = holder.button;
if(viewHolder instanceof AllStationsActRecyclerViewHolder) {
AllStationsActRecyclerViewHolder holder =
(AllStationsActRecyclerViewHolder) viewHolder;
// get the station object from a list of either all stations or favourites
WeatherStation station = stations.get(position);
// this TextView shows the station name
TextView textView = holder.textView;
if (station != null) {
textView.setText(station.getDisplayedName());
button.setText(R.string.select_station);
// this TextView shows station data if this is favourites list
TextView textViewData = holder.textViewData;
// button to go to the StationDetailsActivity
Button button = holder.button;
// get the station object from a list of either all stations or favourites
WeatherStation station = stations.get(position);
if (station != null) {
textView.setText(station.getDisplayedName());
button.setText(R.string.select_station);
if (!reason.equals(ParceableFavsCallReason.Reason.FAVOURITES)) {
if (station.getDisplayedName().length() > 22) {
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18.0f);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20.0f);
} else {
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22.0f);
}
button.setOnClickListener(new AllStationsActRecyclerViewButtonClickEvent(station, activity, reason));
}
button.setOnClickListener(new AllStationsActRecyclerViewButtonClickEvent(station, activity, reason));
}
// this if distinguish between All Stations and Favorites view
if (textViewData != null && favsUpdater != null) {
favsUpdater.addNewStation(station.getSystemName(), textViewData);
// this if distinguish between All Stations and Favorites view
if (textViewData != null && favsUpdater != null) {
favsUpdater.addNewStation(station.getSystemName(), textViewData);
}
}
}
public void update(@NonNull List<WeatherStation> updatedStations) {
stations.clear();
stations.addAll(updatedStations);
notifyDataSetChanged();
}
@Override
public int getItemCount() {
return stations.size();
// In case of empty station list at least 1 should be returned to properly select view type
// and render empty list info.
return stations.isEmpty() ? 1 : stations.size();
}
public void createAndStartUpdater() {
// check if there is previous instance of updater
@ -134,17 +163,30 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
}
handler = new Handler(Looper.getMainLooper());
favsUpdater = new FavouritesStationDetailsOnListUpdater(handler, main.getStationSystemNameToSummary());
favsUpdater = new FavouritesStationDetailsOnListUpdater(
handler,
main.getHashmapFavStationSystemNameToSummary(),
main.getHashmapAllStationSystemNameToAvailParameters(),
main.getThemeColours());
handler.postDelayed(favsUpdater, 100);
favsUpdater.setEnabled(true);
}
public void stopUpdater() {
if (reason.equals(ParceableFavsCallReason.Reason.FAVOURITES)) {
if (reason.equals(ParceableFavsCallReason.Reason.FAVOURITES)
&& handler != null && favsUpdater != null) {
handler.removeCallbacks(favsUpdater);
favsUpdater.setEnabled(false);
}
}
private class EmptyViewHolder extends RecyclerView.ViewHolder{
public EmptyViewHolder(@NonNull View itemView) {
super(itemView);
}
}
}

Wyświetl plik

@ -0,0 +1,17 @@
package cc.pogoda.mobile.meteosystem.config;
public class ConstAppConfiguration {
public static final int REUPDATE_VALUES_ON_ACTIVITY_ON_FAIL = 1000;
public static final int NORMAL_UPDATE_VALUES_ON_ACTIVITY = 60000;
/**
* This is an interval how often labels on Favourites List (with station
* summary) are updated.
*/
public static final int DETAILS_ON_FAVS_LIST_REUPDATE = 500;
public static final int DETAILS_ON_FAVS_LIST_DEFAULT_UPDATE = 45000;
}

Wyświetl plik

@ -0,0 +1,6 @@
package cc.pogoda.mobile.meteosystem.config;
public class WebIoConfig {
public static final int TIMEOUT_SECOND = 20;
}

Wyświetl plik

@ -1,5 +1,7 @@
package cc.pogoda.mobile.meteosystem.dao;
import static cc.pogoda.mobile.meteosystem.config.WebIoConfig.TIMEOUT_SECOND;
import org.tinylog.Logger;
import java.util.LinkedList;
@ -32,7 +34,7 @@ public class AllStationsDao {
try {
resp = consumer.getAllStations().execute();
} catch (Exception e) {
Logger.error("[AllStationsDao][Worker][Exception][e = " + e.getLocalizedMessage() +"]");
Logger.error("[Exception][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}
}

Wyświetl plik

@ -1,7 +1,11 @@
package cc.pogoda.mobile.meteosystem.dao;
import static cc.pogoda.mobile.meteosystem.config.WebIoConfig.TIMEOUT_SECOND;
import org.tinylog.Logger;
import java.io.IOException;
import cc.pogoda.mobile.meteosystem.type.web.AvailableParametersWeb;
import cc.pogoda.mobile.meteosystem.web.AvailableParametersConsumer;
import cc.pogoda.mobile.meteosystem.web.RestClientConfig;
@ -25,10 +29,26 @@ public class AvailableParametersDao {
try {
response = consumer.getParametersForStation(stationName).execute();
} catch (Exception e) {
Logger.error("[AvailableParametersDao][Worker][Exception][e = " + e.getLocalizedMessage() +"]");
} catch (IOException e) {
Logger.error("[IOException][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
} catch (RuntimeException e) {
Logger.error("[RuntimeException][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}
catch (Exception e) {
Logger.error("[Exception][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}
if (response == null) {
Logger.error("[worker is done, response is null]");
}
else {
Logger.info("[worker is done][response.code() = " + response.code() +"]");
}
}
}
@ -45,7 +65,9 @@ public class AvailableParametersDao {
try {
t.join();
out = response.body();
if (response != null) {
out = response.body();
}
} catch (InterruptedException e) {
e.printStackTrace();
}

Wyświetl plik

@ -1,5 +1,7 @@
package cc.pogoda.mobile.meteosystem.dao;
import static cc.pogoda.mobile.meteosystem.config.WebIoConfig.TIMEOUT_SECOND;
import org.tinylog.Logger;
import cc.pogoda.mobile.meteosystem.type.web.ListOfStationData;
@ -25,7 +27,7 @@ public class LastStationDataDao {
try {
response = consumer.getLastDataForStation(station, true, true).execute();
} catch (Exception e) {
Logger.error("[LastStationDataDao][Worker][Exception][e = " + e.getLocalizedMessage() +"]");
Logger.error("[Exception][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}

Wyświetl plik

@ -28,7 +28,7 @@ public class StationDataDao {
try {
response = consumer.getDataForStation(station, from, to).execute();
} catch (Exception e) {
Logger.error("[StationDataDao][Worker][Exception][e = " + e.getLocalizedMessage() +"]");
Logger.error("[Exception][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}
@ -52,7 +52,9 @@ public class StationDataDao {
thread.start();
thread.join();
out = response.body();
if (response != null) {
out = response.body();
}
}
catch (InterruptedException ex) {

Wyświetl plik

@ -1,5 +1,7 @@
package cc.pogoda.mobile.meteosystem.dao;
import static cc.pogoda.mobile.meteosystem.config.WebIoConfig.TIMEOUT_SECOND;
import org.tinylog.Logger;
import java.io.IOException;
@ -32,11 +34,29 @@ public class SummaryDao {
SummaryConsumer consumer = restClient.getWeatherStationClient().create(SummaryConsumer.class);
try {
Logger.info("[station = " + station +"]");
response = consumer.getSummaryForStation(station).execute();
} catch (IOException e) {
Logger.error("[SummaryDao][Worker][Exception][e = " + e.getLocalizedMessage() +"]");
Logger.error("[station = " + station + "][IOException][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
} catch (RuntimeException e) {
Logger.error("[station = " + station + "][RuntimeException][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}
catch (Exception e) {
Logger.error("[station = " + station + "][Exception][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
}
if (response == null) {
Logger.error("[station = " + station + "][worker is done, response is null]");
}
else {
Logger.info("[station = " + station + "][worker is done][response.code() = " + response.code() +"]");
}
}
}
@ -67,9 +87,17 @@ public class SummaryDao {
out.humidity_qf_native = QualityFactor.valueOf(out.humidity_qf);
out.qnh_qf_native = QualityFactor.valueOf(out.qnh_qf);
}
else {
Logger.error("[station = " + station +"][response.code() = " + response.code() +"][response body is nulll, probably HTTP error" +
"]");
}
}
else {
Logger.error("[station = " + station +"][response is null!!]");
}
} catch (InterruptedException e) {
e.printStackTrace();
Logger.error("[station = " + station +"][InterruptedException]");
}
return out;

Wyświetl plik

@ -1,5 +1,7 @@
package cc.pogoda.mobile.meteosystem.dao;
import static cc.pogoda.mobile.meteosystem.config.WebIoConfig.TIMEOUT_SECOND;
import org.tinylog.Logger;
import java.io.IOException;
@ -48,7 +50,9 @@ public class TrendDao {
try {
thread.join();
out = trend.body();
if (trend != null) {
out = trend.body();
}
} catch (InterruptedException e) {
e.printStackTrace();
}

Wyświetl plik

@ -50,7 +50,7 @@ public class ConfigurationFile {
} catch (IOException | JSONException e) {
e.printStackTrace();
Logger.error("[ConfigurationFile][restoreFromFile][e = " + e.getLocalizedMessage() +"]");
Logger.error("[e = " + e.getLocalizedMessage() +"]");
AppConfiguration.locale = "default";
AppConfiguration.replaceMsWithKnots = false;

Wyświetl plik

@ -39,10 +39,10 @@ public class CopyLog {
streamWriter.flush();
streamWriter.close();
Logger.info("[CopyLog][CopyLogRunner][run][log file copied succesfully]");
Logger.info("[log file copied succesfully]");
}
catch (IOException e) {
Logger.error("[CopyLog][CopyLogRunner][run][IOException e = " + e.getLocalizedMessage() +"]");
Logger.error("[IOException e = " + e.getLocalizedMessage() +"]");
}
}
}
@ -55,7 +55,7 @@ public class CopyLog {
File logfile = new File(baseDir.getAbsolutePath() + "/logs/log_" + _date.format(formatter) + ".txt");
Logger.debug("[CopyLog][forDay][logfile.getAbsolutePath() = " + logfile.getAbsolutePath() +"][logfile.length() = " + logfile.length() +"]");
Logger.debug("[logfile.getAbsolutePath() = " + logfile.getAbsolutePath() +"][logfile.length() = " + logfile.length() +"]");
try {
// create an input stream to load log file
@ -74,7 +74,7 @@ public class CopyLog {
}
catch (IOException e) {
Logger.error("[CopyLog][forDay][IOException e = " + e.getLocalizedMessage() +"]");
Logger.error("[IOException e = " + e.getLocalizedMessage() +"]");
}
// log_{date:yyyy-MM-dd}.txt

Wyświetl plik

@ -30,7 +30,7 @@ public class FavouritiesFile {
File file = fileNames.getFavJsonFile();
Logger.info("[FavouritiesFile][loadFavourites][file = " + file + "]");
Logger.info("[file = " + file + "]");
try {
// create an input stream to load file content
@ -60,7 +60,7 @@ public class FavouritiesFile {
out.add(station);
Logger.debug("[FavouritiesFile][loadFavourites][i = " + i +"][station.getSystemName() = " + station.getSystemName() + "]");
Logger.debug("[i = " + i +"][station.getSystemName() = " + station.getSystemName() + "]");
}
}
} catch (IOException e) {
@ -86,7 +86,7 @@ public class FavouritiesFile {
// main array for all stations
JSONArray mainArray = new JSONArray();
Logger.info("[FavouritiesFile][persistFavourities][favourites.size() = " + favourites.size() + "]");
Logger.info("[favourites.size() = " + favourites.size() + "]");
for (WeatherStation wx : favourites) {
JSONObject obj = new JSONObject();
@ -103,7 +103,7 @@ public class FavouritiesFile {
mainArray.put(obj);
Logger.debug("[FavouritiesFile][persistFavourities][wx.getSystemName() = " + wx.getSystemName() + "]");
Logger.debug("[wx.getSystemName() = " + wx.getSystemName() + "]");
} catch (JSONException e) {
e.printStackTrace();
}

Wyświetl plik

@ -0,0 +1,42 @@
package cc.pogoda.mobile.meteosystem.service;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
import org.greenrobot.eventbus.EventBus;
import org.tinylog.Logger;
import java.util.HashMap;
import java.util.List;
import cc.pogoda.mobile.meteosystem.dao.AllStationsDao;
import cc.pogoda.mobile.meteosystem.dao.AvailableParametersDao;
import cc.pogoda.mobile.meteosystem.type.AllStationsReceivedEvent;
import cc.pogoda.mobile.meteosystem.type.AvailableParameters;
import cc.pogoda.mobile.meteosystem.type.StartStationsRefreshEvent;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
public class GetAllStationsService extends JobIntentService {
private static final int JOB_ID = 1;
public static void enqueueWork(@NonNull Context context, @NonNull Intent intent) {
enqueueWork(context, GetAllStationsService.class, JOB_ID, intent);
}
@Override
protected void onHandleWork(@NonNull Intent intent) {
EventBus.getDefault().post(new StartStationsRefreshEvent());
// download all stations
List<WeatherStation> allStations = new AllStationsDao().getAllStations();
if (allStations != null){
EventBus.getDefault().post(new AllStationsReceivedEvent(allStations));
Logger.debug("onHandleWork done. allStations size:" + allStations.size());
}
}
}

Wyświetl plik

@ -0,0 +1,25 @@
package cc.pogoda.mobile.meteosystem.type;
import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.List;
public class AllStationsReceivedEvent {
List<WeatherStation> stations;
public AllStationsReceivedEvent(@NonNull List<WeatherStation> stations) {
this.stations = stations;
}
@NonNull
public List<WeatherStation> getStations(){
return this.stations;
}
@NonNull
@Override
public String toString() {
return "[AllStationsReceivedEvent][stations.size() = " + stations.size() +"]";
}
}

Wyświetl plik

@ -0,0 +1,4 @@
package cc.pogoda.mobile.meteosystem.type;
public class StartStationsRefreshEvent {
}

Wyświetl plik

@ -94,7 +94,7 @@ public class StationSummaryActElements implements StationActivityElements {
long minutes_difference = last_station_data.until(current, ChronoUnit.MINUTES);
Logger.debug("[StationSummaryActElements][updateFromSummary][last_station_data = " + last_station_data.format(DateTimeFormatter. ISO_LOCAL_DATE_TIME) +"]");
Logger.debug("[last_station_data = " + last_station_data.format(DateTimeFormatter. ISO_LOCAL_DATE_TIME) +"]");
// calculate the duration between
Duration duration = Duration.between(last_station_data, current);

Wyświetl plik

@ -87,7 +87,7 @@ public class StationWindRoseActElements implements StationActivityElements {
// current date and time (in current time zone set in system configuration)
LocalDateTime current = LocalDateTime.now();
Logger.debug("[StationWindRoseActElements][updateFromSummary][last_station_data = " + last_station_data.format(DateTimeFormatter. ISO_LOCAL_DATE_TIME) +"]");
Logger.debug("[last_station_data = " + last_station_data.format(DateTimeFormatter. ISO_LOCAL_DATE_TIME) +"]");
// calculate the duration between
Duration duration = Duration.between(last_station_data, current);
@ -98,7 +98,7 @@ public class StationWindRoseActElements implements StationActivityElements {
}
}
Logger.debug("[StationWindRoseActElements][updateFromSummary][no_data = " + no_data +"][old_data = " + old_data+"]");
Logger.debug("[no_data = " + no_data +"][old_data = " + old_data+"]");
// create strings with wind speed, gusts etc
String average_speed = String.format("%s", data.getWindspeedStr(true));
@ -115,12 +115,14 @@ public class StationWindRoseActElements implements StationActivityElements {
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
windSpeed.setText(average_speed);
windSpeed.setTextColor(goodColor);
} else {
windSpeed.setText("---");
}
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
windGusts.setText(gusts_speed);
windGusts.setTextColor(goodColor);
} else {
windGusts.setText("---");
@ -128,6 +130,7 @@ public class StationWindRoseActElements implements StationActivityElements {
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
windDirection.setText(String.valueOf(data.direction) + activity.getResources().getString(R.string.degrees_sign));
windDirection.setTextColor(goodColor);
} else {
windDirection.setText("---");
}

Wyświetl plik

@ -0,0 +1,11 @@
package cc.pogoda.mobile.meteosystem.type;
public class ThemeColours {
public int colorPrimary;
public int colorPrimaryVariant;
public int colorOnPrimary;
public int colorSecondary;
public int colorSecondaryVariant;
public int colorOnSecondary;
}

Wyświetl plik

@ -1,5 +1,7 @@
package cc.pogoda.mobile.meteosystem.web;
import static cc.pogoda.mobile.meteosystem.config.WebIoConfig.TIMEOUT_SECOND;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -8,6 +10,7 @@ import java.util.concurrent.TimeUnit;
import cc.pogoda.mobile.meteosystem.type.CustomLocalDateTime;
import cc.pogoda.mobile.meteosystem.web.deserializer.CustomLocalDateTimeDeserializer;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
@ -20,12 +23,15 @@ public class RestClientConfig {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.readTimeout(20, TimeUnit.SECONDS);
builder.writeTimeout(20, TimeUnit.SECONDS);
builder.connectTimeout(20, TimeUnit.SECONDS);
builder.callTimeout(20, TimeUnit.SECONDS);
builder.readTimeout(TIMEOUT_SECOND, TimeUnit.SECONDS);
builder.writeTimeout(TIMEOUT_SECOND, TimeUnit.SECONDS);
builder.connectTimeout(TIMEOUT_SECOND, TimeUnit.SECONDS);
builder.callTimeout(TIMEOUT_SECOND, TimeUnit.SECONDS);
OkHttpClient client = builder.build();//new OkHttpClient(builder);
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
OkHttpClient client = builder.addInterceptor(loggingInterceptor).build();//new OkHttpClient(builder);
out = new Retrofit.Builder().baseUrl("http://pogoda.cc:8080/").addConverterFactory(GsonConverterFactory.create(gson)).client(client).build();

Wyświetl plik

@ -3,8 +3,11 @@ package cc.pogoda.mobile.meteosystem.web;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import org.tinylog.Logger;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import cc.pogoda.mobile.meteosystem.type.WeatherStation;
@ -28,10 +31,17 @@ public class StationBackgroundDownloader implements Runnable {
public void run() {
InputStream in = null;
try {
in = new java.net.URL(station.getImageUrl()).openStream();
URL url = new java.net.URL(station.getImageUrl());
Logger.debug("[url = " + url.toString() +"]");
in = url.openStream();
bitmap = BitmapFactory.decodeStream(in);
in.close();
} catch (IOException e) {
Logger.error("[IOException][e = " + e.getLocalizedMessage() +"]");
e.printStackTrace();
bitmap = null;
}

Wyświetl plik

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

Wyświetl plik

@ -5,11 +5,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.AllStationsActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewAllStations"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refreshAllStationsView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="83dp"
tools:layout_editor_absoluteY="95dp" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewAllStations"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="83dp"
tools:layout_editor_absoluteY="95dp" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewEmpty1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/all_stations_empty_list1"
android:textAlignment="center"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="@+id/textViewEmpty2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textViewEmpty2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/all_station_empty_list2"
android:textAlignment="center"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewEmpty1" />
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -23,9 +23,10 @@
<Button
android:id="@+id/buttonExportTarget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="6dp"
android:text="@string/output_fn"
android:textSize="16sp"
app:iconTint="#56039BE5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -47,7 +48,7 @@
<Spinner
android:id="@+id/spinnerOutputFormat"
android:layout_width="247dp"
android:layout_height="29dp"
android:layout_height="50dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
@ -66,8 +67,9 @@
<Button
android:id="@+id/buttonExportStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:text="@string/start_export"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonExportTarget" />
@ -110,8 +112,8 @@
<EditText
android:id="@+id/editTextNumberExport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:ems="10"
android:inputType="number"
@ -133,11 +135,12 @@
<Button
android:id="@+id/buttonSelectStationExport"
android:layout_width="0dp"
android:layout_height="47dp"
android:layout_marginStart="32dp"
android:layout_height="50dp"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginEnd="16dp"
android:text="@string/select_station_export"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Wyświetl plik

@ -1,10 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewFavourites"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refreshViewFavourites"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewFavourites"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -10,11 +10,11 @@
android:id="@+id/station_name_fav"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="24dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:textSize="24sp"
android:textSize="22sp"
app:layout_constraintBottom_toBottomOf="@+id/station_button_fav"
app:layout_constraintEnd_toStartOf="@+id/station_button_fav"
app:layout_constraintStart_toStartOf="parent"
@ -24,7 +24,7 @@
android:id="@+id/station_button_fav"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginEnd="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textSize="14sp"
@ -37,9 +37,10 @@
android:id="@+id/station_data_fav"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="@string/loading"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="@+id/station_button_fav"
app:layout_constraintEnd_toStartOf="@+id/station_button_fav"

Wyświetl plik

@ -248,12 +248,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="2dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/credits_2"
android:textSize="28sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/textViewCredits3"
app:layout_constraintBottom_toTopOf="@+id/textViewCreditsRafal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewCredits1" />
@ -262,6 +261,7 @@
android:id="@+id/textViewCredits3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/credits_3"
android:textSize="24sp"
@ -294,6 +294,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewCredits4" />
<TextView
android:id="@+id/textViewCreditsRafal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/credits_2_rafal"
android:textSize="28sp"
app:layout_constraintBottom_toTopOf="@+id/textViewCredits3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewCredits2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

Wyświetl plik

@ -9,7 +9,7 @@
<Switch
android:id="@+id/switchKnots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:minWidth="48dp"
@ -35,7 +35,7 @@
<TextView
android:id="@+id/textViewSettingsWindspeedUnitDisp"
android:layout_width="118dp"
android:layout_height="48dp"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
@ -62,7 +62,7 @@
<Spinner
android:id="@+id/spinnerSettingsLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
@ -87,7 +87,7 @@
<TextView
android:id="@+id/textViewSettingsLabelDecimationTimeStep"
android:layout_width="wrap_content"
android:layout_height="41dp"
android:layout_height="50dp"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
@ -102,7 +102,7 @@
<EditText
android:id="@+id/editTextNumberSettingsMinTimeRes"
android:layout_width="93dp"
android:layout_height="41dp"
android:layout_height="50dp"
android:layout_marginTop="16dp"
android:ems="10"
android:inputType="number"

Wyświetl plik

@ -33,7 +33,7 @@
android:id="@+id/textViewTemperatureValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:text="@string/please_wait"
android:textAlignment="center"
android:textSize="50sp"
app:layout_constraintEnd_toEndOf="parent"
@ -62,7 +62,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:text="TextView"
android:text="---"
android:textAlignment="center"
android:textSize="50sp"
app:layout_constraintEnd_toEndOf="parent"
@ -90,7 +90,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:text="TextView"
android:text="---"
android:textAlignment="center"
android:textSize="50sp"
app:layout_constraintEnd_toEndOf="parent"
@ -118,7 +118,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:text="TextView"
android:text="---"
android:textAlignment="center"
android:textSize="50sp"
app:layout_constraintEnd_toEndOf="parent"
@ -145,7 +145,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:text="TextView"
android:text="---"
android:textAlignment="center"
android:textSize="50sp"
app:layout_constraintEnd_toEndOf="parent"
@ -172,7 +172,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:text="TextView"
android:text="---"
android:textAlignment="center"
android:textSize="50sp"
app:layout_constraintEnd_toEndOf="parent"

Wyświetl plik

@ -26,7 +26,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/last_data_timestamp"
android:textSize="18sp"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendStationName" />
@ -53,7 +53,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/current_value"
android:textSize="18sp"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendLastTimestampValue" />
@ -93,6 +93,7 @@
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h2_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrentTValue" />
@ -130,6 +131,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h4_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHoursTValue" />
@ -167,6 +169,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h6_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHoursTValue" />
@ -204,6 +207,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h8_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHoursTValue" />

Wyświetl plik

@ -26,7 +26,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/last_data_timestamp"
android:textSize="18sp"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendStationName" />
@ -53,7 +53,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/current_value"
android:textSize="18sp"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendLastTimestampValue" />
@ -93,6 +93,7 @@
android:layout_marginTop="16dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h2_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendCurrentTValue" />
@ -130,6 +131,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h4_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendTwoHoursTValue" />
@ -167,6 +169,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h6_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendFourHoursTValue" />
@ -204,6 +207,7 @@
android:layout_marginTop="8dp"
android:fontFamily="@font/alegreya_sans_sc_medium"
android:text="@string/h8_value"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textViewTemperatureTrendSixHoursTValue" />

Wyświetl plik

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/search"
android:title="@string/search_bar"
android:icon="@drawable/ic_search"
app:actionViewClass="android.widget.SearchView"
app:showAsAction="always" />
</menu>

Wyświetl plik

@ -8,7 +8,4 @@
<item
android:id="@+id/fav_sort_add_order"
android:title="@string/sort_in_adding_order" />
<item
android:id="@+id/fav_remove_noext"
android:title="@string/clear_from_non_existent" />
</menu>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">VYBRAT</string>
@ -187,5 +186,10 @@
<string name="export_decimation">Decimace eskportovaných údajov</string>
<string name="export_decimation_minutes">Minimální krok v minutách</string>
<string name="www_link">URL pro více informací</string>
<string name="please_wait">Please Wait</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Načítání...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">VYBRAT</string>
@ -187,5 +186,10 @@
<string name="export_decimation">Decimace eskportovaných údajov</string>
<string name="export_decimation_minutes">Minimální krok v minutách</string>
<string name="www_link">URL pro více informací</string>
<string name="please_wait">Please Wait</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Načítání...</string>
</resources>

Wyświetl plik

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Auswählen</string>
<string name="select_station">Auswählen</string>
<string name="all_stations">Alle Stationen</string>
<string name="fav_stations">Favoriten </string>
<string name="station_summary">Akutelle Werte</string>
@ -116,6 +115,11 @@
<string name="export_decimation">Dezimierung exportierten Dateien </string>
<string name="export_decimation_minutes">Minimaler Schritt in Minuten </string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Warten Sie bitte</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Wird geladen...</string>
</resources>

Wyświetl plik

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Auswählen</string>
<string name="select_station">Auswählen</string>
<string name="all_stations">Alle Stationen</string>
<string name="fav_stations">Favoriten </string>
<string name="station_summary">Akutelle Werte</string>
@ -116,6 +115,11 @@
<string name="export_decimation">Dezimierung exportierten Dateien </string>
<string name="export_decimation_minutes">Minimaler Schritt in Minuten </string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Warten Sie bitte</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Wird geladen...</string>
</resources>

Wyświetl plik

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Auswählen</string>
<string name="select_station">Auswählen</string>
<string name="all_stations">Alle Stationen</string>
<string name="fav_stations">Favoriten </string>
<string name="station_summary">Akutelle Werte</string>
@ -116,6 +115,11 @@
<string name="export_decimation">Dezimierung exportierten Dateien </string>
<string name="export_decimation_minutes">Minimaler Schritt in Minuten </string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Warten Sie bitte</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Wird geladen...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">SELECT</string>
<string name="all_stations">All Stations</string>
<string name="fav_stations">Favourities</string>
@ -70,7 +69,7 @@
<string name="sort_in_adding_order">Sort in adding order</string>
<string name="clear_from_non_existent">Clear removed stations</string>
<string name="days_3">Three days</string>
<string name="plot_data_lenght">Plots data lenght</string>
<string name="plot_data_lenght">Plots data length</string>
<string name="pressure">Pressure</string>
<string name="wind">Wind</string>
<string name="current_value">Current Value</string>
@ -90,7 +89,7 @@
<string name="forecast">Weather forecast</string>
<string name="from">From</string>
<string name="to">To</string>
<string name="language">Laguage</string>
<string name="language">Language</string>
<string name="unit_of_measure">Unit of measure</string>
<string name="wind_unit_of_measure">Windspeed unit</string>
<string name="filter">Filter</string>
@ -114,4 +113,10 @@
<string name="export_decimation">Export data decimation</string>
<string name="export_decimation_minutes">Minimum time resolution</string>
<string name="www_link">URL to more information</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="please_wait">Please Wait</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">ATLASĪT</string>
<string name="all_stations">Visas stacijas</string>
<string name="fav_stations">Izlase</string>
@ -114,4 +113,9 @@
<string name="export_decimation">Export data decimation</string>
<string name="export_decimation_minutes">Minimum time resolution</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Please Wait</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">ATLASĪT</string>
<string name="all_stations">Visas stacijas</string>
<string name="fav_stations">Izlase</string>
@ -114,4 +113,9 @@
<string name="export_decimation">Export data decimation</string>
<string name="export_decimation_minutes">Minimum time resolution</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Please Wait</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -2,15 +2,15 @@
<!-- Base application theme. -->
<style name="Theme.Meteosystem" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorPrimary">@color/white</item>
<item name="colorPrimaryVariant">@color/white</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorOnSecondary">@color/white</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor" tools:targetApi="l">@color/black</item>
<!-- Customize your theme here. -->
</style>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">WYBIERZ</string>
<string name="all_stations">Wszystkie Stacje</string>
<string name="fav_stations">Ulubione</string>
@ -114,4 +113,11 @@
<string name="export_decimation">Decymacja eskportowanych danych</string>
<string name="export_decimation_minutes">Minimalny krok w minutach</string>
<string name="www_link">Więcej informacji</string>
<string name="refreshing_station_list">Odświeżanie listy stacji</string>
<string name="all_stations_empty_list1">Brak stacji na liście.</string>
<string name="all_station_empty_list2">Proszę poczekać lub pociągnąć w dół aby odświeżyć.</string>
<string name="please_wait">Proszę czekać</string>
<string name="loading">Ładowanie...</string>
<string name="search_for_station">Wyszukaj stacji</string>
<string name="search_bar">Wyszukaj</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">WYBIERZ</string>
<string name="all_stations">Wszystkie Stacje</string>
<string name="fav_stations">Ulubione</string>
@ -114,4 +113,11 @@
<string name="export_decimation">Decymacja eskportowanych danych</string>
<string name="export_decimation_minutes">Minimalny krok w minutach</string>
<string name="www_link">Więcej informacji</string>
<string name="please_wait">Proszę czekać</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Ładowanie...</string>
<string name="search_for_station">Wyszukaj stacji</string>
<string name="search_bar">Wyszukaj</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Выбрать</string>
<string name="all_stations">Все станции</string>
<string name="fav_stations">Избранные</string>
@ -114,4 +113,9 @@
<string name="export_decimation">Децимация экспортируемых данных</string>
<string name="export_decimation_minutes">Минимальный шаг в минутах</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Proszę czekać</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Выбрать</string>
<string name="all_stations">Все станции</string>
<string name="fav_stations">Избранные</string>
@ -114,4 +113,9 @@
<string name="export_decimation">Децимация экспортируемых данных</string>
<string name="export_decimation_minutes">Минимальный шаг в минутах</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Proszę czekać</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Выбрать</string>
<string name="all_stations">Все станции</string>
<string name="fav_stations">Избранные</string>
@ -114,4 +113,9 @@
<string name="export_decimation">Децимация экспортируемых данных</string>
<string name="export_decimation_minutes">Минимальный шаг в минутах</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Proszę czekać</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Вибрати</string>
<string name="all_stations">Усі станції</string>
<string name="fav_stations">Улюблені</string>
@ -114,4 +113,8 @@
<string name="export_decimation">Децимація експортованих даних</string>
<string name="export_decimation_minutes">Мінімальний крок у хвилинах</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Proszę czekać</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MeteoSystem</string>
<string name="select_station">Вибрати</string>
<string name="all_stations">Усі станції</string>
<string name="fav_stations">Улюблені</string>
@ -114,4 +113,9 @@
<string name="export_decimation">Децимація експортованих даних</string>
<string name="export_decimation_minutes">Мінімальний крок у хвилинах</string>
<string name="www_link">URL to more information</string>
<string name="please_wait">Proszę czekać</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="loading">Loading...</string>
</resources>

Wyświetl plik

@ -1,5 +1,5 @@
<resources>
<string name="app_name">MeteoSystem</string>
<string name="app_name" translatable="false">Meteo System</string>
<string name="select_station">SELECT</string>
<string name="all_stations">All Stations</string>
<string name="fav_stations">Favourities</string>
@ -94,7 +94,7 @@
<string name="test_warning">Warning! This is a test version of the application!</string>
<string name="credits_1">Developed by:</string>
<string name="credits_2" translatable="false">Mateusz Lubecki</string>
<string name="credits_3" translatable="false">Bielsko - Biała 2020, 2021</string>
<string name="credits_3" translatable="false">Bielsko - Biała 2020, 2021, 2022</string>
<string name="credits_4" translatable="false">sp8ebc@gmail.com</string>
<string name="credits_5" translatable="false">tel: +48 660 43 44 46</string>
<string name="camera">Online Camera</string>
@ -144,4 +144,12 @@
</string-array>
<string name="lang_change_req_restart" translatable="false">Changing language requires app restart after making a choose in this window.</string>
<string name="www_link">URL to more information</string>
<string name="refreshing_station_list">Refreshing station list</string>
<string name="all_stations_empty_list1">There are no stations on this list.</string>
<string name="all_station_empty_list2">Please wait or pull down to refresh list.</string>
<string name="please_wait">Please Wait</string>
<string name="loading">Loading...</string>
<string name="credits_2_rafal" translatable="false">Rafał Woloszyn</string>
<string name="search_for_station">Search for station</string>
<string name="search_bar">Search</string>
</resources>

Wyświetl plik

@ -6,7 +6,7 @@
<item name="colorPrimaryVariant">@color/blue</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondary">@color/dark_blue</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->

Wyświetl plik

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name"
android:hint="@string/search_for_station" />

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 90 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 732 KiB

BIN
doc/stats.jpg 100644

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 49 KiB