From 7372bee5d8df684df811e9c10fe3d0904dd9d217 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 10:16:01 +0100 Subject: [PATCH 01/25] Update gradle to 3.6.4 --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1319971..e2a5bef 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:3.5.4' + classpath 'com.android.tools.build:gradle:3.6.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9c24206..215e9a3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip From e04fbac4880bcbd015dc569cd178577b57e25eb9 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 10:18:07 +0100 Subject: [PATCH 02/25] Upgrade gradle to 4.2.2 --- app/build.gradle | 1 - build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a693639..caf2cac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,6 @@ apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 - buildToolsVersion "29.0.3" defaultConfig { applicationId "foss.cnugteren.nlweer" minSdkVersion 21 diff --git a/build.gradle b/build.gradle index e2a5bef..d45f39a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:3.6.4' + classpath 'com.android.tools.build:gradle:4.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 215e9a3..e443675 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip From a11cd08e6886ee2e8cd0edab5e1f090efc4087fa Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 10:20:37 +0100 Subject: [PATCH 03/25] Upgrade gradle to 7.4.2 --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 2 +- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index caf2cac..fb9d3be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,6 +28,7 @@ android { kotlinOptions { jvmTarget = "1.8" } + namespace 'foss.cnugteren.nlweer' } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9bb154b..6adf574 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ +> diff --git a/build.gradle b/build.gradle index d45f39a..29c8637 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.72' + ext.kotlin_version = '1.6.21' repositories { google() jcenter() maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e443675..505604c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip From 8716462025de92b45f26910fce2d7d22a0a8bfb7 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 10:26:08 +0100 Subject: [PATCH 04/25] Minor changes --- app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt | 1 + build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt b/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt index 8f54959..979e07c 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt @@ -342,6 +342,7 @@ class MainActivity : AppCompatActivity() { } } } + @Deprecated("Deprecated in Java") override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {} override fun onProviderEnabled(provider: String) {} override fun onProviderDisabled(provider: String) {} diff --git a/build.gradle b/build.gradle index 29c8637..b66d718 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { ext.kotlin_version = '1.6.21' repositories { google() - jcenter() + mavenCentral() maven { url 'https://jitpack.io' } } dependencies { @@ -18,7 +18,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() maven { url 'https://jitpack.io' } } From ac113fe055e5c4f430a3ae40c50200b756ca569d Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 10:48:15 +0100 Subject: [PATCH 05/25] Use ViewBinding in Activity --- app/build.gradle | 3 +++ .../java/foss/cnugteren/nlweer/MainActivity.kt | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fb9d3be..7da354c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,6 +24,9 @@ android { sourceCompatibility = 1.8 targetCompatibility = 1.8 } + buildFeatures { + viewBinding = true + } kotlinOptions { jvmTarget = "1.8" diff --git a/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt b/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt index 979e07c..b7d1c95 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt @@ -18,7 +18,6 @@ import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.BaseContextWrappingDelegate import androidx.appcompat.widget.Toolbar import androidx.core.view.isVisible -import androidx.drawerlayout.widget.DrawerLayout import androidx.fragment.app.Fragment import androidx.navigation.createGraph import androidx.navigation.findNavController @@ -30,6 +29,7 @@ import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController import androidx.preference.PreferenceManager import com.google.android.material.navigation.NavigationView +import foss.cnugteren.nlweer.databinding.ActivityMainBinding import foss.cnugteren.nlweer.ui.fragments.* class MainActivity : AppCompatActivity() { @@ -40,16 +40,19 @@ class MainActivity : AppCompatActivity() { var gpsLat: Float? = null var gpsLon: Float? = null private var baseContextWrappingDelegate: AppCompatDelegate? = null + private lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) + binding = ActivityMainBinding.inflate(layoutInflater) + val view = binding.root + setContentView(view) + val toolbar: Toolbar = findViewById(R.id.toolbar) setSupportActionBar(toolbar) createNavGraph() - val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) val navView: NavigationView = findViewById(R.id.nav_view) setMenuItemsVisibility() val navController = findNavController(R.id.nav_host_fragment) @@ -58,7 +61,7 @@ class MainActivity : AppCompatActivity() { val destinations = mutableSetOf(R.id.nav_empty) for (item in KNMI_ITEMS) { destinations.add(item.navId) } for (item in BUIENRADAR_ITEMS) { destinations.add(item.navId) } - appBarConfiguration = AppBarConfiguration(destinations, drawerLayout) + appBarConfiguration = AppBarConfiguration(destinations, binding.drawerLayout) setupActionBarWithNavController(navController, appBarConfiguration) navView.setupWithNavController(navController) @@ -151,8 +154,7 @@ class MainActivity : AppCompatActivity() { } fun setMenuItemsVisibility() { - val navView: NavigationView = findViewById(R.id.nav_view) - val menu = navView.menu + val menu = binding.navView.menu val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext) val sourceEnableKNMI = sharedPreferences.getBoolean("knmi_enable", true) From 29afe19cbbecdb15d3632371c2ecf27783c55c9c Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:15:02 +0100 Subject: [PATCH 06/25] Changed first fragment --- .../cnugteren/nlweer/ui/fragments/AboutFragment.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt index 9190c2c..53fd935 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt @@ -9,15 +9,22 @@ import androidx.fragment.app.Fragment import foss.cnugteren.nlweer.BuildConfig import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R +import foss.cnugteren.nlweer.databinding.FragmentAboutBinding class AboutFragment: Fragment() { + private var _binding: FragmentAboutBinding? = null + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! + + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - val root = inflater.inflate(R.layout.fragment_about, container, false) + _binding = FragmentAboutBinding.inflate(inflater, container, false) // Don't display floating navigation buttons val activity = this.activity as MainActivity @@ -25,9 +32,8 @@ class AboutFragment: Fragment() { val versionCode = BuildConfig.VERSION_CODE val versionName = BuildConfig.VERSION_NAME - val versionField = root.findViewById(R.id.textViewVersion) - versionField.text = versionName + " (build " + versionCode + ")" + binding.textViewVersion.text = versionName + " (build " + versionCode + ")" - return root + return binding.root } } \ No newline at end of file From 80ccfcbcfd8c36dd54d854ffb0f2b032303359e8 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:20:53 +0100 Subject: [PATCH 07/25] Update --- .../cnugteren/nlweer/ui/fragments/AboutFragment.kt | 5 +++++ .../nlweer/ui/fragments/BuienradarChartFragment.kt | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt index 53fd935..4500555 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt @@ -36,4 +36,9 @@ class AboutFragment: Fragment() { return binding.root } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } } \ No newline at end of file diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt index d917b49..cc019ee 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt @@ -23,6 +23,7 @@ import org.jsoup.Jsoup import org.jsoup.nodes.Document import kotlin.math.pow import foss.cnugteren.nlweer.R +import foss.cnugteren.nlweer.databinding.FragmentBuienradarChartBinding import kotlin.math.max @@ -32,13 +33,19 @@ class BuienradarChartFragment : Fragment() { private lateinit var chart: BarChart private var latitude: Float? = null private var longitude: Float? = null + private var _binding: FragmentBuienradarChartBinding? = null + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - root = inflater.inflate(R.layout.fragment_buienradar_chart, container, false) + _binding = FragmentBuienradarChartBinding.inflate(inflater, container, false) + val root = binding.root // Pull down to refresh the page val pullToRefresh = root.findViewById(R.id.pullToRefresh) @@ -71,6 +78,11 @@ class BuienradarChartFragment : Fragment() { return root } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + fun setLocation(lat: Float?, lon: Float?) { if (lat != null && lon != null) { // Only sets if valid latitude = lat From a73e762df982693a1ff3b37678100cbece3bab08 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:24:26 +0100 Subject: [PATCH 08/25] Update Fragment --- .../nlweer/ui/fragments/BuienradarChartFragment.kt | 8 +++----- .../nlweer/ui/fragments/BuienradarPluimFragment.kt | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt index cc019ee..c60593f 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt @@ -29,16 +29,13 @@ import kotlin.math.max class BuienradarChartFragment : Fragment() { - private lateinit var root: View - private lateinit var chart: BarChart private var latitude: Float? = null private var longitude: Float? = null private var _binding: FragmentBuienradarChartBinding? = null // This property is only valid between onCreateView and // onDestroyView. private val binding get() = _binding!! - - + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -108,7 +105,7 @@ class BuienradarChartFragment : Fragment() { background = Color.rgb(46, 46, 46) // matches Android's dark mode colours } - chart = root.findViewById(R.id.buienradar_chart) + val chart = binding.buienradarChart // Chart styling and formatting chart.axisRight.isEnabled = false @@ -158,6 +155,7 @@ class BuienradarChartFragment : Fragment() { // When complete: parses the result override fun onPostExecute(htmlDocument: Document?) { + val chart = binding.buienradarChart if (htmlDocument == null || htmlDocument.text() == "") { chart.setNoDataText(getString(R.string.menu_buienradar_chart_error) + ": " + "lat=%.2f, lon=%.2f".format(latitude, longitude)) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt index 75a9d5b..3a46ddc 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt @@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R +import foss.cnugteren.nlweer.databinding.FragmentBuienradarChartBinding class WebClientBuienradarPluim : WebViewClient() { // From https://stackoverflow.com/questions/14423981/android-webview-display-only-some-part-of-website @@ -38,6 +39,10 @@ class BuienradarPluimFragment : Fragment() { private lateinit var webView: WebView private lateinit var root: View + private var _binding: FragmentBuienradarChartBinding? = null + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! override fun onCreateView( inflater: LayoutInflater, From d91399f19050807cfc926f4f016997bea1496556 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:27:25 +0100 Subject: [PATCH 09/25] Updated buienradar pluim --- .../ui/fragments/BuienradarChartFragment.kt | 2 +- .../ui/fragments/BuienradarPluimFragment.kt | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt index c60593f..09551b5 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt @@ -35,7 +35,7 @@ class BuienradarChartFragment : Fragment() { // This property is only valid between onCreateView and // onDestroyView. private val binding get() = _binding!! - + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt index 3a46ddc..44ce81b 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt @@ -11,10 +11,12 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R import foss.cnugteren.nlweer.databinding.FragmentBuienradarChartBinding +import foss.cnugteren.nlweer.databinding.FragmentBuienradarPluimBinding class WebClientBuienradarPluim : WebViewClient() { // From https://stackoverflow.com/questions/14423981/android-webview-display-only-some-part-of-website + @Deprecated("Deprecated in Java") override fun shouldOverrideUrlLoading( view: WebView, url: String @@ -36,10 +38,7 @@ class WebClientBuienradarPluim : WebViewClient() { class BuienradarPluimFragment : Fragment() { - private lateinit var webView: WebView - - private lateinit var root: View - private var _binding: FragmentBuienradarChartBinding? = null + private var _binding: FragmentBuienradarPluimBinding? = null // This property is only valid between onCreateView and // onDestroyView. private val binding get() = _binding!! @@ -49,8 +48,9 @@ class BuienradarPluimFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { - root = inflater.inflate(R.layout.fragment_knmi_pluim, container, false) + _binding = FragmentBuienradarPluimBinding.inflate(inflater, container, false) + val root = binding.root // Pull down to refresh the page val pullToRefresh = root.findViewById(R.id.pullToRefresh) pullToRefresh.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener { @@ -63,7 +63,7 @@ class BuienradarPluimFragment : Fragment() { activity.toggleNavigationButtons(true) // The web-viewer for the content - webView = root.findViewById(R.id.web_view) as WebView + val webView = binding.webView val webViewClientModified = WebClientBuienradarPluim() webView.settings.javaScriptEnabled = true webView.webViewClient = webViewClientModified @@ -73,16 +73,23 @@ class BuienradarPluimFragment : Fragment() { return root } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + private fun getURL(): String { return "https://www.buienradar.nl/nederland/verwachtingen/de-pluim" } private fun refreshPage() { + val webView = binding.webView webView.clearCache(false) loadPage() } private fun loadPage() { + val webView = binding.webView webView.loadUrl(getURL()) } } \ No newline at end of file From 95b821974623d5835e860153c7fb3fd2baceb79b Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:32:24 +0100 Subject: [PATCH 10/25] Updated more KNMI fragments --- .../nlweer/ui/fragments/KnmiPluimFragment.kt | 22 ++++++++++++++----- .../nlweer/ui/fragments/KnmiTextFragment.kt | 21 ++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt index 4c70127..0d113e3 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt @@ -10,10 +10,13 @@ import androidx.fragment.app.Fragment import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R +import foss.cnugteren.nlweer.databinding.FragmentBuienradarPluimBinding +import foss.cnugteren.nlweer.databinding.FragmentKnmiPluimBinding class WebClientKnmiPluim : WebViewClient() { // From https://stackoverflow.com/questions/14423981/android-webview-display-only-some-part-of-website + @Deprecated("Deprecated in Java") override fun shouldOverrideUrlLoading( view: WebView, url: String @@ -38,17 +41,19 @@ class WebClientKnmiPluim : WebViewClient() { class KnmiPluimFragment : Fragment() { - private lateinit var webView: WebView - - private lateinit var root: View + private var _binding: FragmentKnmiPluimBinding? = null + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - root = inflater.inflate(R.layout.fragment_knmi_pluim, container, false) + _binding = FragmentKnmiPluimBinding.inflate(inflater, container, false) + val root = binding.root // Pull down to refresh the page val pullToRefresh = root.findViewById(R.id.pullToRefresh) pullToRefresh.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener { @@ -61,7 +66,7 @@ class KnmiPluimFragment : Fragment() { activity.toggleNavigationButtons(true) // The web-viewer for the content - webView = root.findViewById(R.id.web_view) as WebView + val webView = binding.webView val webViewClientModified = WebClientKnmiPluim() webView.settings.javaScriptEnabled = true webView.webViewClient = webViewClientModified @@ -71,16 +76,23 @@ class KnmiPluimFragment : Fragment() { return root } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + private fun getURL(): String { return "https://www.knmi.nl/nederland-nu/weer/waarschuwingen-en-verwachtingen/weer-en-klimaatpluim" } private fun refreshPage() { + val webView = binding.webView webView.clearCache(false) loadPage() } private fun loadPage() { + val webView = binding.webView webView.loadUrl(getURL()) } } \ No newline at end of file diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt index 703b166..3cc79c8 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt @@ -11,21 +11,27 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.R import android.os.AsyncTask import foss.cnugteren.nlweer.MainActivity +import foss.cnugteren.nlweer.databinding.FragmentKnmiPluimBinding +import foss.cnugteren.nlweer.databinding.FragmentKnmiTextBinding import org.jsoup.nodes.Document class KnmiTextFragment : Fragment() { - private lateinit var root: View + private var _binding: FragmentKnmiTextBinding? = null + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - root = inflater.inflate(R.layout.fragment_knmi_text, container, false) + _binding = FragmentKnmiTextBinding.inflate(inflater, container, false) // Pull down to refresh the page + val root = binding.root val pullToRefresh = root.findViewById(R.id.pullToRefresh) pullToRefresh.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener { refreshPage() @@ -41,6 +47,11 @@ class KnmiTextFragment : Fragment() { return root } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + fun getURL(): String { return "https://www.knmi.nl/nederland-nu/weer/verwachtingen" } @@ -49,7 +60,8 @@ class KnmiTextFragment : Fragment() { loadPage() } - fun loadPage() { + private fun loadPage() { + val root = binding.root val headers = arrayOf("Vandaag & Morgen", "Vooruitzichten", "", "Vooruitzichten lange termijn") root.findViewById(R.id.textViewHeader0).text = headers[0] root.findViewById(R.id.textViewHeader1).text = headers[1] @@ -73,13 +85,14 @@ class KnmiTextFragment : Fragment() { // When complete: parses the result override fun onPostExecute(htmlDocument: Document?) { + val root = binding.root if (htmlDocument == null) { root.findViewById(R.id.textViewContent0).text = getString(R.string.menu_knmi_text_failed) root.findViewById(R.id.textViewContent1).text = getString(R.string.menu_knmi_text_failed) root.findViewById(R.id.textViewContent3).text = getString(R.string.menu_knmi_text_failed) return } - var contents = arrayOf("", "", "", "") + val contents = arrayOf("", "", "", "") htmlDocument.run { select("div.columns.filled-main-content").forEachIndexed { index, group -> From 239617e19c89e9b3a3ef5bd3da5303b082f291c1 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:37:30 +0100 Subject: [PATCH 11/25] Last one --- .../nlweer/ui/fragments/MapFragment.kt | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt index dcd529c..1d7b6db 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt @@ -13,12 +13,17 @@ import foss.cnugteren.nlweer.ALL_ITEMS import foss.cnugteren.nlweer.DrawWebView import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R +import foss.cnugteren.nlweer.databinding.FragmentKnmiBinding +import foss.cnugteren.nlweer.databinding.FragmentKnmiTextBinding import java.text.SimpleDateFormat import java.util.* class MapFragment : Fragment() { - private lateinit var gifView: DrawWebView + private var _binding: FragmentKnmiBinding? = null + // This property is only valid between onCreateView and + // onDestroyView. + private val binding get() = _binding!! var url: String = "" private var imageWidth: Int = 1 @@ -30,7 +35,7 @@ class MapFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { - val root = inflater.inflate(R.layout.fragment_knmi, container, false) + _binding = FragmentKnmiBinding.inflate(inflater, container, false) val activity = this.activity as MainActivity // Iterate over all items to find the current one and set the private variables accordingly @@ -46,6 +51,7 @@ class MapFragment : Fragment() { } } + val root = binding.root // Pull down to refresh the page val pullToRefresh = root.findViewById(R.id.pullToRefresh) pullToRefresh.setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener { @@ -57,7 +63,7 @@ class MapFragment : Fragment() { activity.toggleNavigationButtons(true) // The web-viewer for the content - gifView = root.findViewById(R.id.gif_view) as DrawWebView + val gifView = binding.gifView // Sets the scale of the image root.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { @@ -92,14 +98,21 @@ class MapFragment : Fragment() { return root } + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + fun setLocation(lat: Float?, lon: Float?) { if (lat != null && lon != null) { // Only sets if valid + val gifView = binding.gifView gifView.lat = lat gifView.lon = lon } } fun refreshPage() { + val gifView = binding.gifView gifView.clearCache(false) loadPage() } @@ -134,6 +147,7 @@ class MapFragment : Fragment() { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) val backgroundColour = " " + sharedPreferences.getString("background_colour", "black") + " " + val gifView = binding.gifView // Centers the image both horizontally and vertically using CSS gifView.loadDataWithBaseURL(null,""" From 3761c6098af740e5868bc63acbf2154fe7e728ef Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:48:22 +0100 Subject: [PATCH 12/25] Remove deprecated extension --- app/build.gradle | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7da354c..0109c19 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,8 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - android { compileSdkVersion 29 defaultConfig { @@ -42,16 +40,16 @@ dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.2.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.2' - implementation 'androidx.navigation:navigation-fragment:2.3.1' - implementation 'androidx.navigation:navigation-ui:2.3.1' + implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1' + implementation 'androidx.navigation:navigation-ui-ktx:2.3.1' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1' implementation 'androidx.navigation:navigation-ui-ktx:2.3.1' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'androidx.preference:preference:1.1.1' - implementation 'org.jsoup:jsoup:1.10.3' + implementation 'androidx.preference:preference-ktx:1.1.1' + implementation 'org.jsoup:jsoup:1.17.2' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' } From dab296c7e44e78dd67dc67a63836e5b945c2f29b Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:49:48 +0100 Subject: [PATCH 13/25] Tiny update --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b66d718..0941403 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,6 @@ allprojects { } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } From 7d5471bd4e202f11af1dc96b915c852abea27a5e Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:52:52 +0100 Subject: [PATCH 14/25] Removed unused imports --- .../foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt | 2 -- .../nlweer/ui/fragments/BuienradarChartFragment.kt | 7 +++---- .../nlweer/ui/fragments/BuienradarPluimFragment.kt | 1 - .../cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt | 1 - .../foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt | 7 +++---- .../java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt | 2 -- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt index 4500555..cae1daf 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/AboutFragment.kt @@ -4,11 +4,9 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView import androidx.fragment.app.Fragment import foss.cnugteren.nlweer.BuildConfig import foss.cnugteren.nlweer.MainActivity -import foss.cnugteren.nlweer.R import foss.cnugteren.nlweer.databinding.FragmentAboutBinding class AboutFragment: Fragment() { diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt index 09551b5..637005f 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarChartFragment.kt @@ -9,7 +9,6 @@ import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.preference.PreferenceManager import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import com.github.mikephil.charting.charts.BarChart import com.github.mikephil.charting.components.AxisBase import com.github.mikephil.charting.components.Description import com.github.mikephil.charting.components.XAxis @@ -19,12 +18,12 @@ import com.github.mikephil.charting.data.BarDataSet import com.github.mikephil.charting.data.BarEntry import com.github.mikephil.charting.formatter.ValueFormatter import foss.cnugteren.nlweer.MainActivity -import org.jsoup.Jsoup -import org.jsoup.nodes.Document -import kotlin.math.pow import foss.cnugteren.nlweer.R import foss.cnugteren.nlweer.databinding.FragmentBuienradarChartBinding +import org.jsoup.Jsoup +import org.jsoup.nodes.Document import kotlin.math.max +import kotlin.math.pow class BuienradarChartFragment : Fragment() { diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt index 44ce81b..986331c 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/BuienradarPluimFragment.kt @@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R -import foss.cnugteren.nlweer.databinding.FragmentBuienradarChartBinding import foss.cnugteren.nlweer.databinding.FragmentBuienradarPluimBinding class WebClientBuienradarPluim : WebViewClient() { diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt index 0d113e3..dd07182 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiPluimFragment.kt @@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R -import foss.cnugteren.nlweer.databinding.FragmentBuienradarPluimBinding import foss.cnugteren.nlweer.databinding.FragmentKnmiPluimBinding class WebClientKnmiPluim : WebViewClient() { diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt index 3cc79c8..612ef32 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/KnmiTextFragment.kt @@ -1,18 +1,17 @@ package foss.cnugteren.nlweer.ui.fragments +import android.os.AsyncTask import android.os.Bundle -import org.jsoup.Jsoup import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.fragment.app.Fragment import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import foss.cnugteren.nlweer.R -import android.os.AsyncTask import foss.cnugteren.nlweer.MainActivity -import foss.cnugteren.nlweer.databinding.FragmentKnmiPluimBinding +import foss.cnugteren.nlweer.R import foss.cnugteren.nlweer.databinding.FragmentKnmiTextBinding +import org.jsoup.Jsoup import org.jsoup.nodes.Document diff --git a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt index 1d7b6db..f116034 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/ui/fragments/MapFragment.kt @@ -10,11 +10,9 @@ import androidx.navigation.findNavController import androidx.preference.PreferenceManager import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import foss.cnugteren.nlweer.ALL_ITEMS -import foss.cnugteren.nlweer.DrawWebView import foss.cnugteren.nlweer.MainActivity import foss.cnugteren.nlweer.R import foss.cnugteren.nlweer.databinding.FragmentKnmiBinding -import foss.cnugteren.nlweer.databinding.FragmentKnmiTextBinding import java.text.SimpleDateFormat import java.util.* From d2d9e7a526ed88cb0de715fef56e689dcd4d719b Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 11:56:37 +0100 Subject: [PATCH 15/25] Resolve minor warnings --- .../foss/cnugteren/nlweer/MainActivity.kt | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt b/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt index b7d1c95..f5ef1c0 100644 --- a/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt +++ b/app/src/main/java/foss/cnugteren/nlweer/MainActivity.kt @@ -2,7 +2,6 @@ package foss.cnugteren.nlweer import android.app.AlertDialog import android.content.Context -import android.content.DialogInterface import android.content.Intent import android.content.pm.PackageManager import android.content.res.Configuration @@ -121,7 +120,7 @@ class MainActivity : AppCompatActivity() { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } - fun createNavGraph() { + private fun createNavGraph() { // This is instead of a hard-coded mobile_navigation.xml file. That file still exists though // to define the R.id values val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment @@ -129,20 +128,22 @@ class MainActivity : AppCompatActivity() { navHostFragment.navController.apply { graph = createGraph(startDestination = R.id.nav_knmi_rain_m1) { for (item in ALL_ITEMS) { - if (item.navId == R.id.nav_knmi_text) { - fragment(item.navId) {label = getString(item.stringId) } - } - else if (item.navId == R.id.nav_knmi_pluim) { - fragment(item.navId) {label = getString(item.stringId) } - } - else if (item.navId == R.id.nav_buienradar_chart) { - fragment(item.navId) {label = getString(item.stringId) } - } - else if (item.navId == R.id.nav_buienradar_pluim) { - fragment(item.navId) {label = getString(item.stringId) } - } - else { - fragment(item.navId) {label = getString(item.stringId) } + when (item.navId) { + R.id.nav_knmi_text -> { + fragment(item.navId) {label = getString(item.stringId) } + } + R.id.nav_knmi_pluim -> { + fragment(item.navId) {label = getString(item.stringId) } + } + R.id.nav_buienradar_chart -> { + fragment(item.navId) {label = getString(item.stringId) } + } + R.id.nav_buienradar_pluim -> { + fragment(item.navId) {label = getString(item.stringId) } + } + else -> { + fragment(item.navId) {label = getString(item.stringId) } + } } } fragment(R.id.nav_empty) { label = getString(R.string.menu_empty) } @@ -184,7 +185,7 @@ class MainActivity : AppCompatActivity() { } } - fun setStartFragment() { + private fun setStartFragment() { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext) val defaultViewId = sharedPreferences.getString("settings_default_view_listpreference", (R.id.nav_knmi_rain_m1).toString())?.toInt() if (defaultViewId != null) { @@ -239,8 +240,8 @@ class MainActivity : AppCompatActivity() { builder.setMessage(R.string.share_disabled_alert_message) builder.setTitle(R.string.share_disabled_alert_title) builder.apply { - setPositiveButton(R.string.settings_buienradar_enable_accept, - DialogInterface.OnClickListener { _, _ -> }) + setPositiveButton(R.string.settings_buienradar_enable_accept + ) { _, _ -> } } builder.create() } @@ -291,9 +292,9 @@ class MainActivity : AppCompatActivity() { else if (locationProvider == "gps") { locationManager?.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0f, locationListener) } - } catch (ex: SecurityException) { } + } catch (_: SecurityException) { } } - catch (ex: Exception) { } + catch (_: Exception) { } } else { locationManager?.removeUpdates(locationListener) From f70bb1181f28f0269662074ad52717398104e0a0 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 12:10:12 +0100 Subject: [PATCH 16/25] Update gradle files --- app/build.gradle | 2 +- build.gradle | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0109c19..adb34b2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 29 + compileSdk 29 defaultConfig { applicationId "foss.cnugteren.nlweer" minSdkVersion 21 diff --git a/build.gradle b/build.gradle index 0941403..f3a845a 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,6 @@ allprojects { google() mavenCentral() maven { url 'https://jitpack.io' } - } } From b80bb8e0423dab646313d35be32dd0a14e99cfad Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 12:45:00 +0100 Subject: [PATCH 17/25] Upgrade gradle to 8.2.0 --- app/build.gradle | 1 + build.gradle | 2 +- gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index adb34b2..c9c015d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,6 +24,7 @@ android { } buildFeatures { viewBinding = true + buildConfig = true } kotlinOptions { diff --git a/build.gradle b/build.gradle index f3a845a..c9ad2ac 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 23339e0..4795480 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 505604c..43db623 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip From 23b0d355fdb6d1bfd93033ebd721167f35246c60 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 12:46:31 +0100 Subject: [PATCH 18/25] Fix warning --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4795480..0d290c2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,5 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -android.nonTransitiveRClass=false +android.nonTransitiveRClass=true android.nonFinalResIds=false From 2b8eb32d56e2953c559c0f30e11e848fdc5eec64 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 13:20:06 +0100 Subject: [PATCH 19/25] Revert "Fix warning" This reverts commit 23b0d355fdb6d1bfd93033ebd721167f35246c60. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 0d290c2..4795480 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,5 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -android.nonTransitiveRClass=true +android.nonTransitiveRClass=false android.nonFinalResIds=false From dd18e783e42fc248e0c4677b3d189efd1c4eceff Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 13:20:15 +0100 Subject: [PATCH 20/25] Revert "Upgrade gradle to 8.2.0" This reverts commit b80bb8e0423dab646313d35be32dd0a14e99cfad. --- app/build.gradle | 1 - build.gradle | 2 +- gradle.properties | 2 -- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c9c015d..adb34b2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,6 @@ android { } buildFeatures { viewBinding = true - buildConfig = true } kotlinOptions { diff --git a/build.gradle b/build.gradle index c9ad2ac..f3a845a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:8.2.0' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 4795480..23339e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,5 +19,3 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -android.nonTransitiveRClass=false -android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 43db623..505604c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip From 40071c658bef3b0e661428dae99ec4ff84da79cb Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 19:16:40 +0100 Subject: [PATCH 21/25] Updated some files --- .idea/misc.xml | 3 ++- .idea/modules.xml | 9 --------- .idea/runConfigurations.xml | 12 ------------ .idea/vcs.xml | 2 +- 4 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 .idea/modules.xml delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59..360e6d4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,7 @@ - + + diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 808920d..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file From 2d6bfe4d09cbcc35d710b4c378215c121db9904c Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 19:17:10 +0100 Subject: [PATCH 22/25] Added more .idea files --- .idea/compiler.xml | 6 ++++++ .idea/deploymentTargetDropDown.xml | 10 ++++++++++ .idea/jarRepositories.xml | 30 ++++++++++++++++++++++++++++++ .idea/kotlinc.xml | 6 ++++++ 4 files changed, 52 insertions(+) create mode 100644 .idea/compiler.xml create mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/kotlinc.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..cfc391f --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..7e340a7 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file From 32f0d75cf283c0addf296e35881f896e2196bc1c Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 19:21:46 +0100 Subject: [PATCH 23/25] Upgrade gradle to 8.2.0 --- .idea/compiler.xml | 2 +- .idea/misc.xml | 2 +- app/build.gradle | 1 + build.gradle | 2 +- gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..b589d56 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 360e6d4..d6c42ae 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index adb34b2..c9c015d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,6 +24,7 @@ android { } buildFeatures { viewBinding = true + buildConfig = true } kotlinOptions { diff --git a/build.gradle b/build.gradle index f3a845a..c9ad2ac 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 23339e0..4795480 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 505604c..43db623 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip From 8d66ca99ef43a8aeb77a29dc78a3ec83bb9d44e4 Mon Sep 17 00:00:00 2001 From: Leonard Date: Wed, 14 Feb 2024 19:27:10 +0100 Subject: [PATCH 24/25] Upgrade gradle to 8.2.2 --- app/build.gradle | 3 --- build.gradle | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c9c015d..7e4612d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,9 +27,6 @@ android { buildConfig = true } - kotlinOptions { - jvmTarget = "1.8" - } namespace 'foss.cnugteren.nlweer' } diff --git a/build.gradle b/build.gradle index c9ad2ac..c52ab97 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:8.2.0' + classpath 'com.android.tools.build:gradle:8.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From a5f8c9abfd81e8a99f18a00697db1f0af8afc91a Mon Sep 17 00:00:00 2001 From: Leonard Date: Thu, 15 Feb 2024 16:41:54 +0100 Subject: [PATCH 25/25] Upgrade kotlin to 1.9.22 --- .idea/kotlinc.xml | 2 +- app/build.gradle | 11 +++++++---- build.gradle | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 7e340a7..8d81632 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 7e4612d..419eb0a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,11 +3,11 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdk 29 + compileSdk 30 defaultConfig { applicationId "foss.cnugteren.nlweer" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 11 versionName "1.9.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -19,13 +19,16 @@ android { } } compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } buildFeatures { viewBinding = true buildConfig = true } + kotlinOptions { + jvmTarget = '17' + } namespace 'foss.cnugteren.nlweer' } diff --git a/build.gradle b/build.gradle index c52ab97..3d21bff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.21' + ext.kotlin_version = '1.9.22' repositories { google() mavenCentral()