kopia lustrzana https://github.com/SP8EBC/MeteoSystem
displaying current values into favourites list
rodzic
78093e489c
commit
022016d605
|
@ -13,3 +13,143 @@
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
|
||||||
|
# Built application files
|
||||||
|
*.apk
|
||||||
|
*.ap_
|
||||||
|
*.aab
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Signing files
|
||||||
|
.signing/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio
|
||||||
|
/*/build/
|
||||||
|
/*/local.properties
|
||||||
|
/*/out
|
||||||
|
/*/*/build
|
||||||
|
/*/*/production
|
||||||
|
captures/
|
||||||
|
.navigation/
|
||||||
|
*.ipr
|
||||||
|
*~
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
# google-services.json
|
||||||
|
|
||||||
|
# Android Patch
|
||||||
|
gen-external-apklibs
|
||||||
|
|
||||||
|
# External native build folder generated in Android Studio 2.2 and later
|
||||||
|
.externalNativeBuild
|
||||||
|
|
||||||
|
# NDK
|
||||||
|
obj/
|
||||||
|
|
||||||
|
# IntelliJ IDEA
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# User-specific configurations
|
||||||
|
.idea/caches/
|
||||||
|
.idea/libraries/
|
||||||
|
.idea/shelf/
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/.name
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/copyright/profiles_settings.xml
|
||||||
|
.idea/encodings.xml
|
||||||
|
.idea/misc.xml
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/scopes/scope_settings.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/vcs.xml
|
||||||
|
.idea/jsLibraryMappings.xml
|
||||||
|
.idea/datasources.xml
|
||||||
|
.idea/dataSources.ids
|
||||||
|
.idea/sqlDataSources.xml
|
||||||
|
.idea/dynamic.xml
|
||||||
|
.idea/uiDesigner.xml
|
||||||
|
.idea/assetWizardSettings.xml
|
||||||
|
.idea/gradle.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/navEditor.xml
|
||||||
|
|
||||||
|
# OS-specific files
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Legacy Eclipse project files
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.cproject
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/mongoSettings.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
### AndroidStudio Patch ###
|
||||||
|
|
||||||
|
!/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
</deviceKey>
|
</deviceKey>
|
||||||
</Target>
|
</Target>
|
||||||
</targetSelectedWithDropDown>
|
</targetSelectedWithDropDown>
|
||||||
<timeTargetWasSelectedWithDropDown value="2021-08-22T19:33:57.901403Z" />
|
<timeTargetWasSelectedWithDropDown value="2021-11-09T11:30:18.926154Z" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -3,12 +3,14 @@
|
||||||
<component name="DesignSurface">
|
<component name="DesignSurface">
|
||||||
<option name="filePathToZoomLevelMap">
|
<option name="filePathToZoomLevelMap">
|
||||||
<map>
|
<map>
|
||||||
|
<entry key="../../../../../layout/custom_preview.xml" value="0.2171875" />
|
||||||
<entry key="app/src/main/res/layout/activity_all_stations.xml" value="0.3651041666666667" />
|
<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_all_stations_linear_layout.xml" value="0.3651041666666667" />
|
||||||
<entry key="app/src/main/res/layout/activity_export_data.xml" value="0.67" />
|
<entry key="app/src/main/res/layout/activity_export_data.xml" value="0.67" />
|
||||||
<entry key="app/src/main/res/layout/activity_favourites.xml" value="0.3651041666666667" />
|
<entry key="app/src/main/res/layout/activity_favourites.xml" value="0.3651041666666667" />
|
||||||
<entry key="app/src/main/res/layout/activity_favourites_empty.xml" value="0.3651041666666667" />
|
<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.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.3651041666666667" />
|
||||||
<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.3651041666666667" />
|
||||||
<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_plots.xml" value="0.3651041666666667" />
|
||||||
|
|
|
@ -1 +1,155 @@
|
||||||
/build
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
|
||||||
|
# Built application files
|
||||||
|
*.apk
|
||||||
|
*.ap_
|
||||||
|
*.aab
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Signing files
|
||||||
|
.signing/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio
|
||||||
|
/*/build/
|
||||||
|
/*/local.properties
|
||||||
|
/*/out
|
||||||
|
/*/*/build
|
||||||
|
/*/*/production
|
||||||
|
captures/
|
||||||
|
.navigation/
|
||||||
|
*.ipr
|
||||||
|
*~
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
# google-services.json
|
||||||
|
|
||||||
|
# Android Patch
|
||||||
|
gen-external-apklibs
|
||||||
|
|
||||||
|
# External native build folder generated in Android Studio 2.2 and later
|
||||||
|
.externalNativeBuild
|
||||||
|
|
||||||
|
# NDK
|
||||||
|
obj/
|
||||||
|
|
||||||
|
# IntelliJ IDEA
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# User-specific configurations
|
||||||
|
.idea/caches/
|
||||||
|
.idea/libraries/
|
||||||
|
.idea/shelf/
|
||||||
|
.idea/workspace.xml
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/.name
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/copyright/profiles_settings.xml
|
||||||
|
.idea/encodings.xml
|
||||||
|
.idea/misc.xml
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/scopes/scope_settings.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/vcs.xml
|
||||||
|
.idea/jsLibraryMappings.xml
|
||||||
|
.idea/datasources.xml
|
||||||
|
.idea/dataSources.ids
|
||||||
|
.idea/sqlDataSources.xml
|
||||||
|
.idea/dynamic.xml
|
||||||
|
.idea/uiDesigner.xml
|
||||||
|
.idea/assetWizardSettings.xml
|
||||||
|
.idea/gradle.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/navEditor.xml
|
||||||
|
|
||||||
|
# OS-specific files
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Legacy Eclipse project files
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.cproject
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/mongoSettings.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
### AndroidStudio Patch ###
|
||||||
|
|
||||||
|
!/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import cc.pogoda.mobile.pogodacc.dao.AllStationsDao;
|
||||||
import cc.pogoda.mobile.pogodacc.dao.LastStationDataDao;
|
import cc.pogoda.mobile.pogodacc.dao.LastStationDataDao;
|
||||||
import cc.pogoda.mobile.pogodacc.dao.SummaryDao;
|
import cc.pogoda.mobile.pogodacc.dao.SummaryDao;
|
||||||
import cc.pogoda.mobile.pogodacc.dao.mock.AllStationsDaoMock;
|
import cc.pogoda.mobile.pogodacc.dao.mock.AllStationsDaoMock;
|
||||||
|
import cc.pogoda.mobile.pogodacc.type.ParceableFavsCallReason;
|
||||||
import cc.pogoda.mobile.pogodacc.type.ParceableStationsList;
|
import cc.pogoda.mobile.pogodacc.type.ParceableStationsList;
|
||||||
import cc.pogoda.mobile.pogodacc.type.web.ListOfStationData;
|
import cc.pogoda.mobile.pogodacc.type.web.ListOfStationData;
|
||||||
import cc.pogoda.mobile.pogodacc.type.web.Summary;
|
import cc.pogoda.mobile.pogodacc.type.web.Summary;
|
||||||
|
@ -37,7 +38,7 @@ public class AllStationsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
WeatherStationRecyclerViewAdapter adapter = null;
|
WeatherStationRecyclerViewAdapter adapter = null;
|
||||||
|
|
||||||
adapter = new WeatherStationRecyclerViewAdapter(allStationsList.getList(), this, null);
|
adapter = new WeatherStationRecyclerViewAdapter(allStationsList.getList(), this, ParceableFavsCallReason.Reason.ALL_STATIONS);
|
||||||
|
|
||||||
recyclerViewAllStations.setAdapter(adapter);
|
recyclerViewAllStations.setAdapter(adapter);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class AllStationsActRecyclerViewButtonClickEvent implements View.OnClickL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (reason == null || reason == ParceableFavsCallReason.Reason.FAVOURITES) {
|
if (reason == null || reason == ParceableFavsCallReason.Reason.FAVOURITES || reason == ParceableFavsCallReason.Reason.ALL_STATIONS) {
|
||||||
intent = new Intent(p, StationDetailsActivity.class);
|
intent = new Intent(p, StationDetailsActivity.class);
|
||||||
intent.putExtra("station", station);
|
intent.putExtra("station", station);
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,29 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import cc.pogoda.mobile.pogodacc.R;
|
import cc.pogoda.mobile.pogodacc.R;
|
||||||
import cc.pogoda.mobile.pogodacc.activity.handler.AllStationsActRecyclerViewButtonClickEvent;
|
import cc.pogoda.mobile.pogodacc.activity.handler.AllStationsActRecyclerViewButtonClickEvent;
|
||||||
|
import cc.pogoda.mobile.pogodacc.type.ParceableFavsCallReason;
|
||||||
|
|
||||||
public class AllStationsActRecyclerViewHolder extends RecyclerView.ViewHolder {
|
public class AllStationsActRecyclerViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
public TextView textView;
|
public TextView textView;
|
||||||
public Button button;
|
public Button button;
|
||||||
|
public TextView textViewData;
|
||||||
|
|
||||||
public AllStationsActRecyclerViewHolder(@NonNull View itemView) {
|
public AllStationsActRecyclerViewHolder(@NonNull View itemView, ParceableFavsCallReason.Reason callReason) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
textView = itemView.findViewById(R.id.station_name);
|
if (callReason.equals(ParceableFavsCallReason.Reason.EXPORT_SELECT) || callReason.equals(ParceableFavsCallReason.Reason.ALL_STATIONS)) {
|
||||||
button = itemView.findViewById(R.id.station_button);
|
textView = itemView.findViewById(R.id.station_name);
|
||||||
|
button = itemView.findViewById(R.id.station_button);
|
||||||
|
textViewData = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
textView = itemView.findViewById(R.id.station_name_fav);
|
||||||
|
button = itemView.findViewById(R.id.station_button_fav);
|
||||||
|
textViewData = itemView.findViewById(R.id.station_data_fav);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,11 @@ import java.util.List;
|
||||||
import cc.pogoda.mobile.pogodacc.R;
|
import cc.pogoda.mobile.pogodacc.R;
|
||||||
import cc.pogoda.mobile.pogodacc.activity.handler.AllStationsActRecyclerViewButtonClickEvent;
|
import cc.pogoda.mobile.pogodacc.activity.handler.AllStationsActRecyclerViewButtonClickEvent;
|
||||||
import cc.pogoda.mobile.pogodacc.activity.view.AllStationsActRecyclerViewHolder;
|
import cc.pogoda.mobile.pogodacc.activity.view.AllStationsActRecyclerViewHolder;
|
||||||
|
import cc.pogoda.mobile.pogodacc.dao.SummaryDao;
|
||||||
import cc.pogoda.mobile.pogodacc.type.ParceableFavsCallReason;
|
import cc.pogoda.mobile.pogodacc.type.ParceableFavsCallReason;
|
||||||
import cc.pogoda.mobile.pogodacc.type.WeatherStation;
|
import cc.pogoda.mobile.pogodacc.type.WeatherStation;
|
||||||
|
import cc.pogoda.mobile.pogodacc.type.web.QualityFactor;
|
||||||
|
import cc.pogoda.mobile.pogodacc.type.web.Summary;
|
||||||
|
|
||||||
public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllStationsActRecyclerViewHolder> {
|
public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllStationsActRecyclerViewHolder> {
|
||||||
|
|
||||||
|
@ -27,10 +30,13 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
|
||||||
|
|
||||||
ParceableFavsCallReason.Reason reason;
|
ParceableFavsCallReason.Reason reason;
|
||||||
|
|
||||||
|
SummaryDao summaryDao;
|
||||||
|
|
||||||
public WeatherStationRecyclerViewAdapter(List<WeatherStation> stations, AppCompatActivity parentActivity, ParceableFavsCallReason.Reason callReason) {
|
public WeatherStationRecyclerViewAdapter(List<WeatherStation> stations, AppCompatActivity parentActivity, ParceableFavsCallReason.Reason callReason) {
|
||||||
this.stations = stations;
|
this.stations = stations;
|
||||||
this.activity = parentActivity;
|
this.activity = parentActivity;
|
||||||
this.reason = callReason;
|
this.reason = callReason;
|
||||||
|
this.summaryDao = new SummaryDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -39,17 +45,27 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
|
||||||
Context context = parent.getContext();
|
Context context = parent.getContext();
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
|
||||||
// Inflate the custom layout
|
View view;
|
||||||
View view = inflater.inflate(R.layout.activity_all_stations_linear_layout, parent, false);
|
|
||||||
|
// 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 a new holder instance
|
// Return a new holder instance
|
||||||
AllStationsActRecyclerViewHolder viewHolder = new AllStationsActRecyclerViewHolder(view);
|
AllStationsActRecyclerViewHolder viewHolder = new AllStationsActRecyclerViewHolder(view, reason);
|
||||||
return viewHolder;
|
return viewHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull AllStationsActRecyclerViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull AllStationsActRecyclerViewHolder holder, int position) {
|
||||||
TextView textView = holder.textView;
|
TextView textView = holder.textView;
|
||||||
|
TextView textViewData = holder.textViewData;
|
||||||
Button button = holder.button;
|
Button button = holder.button;
|
||||||
|
|
||||||
WeatherStation station = stations.get(position);
|
WeatherStation station = stations.get(position);
|
||||||
|
@ -61,6 +77,33 @@ public class WeatherStationRecyclerViewAdapter extends RecyclerView.Adapter<AllS
|
||||||
button.setOnClickListener(new AllStationsActRecyclerViewButtonClickEvent(station, activity, reason));
|
button.setOnClickListener(new AllStationsActRecyclerViewButtonClickEvent(station, activity, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (textViewData != null) {
|
||||||
|
Summary summary = summaryDao.getStationSummary(station.getSystemName());
|
||||||
|
|
||||||
|
if (summary != null) {
|
||||||
|
String str;
|
||||||
|
if (summary.wind_qf_native.equals(QualityFactor.FULL) || summary.wind_qf_native.equals(QualityFactor.DEGRADED)) {
|
||||||
|
if (summary.humidity_qf_native.equals(QualityFactor.FULL) || summary.humidity_qf_native.equals(QualityFactor.DEGRADED)) {
|
||||||
|
str = String.format("%d°C %d%% %s %3.1f m/s max %3.1f m/s", Math.round(summary.avg_temperature), summary.humidity, summary.getWindDirStr(), summary.average_speed, summary.gusts);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
str = String.format("%d°C %s %3.1f m/s max %3.1f m/s", Math.round(summary.avg_temperature), summary.getWindDirStr(), summary.average_speed, summary.gusts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (summary.humidity_qf_native.equals(QualityFactor.FULL) || summary.humidity_qf_native.equals(QualityFactor.DEGRADED)) {
|
||||||
|
str = String.format("%d°C %d%%", Math.round(summary.avg_temperature), summary.humidity);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
str = String.format("%d°C", Math.round(summary.avg_temperature));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
textViewData.setText(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,7 +7,8 @@ public class ParceableFavsCallReason implements Parcelable {
|
||||||
|
|
||||||
public enum Reason {
|
public enum Reason {
|
||||||
FAVOURITES,
|
FAVOURITES,
|
||||||
EXPORT_SELECT
|
EXPORT_SELECT,
|
||||||
|
ALL_STATIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reason getReason() {
|
public Reason getReason() {
|
||||||
|
@ -26,6 +27,7 @@ public class ParceableFavsCallReason implements Parcelable {
|
||||||
switch (reasonInt) {
|
switch (reasonInt) {
|
||||||
case 1: reason = Reason.FAVOURITES; break;
|
case 1: reason = Reason.FAVOURITES; break;
|
||||||
case 2: reason = Reason.EXPORT_SELECT; break;
|
case 2: reason = Reason.EXPORT_SELECT; break;
|
||||||
|
case 3: reason = Reason.ALL_STATIONS; break;
|
||||||
default: reason = null;
|
default: reason = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +37,7 @@ public class ParceableFavsCallReason implements Parcelable {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case FAVOURITES: dest.writeInt(1); break;
|
case FAVOURITES: dest.writeInt(1); break;
|
||||||
case EXPORT_SELECT: dest.writeInt(2); break;
|
case EXPORT_SELECT: dest.writeInt(2); break;
|
||||||
|
case ALL_STATIONS: dest.writeInt(3); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ public class StationWindRoseActElements implements StationActivityElements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create strings with wind speed, gusts etc
|
||||||
|
String average_speed = String.format("%3.1f", data.average_speed);
|
||||||
|
String gusts_speed = String.format("%3.1f", data.gusts);
|
||||||
|
|
||||||
// check if wind data is avaliable in the input data set
|
// check if wind data is avaliable in the input data set
|
||||||
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
||||||
windArrow.setRotation(data.direction - 225.0f);
|
windArrow.setRotation(data.direction - 225.0f);
|
||||||
|
@ -103,13 +107,13 @@ public class StationWindRoseActElements implements StationActivityElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
||||||
windSpeed.setText(activity.getResources().getString(R.string.mean_value) + '\n' + data.average_speed + "m/s");
|
windSpeed.setText(activity.getResources().getString(R.string.mean_value) + '\n' + average_speed + "m/s");
|
||||||
} else {
|
} else {
|
||||||
windSpeed.setText(activity.getResources().getString(R.string.mean_value) + '\n' + "---");
|
windSpeed.setText(activity.getResources().getString(R.string.mean_value) + '\n' + "---");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
if (!no_data && !data.wind_qf_native.equals(QualityFactor.NOT_AVALIABLE)) {
|
||||||
windGusts.setText(activity.getResources().getString(R.string.wind_gust_short) + '\n' + data.gusts + "m/s");
|
windGusts.setText(activity.getResources().getString(R.string.wind_gust_short) + '\n' + gusts_speed + "m/s");
|
||||||
} else {
|
} else {
|
||||||
windGusts.setText(activity.getResources().getString(R.string.wind_gust_short) + '\n' + "---");
|
windGusts.setText(activity.getResources().getString(R.string.wind_gust_short) + '\n' + "---");
|
||||||
|
|
||||||
|
@ -129,9 +133,12 @@ public class StationWindRoseActElements implements StationActivityElements {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_data && !old_data) {
|
if (!no_data && !old_data) {
|
||||||
|
String hour_max_gusts = String.format("%3.1f", data.hour_gusts);
|
||||||
|
String hour_min_avg = String.format("%3.1f", data.hour_min_average_speed);
|
||||||
|
|
||||||
pressure.setText(activity.getResources().getString(R.string.qnh) + ": " + String.format("%d hPa", data.qnh));
|
pressure.setText(activity.getResources().getString(R.string.qnh) + ": " + String.format("%d hPa", data.qnh));
|
||||||
maxGust.setText(activity.getResources().getString(R.string.max_1h_gust) + ": " + data.hour_gusts + "m/s");
|
maxGust.setText(activity.getResources().getString(R.string.max_1h_gust) + ": " + hour_max_gusts + "m/s");
|
||||||
minAverage.setText(activity.getResources().getString(R.string.min_1h_avg) + ": " + data.hour_min_average_speed + "m/s");
|
minAverage.setText(activity.getResources().getString(R.string.min_1h_avg) + ": " + hour_min_avg + "m/s");
|
||||||
} else if (!no_data && old_data) {
|
} else if (!no_data && old_data) {
|
||||||
maxGust.setText(activity.getResources().getString(R.string.warning));
|
maxGust.setText(activity.getResources().getString(R.string.warning));
|
||||||
maxGust.setTextColor(Color.RED);
|
maxGust.setTextColor(Color.RED);
|
||||||
|
|
|
@ -46,4 +46,99 @@ public class Summary {
|
||||||
wind_qf_native = QualityFactor.UNSET;
|
wind_qf_native = QualityFactor.UNSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getWindDirStr() {
|
||||||
|
String out;
|
||||||
|
|
||||||
|
if (direction <= 11 && direction >= 349) {
|
||||||
|
out = String.format("%5s", "N");
|
||||||
|
}
|
||||||
|
else if (direction <= 34 && direction > 11) {
|
||||||
|
out = String.format("%5s", "N NE");
|
||||||
|
}
|
||||||
|
else if (direction <= 56 && direction > 34) {
|
||||||
|
out = String.format("%5s", "NE");
|
||||||
|
}
|
||||||
|
else if (direction <= 79 && direction > 56) {
|
||||||
|
out = String.format("%5s", "E NE");
|
||||||
|
}
|
||||||
|
else if (direction <= 101 && direction > 79) {
|
||||||
|
out = String.format("%5s", "E");
|
||||||
|
}
|
||||||
|
else if (direction <= 124 && direction > 101) {
|
||||||
|
out = String.format("%5s", "E SE");
|
||||||
|
}
|
||||||
|
else if (direction <= 146 && direction > 124) {
|
||||||
|
out = String.format("%5s", "SE");
|
||||||
|
}
|
||||||
|
else if (direction <= 169 && direction > 146) {
|
||||||
|
out = String.format("%5s", "S SE");
|
||||||
|
}
|
||||||
|
else if (direction <= 191 && direction > 169) {
|
||||||
|
out = String.format("%5s", "S");
|
||||||
|
}
|
||||||
|
else if (direction <= 214 && direction > 191) {
|
||||||
|
out = String.format("%5s", "S SW");
|
||||||
|
}
|
||||||
|
else if (direction <= 236 && direction > 214) {
|
||||||
|
out = String.format("%5s", "SW");
|
||||||
|
}
|
||||||
|
else if (direction <= 259 && direction > 236) {
|
||||||
|
out = String.format("%5s", "W SW");
|
||||||
|
}
|
||||||
|
else if (direction <= 281 && direction > 259) {
|
||||||
|
out = String.format("%5s", "W");
|
||||||
|
}
|
||||||
|
else if (direction <= 304 && direction > 281) {
|
||||||
|
out = String.format("%5s", "W NW");
|
||||||
|
}
|
||||||
|
else if (direction <= 327 && direction > 304) {
|
||||||
|
out = String.format("%5s", "NW");
|
||||||
|
}
|
||||||
|
else if (direction <= 349 && direction > 327) {
|
||||||
|
out = String.format("%5s", "N NW");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
if (WX.wind_direction <= 11 && WX.wind_direction >= 349)
|
||||||
|
html << "- N";
|
||||||
|
else if (WX.wind_direction <= 34 && WX.wind_direction > 11)
|
||||||
|
html << "- N NE";
|
||||||
|
else if (WX.wind_direction <= 56 && WX.wind_direction > 34)
|
||||||
|
html << "- NE";
|
||||||
|
else if (WX.wind_direction <= 79 && WX.wind_direction > 56)
|
||||||
|
html << "- E NE";
|
||||||
|
else if (WX.wind_direction <= 101 && WX.wind_direction > 79)
|
||||||
|
html << "- E";
|
||||||
|
else if (WX.wind_direction <= 124 && WX.wind_direction > 101)
|
||||||
|
html << "- E SE";
|
||||||
|
else if (WX.wind_direction <= 146 && WX.wind_direction > 124)
|
||||||
|
html << "- SE";
|
||||||
|
else if (WX.wind_direction <= 169 && WX.wind_direction > 146)
|
||||||
|
html << "- S SE";
|
||||||
|
else if (WX.wind_direction <= 191 && WX.wind_direction > 169)
|
||||||
|
html << "- S";
|
||||||
|
else if (WX.wind_direction <= 214 && WX.wind_direction > 191)
|
||||||
|
html << "- S SW";
|
||||||
|
else if (WX.wind_direction <= 236 && WX.wind_direction > 214)
|
||||||
|
html << "- SW";
|
||||||
|
else if (WX.wind_direction <= 259 && WX.wind_direction > 236)
|
||||||
|
html <<"- W SW";
|
||||||
|
else if (WX.wind_direction <= 281 && WX.wind_direction > 259)
|
||||||
|
html << "- W";
|
||||||
|
else if (WX.wind_direction <= 304 && WX.wind_direction > 281)
|
||||||
|
html << "- W NW";
|
||||||
|
else if (WX.wind_direction <= 327 && WX.wind_direction > 304)
|
||||||
|
html << "- NW";
|
||||||
|
else if (WX.wind_direction <= 349 && WX.wind_direction > 327)
|
||||||
|
html << "- N NW";
|
||||||
|
else;
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?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:id="@+id/cLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/station_name_fav"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/station_button_fav"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/station_button_fav"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/station_button_fav" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/station_button_fav"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:textSize="10sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/station_name_fav"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/station_data_fav"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/station_button_fav"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/station_button_fav"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/station_name_fav" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Ładowanie…
Reference in New Issue