kopia lustrzana https://github.com/SP8EBC/MeteoSystem
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>feat/search-view-in-all-stations-activity
rodzic
6bcdf9fdbb
commit
34d43825f9
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_API_24.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-05-08T12:49:38.695730Z" />
|
||||
</component>
|
||||
</project>
|
|
@ -6,38 +6,43 @@
|
|||
<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: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: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" />
|
||||
<activity android:name=".activity.StationDetailsPlotsWind" />
|
||||
<activity android:name=".activity.StationDetailsPlotsDirection" />
|
||||
<activity android:name=".activity.StationDetailsPlotsTemperature" />
|
||||
<activity android:name=".activity.StationDetailsPlotsHumidity" />
|
||||
<activity android:name=".activity.StationDetailsSummaryActivity" />
|
||||
<activity android:name=".activity.StationDetailsActivity" />
|
||||
<activity android:name=".activity.AllStationsActivity" />
|
||||
<activity android:name=".activity.FavouritesActivity" />
|
||||
<activity android:name=".activity.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ package cc.pogoda.mobile.meteosystem;
|
|||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.jakewharton.threetenabp.AndroidThreeTen;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
@ -17,15 +19,19 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import cc.pogoda.mobile.meteosystem.activity.updater.FavouritesStationSummaryUpdater;
|
||||
|
||||
import cc.pogoda.mobile.meteosystem.dao.AllStationsDao;
|
||||
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.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;
|
||||
|
||||
|
@ -121,10 +127,9 @@ public class Main extends Application {
|
|||
|
||||
favouritiesFile = new FavouritiesFile(fileNames);
|
||||
|
||||
// download all stations from API
|
||||
listOfAllStations = new AllStationsDao().getAllStations();
|
||||
|
||||
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();
|
||||
|
@ -145,8 +150,20 @@ public class Main extends Application {
|
|||
// }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
private void recreateListOfFavs() {
|
||||
|
||||
if(listOfAllStations == null) {
|
||||
Logger.info("[recreateListOfFavs]listOfAllStations=null]");
|
||||
return;
|
||||
}
|
||||
|
||||
// check if this is a first call after application start
|
||||
if (favs == null) {
|
||||
favs = favouritiesFile.loadFavourites();
|
||||
|
@ -239,22 +256,19 @@ public class Main extends Application {
|
|||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.BACKGROUND)
|
||||
public void allStationsEventHandler(@NonNull AllStationsReceivedEvent event) {
|
||||
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) {
|
||||
|
@ -270,4 +284,10 @@ public class Main extends Application {
|
|||
return out;
|
||||
}
|
||||
|
||||
|
||||
public void startGetAllStationsService () {
|
||||
Intent mIntent = new Intent(this, GetAllStationsService.class);
|
||||
GetAllStationsService.enqueueWork(this, mIntent);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,48 +1,85 @@
|
|||
package cc.pogoda.mobile.meteosystem.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
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 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 final List<WeatherStation> allStationsList = new LinkedList<>();
|
||||
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(
|
||||
allStationsList, this, ParceableFavsCallReason.Reason.ALL_STATIONS);
|
||||
recyclerViewAllStations.setAdapter(adapter);
|
||||
|
||||
recyclerViewAllStations.setLayoutManager(new LinearLayoutManager(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().register(this);
|
||||
updateStationList(((Main) getApplication()).getListOfAllStations());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
private void updateStationList(List<WeatherStation> stations) {
|
||||
if (stations != null) {
|
||||
allStationsList.clear();
|
||||
allStationsList.addAll(stations);
|
||||
refreshLayout.setRefreshing(false);
|
||||
adapter.notifyDataSetChanged();
|
||||
} 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();
|
||||
}
|
||||
}
|
|
@ -3,31 +3,43 @@ package cc.pogoda.mobile.meteosystem.activity;
|
|||
import android.os.Bundle;
|
||||
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 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 +47,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 +91,6 @@ public class FavouritesActivity extends AppCompatActivity {
|
|||
recyclerViewFavourites.setAdapter(adapter);
|
||||
}
|
||||
|
||||
break;
|
||||
case R.id.fav_remove_noext:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -93,43 +100,65 @@ 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() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().register(this);
|
||||
updateStationList();
|
||||
}
|
||||
|
||||
recyclerViewFavourites = findViewById(R.id.recyclerViewFavourites);
|
||||
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,6 @@ 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;
|
||||
|
@ -13,27 +9,21 @@ import android.content.Intent;
|
|||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.StrictMode;
|
||||
import android.os.strictmode.Violation;
|
||||
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 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,33 +33,12 @@ 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;
|
||||
|
||||
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();
|
||||
|
@ -95,48 +64,34 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
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("[MainActivity][onCreate][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("[MainActivity][onCreate][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()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -146,21 +101,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("[MainActivity][onActivityResult][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]");
|
||||
}
|
||||
|
||||
// getContentResolver().openOutputStream(exportUri)
|
||||
|
||||
//exportUri = uri;
|
||||
|
||||
}
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@ -183,7 +140,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
"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");
|
||||
"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 +151,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, "meteosystem_" +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 +168,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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,8 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
|
|||
Summary summary = stationNameSummary.get(stationSystemName);
|
||||
|
||||
// query for available parameters
|
||||
AvailableParametersWeb params = availableParametersDao.getAvaliableParamsByStationName(stationSystemName);
|
||||
AvailableParametersWeb params
|
||||
= availableParametersDao.getAvaliableParamsByStationName(stationSystemName);
|
||||
|
||||
// if data has been collected
|
||||
if (summary != null && params != null) {
|
||||
|
@ -103,6 +104,9 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
|
|||
|
||||
String str;
|
||||
|
||||
Logger.debug("[FavouritesStationDetailsOnListUpdater][run][stationSystemName = " +
|
||||
"" + stationSystemName +"][summary.last_timestamp = " + summary.last_timestamp +"]");
|
||||
|
||||
// check if this station transmits wind information
|
||||
if (params.hasWind) {
|
||||
|
||||
|
@ -138,7 +142,7 @@ public class FavouritesStationDetailsOnListUpdater implements Runnable {
|
|||
}
|
||||
}
|
||||
else {
|
||||
Logger.error("[FavouritesStationDetailsOnListUpdater][run][summary object is null!! Maybe the API responds exeptionally slow?]");
|
||||
Logger.error("[FavouritesStationDetailsOnListUpdater][run][summary object is null!! Maybe the API responds exceptionally slow?]");
|
||||
nextExecutionDelay = 3000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ public class FavouritesStationSummaryUpdater implements Runnable {
|
|||
|
||||
|
||||
}
|
||||
else {
|
||||
Logger.info("[FavouritesStationSummaryUpdater][run][no station to update]");
|
||||
}
|
||||
|
||||
if (forceUpdate) {
|
||||
forceUpdate = false;
|
||||
|
|
|
@ -26,9 +26,9 @@ 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;
|
||||
|
||||
|
@ -51,7 +51,13 @@ 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;
|
||||
|
@ -62,77 +68,95 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
|
|||
|
||||
@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, 20.0f);
|
||||
} else {
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (station.getDisplayedName().length() > 22) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
@ -148,10 +172,19 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,9 @@ public class AvailableParametersDao {
|
|||
try {
|
||||
t.join();
|
||||
|
||||
out = response.body();
|
||||
if (response != null) {
|
||||
out = response.body();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
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.List;
|
||||
|
||||
import cc.pogoda.mobile.meteosystem.dao.AllStationsDao;
|
||||
import cc.pogoda.mobile.meteosystem.type.AllStationsReceivedEvent;
|
||||
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());
|
||||
List<WeatherStation> allStations = new AllStationsDao().getAllStations();
|
||||
if (allStations != null){
|
||||
EventBus.getDefault().post(new AllStationsReceivedEvent(allStations));
|
||||
Logger.debug("onHandleWork done. allStations size:" + allStations.size());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package cc.pogoda.mobile.meteosystem.type;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package cc.pogoda.mobile.meteosystem.type;
|
||||
|
||||
public class StartStationsRefreshEvent {
|
||||
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -70,7 +70,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 +90,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 +114,6 @@
|
|||
<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>
|
||||
|
||||
</resources>
|
|
@ -114,4 +114,7 @@
|
|||
<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>
|
||||
</resources>
|
|
@ -144,4 +144,7 @@
|
|||
</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>
|
||||
</resources>
|
Ładowanie…
Reference in New Issue