From dccdd4dbf805043c79664ff4009ec4d39c9a53da Mon Sep 17 00:00:00 2001 From: choelzl Date: Thu, 6 Apr 2023 23:03:54 +0200 Subject: [PATCH] [m] Reorganised files and fixed tests --- app/build.gradle | 3 --- app/src/main/AndroidManifest.xml | 2 +- .../beendroid/{ => activity}/FoldingListAdapter.kt | 3 ++- .../net/helcel/beendroid/{ => activity}/MainActivity.kt | 9 ++++++--- .../main/java/net/helcel/beendroid/{ => svg}/Level.kt | 2 +- .../java/net/helcel/beendroid/{ => svg}/PSVGWrapper.kt | 2 +- app/src/main/res/menu/menu_main.xml | 2 +- app/src/test/java/net/helcel/beendroid/CountryTest.kt | 4 ++-- 8 files changed, 14 insertions(+), 13 deletions(-) rename app/src/main/java/net/helcel/beendroid/{ => activity}/FoldingListAdapter.kt (97%) rename app/src/main/java/net/helcel/beendroid/{ => activity}/MainActivity.kt (83%) rename app/src/main/java/net/helcel/beendroid/{ => svg}/Level.kt (67%) rename app/src/main/java/net/helcel/beendroid/{ => svg}/PSVGWrapper.kt (95%) diff --git a/app/build.gradle b/app/build.gradle index 7387cd8..ff9e2fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -35,7 +35,6 @@ android { } } - dependencies { implementation 'androidx.core:core-ktx:1.9.0' @@ -45,10 +44,8 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3' implementation 'androidx.navigation:navigation-ui-ktx:2.5.3' - implementation 'androidx.core:core-ktx:1.9.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d7b73e8..13b483f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,7 +15,7 @@ tools:replace="android:allowBackup" > diff --git a/app/src/main/java/net/helcel/beendroid/FoldingListAdapter.kt b/app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt similarity index 97% rename from app/src/main/java/net/helcel/beendroid/FoldingListAdapter.kt rename to app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt index fbb3bc5..23c2308 100644 --- a/app/src/main/java/net/helcel/beendroid/FoldingListAdapter.kt +++ b/app/src/main/java/net/helcel/beendroid/activity/FoldingListAdapter.kt @@ -1,4 +1,4 @@ -package net.helcel.beendroid +package net.helcel.beendroid.activity import android.content.Context import android.view.LayoutInflater @@ -8,6 +8,7 @@ import android.widget.CheckBox import android.widget.TextView import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import net.helcel.beendroid.R import net.helcel.beendroid.countries.GeoLoc import net.helcel.beendroid.countries.LocType import java.util.* diff --git a/app/src/main/java/net/helcel/beendroid/MainActivity.kt b/app/src/main/java/net/helcel/beendroid/activity/MainActivity.kt similarity index 83% rename from app/src/main/java/net/helcel/beendroid/MainActivity.kt rename to app/src/main/java/net/helcel/beendroid/activity/MainActivity.kt index 7381771..08b9a17 100644 --- a/app/src/main/java/net/helcel/beendroid/MainActivity.kt +++ b/app/src/main/java/net/helcel/beendroid/activity/MainActivity.kt @@ -1,4 +1,4 @@ -package net.helcel.beendroid +package net.helcel.beendroid.activity import android.graphics.Bitmap import android.graphics.Canvas @@ -8,8 +8,11 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.caverock.androidsvg.SVG import com.caverock.androidsvg.SVGImageView +import net.helcel.beendroid.R import net.helcel.beendroid.countries.Country import net.helcel.beendroid.countries.WORLD +import net.helcel.beendroid.svg.Level +import net.helcel.beendroid.svg.PSVGWrapper class MainActivity : AppCompatActivity() { @@ -23,9 +26,9 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) map = findViewById(R.id.map) - val cm = HashMap() + val cm = HashMap() Country.values().forEach { c-> - cm[c] = PSVGWrapper(applicationContext,c,Level.ZERO).load() + cm[c] = PSVGWrapper(applicationContext,c, Level.ZERO).load() } val fm = cm.values.fold("") { acc, e -> acc + e.data } diff --git a/app/src/main/java/net/helcel/beendroid/Level.kt b/app/src/main/java/net/helcel/beendroid/svg/Level.kt similarity index 67% rename from app/src/main/java/net/helcel/beendroid/Level.kt rename to app/src/main/java/net/helcel/beendroid/svg/Level.kt index ea3f652..3080e52 100644 --- a/app/src/main/java/net/helcel/beendroid/Level.kt +++ b/app/src/main/java/net/helcel/beendroid/svg/Level.kt @@ -1,4 +1,4 @@ -package net.helcel.beendroid +package net.helcel.beendroid.svg enum class Level(id: Int) { ZERO(0), ONE(1); diff --git a/app/src/main/java/net/helcel/beendroid/PSVGWrapper.kt b/app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt similarity index 95% rename from app/src/main/java/net/helcel/beendroid/PSVGWrapper.kt rename to app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt index 47d8152..6e698e0 100644 --- a/app/src/main/java/net/helcel/beendroid/PSVGWrapper.kt +++ b/app/src/main/java/net/helcel/beendroid/svg/PSVGWrapper.kt @@ -1,4 +1,4 @@ -package net.helcel.beendroid +package net.helcel.beendroid.svg import android.content.Context import net.helcel.beendroid.countries.Country diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index f51c94b..4f25970 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -1,7 +1,7 @@ + tools:context="net.helcel.beendroid.activity.MainActivity"> val cnt = CountryGroup.values().none { - it.countries.contains((c)) + it.children.contains((c)) } Assert.assertEquals("$c has no group !",cnt,false) } @@ -44,7 +44,7 @@ class CountryTest { fun allCountriesInASingleGroup() { Country.values().forEach { c -> val cnt = listOf(EEE,FFF,ABB,NNN,SRR,UUU,XXX,ZZZ).count { - it.countries.contains((c)) + it.children.contains((c)) } Assert.assertEquals("$c is in none or multiple continents",cnt,1) }