From 8479bcd741d4d04f6f3490ebf5c572e52b956e74 Mon Sep 17 00:00:00 2001 From: woheller69 Date: Tue, 29 Apr 2025 07:11:45 +0200 Subject: [PATCH] Add produced / remaining today Remove dependenciesInfo block --- app/build.gradle | 11 ++ .../ui/RecycleList/CityWeatherAdapter.java | 19 ++- .../weather/ui/WeatherCityFragment.java | 3 +- app/src/main/res/layout/card_overview.xml | 125 +++++++++++++----- app/src/main/res/values-de/strings.xml | 3 + app/src/main/res/values/strings.xml | 4 +- 6 files changed, 126 insertions(+), 39 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6199754..3ae40a3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,17 @@ apply plugin: 'com.android.application' android { + lintOptions { + disable 'MissingTranslation' + } + + dependenciesInfo { + // Disable including dependency metadata when building APKs + includeInApk = false + // Disable including dependency metadata when building Android App Bundles + includeInBundle = false + } + compileSdk 34 defaultConfig { diff --git a/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java b/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java index 85b228b..e4229ea 100644 --- a/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java +++ b/app/src/main/java/org/woheller69/weather/ui/RecycleList/CityWeatherAdapter.java @@ -38,6 +38,8 @@ public class CityWeatherAdapter extends RecyclerView.Adapter courseDayList; private List weekForecastList; + private float producedToday; + private float remainingToday; private Context context; private ViewGroup mParent; @@ -118,6 +120,13 @@ public class CityWeatherAdapter extends RecyclerView.Adapter System.currentTimeMillis() && f.getForecastTime() < System.currentTimeMillis() + 3600000 && stepCounter <= 24) { + long millisRemainingThisHour = f.getForecastTime() - System.currentTimeMillis(); + long millisSoFarThisHour = 3600000 - millisRemainingThisHour; + producedToday = producedToday + (f.getEnergyCum()-producedToday) * millisSoFarThisHour/3600000; + } + stepCounter++; // if not in debug mode: Reset energyCumulated after every 24 hours if next step is 01:00 am because values are for previous hour if (!isDebugMode && stepCounter % 24 == 1) { @@ -136,7 +145,7 @@ public class CityWeatherAdapter extends RecyclerView.Adapter - - - - + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:background="@color/backgroundBlue"> + android:textStyle="bold" /> + + + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 7bf428b..c455042 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -111,4 +111,7 @@ Server URLs Nur ändern, wenn Sie Ihre eigenen Server betreiben wollen Zentralwechselrichter + Heute + Produziert: + Verbleibend: diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 368ff81..6d167aa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -114,5 +114,7 @@ Server URLs Only change if you want to host your own servers Central Inverter - + Today + Produced: + Remaining: