[M] Refactor, Cleanup,...

This commit is contained in:
soraefir 2024-04-03 01:32:02 +02:00
parent 3ea1a86590
commit 4fd4eff258
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
72 changed files with 16777 additions and 6726 deletions

View File

@ -6,45 +6,53 @@ plugins {
}
android {
namespace 'net.helcel.beendroid'
namespace 'net.helcel.beans'
compileSdk 34
defaultConfig {
applicationId 'net.helcel.beendroid'
applicationId 'net.helcel.beans'
minSdk 28
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
encoding 'utf-8'
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_17
}
buildFeatures {
viewBinding true
}
dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.12.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
implementation 'com.google.android.material:material:1.11.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3'
@ -52,5 +60,4 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation "com.github.AppDevNext:AndroidChart:3.1.0.21"
implementation 'com.mikepenz:aboutlibraries:11.1.1'
}

View File

@ -10,7 +10,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Beendroid"
android:theme="@style/Theme.Beans"
tools:targetApi="31"
tools:replace="android:allowBackup"
>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.5 MiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 454 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.5 MiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.3 MiB

View File

@ -1,14 +1,17 @@
package net.helcel.beendroid.activity
package net.helcel.beans.activity
import android.os.Bundle
import android.view.MenuItem
import androidx.activity.addCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import net.helcel.beendroid.R
import net.helcel.beendroid.activity.adapter.ViewPagerAdapter
import net.helcel.beendroid.helper.createActionBar
import net.helcel.beans.R
import net.helcel.beans.activity.adapter.ViewPagerAdapter
import net.helcel.beans.activity.fragment.EditPlaceFragment
import net.helcel.beans.countries.World
import net.helcel.beans.helper.Theme.createActionBar
class EditActivity : AppCompatActivity() {
@ -26,12 +29,19 @@ class EditActivity : AppCompatActivity() {
viewPager = findViewById(R.id.pager)
tabLayout = findViewById(R.id.tab)
val adapter = ViewPagerAdapter(supportFragmentManager, lifecycle)
val adapter = ViewPagerAdapter(supportFragmentManager, lifecycle, viewPager)
viewPager.adapter = adapter
adapter.addFragment(null, EditPlaceFragment(World.WWW, adapter))
TabLayoutMediator(tabLayout, viewPager) { tab, position ->
tab.text = adapter.getTabs()[position]
tab.text = adapter.getLabel(position)
}.attach()
onBackPressedDispatcher.addCallback {
if (!adapter.backPressed()) {
finish()
}
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -1,4 +1,4 @@
package net.helcel.beendroid.activity
package net.helcel.beans.activity
import android.content.Intent
import android.content.SharedPreferences
@ -9,18 +9,15 @@ import android.view.MenuInflater
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.preference.PreferenceManager
import com.caverock.androidsvg.RenderOptions
import com.github.chrisbanes.photoview.PhotoView
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import net.helcel.beendroid.R
import net.helcel.beendroid.activity.fragment.SettingsFragment
import net.helcel.beendroid.svg.CSSWrapper
import net.helcel.beendroid.svg.SVGWrapper
import net.helcel.beendroid.helper.*
import net.helcel.beans.R
import net.helcel.beans.countries.GeoLocImporter
import net.helcel.beans.helper.Data.loadData
import net.helcel.beans.helper.Settings
import net.helcel.beans.helper.Theme.colorWrapper
import net.helcel.beans.svg.CSSWrapper
import net.helcel.beans.svg.SVGWrapper
class MainActivity : AppCompatActivity() {
@ -44,8 +41,7 @@ class MainActivity : AppCompatActivity() {
supportActionBar?.setBackgroundDrawable(colorWrapper(this, android.R.attr.colorPrimary))
// Fetch shared preferences to restore app theme upon startup
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
SettingsFragment.setTheme(this, sharedPreferences.getString(getString(R.string.key_theme), getString(R.string.system)))
Settings.start(this)
// Create menu in action bar
addMenuProvider(object : MenuProvider {
@ -59,14 +55,17 @@ class MainActivity : AppCompatActivity() {
startActivity(Intent(this@MainActivity, EditActivity::class.java))
true
}
R.id.action_stats -> {
startActivity(Intent(this@MainActivity, StatActivity::class.java))
true
}
R.id.action_settings -> {
startActivity(Intent(this@MainActivity, SettingsActivity::class.java))
true
}
else -> {
false
}
@ -80,8 +79,9 @@ class MainActivity : AppCompatActivity() {
photoView = findViewById(R.id.photo_view)
photoView.minimumScale = 1f
photoView.maximumScale = 50f
photoView.maximumScale = 40f
GeoLocImporter.importState(this)
loadData(this, Int.MIN_VALUE)
psvg = SVGWrapper(this)
css = CSSWrapper(this)
@ -91,6 +91,7 @@ class MainActivity : AppCompatActivity() {
private fun refreshMap() {
val opt: RenderOptions = RenderOptions.create()
css.refresh()
opt.css(css.get())
photoView.setImageDrawable(PictureDrawable(psvg.get()?.renderToPicture(opt)))
}

View File

@ -1,13 +1,13 @@
package net.helcel.beendroid.activity
package net.helcel.beans.activity
import android.os.Bundle
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import net.helcel.beendroid.R
import net.helcel.beendroid.activity.fragment.AboutFragment
import net.helcel.beendroid.activity.fragment.LicenseFragment
import net.helcel.beendroid.activity.fragment.SettingsFragment
import net.helcel.beendroid.helper.*
import net.helcel.beans.R
import net.helcel.beans.activity.fragment.AboutFragment
import net.helcel.beans.activity.fragment.LicenseFragment
import net.helcel.beans.activity.fragment.SettingsFragment
import net.helcel.beans.helper.Theme.createActionBar
class SettingsActivity : AppCompatActivity() {
@ -24,7 +24,8 @@ class SettingsActivity: AppCompatActivity() {
// Change title in action bar according to current fragment
supportFragmentManager.addFragmentOnAttachListener { _, _ ->
supportActionBar?.title = supportFragmentManager.findFragmentById(R.id.fragment_view).let {
supportActionBar?.title =
supportFragmentManager.findFragmentById(R.id.fragment_view).let {
when (it) {
is LicenseFragment -> getString(R.string.licenses)
is AboutFragment -> getString(R.string.about)
@ -43,10 +44,15 @@ class SettingsActivity: AppCompatActivity() {
.remove(it)
.commit()
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_view, SettingsFragment(), getString(R.string.action_settings))
.replace(
R.id.fragment_view,
SettingsFragment(),
getString(R.string.action_settings)
)
.commit()
supportActionBar?.title = getString(R.string.action_settings)
}
else -> {
finish()
}

View File

@ -1,7 +1,6 @@
package net.helcel.beendroid.activity
package net.helcel.beans.activity
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.util.Log
import android.view.MenuItem
@ -12,12 +11,12 @@ import com.github.mikephil.charting.data.PieDataSet
import com.github.mikephil.charting.data.PieEntry
import com.github.mikephil.charting.formatter.PercentFormatter
import com.github.mikephil.charting.utils.MPPointF
import net.helcel.beendroid.R
import net.helcel.beendroid.countries.World
import net.helcel.beendroid.helper.colorWrapper
import net.helcel.beendroid.helper.createActionBar
import net.helcel.beendroid.helper.groups
import net.helcel.beendroid.helper.visits
import net.helcel.beans.R
import net.helcel.beans.countries.World
import net.helcel.beans.helper.Data.groups
import net.helcel.beans.helper.Data.visits
import net.helcel.beans.helper.Theme.colorWrapper
import net.helcel.beans.helper.Theme.createActionBar
class StatActivity : AppCompatActivity() {
@ -63,13 +62,21 @@ class StatActivity : AppCompatActivity() {
private fun bind() {
val entries = ArrayList<PieEntry>()
val VIS_continents = World.WWW.children.groupBy { visits?.getVisited(it)?:0 }.map { Pair(it.key,it.value.map { c-> c.area }.fold(0){ acc, i-> acc+i}) }
val VIS_country = World.WWW.children.map { it.children }.flatten().groupBy { visits!!.getVisited(it) }.map { Pair(it.key,it.value.map { c-> c.area }.fold(0){ acc, i-> acc+i}) }
val VIS_continents = World.WWW.children.groupBy { visits.getVisited(it) }
.map { Pair(it.key, it.value.map { c -> c.area }.fold(0) { acc, i -> acc + i }) }
val VIS_country =
World.WWW.children.map { it.children }.flatten().groupBy { visits.getVisited(it) }
.map { Pair(it.key, it.value.map { c -> c.area }.fold(0) { acc, i -> acc + i }) }
val vis = VIS_country
Log.d("VIS", vis.toString())
val max = vis.map { it.second }.fold(0) { acc, i -> acc + i }
vis.forEach {
entries.add(PieEntry(it.second.toFloat().div(max.toFloat()),groups!!.getGroupFromKey(it.first)?.name?:"None"))
entries.add(
PieEntry(
it.second.toFloat().div(max.toFloat()),
groups.getGroupFromKey(it.first).name
)
)
}
val dataSet = PieDataSet(entries, "GG1")
@ -80,7 +87,7 @@ class StatActivity : AppCompatActivity() {
dataSet.setDrawIcons(true)
dataSet.colors = vis.map{ (groups!!.getGroupFromKey(it.first)?.color?:ColorDrawable(Color.WHITE)).color }.toList()
dataSet.colors = vis.map { groups.getGroupFromKey(it.first).color.color }.toList()
val data = PieData(dataSet)
data.setDrawValues(false)
@ -94,6 +101,4 @@ class StatActivity : AppCompatActivity() {
}
}

View File

@ -0,0 +1,160 @@
package net.helcel.beans.activity.adapter
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Typeface
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.FragmentActivity
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.checkbox.MaterialCheckBox
import net.helcel.beans.R
import net.helcel.beans.activity.fragment.EditPlaceColorFragment
import net.helcel.beans.activity.fragment.EditPlaceFragment
import net.helcel.beans.countries.GeoLoc
import net.helcel.beans.helper.Data.groups
import net.helcel.beans.helper.Data.saveData
import net.helcel.beans.helper.Data.selected_geoloc
import net.helcel.beans.helper.Data.selected_group
import net.helcel.beans.helper.Data.visits
import net.helcel.beans.helper.Settings
import net.helcel.beans.helper.Theme.colorWrapper
class GeolocListAdapter(
private val ctx: EditPlaceFragment, val l: GeoLoc, private val pager: ViewPagerAdapter
) : RecyclerView.Adapter<GeolocListAdapter.FoldingListViewHolder>() {
private lateinit var view: View
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): FoldingListViewHolder {
view = LayoutInflater
.from(viewGroup.context)
.inflate(R.layout.item_list_geoloc, viewGroup, false)
return FoldingListViewHolder(ctx.requireActivity(), view)
}
override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) {
val el = l.children[position]
holder.bind(el)
holder.addListeners(el) {
if (el.children.isNotEmpty())
pager.addFragment(ctx, EditPlaceFragment(el, pager))
true
}
}
override fun getItemCount(): Int {
return l.children.size
}
class FoldingListViewHolder(private val ctx: FragmentActivity, itemView: View) :
RecyclerView.ViewHolder(itemView) {
private val textView: TextView = itemView.findViewById(R.id.textView)
private val progressView: TextView = itemView.findViewById(R.id.name)
private val checkBox: MaterialCheckBox = itemView.findViewById(R.id.checkBox)
private val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
private val statsPref = sharedPreferences.getString(
ctx.getString(R.string.key_stats),
ctx.getString(R.string.counters)
)
fun bind(el: GeoLoc) {
textView.text = el.fullName
if (el.children.isEmpty() || (el.type == GeoLoc.LocType.COUNTRY && !Settings.isRegional(
ctx
))
) {
textView.backgroundTintList =
ColorStateList.valueOf(colorWrapper(ctx, android.R.attr.colorBackground).color)
} else {
textView.setTypeface(null, Typeface.BOLD)
val numerator = el.children.map { visits.getVisited(it) != 0 }.count { it }
val denominator = el.children.size
progressView.text = when (statsPref) {
ctx.getString(R.string.percentages) -> ctx.getString(
R.string.percentage,
(100 * (numerator.toFloat() / denominator.toFloat())).toInt()
)
else -> ctx.getString(R.string.rate, numerator, denominator)
}
textView.backgroundTintList = ColorStateList.valueOf(
colorWrapper(
ctx,
android.R.attr.panelColorBackground
).color
).withAlpha(128)
textView.parent.parent.requestChildFocus(textView, textView)
}
refreshCheck(el)
}
fun addListeners(el: GeoLoc, expandLambda: () -> Boolean) {
if (el.children.isNotEmpty() && (el.type != GeoLoc.LocType.COUNTRY || Settings.isRegional(
ctx
))
) {
textView.setOnClickListener { expandLambda() }
}
checkBox.setOnClickListener {
selected_geoloc = el
if (groups.size() == 1 && Settings.isSingleGroup(ctx)) {
if (checkBox.isChecked) {
// If one has just checked the box (assign unique group)
selected_group = groups.getUniqueEntry()
onColorDialogDismiss(false)
} else {
// If one has just unchecked the box (unassign unique group)
selected_group = null
onColorDialogDismiss(true)
}
} else {
selected_group = null
EditPlaceColorFragment(this).show(
ctx.supportFragmentManager,
"AddColorDialogFragment"
)
}
}
}
fun onColorDialogDismiss(clear: Boolean) {
if (clear) {
visits.setVisited(selected_geoloc!!, 0)
saveData()
}
if (selected_group != null && selected_geoloc != null) {
visits.setVisited(selected_geoloc!!, selected_group!!.key)
saveData()
}
selected_geoloc?.let { refreshCheck(it) }
selected_geoloc = null
selected_group = null
}
private fun refreshCheck(geoLoc: GeoLoc) {
var col = groups.getGroupFromKey(visits.getVisited(geoLoc)).color.color
if (col == Color.TRANSPARENT)
col = Color.GRAY
checkBox.checkedState =
if (visits.getVisited(geoLoc) != 0) MaterialCheckBox.STATE_CHECKED
else if (geoLoc.children.any { visits.getVisited(it) != 0 }) MaterialCheckBox.STATE_INDETERMINATE
else MaterialCheckBox.STATE_UNCHECKED
checkBox.buttonTintList = ColorStateList(
arrayOf(
intArrayOf(-android.R.attr.state_checked),
intArrayOf(android.R.attr.state_checked)
),
intArrayOf(col, col)
)
}
}
}

View File

@ -0,0 +1,80 @@
package net.helcel.beans.activity.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import net.helcel.beans.R
import net.helcel.beans.activity.fragment.EditGroupAddFragment
import net.helcel.beans.helper.Data
import net.helcel.beans.helper.Groups
import net.helcel.beans.helper.Theme.getContrastColor
class GroupListAdapter(
private val activity: FragmentActivity,
private val selectDialog: DialogFragment
) : RecyclerView.Adapter<GroupListAdapter.GroupViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GroupViewHolder {
val view: View =
LayoutInflater.from(parent.context).inflate(R.layout.item_list_group, parent, false)
return GroupViewHolder(view, activity, selectDialog)
}
override fun onBindViewHolder(holder: GroupViewHolder, pos: Int) {
holder.bind(Data.groups.getGroupFromPos(pos))
}
override fun getItemCount(): Int {
return Data.groups.size()
}
inner class GroupViewHolder(
itemView: View,
private val activity: FragmentActivity,
private val selectDialog: DialogFragment
) : RecyclerView.ViewHolder(itemView) {
private val color: Button = itemView.findViewById(R.id.group_color)
private val entries: TextView = itemView.findViewById(R.id.name)
private lateinit var dialogFragment: EditGroupAddFragment
fun bind(entry: Pair<Int, Groups.Group>) {
color.text = entry.second.name
dialogFragment = EditGroupAddFragment(entry.first, {
val newEntry = Data.groups.getGroupFromKey(entry.first)
color.text = newEntry.name
val newEntryColor = newEntry.color.color
val contrastNewEntryColor =
getContrastColor(newEntryColor)
color.setBackgroundColor(newEntryColor)
color.setTextColor(contrastNewEntryColor)
entries.setTextColor(contrastNewEntryColor)
entries.text = "0"
}, {
notifyItemRemoved(it)
})
val entryColor = entry.second.color.color
val contrastEntryColor = getContrastColor(entryColor)
color.setBackgroundColor(entryColor)
color.setTextColor(contrastEntryColor)
entries.setTextColor(contrastEntryColor)
entries.text = Data.visits.countVisited(entry.first).toString()
color.setOnClickListener {
Data.selected_group = entry.second
selectDialog.dismiss()
}
color.setOnLongClickListener {
dialogFragment.show(
activity.supportFragmentManager,
"AddColorDialogFragment"
)
true
}
}
}
}

View File

@ -0,0 +1,57 @@
package net.helcel.beans.activity.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import net.helcel.beans.activity.fragment.EditPlaceFragment
class ViewPagerAdapter(
fragmentManager: FragmentManager,
lifecycle: Lifecycle,
private val viewPager: ViewPager2
) :
FragmentStateAdapter(fragmentManager, lifecycle) {
private val fragmentList: MutableList<EditPlaceFragment> = ArrayList()
fun addFragment(src: EditPlaceFragment?, target: EditPlaceFragment) {
if (src != null) {
while (fragmentList.last() != src) {
fragmentList.removeLast()
notifyItemRemoved(fragmentList.size)
}
}
println(src.toString() + " - " + target.toString())
fragmentList.add(target)
notifyItemInserted(fragmentList.size)
viewPager.currentItem = fragmentList.size - 1
}
override fun getItemCount(): Int {
return fragmentList.size
}
fun backPressed(): Boolean {
if (viewPager.currentItem == 0) {
return false
}
val target = viewPager.currentItem
while (fragmentList.size > target) {
fragmentList.removeLast()
notifyItemRemoved(fragmentList.size)
}
return true
}
fun getLabel(pos: Int): String {
return fragmentList[pos].loc.fullName
}
override fun createFragment(position: Int): Fragment {
return fragmentList[position]
}
}

View File

@ -0,0 +1,21 @@
package net.helcel.beans.activity.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import net.helcel.beans.databinding.FragmentAboutBinding
class AboutFragment : Fragment() {
private lateinit var _binding: FragmentAboutBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentAboutBinding.inflate(inflater, container, false)
return _binding.root
}
}

View File

@ -1,7 +1,6 @@
package net.helcel.beendroid.activity.fragment
package net.helcel.beans.activity.fragment
import android.app.Dialog
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
@ -9,21 +8,25 @@ import android.text.Editable
import android.text.TextWatcher
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AppCompatButton
import androidx.core.graphics.blue
import androidx.core.graphics.green
import androidx.core.graphics.red
import androidx.fragment.app.DialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.slider.Slider
import com.google.android.material.textfield.TextInputEditText
import net.helcel.beendroid.R
import net.helcel.beendroid.helper.Groups
import net.helcel.beendroid.helper.colorToHex6
import net.helcel.beendroid.helper.groups
import net.helcel.beendroid.helper.saveData
import java.lang.Exception
import net.helcel.beans.R
import net.helcel.beans.helper.Data
import net.helcel.beans.helper.Groups
import net.helcel.beans.helper.Theme.colorToHex6
class EditGroupAddFragment(private val key: Int = 0, val onAddCb: (Int) -> Unit) :
class EditGroupAddFragment(
private val key: Int = 0,
val onAddCb: (Int) -> Unit,
val onDelCb: (Int) -> Unit
) :
DialogFragment() {
private lateinit var colorNameEditText: TextInputEditText
private lateinit var colorEditText: TextInputEditText
@ -34,11 +37,13 @@ class EditGroupAddFragment(private val key: Int = 0, val onAddCb: (Int) -> Unit)
private lateinit var colorEditG: Slider
private lateinit var colorEditB: Slider
private val grp = groups!!.getGroupFromKey(key)
private lateinit var btnDelete: AppCompatButton
private lateinit var btnCancel: AppCompatButton
private lateinit var btnOk: AppCompatButton
private val grp = Data.groups.getGroupFromKey(key)
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = AlertDialog.Builder(
requireActivity()
)
val builder = AlertDialog.Builder(requireActivity())
val inflater = requireActivity().layoutInflater
val view: View = inflater.inflate(R.layout.fragment_edit_groups_add, null)
@ -49,27 +54,55 @@ class EditGroupAddFragment(private val key: Int = 0, val onAddCb: (Int) -> Unit)
colorEditG = view.findViewById(R.id.colorG)
colorEditB = view.findViewById(R.id.colorB)
setupSlider(colorEditR, (grp?.color?.color?.red ?: 0) / 255F)
setupSlider(colorEditG, (grp?.color?.color?.green ?: 0) / 255F)
setupSlider(colorEditB, (grp?.color?.color?.blue ?: 0) / 255F)
setupSlider(colorEditR, grp.color.color.red / 255F)
setupSlider(colorEditG, grp.color.color.green / 255F)
setupSlider(colorEditB, grp.color.color.blue / 255F)
setupText(colorEditText, grp)
colorView.background = ColorDrawable(grp?.color?.color ?: 0)
colorView.background = ColorDrawable(grp.color.color)
colorNameEditText.setText(grp?.name ?: "")
builder.setView(view)
.setPositiveButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
btnDelete = view.findViewById(R.id.btnDelete)
btnCancel = view.findViewById(R.id.btnCancel)
btnOk = view.findViewById(R.id.btnOk)
if (key == 0) {
btnDelete.visibility = View.INVISIBLE
btnDelete.isEnabled = false
}
btnDelete.setOnClickListener {
MaterialAlertDialogBuilder(requireActivity())
.setMessage(R.string.delete_group)
.setPositiveButton(android.R.string.ok) { _, _ ->
val pos = Data.groups.findGroupPos(key)
// Remove all countries belonging to that group
// Delete the group
Data.visits.deleteVisited(key)
Data.groups.deleteGroup(key)
Data.saveData()
onDelCb(pos)
dialog?.dismiss()
}
.setNegativeButton(android.R.string.cancel) { _, _ -> }
.show()
}
btnOk.setOnClickListener {
val name = colorNameEditText.text.toString()
val color = colorEditText.text.toString()
val key = (if (key != 0) key else groups!!.genKey())
groups!!.setGroup(key, name, ColorDrawable(Color.parseColor("#$color")))
saveData()
val key = (if (key != 0) key else Data.groups.genKey())
Data.groups.setGroup(key, name, ColorDrawable(Color.parseColor("#$color")))
Data.saveData()
onAddCb(key)
dialog?.dismiss()
}
.setNegativeButton(android.R.string.cancel) { dialog: DialogInterface, _: Int ->
dialog.cancel()
btnCancel.setOnClickListener {
dialog?.cancel()
}
colorNameEditText.setText(grp.name)
builder.setView(view)
return builder.create()
}
@ -112,13 +145,8 @@ private class EditTextListener(
private val colorView: View
) : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable?) {
val col: Color
try {
@ -132,7 +160,6 @@ private class EditTextListener(
colorEditB.value = col.blue()
colorView.background = ColorDrawable(col.toArgb())
}
}
private class SliderOnChangeListener(
@ -148,5 +175,4 @@ private class SliderOnChangeListener(
colorEditText.setText(colorToHex6(rgb).substring(1))
colorView.background = rgb
}
}

View File

@ -0,0 +1,56 @@
package net.helcel.beans.activity.fragment
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AppCompatButton
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import net.helcel.beans.R
import net.helcel.beans.activity.adapter.GeolocListAdapter
import net.helcel.beans.activity.adapter.GroupListAdapter
import net.helcel.beans.helper.Data
class EditPlaceColorFragment(private val parent: GeolocListAdapter.FoldingListViewHolder) :
DialogFragment() {
private lateinit var listAdapt: GroupListAdapter
private lateinit var list: RecyclerView
private var clear: Boolean = false
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = AlertDialog.Builder(
requireActivity()
)
val inflater = requireActivity().layoutInflater
val view: View = inflater.inflate(R.layout.fragment_edit_places_colors, null)
val btnAdd: AppCompatButton = view.findViewById(R.id.btnAdd)
val btnClear: AppCompatButton = view.findViewById(R.id.btnClear)
btnAdd.setOnClickListener {
EditGroupAddFragment(0, {
listAdapt.notifyItemInserted(Data.groups.findGroupPos(it))
}, {}).show(requireActivity().supportFragmentManager, "AddColorDialogFragment")
}
btnClear.setOnClickListener {
clear = true
dialog?.dismiss()
}
val dialog = builder.setView(view).create()
listAdapt = GroupListAdapter(requireActivity(), this)
list = view.findViewById(R.id.groups_color)!!
list.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
list.adapter = listAdapt
return dialog
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
parent.onColorDialogDismiss(clear)
}
}

View File

@ -0,0 +1,32 @@
package net.helcel.beans.activity.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import net.helcel.beans.activity.adapter.GeolocListAdapter
import net.helcel.beans.activity.adapter.ViewPagerAdapter
import net.helcel.beans.countries.GeoLoc
import net.helcel.beans.databinding.FragmentEditPlacesBinding
class EditPlaceFragment(val loc: GeoLoc, private val pager: ViewPagerAdapter) : Fragment() {
private lateinit var _binding: FragmentEditPlacesBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentEditPlacesBinding.inflate(inflater, container, false)
_binding.list.setItemViewCacheSize(5)
_binding.list.setHasFixedSize(true)
_binding.list.layoutManager =
LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
_binding.list.adapter = GeolocListAdapter(this, loc, pager)
return _binding.root
}
}

View File

@ -1,18 +1,17 @@
package net.helcel.beendroid.activity.fragment
package net.helcel.beans.activity.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import net.helcel.beendroid.R
import net.helcel.beendroid.databinding.FragmentLicenseBinding
import com.mikepenz.aboutlibraries.LibsBuilder
import net.helcel.beans.R
import net.helcel.beans.databinding.FragmentLicenseBinding
class LicenseFragment : Fragment() {
private var _binding: FragmentLicenseBinding? = null
private lateinit var _binding: FragmentLicenseBinding
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
@ -29,11 +28,6 @@ class LicenseFragment: Fragment() {
.replace(R.id.license_fragment_view, librariesFragment)
.commit()
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
return _binding.root
}
}

View File

@ -1,23 +1,22 @@
package net.helcel.beendroid.activity.fragment
package net.helcel.beans.activity.fragment
import android.content.Context
import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import net.helcel.beendroid.R
import net.helcel.beans.R
class SettingsFragment : PreferenceFragmentCompat() {
private lateinit var themePreference: ListPreference
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.fragment_settings, rootKey)
// Select Light/Dark/System Mode
themePreference = findPreference(getString(R.string.key_theme))!!
themePreference.setOnPreferenceChangeListener { _, key ->
val themePreference = findPreference<Preference>(getString(R.string.key_theme))
themePreference?.setOnPreferenceChangeListener { _, key ->
setTheme(requireContext(), key as String)
}
@ -43,30 +42,16 @@ class SettingsFragment: PreferenceFragmentCompat() {
}
companion object {
fun setTheme(context: Context, key: String?): Boolean {
fun setTheme(ctx: Context, key: String?): Boolean {
AppCompatDelegate.setDefaultNightMode(
when (key) {
context.getString(R.string.system) -> {
// Set SYSTEM Theme
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
ctx.getString(R.string.system) -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
ctx.getString(R.string.light) -> AppCompatDelegate.MODE_NIGHT_NO
ctx.getString(R.string.dark) -> AppCompatDelegate.MODE_NIGHT_YES
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
)
return true
}
context.getString(R.string.light) -> {
// Set LIGHT Theme
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
return true
}
context.getString(R.string.dark) -> {
// Set DARK Theme
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
return true
}
else -> {
return false
}
}
}
}
}

View File

@ -0,0 +1,269 @@
package net.helcel.beans.countries
enum class Country(
override val fullName: String,
override val area: Int
) : GeoLoc {
ATA("Antarctica", 14000000),
HKG("Hong Kong", 1104),
MAC("Macao", 32),
ANT("Netherlands Antilles", 800),
AFG("Afghanistan", 645487),
XAD("Akrotiri and Dhekelia", 234),
ALA("Åland", 1483),
ALB("Albania", 28755),
DZA("Algeria", 2316624),
ASM("American Samoa", 205),
AND("Andorra", 451),
AGO("Angola", 1254492),
AIA("Anguilla", 80),
ATG("Antigua and Barbuda", 438),
ARG("Argentina", 2785500),
ARM("Armenia", 29724),
ABW("Aruba", 183),
AUS("Australia", 7720095),
AUT("Austria", 83897),
AZE("Azerbaijan", 86331),
BHS("Bahamas", 13437),
BHR("Bahrain", 718),
BGD("Bangladesh", 140002),
BRB("Barbados", 437),
BLR("Belarus", 206665),
BEL("Belgium", 30668),
BLZ("Belize", 22164),
BEN("Benin", 116014),
BMU("Bermuda", 68),
BTN("Bhutan", 38913),
BOL("Bolivia", 1090425),
BES("Bonaire, Sint Eustatius and Saba", 325),
BIH("Bosnia and Herzegovina", 51081),
BWA("Botswana", 580648),
BVT("Bouvet Island", 77),
BRA("Brazil", 8560656),
IOT("British Indian Ocean Territory", 65),
VGB("British Virgin Islands", 169),
BRN("Brunei", 5815),
BGR("Bulgaria", 111647),
BFA("Burkina Faso", 274620),
BDI("Burundi", 27113),
KHM("Cambodia", 182800),
CMR("Cameroon", 469101),
CAN("Canada", 9925768),
CPV("Cabo Verde", 4115),
XCA("Caspian Sea", 371885),
CYM("Cayman Islands", 282),
CAF("Central African Republic", 624264),
TCD("Chad", 1277250),
CHL("Chile", 753785),
CHN("China", 9405272),
CXR("Christmas Island", 140),
XCL("Clipperton Island", 10),
CCK("Cocos Islands", 14),
COL("Colombia", 1144791),
COM("Comoros", 1684),
COK("Cook Islands", 281),
CRI("Costa Rica", 51511),
CIV("Côte d'Ivoire", 323636),
HRV("Croatia", 57065),
CUB("Cuba", 111255),
CUW("Curaçao", 440),
CYP("Cyprus", 5733),
CZE("Czechia", 78754),
COD("Democratic Republic of the Congo", 2344314),
DNK("Denmark", 43034),
DJI("Djibouti", 22509),
DMA("Dominica", 759),
DOM("Dominican Republic", 48348),
ECU("Ecuador", 258071),
EGY("Egypt", 987766),
SLV("El Salvador", 20545),
GNQ("Equatorial Guinea", 27138),
ERI("Eritrea", 121150),
EST("Estonia", 45354),
ETH("Ethiopia", 1136255),
FLK("Falkland Islands", 12370),
FRO("Faroe Islands", 1434),
FJI("Fiji", 19057),
FIN("Finland", 335489),
FRA("France", 549335),
GUF("French Guiana", 83856),
PYF("French Polynesia", 4053),
ATF("French Southern Territories", 7852),
GAB("Gabon", 266332),
GMB("Gambia", 10731),
GEO("Georgia", 6989),
DEU("Germany", 35732),
GHA("Ghana", 241025),
GIB("Gibraltar", 7),
GRC("Greece", 132751),
GRL("Greenland", 2139125),
GRD("Grenada", 362),
GLP("Guadeloupe", 1658),
GUM("Guam", 554),
GTM("Guatemala", 109777),
GGY("Guernsey", 88),
GIN("Guinea", 246356),
GNB("Guinea-Bissau", 34088),
GUY("Guyana", 211133),
HTI("Haiti", 27258),
HMD("Heard Island and Mc Donald Island", 362),
HND("Honduras", 112950),
HUN("Hungary", 92993),
ISL("Iceland", 101781),
IND("India", 3166019),
IDN("Indonesia", 1902704),
IRN("Iran", 1626366),
IRQ("Iraq", 437670),
IRL("Ireland", 70131),
IMN("Isle of Man", 578),
ISR("Israel", 22226),
ITA("Italy", 300894),
JAM("Jamaica", 11061),
JPN("Japan", 373106),
JEY("Jersey", 125),
JOR("Jordan", 89464),
KAZ("Kazakhstan", 2728680),
KEN("Kenya", 589936),
KIR("Kiribati", 1017),
XKO("Kosovo", 10843),
KWT("Kuwait", 17486),
KGZ("Kyrgyzstan", 197618),
LAO("Laos", 231104),
LVA("Latvia", 64537),
LBN("Lebanon", 10265),
LSO("Lesotho", 30653),
LBR("Liberia", 96550),
LBY("Libya", 1622430),
LIE("Liechtenstein", 159),
LTU("Lithuania", 64862),
LUX("Luxembourg", 2579),
SXM("Sint Maarten", 38),
MKD("North Macedonia", 24930),
MDG("Madagascar", 594538),
MWI("Malawi", 118637),
MYS("Malaysia", 331770),
MDV("Maldives", 281),
MLI("Mali", 1258093),
MLT("Malta", 324),
MHL("Marshall Islands", 285),
MTQ("Martinique", 1124),
MRT("Mauritania", 1046483),
MUS("Mauritius", 2036),
MYT("Mayotte", 394),
MEX("México", 1960059),
FSM("Micronesia", 770),
MDA("Moldova", 33889),
MCO("Monaco", 2),
MNG("Mongolia", 1565638),
MNE("Montenegro", 13342),
MSR("Montserrat", 101),
MAR("Morocco", 414714),
MOZ("Mozambique", 791805),
MMR("Myanmar", 672590),
NAM("Namibia", 828017),
NRU("Nauru", 22),
NPL("Nepal", 148210),
NLD("Netherlands", 37624),
NCL("New Caledonia", 18916),
NZL("New Zealand", 268937),
NIC("Nicaragua", 128957),
NER("Niger", 1190189),
NGA("Nigeria", 914161),
NIU("Niue", 268),
NFK("Norfolk Island", 41),
PRK("North Korea", 122844),
ZNC("Northern Cyprus", 3321),
MNP("Northern Mariana Islands", 506),
NOR("Norway", 323747),
OMN("Oman", 310686),
PAK("Pakistan", 877139),
PLW("Palau", 484),
PSE("Palestine", 6238),
PAN("Panama", 75933),
PNG("Papua New Guinea", 466628),
PRY("Paraguay", 401148),
PER("Peru", 1300636),
PHL("Philippines", 297628),
PCN("Pitcairn Islands", 54),
POL("Poland", 311892),
PRT("Portugal", 91999),
PRI("Puerto Rico", 9019),
QAT("Qatar", 11633),
COG("Republic of the Congo", 344030),
REU("Réunion", 2526),
ROU("Romania", 238297),
RUS("Russia", 16869756),
RWA("Rwanda", 25449),
BLM("Saint-Barthélemy", 21),
MAF("Saint-Martin", 56),
SHN("Saint Helena, Ascension and Tris", 412),
KNA("Saint Kitts and Nevis", 269),
LCA("Saint Lucia", 618),
SPM("Saint Pierre and Miquelon", 227),
VCT("Saint Vincent and the Grenadines", 400),
WSM("Samoa", 2871),
SMR("San Marino", 61),
STP("São Tomé and Príncipe", 1009),
SAU("Saudi Arabia", 1931654),
SEN("Senegal", 198056),
SRB("Serbia", 78247),
SYC("Seychelles", 492),
SLE("Sierra Leone", 73067),
SGP("Singapore", 700),
SVK("Slovakia", 49055),
SVN("Slovenia", 19951),
SLB("Solomon Islands", 28686),
SOM("Somalia", 637672),
ZAF("South Africa", 1224059),
SGS("South Georgia and the South Sand", 4085),
KOR("South Korea", 100721),
SSD("South Sudan", 632186),
ESP("Spain", 506617),
LKA("Sri Lanka", 66267),
SDN("Sudan", 1882758),
SUR("Suriname", 147402),
SJM("Svalbard and Jan Mayen", 59960),
SWZ("Swaziland", 17451),
SWE("Sweden", 448298),
CHE("Switzerland", 41217),
SYR("Syria", 187360),
TWN("Taiwan", 36571),
TJK("Tajikistan", 142330),
TZA("Tanzania", 946695),
THA("Thailand", 516901),
TLS("Timor-Leste", 15012),
TGO("Togo", 57272),
TKL("Tokelau", 15),
TON("Tonga", 762),
TTO("Trinidad and Tobago", 5193),
TUN("Tunisia", 155257),
TUR("Turkey", 781794),
TKM("Turkmenistan", 490273),
TCA("Turks and Caicos Islands", 995),
TUV("Tuvalu", 40),
UGA("Uganda", 243045),
UKR("Ukraine", 600816),
ARE("United Arab Emirates", 71429),
GBR("United Kingdom", 244732),
USA("United States", 9477483),
UMI("United States Minor Outlying Isl", 47),
URY("Uruguay", 178103),
UZB("Uzbekistan", 447894),
VUT("Vanuatu", 12384),
VAT("Vatican City", 1),
VEN("Venezuela", 918303),
VNM("Vietnam", 331121),
VIR("Virgin Islands, U.S.", 364),
WLF("Wallis and Futuna", 157),
ESH("Western Sahara", 268500),
YEM("Yemen", 454747),
ZMB("Zambia", 755679),
ZWE("Zimbabwe", 392107),
;
override val code = this.name
override val type = GeoLoc.LocType.COUNTRY
override val children: MutableList<GeoLoc> = ArrayList()
}

View File

@ -0,0 +1,19 @@
package net.helcel.beans.countries
interface GeoLoc {
enum class LocType {
WORLD, GROUP, CUSTOM_GROUP, COUNTRY, STATE;
}
val code: String
val fullName: String
val area: Int
val type: LocType
val children: List<GeoLoc>
}

View File

@ -0,0 +1,21 @@
package net.helcel.beans.countries
import android.content.Context
import net.helcel.beans.helper.Settings
import java.io.BufferedReader
import java.io.InputStreamReader
object GeoLocImporter {
fun importState(ctx: Context) {
if (!Settings.isRegional(ctx)) {
return
}
val fs = BufferedReader(InputStreamReader(ctx.assets.open("geoloc_state.txt")))
while (fs.ready()) {
val line = fs.readLine().split("|")
val state = State(line[0], line[2], line[3].toInt())
Country.entries.find { it.code == line[1] }?.children?.add(state)
}
}
}

View File

@ -0,0 +1,319 @@
package net.helcel.beans.countries
import net.helcel.beans.countries.Country.*
enum class Group(override val fullName: String, override val children: List<GeoLoc>) : GeoLoc {
EEE(
"Europe", listOf(
ALB,
AND,
AUT,
BLR,
BEL,
BIH,
BGR,
HRV,
CYP,
CZE,
DNK,
EST,
FIN,
FRA,
DEU,
GRC,
HUN,
ISL,
IRL,
ITA,
KAZ,
XKO,
LVA,
LIE,
LTU,
LUX,
MLT,
MDA,
MCO,
MNE,
NLD,
MKD,
NOR,
POL,
PRT,
ROU,
RUS,
SMR,
SRB,
SVK,
SVN,
ESP,
SWE,
CHE,
UKR,
GBR,
VAT,
XAD,
)
),
ABB(
"Asia", listOf(
AFG,
ARM,
AZE,
BHR,
BGD,
BTN,
BRN,
KHM,
CHN,
GEO,
HKG,
IND,
IDN,
IRN,
IRQ,
ISR,
JPN,
JOR,
KWT,
KGZ,
LAO,
LBN,
MAC,
MYS,
MDV,
MNG,
MMR,
NPL,
PRK,
OMN,
PAK,
PSE,
PHL,
QAT,
SAU,
SGP,
KOR,
LKA,
SYR,
TWN,
TJK,
THA,
TLS,
TUR,
TKM,
ARE,
UZB,
VNM,
YEM,
ZNC,
)
),
FFF(
"Africa", listOf(
DZA,
AGO,
BDI,
BEN,
BWA,
BFA,
BDI,
CPV,
CMR,
CAF,
TCD,
COM,
COG,
COD,
CIV,
DJI,
EGY,
GNQ,
ERI,
SWZ,
ETH,
GAB,
GMB,
GHA,
GIN,
GNB,
KEN,
LSO,
LBR,
LBY,
MDG,
MWI,
MLI,
MRT,
MUS,
MYT,
MAR,
MOZ,
NAM,
NER,
NGA,
COD,
REU,
RWA,
STP,
SEN,
SYC,
SLE,
SOM,
ZAF,
SSD,
SHN,
SDN,
TZA,
TGO,
TUN,
UGA,
COD,
ZMB,
ZWE,
ESH,
)
),
NNN(
"North America", listOf(
ABW,
AIA,
ATG,
BHS,
BRB,
BLZ,
BMU,
VGB,
CAN,
CYM,
CRI,
CUB,
CUW,
DMA,
DOM,
SLV,
GRL,
GRD,
GLP,
GTM,
HTI,
HND,
JAM,
MTQ,
MEX,
MSR,
ANT,
CUW,
NIC,
PAN,
PRI,
KNA,
LCA,
MAF,
SPM,
VCT,
TTO,
TCA,
USA,
XCL,
)
),
SRR(
"South America", listOf(
ARG,
BOL,
BRA,
CHL,
COL,
ECU,
FLK,
GUF,
GUY,
PRY,
PER,
SUR,
URY,
VEN,
)
),
UUU(
"Oceania", listOf(
ASM,
AUS,
COK,
FJI,
PYF,
GUM,
KIR,
MHL,
FSM,
NRU,
NCL,
NZL,
NIU,
NFK,
MNP,
PLW,
PNG,
PCN,
SLB,
TKL,
TON,
TUV,
VUT,
WLF,
)
),
XXX(
"Others", listOf(
ATA, // Antarctica: not in any other region
ALA,// Åland Islands: an autonomous region of Finland, but not a member of the EU or UN
BES,// Bonaire, Sint Eustatius and Saba: special municipalities of the Netherlands in the Caribbean
BVT,// Bouvet Island: an uninhabited territory of Norway in the South Atlantic
IOT,// British Indian Ocean Territory: a British overseas territory in the Indian Ocean
CXR,// Christmas Island: an Australian external territory in the Indian Ocean
CCK,// Cocos (Keeling) Islands: an Australian external territory in the Indian Ocean
FRO,// Faroe Islands: an autonomous region of Denmark
ATF,// French Southern and Antarctic Lands: a territory of France located in the southern Indian Ocean
GIB,// Gibraltar: a British overseas territory located at the southern tip of the Iberian Peninsula
GGY,// Guernsey: a British Crown dependency in the English Channel
HMD,// Heard Island and McDonald Islands: an uninhabited Australian external territory in the southern Indian Ocean
IMN,// Isle of Man: a British Crown dependency located in the Irish Sea
JEY,// Jersey: a British Crown dependency located in the English Channel
BLM,// Saint Barthélemy: an overseas collectivity of France in the Caribbean
WSM, // Samoa: an independent island nation in the South Pacific
SXM, // Sint Maarten: a constituent country of the Kingdom of the Netherlands in the Caribbean
SGS, // South Georgia and the South Sandwich Islands: a British overseas territory in the southern Atlantic Ocean
SJM, // Svalbard and Jan Mayen: an archipelago administered by Norway
UMI, // United States Minor Outlying Islands: a collection of nine insular areas of the United States
VIR, // United States Virgin Islands: an unincorporated territory of the United States in the Caribbean
)
),
ZZZ(
"Undefined", listOf(
)
),
NTT(
"NATO", listOf(
ALB, BEL, BGR, CAN, HRV, CZE, DNK, EST, FRA, DEU, GRC, HUN, ISL, ITA, LVA, LTU, LUX,
MNE, NLD, NOR, POL, PRT, ROU, SVK, SVN, ESP, TUR, GBR, USA
)
);
override val area = children.fold(0) { acc, i ->
acc + i.area
}
private val isInWorld =
listOf("EEE", "ABB", "FFF", "NNN", "SRR", "UUU", "XXX").contains(this.name)
override val type = if (isInWorld) GeoLoc.LocType.GROUP else GeoLoc.LocType.CUSTOM_GROUP
override val code = this.name
}

View File

@ -0,0 +1,8 @@
package net.helcel.beans.countries
class State(override val code: String, override val fullName: String, override val area: Int) :
GeoLoc {
override val children = emptyList<GeoLoc>()
override val type = GeoLoc.LocType.STATE
}

View File

@ -1,6 +1,6 @@
package net.helcel.beendroid.countries
package net.helcel.beans.countries
import net.helcel.beendroid.countries.Group.*
import net.helcel.beans.countries.Group.*
enum class World(override val fullName: String, override val children: List<GeoLoc>) : GeoLoc {
@ -13,7 +13,7 @@ enum class World(override val fullName: String, override val children: List<GeoL
}
override val type: LocType = LocType.WORLD
override val type = GeoLoc.LocType.WORLD
override val code = this.name

View File

@ -0,0 +1,51 @@
package net.helcel.beans.helper
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.ColorDrawable
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import net.helcel.beans.R
import net.helcel.beans.countries.GeoLoc
import java.util.HashMap
object Data {
var visits : Visits = Visits(0, HashMap())
var groups : Groups = Groups(0,HashMap())
var selected_group : Groups.Group? = null
var selected_geoloc: GeoLoc? = null
private val groupsSerial = Groups.GroupsSerializer()
private val visitsSerial = Visits.VisitsSerializer()
private lateinit var sharedPreferences: SharedPreferences
fun loadData(ctx: Context, id:Int) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
val groupsString = sharedPreferences.getString("groups_$id",null)
val visitsString = sharedPreferences.getString("visits_$id",null)
groups = if(!groupsString.isNullOrEmpty()) groupsSerial.readFrom(groupsString.byteInputStream()) else groupsSerial.defaultValue
visits = if(!visitsString.isNullOrEmpty()) visitsSerial.readFrom(visitsString.byteInputStream()) else visitsSerial.defaultValue
// Add default group "Visited" with app's color if there is no group already
if (groups.size() == 0) {
groups.setGroup(1, "Visited", ColorDrawable(ContextCompat.getColor(ctx, R.color.blue)))
saveData()
}
}
fun saveData() {
if(groups.id != visits.id) return
val id = groups.id
val editor = sharedPreferences.edit()
editor.putString("groups_$id", groupsSerial.writeTo(groups))
editor.putString("visits_$id", visitsSerial.writeTo(visits))
editor.apply()
}
}

View File

@ -1,5 +1,6 @@
package net.helcel.beendroid.helper
package net.helcel.beans.helper
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
@ -22,8 +23,8 @@ class Groups(val id: Int, private val grps: HashMap<Int,Group>) {
grps.remove(key)
}
fun getGroupFromKey(key: Int): Group? {
return grps.getOrDefault(key,null)
fun getGroupFromKey(key: Int): Group {
return grps.getOrDefault(key,EmptyGroup())
}
fun genKey(): Int {
@ -47,15 +48,17 @@ class Groups(val id: Int, private val grps: HashMap<Int,Group>) {
fun getGroupFromPos(pos: Int): Pair<Int,Group> {
val key = grps.keys.toList()[pos]
return Pair(key,getGroupFromKey(key)!!)
return Pair(key,getGroupFromKey(key))
}
fun findGroupPos(key: Int): Int {
return grps.keys.toList().indexOf(key)
}
class EmptyGroup: Group(0,"")
@Serializable
class Group(val key: Int, val name: String, @Serializable(with = ColorDrawableSerializer::class) val color: ColorDrawable)
open class Group(val key: Int, val name: String, @Serializable(with = ColorDrawableSerializer::class) val color: ColorDrawable = ColorDrawable(Color.TRANSPARENT))
@OptIn(ExperimentalSerializationApi::class)
@Serializer(Groups::class)

View File

@ -0,0 +1,40 @@
package net.helcel.beans.helper
import android.content.Context
import android.content.SharedPreferences
import androidx.preference.PreferenceManager
import net.helcel.beans.R
import net.helcel.beans.activity.fragment.SettingsFragment
object Settings {
private lateinit var sp: SharedPreferences
fun start(ctx: Context) {
sp = PreferenceManager.getDefaultSharedPreferences(ctx)
SettingsFragment.setTheme(
ctx, sp.getString(ctx.getString(R.string.key_theme), ctx.getString(R.string.system))
)
}
fun isSingleGroup(ctx: Context): Boolean {
return !getBooleanValue(
ctx,
sp.getString(ctx.getString(R.string.key_group), ctx.getString(R.string.off))
)
}
fun isRegional(ctx: Context): Boolean {
return getBooleanValue(
ctx,
sp.getString(ctx.getString(R.string.key_regional), ctx.getString(R.string.off))
)
}
private fun getBooleanValue(ctx: Context, key: String?): Boolean {
return when (key) {
ctx.getString(R.string.on) -> true
ctx.getString(R.string.off) -> false
else -> false
}
}
}

View File

@ -0,0 +1,37 @@
package net.helcel.beans.helper
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.util.TypedValue
import androidx.appcompat.app.AppCompatActivity
import androidx.core.graphics.ColorUtils
object Theme {
fun colorWrapper(ctx: Context, res: Int): ColorDrawable {
val colorPrimaryTyped = TypedValue()
ctx.theme.resolveAttribute(res, colorPrimaryTyped, true)
return ColorDrawable(colorPrimaryTyped.data)
}
fun colorToHex6(c: ColorDrawable): String {
return '#' + colorToHex8(c).substring(3)
}
@OptIn(ExperimentalStdlibApi::class)
fun colorToHex8(c: ColorDrawable): String {
return '#' + c.color.toHexString()
}
fun createActionBar(ctx: AppCompatActivity, title: String) {
ctx.supportActionBar?.setBackgroundDrawable(colorWrapper(ctx, android.R.attr.colorPrimary))
ctx.supportActionBar?.title = title
ctx.supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
fun getContrastColor(color: Int): Int {
val whiteContrast = ColorUtils.calculateContrast(Color.WHITE, color)
val blackContrast = ColorUtils.calculateContrast(Color.BLACK, color)
return if (whiteContrast > blackContrast) Color.WHITE else Color.BLACK
}
}

View File

@ -1,4 +1,4 @@
package net.helcel.beendroid.helper
package net.helcel.beans.helper
import android.graphics.drawable.ColorDrawable
import kotlinx.serialization.KSerializer

View File

@ -1,10 +1,10 @@
package net.helcel.beendroid.helper
package net.helcel.beans.helper
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.Serializer
import kotlinx.serialization.json.Json
import net.helcel.beendroid.countries.GeoLoc
import net.helcel.beans.countries.GeoLoc
import java.io.InputStream
@ -27,11 +27,18 @@ class Visits(val id: Int, private val locs: HashMap<String,Int>) {
fun getVisited(key: GeoLoc): Int {
return locs.getOrDefault(key.code,0)
}
private fun getVisited(key: String): Int {
return locs.getOrDefault(key,0)
}
fun countVisited(key: Int): Int {
return locs.filter { it.value == key }.size
}
fun getVisitedByValue(): Map<Int, List<String>> {
return locs.keys.groupBy { getVisited(it) }
}
@OptIn(ExperimentalSerializationApi::class)
@Serializer(Visits::class)
class VisitsSerializer {

View File

@ -0,0 +1,51 @@
package net.helcel.beans.svg
import android.content.Context
import net.helcel.beans.countries.World
import net.helcel.beans.helper.Data.groups
import net.helcel.beans.helper.Data.visits
import net.helcel.beans.helper.Theme.colorToHex6
import net.helcel.beans.helper.Theme.colorWrapper
class CSSWrapper(ctx: Context) {
private val colorForeground: String =
colorToHex6(colorWrapper(ctx, android.R.attr.panelColorBackground))
private val colorBackground: String =
colorToHex6(colorWrapper(ctx, android.R.attr.colorBackground))
private val baseCSS: String
private var customCSS: String = ""
init {
val www = World.WWW.children.joinToString(",") { "#${it.code}2" }
val ccc =
World.WWW.children.joinToString(",") { itt -> itt.children.joinToString(",") { "#${it.code}2" } }
baseCSS =
"svg{fill:$colorForeground;stroke:$colorBackground;stroke-width:0.01;}" +
"$www,$ccc{stroke-width:0.1;fill:none}"
refresh()
}
fun refresh() {
customCSS = visits.getVisitedByValue().map { (k, v) ->
if (groups.getGroupFromKey(k).key == 0)
""
else
v.joinToString(",") { "#${it}1,#${it}" } + "{fill:${
colorToHex6(
groups.getGroupFromKey(
k
).color
)
};}"
}.joinToString("")
}
fun get(): String {
refresh()
return baseCSS + customCSS
}
}

View File

@ -1,14 +1,13 @@
package net.helcel.beendroid.svg
package net.helcel.beans.svg
import android.content.Context
import com.caverock.androidsvg.SVG
class SVGWrapper(ctx: Context) {
private var svg: SVG?= SVG.getFromAsset(ctx.assets,"mercator0.svg")
private var svg: SVG? = SVG.getFromAsset(ctx.assets, "mercator01.svg")
fun get(): SVG? {
return svg
}
}

View File

@ -1,145 +0,0 @@
package net.helcel.beendroid.activity.adapter
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Typeface
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.FragmentActivity
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.checkbox.MaterialCheckBox
import net.helcel.beendroid.R
import net.helcel.beendroid.activity.fragment.EditPlaceColorFragment
import net.helcel.beendroid.countries.GeoLoc
import net.helcel.beendroid.helper.colorWrapper
import net.helcel.beendroid.helper.groups
import net.helcel.beendroid.helper.saveData
import net.helcel.beendroid.helper.selected_geoloc
import net.helcel.beendroid.helper.selected_group
import net.helcel.beendroid.helper.visits
class GeolocListAdapter(
private val ctx: FragmentActivity, l: List<GeoLoc>) : RecyclerView.Adapter<GeolocListAdapter.FoldingListViewHolder>() {
private val cg : MutableMap<GeoLoc,Boolean> = l.sortedBy { it.fullName }.fold(LinkedHashMap()) { acc, e ->
acc[e] = false
acc
}
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): FoldingListViewHolder {
val view: View = LayoutInflater
.from(viewGroup.context)
.inflate(R.layout.item_list_geoloc, viewGroup, false)
return FoldingListViewHolder(ctx, view)
}
override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) {
val el = cg.toList()[position]
holder.bind(el)
holder.addListeners(el) {
if (!el.first.isEnd) {
cg[el.first] = !el.second
notifyItemChanged(position)
}
!el.first.isEnd
}
}
override fun getItemCount(): Int {
return cg.size
}
class FoldingListViewHolder(private val ctx: FragmentActivity, itemView: View) : RecyclerView.ViewHolder(itemView) {
private val textView: TextView = itemView.findViewById(R.id.textView)
private val progressView: TextView = itemView.findViewById(R.id.name)
private val checkBox: MaterialCheckBox = itemView.findViewById(R.id.checkBox)
private val subItemView: View = itemView.findViewById(R.id.sub_item)
private val list: RecyclerView = itemView.findViewById(R.id.list_list)
init {
list.layoutManager = LinearLayoutManager(ctx, RecyclerView.VERTICAL, false)
list.itemAnimator = null //TODO: Fix slow recycler expansion
}
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
val statsPref = sharedPreferences.getString(ctx.getString(R.string.key_stats), ctx.getString(R.string.counters))
fun bind(el: Pair<GeoLoc, Boolean>) {
subItemView.visibility = if (el.second) View.VISIBLE else View.GONE
textView.text = el.first.fullName
if (el.first.children.isEmpty()) {
textView.backgroundTintList = ColorStateList.valueOf(colorWrapper(ctx, android.R.attr.colorBackground).color)
} else {
textView.setTypeface(null, Typeface.BOLD)
val numerator = el.first.children.map { visits!!.getVisited(it) != 0 }.count { it }
val denominator = el.first.children.size
println(100 * (numerator / denominator.toFloat()).toInt())
progressView.text = when (statsPref) {
ctx.getString(R.string.percentages) -> ctx.getString(R.string.percentage, (100 * (numerator.toFloat() / denominator.toFloat())).toInt())
else -> ctx.getString(R.string.rate, numerator, denominator)
}
textView.backgroundTintList = ColorStateList.valueOf(colorWrapper(ctx, android.R.attr.panelColorBackground).color).withAlpha(128)
list.adapter = GeolocListAdapter(ctx, el.first.children)
textView.parent.parent.requestChildFocus(textView, textView)
}
refreshCheck(el.first)
}
fun addListeners(el: Pair<GeoLoc, Boolean>, expandLambda: () -> Boolean) {
textView.setOnClickListener { expandLambda() }
checkBox.setOnClickListener {
selected_geoloc = el.first
if (groups!!.size() != 1) {
val dialogFragment = EditPlaceColorFragment(this)
selected_group = null
dialogFragment.show(ctx.supportFragmentManager, "AddColorDialogFragment")
} else {
if (checkBox.isChecked) {
// If one has just checked the box (assign unique group)
selected_group = groups!!.getUniqueEntry()!!
onColorDialogDismiss(false)
} else {
// If one has just unchecked the box (unassign unique group)
selected_group = null
onColorDialogDismiss(true)
}
}
}
}
fun onColorDialogDismiss(clear: Boolean) {
if(clear){
visits!!.setVisited(selected_geoloc!!,0)
saveData()
}
if(selected_group!=null && selected_geoloc!=null) {
visits!!.setVisited(selected_geoloc!!, selected_group!!.key)
saveData()
}
selected_geoloc?.let { refreshCheck(it) }
selected_geoloc = null
selected_group = null
}
private fun refreshCheck(geoLoc: GeoLoc){
val col = groups!!.getGroupFromKey(visits!!.getVisited(geoLoc))?.color?.color?:Color.GRAY
checkBox.checkedState =
if (visits!!.getVisited(geoLoc)!=0) MaterialCheckBox.STATE_CHECKED
else if (geoLoc.children.any { visits!!.getVisited(it)!=0 }) MaterialCheckBox.STATE_INDETERMINATE
else MaterialCheckBox.STATE_UNCHECKED
checkBox.buttonTintList = ColorStateList(arrayOf(
intArrayOf(-android.R.attr.state_checked), intArrayOf(android.R.attr.state_checked)),
intArrayOf(col, col))
}
}
}

View File

@ -1,93 +0,0 @@
package net.helcel.beendroid.activity.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import net.helcel.beendroid.R
import net.helcel.beendroid.activity.fragment.EditGroupAddFragment
import net.helcel.beendroid.helper.Groups
import net.helcel.beendroid.helper.getContrastColor
import net.helcel.beendroid.helper.groups
import net.helcel.beendroid.helper.saveData
import net.helcel.beendroid.helper.selected_group
import net.helcel.beendroid.helper.visits
class GroupListAdapter(private val activity: FragmentActivity, private val selectDialog: DialogFragment?) : RecyclerView.Adapter<GroupListAdapter.GroupViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) : GroupViewHolder {
val view : View = LayoutInflater.from(parent.context).inflate(R.layout.item_list_group, parent, false)
return GroupViewHolder(view, activity, selectDialog)
}
override fun onBindViewHolder(holder: GroupViewHolder, pos: Int) {
holder.bind(groups!!.getGroupFromPos(pos))
}
override fun getItemCount(): Int {
return groups!!.size()
}
inner class GroupViewHolder(itemView: View, private val activity: FragmentActivity, private val selectDialog: DialogFragment?) : RecyclerView.ViewHolder(itemView) {
private val color: Button = itemView.findViewById(R.id.group_color)
private val entries: TextView = itemView.findViewById(R.id.name)
fun bind(entry: Pair<Int, Groups.Group>) {
color.text = entry.second.name
val entryColor = entry.second.color.color
val contrastEntryColor = getContrastColor(entryColor)
color.setBackgroundColor(entryColor)
color.setTextColor(contrastEntryColor)
entries.setTextColor(contrastEntryColor)
entries.text = visits!!.countVisited(entry.first).toString()
color.setOnClickListener {
if (selectDialog == null) {
val dialogFragment = EditGroupAddFragment(entry.first) {
val newEntry = groups!!.getGroupFromKey(entry.first)!!
color.text = newEntry.name
val newEntryColor = newEntry.color.color
val contrastNewEntryColor = getContrastColor(newEntryColor)
color.setBackgroundColor(newEntryColor)
color.setTextColor(contrastNewEntryColor)
entries.setTextColor(contrastNewEntryColor)
entries.text = "0"
}
dialogFragment.show(
activity.supportFragmentManager,
"AddColorDialogFragment"
)
} else {
selected_group = entry.second
selectDialog.dismiss()
}
}
color.setOnLongClickListener {
if (selectDialog == null) {
MaterialAlertDialogBuilder(activity)
.setMessage(R.string.delete_group)
.setPositiveButton(android.R.string.ok) { _, _ ->
// Remove all countries belonging to that group
val key = entry.first
visits!!.deleteVisited(key)
// Delete the group
val pos = groups!!.findGroupPos(key)
groups!!.deleteGroup(key)
saveData()
this@GroupListAdapter.notifyItemRemoved(pos)
}
.setNegativeButton(android.R.string.cancel) { _, _ -> }
.show()
}
true
}
}
}
}

View File

@ -1,34 +0,0 @@
package net.helcel.beendroid.activity.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import net.helcel.beendroid.activity.fragment.EditGroupFragment
import net.helcel.beendroid.activity.fragment.EditPlaceFragment
private val tabArray = arrayOf(
"Places",
"Groups",
)
class ViewPagerAdapter (fragmentManager: FragmentManager, lifecycle: Lifecycle) :
FragmentStateAdapter(fragmentManager, lifecycle) {
override fun getItemCount(): Int {
return tabArray.size
}
fun getTabs() : Array<String> {
return tabArray
}
override fun createFragment(position: Int): Fragment {
when (position) {
0 -> return EditPlaceFragment()
1 -> return EditGroupFragment()
}
return EditPlaceFragment()
}
}

View File

@ -1,31 +0,0 @@
package net.helcel.beendroid.activity.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import net.helcel.beendroid.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 {
_binding = FragmentAboutBinding.inflate(inflater, container, false)
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -1,43 +0,0 @@
package net.helcel.beendroid.activity.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import net.helcel.beendroid.activity.adapter.GroupListAdapter
import net.helcel.beendroid.databinding.FragmentEditGroupsBinding
import net.helcel.beendroid.helper.groups
class EditGroupFragment : Fragment() {
private var _binding: FragmentEditGroupsBinding? = null
private val binding get() = _binding!!
private lateinit var listadapt : GroupListAdapter
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentEditGroupsBinding.inflate(inflater, container, false)
listadapt = GroupListAdapter(requireActivity(),null)
binding.addGroup.setOnClickListener {
val dialogFragment = EditGroupAddFragment {
listadapt.notifyItemInserted(groups!!.findGroupPos(it))
}
dialogFragment.show(requireActivity().supportFragmentManager, "AddColorDialogFragment")
}
binding.list.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
binding.list.adapter = listadapt
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -1,42 +0,0 @@
package net.helcel.beendroid.activity.fragment
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import net.helcel.beendroid.R
import net.helcel.beendroid.activity.adapter.GeolocListAdapter
import net.helcel.beendroid.activity.adapter.GroupListAdapter
class EditPlaceColorFragment(private val parent: GeolocListAdapter.FoldingListViewHolder) : DialogFragment() {
private lateinit var listAdapt : GroupListAdapter
private lateinit var list : RecyclerView
private var clear : Boolean = false
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = AlertDialog.Builder(
requireActivity()
)
val inflater = requireActivity().layoutInflater
val view: View = inflater.inflate(R.layout.fragment_edit_places_colors, null)
val dialog = builder.setView(view).setNegativeButton("Clear") { dialogInterface: DialogInterface, i: Int -> clear = true }
.create()
listAdapt = GroupListAdapter(requireActivity(),this)
list = view.findViewById(R.id.groups_color)!!
list.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
list.adapter = listAdapt
return dialog
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
parent.onColorDialogDismiss(clear)
}
}

View File

@ -1,34 +0,0 @@
package net.helcel.beendroid.activity.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import net.helcel.beendroid.activity.adapter.GeolocListAdapter
import net.helcel.beendroid.countries.World
import net.helcel.beendroid.databinding.FragmentEditPlacesBinding
class EditPlaceFragment : Fragment() {
private var _binding: FragmentEditPlacesBinding? = null
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentEditPlacesBinding.inflate(inflater, container, false)
binding.list.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
binding.list.adapter = GeolocListAdapter(requireActivity(), World.WWW.children)
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -1,266 +0,0 @@
package net.helcel.beendroid.countries
import net.helcel.beendroid.countries.State.*
enum class Country(override val fullName: String, override val area : Int, override val children : List<GeoLoc>) : GeoLoc {
AFG("Afghanistan", 652864, listOf(AFG_BD, AFG_BDG, AFG_BGL, AFG_BAL, AFG_BAM, AFG_DAY, AFG_FRA, AFG_FYB, AFG_GHA, AFG_GHO, AFG_HEL, AFG_HER, AFG_JOW, AFG_KAB, AFG_KAN, AFG_KAP, AFG_KHO, AFG_KNR, AFG_KDZ, AFG_LAG, AFG_LOG, AFG_NAN, AFG_NIM, AFG_NUR, AFG_PAN, AFG_PAR, AFG_PIA, AFG_PRI, AFG_SAM, AFG_SAR, AFG_SHA, AFG_SOL, AFG_URO, AFG_WAR, AFG_ZAB)),
ALA("Åland Islands", 1580, emptyList()),
ALB("Albania", 28748, listOf(ALB_BR, ALB_BU, ALB_DI, ALB_EL, ALB_FR, ALB_GJ, ALB_KO, ALB_KU, ALB_LE, ALB_SH, ALB_TR, ALB_VL)),
DZA("Algeria", 2381741, listOf(DZA_01, DZA_44, DZA_46, DZA_16, DZA_23, DZA_05, DZA_07, DZA_02, DZA_06, DZA_08, DZA_09, DZA_10, DZA_34, DZA_35, DZA_25, DZA_17, DZA_32, DZA_39, DZA_36, DZA_47, DZA_24, DZA_33, DZA_18, DZA_40, DZA_03, DZA_29, DZA_26, DZA_43, DZA_27, DZA_28, DZA_45, DZA_31, DZA_30, DZA_04, DZA_48, DZA_20, DZA_19, DZA_22, DZA_21, DZA_41, DZA_12, DZA_14, DZA_37, DZA_42, DZA_38, DZA_15)),
ASM("American Samoa", 199000, emptyList()),
AND("Andorra", 468765, emptyList()),
AGO("Angola", 1246700, listOf(AGO_BGO, AGO_BGU, AGO_BIE, AGO_CAB, AGO_CCU, AGO_CNO, AGO_CUS, AGO_CNN, AGO_HUA, AGO_HUI, AGO_LNO, AGO_LSU, AGO_LUA, AGO_MAL, AGO_MOX, AGO_NAM, AGO_UIG, AGO_ZAI)),
AIA("Anguilla", 96, emptyList()),
ATA("Antarctica", 14000000, emptyList()),
ATG("Antigua and Barbuda", 442, emptyList()),
ARG("Argentina", 2780400, listOf(ARG_BA, ARG_C, ARG_K, ARG_H, ARG_U, ARG_X, ARG_W, ARG_E, ARG_P, ARG_Y, ARG_L, ARG_F, ARG_M, ARG_N, ARG_Q, ARG_R, ARG_A, ARG_J, ARG_D, ARG_Z, ARG_S, ARG_G, ARG_V, ARG_T)),
ARM("Armenia", 29743, listOf(ARM_AR, ARM_ARA, ARM_AV, ARM_G, ARM_LO, ARM_KOT, ARM_SH, ARM_SU, ARM_TV, ARM_VA, ARM_ER)),
ABW("Aruba", 180, emptyList()),
AUS("Australia", 7692024, listOf(AUS_ACT, AUS_NSW, AUS_NT, AUS_QLD, AUS_SA, AUS_TAS, AUS_VIC, AUS_WA)),
AUT("Austria", 83879, listOf(AUT_B, AUT_K, AUT_NO, AUT_OO, AUT_S, AUT_ST, AUT_T, AUT_V, AUT_W)),
AZE("Azerbaijan", 86600, listOf()),
BHS("Bahamas", 13878, emptyList()),
BHR("Bahrain", 778, emptyList()),
BGD("Bangladesh", 143998, emptyList()),
BRB("Barbados", 430, emptyList()),
BLR("Belarus", 207595, emptyList()),
BEL("Belgium", 30528, listOf(BEL_BRU, BEL_VAN, BEL_WAL)),
BLZ("Belize", 22965, emptyList()),
BEN("Benin", 114763, emptyList()),
BMU("Bermuda", 54, emptyList()),
BTN("Bhutan", 38394, emptyList()),
BOL("Bolivia (Plurinational State of)", 1098581, emptyList()),
BES("Bonaire, Sint Eustatius and Saba", 294, emptyList()),
BIH("Bosnia and Herzegovina", 51209, emptyList()),
BWA("Botswana", 581730, emptyList()),
BVT("Bouvet Island", 49, emptyList()),
BRA("Brazil", 8515767, emptyList()),
IOT("British Indian Ocean Territory", 60, emptyList()),
BRN("Brunei Darussalam", 5765, emptyList()),
BGR("Bulgaria", 110994, emptyList()),
BFA("Burkina Faso", 274200, emptyList()),
BDI("Burundi", 27834, emptyList()),
CPV("Cabo Verde", 4033, emptyList()),
KHM("Cambodia", 181035, emptyList()),
CMR("Cameroon", 475442, emptyList()),
CAN("Canada", 9984670, emptyList()),
CYM("Cayman Islands", 264, emptyList()),
CAF("Central African Republic", 622436, emptyList()),
TCD("Chad", 1284000, emptyList()),
CHL("Chile", 756102, emptyList()),
CHN("China", 9596961, emptyList()),
CXR("Christmas Island", 135, emptyList()),
CCK("Cocos (Keeling) Islands", 14, emptyList()),
COL("Colombia", 1141748, emptyList()),
COM("Comoros", 2235, emptyList()),
COG("Congo", 342000, emptyList()),
COD("Congo, Democratic Republic of the", 2344858, emptyList()),
COK("Cook Islands", 237, emptyList()),
CRI("Costa Rica", 51100, emptyList()),
CIV("Côte d'Ivoire", 322463, emptyList()),
HRV("Croatia", 56594, emptyList()),
CUB("Cuba", 109884, emptyList()),
CUW("Curaçao", 444, emptyList()),
CYP("Cyprus", 9251, emptyList()),
CZE("Czech Republic", 78865, emptyList()),
DNK("Denmark", 42933, emptyList()),
DJI("Djibouti", 23200, emptyList()),
DMA("Dominica", 750, emptyList()),
ECU("Ecuador", 276841, emptyList()),
EGY("Egypt", 1002450, emptyList()),
SLV("El Salvador", 21041, emptyList()),
GNQ("Equatorial Guinea", 28051, emptyList()),
ERI("Eritrea", 117600, emptyList()),
EST("Estonia", 45227, emptyList()),
SWZ("Eswatini", 17364, emptyList()),
ETH("Ethiopia", 1104300, emptyList()),
FLK("Falkland Islands (Malvinas)", 12173, emptyList()),
FRO("Faroe Islands", 1399, emptyList()),
FJI("Fiji", 18333, emptyList()),
FIN("Finland", 338424, emptyList()),
FRA("France", 643801, listOf(FRA_01, FRA_02, FRA_03, FRA_04, FRA_05, FRA_06, FRA_07, FRA_08, FRA_09, FRA_10, FRA_11, FRA_12, FRA_13, FRA_14, FRA_15, FRA_16, FRA_17, FRA_18, FRA_19, FRA_21, FRA_22, FRA_23, FRA_24, FRA_25, FRA_26, FRA_27, FRA_28, FRA_29, FRA_2A, FRA_2B, FRA_30, FRA_31, FRA_32, FRA_33, FRA_34, FRA_35, FRA_36, FRA_37, FRA_38, FRA_39, FRA_40, FRA_41, FRA_42, FRA_43, FRA_44, FRA_45, FRA_46, FRA_47, FRA_48, FRA_49, FRA_50, FRA_51, FRA_52, FRA_53, FRA_54, FRA_55, FRA_56, FRA_57, FRA_58, FRA_59, FRA_60, FRA_61, FRA_62, FRA_63, FRA_64, FRA_65, FRA_66, FRA_67, FRA_68, FRA_69, FRA_70, FRA_71, FRA_72, FRA_73, FRA_74, FRA_75, FRA_76, FRA_77, FRA_78, FRA_79, FRA_80, FRA_81, FRA_82, FRA_83, FRA_84, FRA_85, FRA_86, FRA_87, FRA_88, FRA_89, FRA_90, FRA_91, FRA_92, FRA_93, FRA_94, FRA_95, FRA_971, FRA_972, FRA_973, FRA_974, FRA_976)),
GUF("French Guiana", 83534, emptyList()),
PYF("French Polynesia", 4167, emptyList()),
ATF("French Southern Territories", 7747, emptyList()),
GAB("Gabon", 267667, emptyList()),
GMB("Gambia", 11295, emptyList()),
GEO("Georgia", 69700, emptyList()),
DEU("Germany", 357408, listOf(DEU_BW, DEU_BY, DEU_BE, DEU_BB, DEU_HB, DEU_HH, DEU_HE, DEU_MV, DEU_NI, DEU_NW, DEU_RP, DEU_SL, DEU_SN, DEU_ST, DEU_SH, DEU_TH)),
GHA("Ghana", 238533, emptyList()),
GIB("Gibraltar", 6, emptyList()),
GRC("Greece", 131957, emptyList()),
GRL("Greenland", 2166086, emptyList()),
GRD("Grenada", 344, emptyList()),
GLP("Guadeloupe", 1628, emptyList()),
GUM("Guam", 541, emptyList()),
GTM("Guatemala", 108889, emptyList()),
GGY("Guernsey", 78, emptyList()),
GIN("Guinea", 245857, emptyList()),
GNB("Guinea-Bissau", 36125, emptyList()),
GUY("Guyana", 214969, emptyList()),
HTI("Haiti", 27750, emptyList()),
HMD("Heard Island and McDonald Islands", 412, emptyList()),
VAT("Holy See (Vatican)", 1, emptyList()),
HND("Honduras", 112492, emptyList()),
HKG("Hong Kong", 1104, emptyList()),
HUN("Hungary", 93028, emptyList()),
ISL("Iceland", 102775, emptyList()),
IND("India", 3287263, emptyList()),
IDN("Indonesia", 1904569, emptyList()),
IRN("Iran (Islamic Republic of)", 1648195, emptyList()),
IRQ("Iraq", 438317, emptyList()),
IRL("Ireland", 70273, emptyList()),
IMN("Isle of Man", 572, emptyList()),
ISR("Israel", 22072, emptyList()),
ITA("Italy", 301340, listOf(ITA_AG, ITA_AL, ITA_AN, ITA_AO, ITA_AR, ITA_AP, ITA_AT, ITA_AV, ITA_BA, ITA_BT, ITA_BL, ITA_BN, ITA_BG, ITA_BI, ITA_BO, ITA_BZ, ITA_BS, ITA_BR, ITA_CA, ITA_CL, ITA_CB, ITA_CI, ITA_CE, ITA_CT, ITA_CZ, ITA_CH, ITA_CO, ITA_CS, ITA_CR, ITA_KR, ITA_CN, ITA_EN, ITA_FM, ITA_FE, ITA_FI, ITA_FG, ITA_FC, ITA_FR, ITA_GE, ITA_GO, ITA_GR, ITA_IM, ITA_IS, ITA_SP, ITA_AQ, ITA_LT, ITA_LE, ITA_LC, ITA_LI, ITA_LO, ITA_LU, ITA_MC, ITA_MN, ITA_MS, ITA_MT, ITA_ME, ITA_MI, ITA_MO, ITA_MB, ITA_NA, ITA_NO, ITA_NU, ITA_OT, ITA_OR, ITA_PD, ITA_PA, ITA_PR, ITA_PV, ITA_PG, ITA_PS, ITA_PE, ITA_PC, ITA_PI, ITA_PT, ITA_PN, ITA_PZ, ITA_PO, ITA_RG, ITA_RA, ITA_RC, ITA_RE, ITA_RI, ITA_RN, ITA_RO, ITA_SA, ITA_SS, ITA_SV, ITA_SI, ITA_SR, ITA_SO, ITA_TA, ITA_TE, ITA_TR, ITA_TO, ITA_TP, ITA_TN, ITA_TV, ITA_TS, ITA_UD, ITA_VA, ITA_VE, ITA_VB, ITA_VC, ITA_VI, ITA_VT)),
JAM("Jamaica", 10991, emptyList()),
JPN("Japan", 377915, listOf(JPN_HO, JPN_AO, JPN_IW, JPN_MI, JPN_AK, JPN_YA, JPN_FU, JPN_IB, JPN_TO, JPN_GU, JPN_SA, JPN_CH, JPN_TY, JPN_KA, JPN_NI, JPN_TOY, JPN_ISH, JPN_FK, JPN_YAM, JPN_NG, JPN_GI, JPN_SHI, JPN_AI, JPN_ME, JPN_SG, JPN_KY, JPN_OS, JPN_HY, JPN_NA, JPN_WK, JPN_TO, JPN_SM, JPN_OK, JPN_HR, JPN_YG, JPN_TS, JPN_KG, JPN_EH, JPN_KC, JPN_FK, JPN_SG, JPN_NG, JPN_KM, JPN_OT, JPN_MY, JPN_KG, JPN_OK)),
JEY("Jersey", 118, emptyList()),
JOR("Jordan", 89342, emptyList()),
KAZ("Kazakhstan", 2724900, emptyList()),
KEN("Kenya", 580367, emptyList()),
KIR("Kiribati", 811, emptyList()),
PRK("Korea (Democratic People's Republic of)", 120538, emptyList()),
KOR("Korea, Republic of", 100210, emptyList()),
XKO("Kosovo", 10887, emptyList()),
KWT("Kuwait", 17818, emptyList()),
KGZ("Kyrgyzstan", 199900, emptyList()),
LAO("Lao People's Democratic Republic", 236800, emptyList()),
LVA("Latvia", 64559, emptyList()),
LBN("Lebanon", 10452, emptyList()),
LSO("Lesotho", 30355, emptyList()),
LBR("Liberia", 111369, emptyList()),
LBY("Libya", 1759540, emptyList()),
LIE("Liechtenstein", 160, emptyList()),
LTU("Lithuania", 65300, emptyList()),
LUX("Luxembourg", 2586, emptyList()),
MAC("Macao", 32, emptyList()),
MDG("Madagascar", 587041, emptyList()),
MWI("Malawi", 118484, emptyList()),
MYS("Malaysia", 330803, emptyList()),
MDV("Maldives", 300, emptyList()),
MLI("Mali", 1240192, emptyList()),
MLT("Malta", 316, emptyList()),
MHL("Marshall Islands", 181, emptyList()),
MTQ("Martinique", 1128, emptyList()),
MRT("Mauritania", 1030700, emptyList()),
MUS("Mauritius", 2040, emptyList()),
MYT("Mayotte", 374, emptyList()),
MEX("Mexico", 1964375, emptyList()),
FSM("Micronesia (Federated States of)", 702, emptyList()),
MDA("Moldova, Republic of", 33846, emptyList()),
MCO("Monaco", 2, emptyList()),
MNG("Mongolia", 1564116, emptyList()),
MNE("Montenegro", 13812, emptyList()),
MSR("Montserrat", 102, emptyList()),
MAR("Morocco", 446550, emptyList()),
MOZ("Mozambique", 799380, emptyList()),
MMR("Myanmar", 676578, emptyList()),
NAM("Namibia", 824292, emptyList()),
NRU("Nauru", 21, emptyList()),
NPL("Nepal", 147181, emptyList()),
NLD("Netherlands", 41526, emptyList()),
NCL("New Caledonia", 18575, emptyList()),
NZL("New Zealand", 270467, emptyList()),
NIC("Nicaragua", 130373, emptyList()),
NER("Niger", 1267000, emptyList()),
NGA("Nigeria", 923768, emptyList()),
NIU("Niue", 261, emptyList()),
NFK("Norfolk Island", 35, emptyList()),
MNP("Northern Mariana Islands", 457, emptyList()),
NOR("Norway", 385207, emptyList()),
OMN("Oman", 309500, emptyList()),
PAK("Pakistan", 881913, emptyList()),
PLW("Palau", 459, emptyList()),
PSE("Palestine, State of", 6220, emptyList()),
PAN("Panama", 75417, emptyList()),
PNG("Papua New Guinea", 462840, emptyList()),
PRY("Paraguay", 406752, emptyList()),
PER("Peru", 1285216, emptyList()),
PHL("Philippines", 300000, emptyList()),
PCN("Pitcairn", 47, emptyList()),
POL("Poland", 312696, emptyList()),
PRT("Portugal", 92090, emptyList()),
PRI("Puerto Rico", 9104, emptyList()),
QAT("Qatar", 11586, emptyList()),
MKD("Republic of North Macedonia", 25713, emptyList()),
ROU("Romania", 238391, emptyList()),
RUS("Russian Federation", 17125242, emptyList()),
RWA("Rwanda", 26338, emptyList()),
REU("Réunion", 2511, emptyList()),
BLM("Saint Barthélemy", 21, emptyList()),
SHN("Saint Helena, Ascension and Tristan da Cunha", 394, emptyList()),
KNA("Saint Kitts and Nevis", 270, emptyList()),
LCA("Saint Lucia", 617, emptyList()),
MAF("Saint Martin (French part)", 53, emptyList()),
SPM("Saint Pierre and Miquelon", 242, emptyList()),
VCT("Saint Vincent and the Grenadines", 389, emptyList()),
WSM("Samoa", 2831, emptyList()),
SMR("San Marino", 61, emptyList()),
STP("Sao Tome and Principe", 1001, emptyList()),
SAU("Saudi Arabia", 2149690, emptyList()),
SEN("Senegal", 196722, emptyList()),
SRB("Serbia", 88361, emptyList()),
SYC("Seychelles", 459, emptyList()),
SLE("Sierra Leone", 71740, emptyList()),
SGP("Singapore", 725, emptyList()),
SXM("Sint Maarten (Dutch part)", 34, emptyList()),
SVK("Slovakia", 49036, emptyList()),
SVN("Slovenia", 20273, emptyList()),
SLB("Solomon Islands", 28896, emptyList()),
SOM("Somalia", 637657, emptyList()),
ZAF("South Africa", 1221037, emptyList()),
SGS("South Georgia and the South Sandwich Islands", 3903, emptyList()),
SSD("South Sudan", 619745, emptyList()),
ESP("Spain", 505990, emptyList()),
LKA("Sri Lanka", 65610, emptyList()),
SDN("Sudan", 1839542, emptyList()),
SUR("Suriname", 163820, emptyList()),
SJM("Svalbard and Jan Mayen", 61399, emptyList()),
SWE("Sweden", 450295, emptyList()),
CHE("Switzerland", 41284, listOf(CHE_AG, CHE_AR, CHE_AI, CHE_BL, CHE_BS, CHE_BE, CHE_FR, CHE_GE, CHE_GL, CHE_GR, CHE_JU, CHE_LU, CHE_NE, CHE_NW, CHE_OW, CHE_SH, CHE_SZ, CHE_SO, CHE_SG, CHE_TG, CHE_TI, CHE_UR, CHE_VS, CHE_VD, CHE_ZG, CHE_ZH)),
SYR("Syrian Arab Republic", 185180, emptyList()),
TWN("Taiwan, Province of China", 36193, emptyList()),
TJK("Tajikistan", 143100, emptyList()),
TZA("Tanzania, United Republic of", 947300, emptyList()),
THA("Thailand", 513120, emptyList()),
TLS("Timor-Leste", 14919, emptyList()),
TGO("Togo", 56785, emptyList()),
TKL("Tokelau", 12, emptyList()),
TON("Tonga", 747, emptyList()),
TTO("Trinidad and Tobago", 5128, emptyList()),
TUN("Tunisia", 163610, emptyList()),
TUR("Turkey", 783562, emptyList()),
TKM("Turkmenistan", 488100, emptyList()),
TCA("Turks and Caicos Islands", 948, emptyList()),
TUV("Tuvalu", 26, emptyList()),
UGA("Uganda", 241551, emptyList()),
UKR("Ukraine", 603700, emptyList()),
ARE("United Arab Emirates", 83600, emptyList()),
GBR("United Kingdom of Great Britain and Northern Ireland", 242910, emptyList()),
USA("United States of America", 9833517, listOf(USA_AL, USA_AK, USA_AZ, USA_AR, USA_CA, USA_CO, USA_CT, USA_DE, USA_FL, USA_GA, USA_HI, USA_ID, USA_IL, USA_IN, USA_IA, USA_KS, USA_KY, USA_LA, USA_ME, USA_MD, USA_MA, USA_MI, USA_MN, USA_MS, USA_MO, USA_MT, USA_NE, USA_NV, USA_NH, USA_NJ, USA_NM, USA_NY, USA_NC, USA_ND, USA_OH, USA_OK, USA_OR, USA_PA, USA_RI, USA_SC, USA_SD, USA_TN, USA_TX, USA_UT, USA_VT, USA_VA, USA_WA, USA_WV, USA_WI, USA_WY)),
UMI("United States Minor Outlying Islands", 34, emptyList()),
URY("Uruguay", 176215, emptyList()),
UZB("Uzbekistan", 447400, emptyList()),
VUT("Vanuatu", 12189, emptyList()),
VEN("Venezuela (Bolivarian Republic of)", 912050, emptyList()),
VNM("Viet Nam", 331212, emptyList()),
VGB("Virgin Islands (British", 153, emptyList()),
VIR("Virgin Islands (U.S.)", 347, emptyList()),
WLF("Wallis and Futuna", 142, emptyList()),
ESH("Western Sahara", 266000, emptyList()),
YEM("Yemen", 527968, emptyList()),
ZMB("Zambia", 752612, emptyList()),
ZWE("Zimbabwe", 390757, emptyList()),
DOM("Dominican Republic", 48671, emptyList()),
ANT("Netherlands Antilles", 800, emptyList()),
XAD("Akrotiri and Dhekelia", 254, emptyList()),
XCL("Clipperton Island", 6, emptyList()),
ZNC("Nothern Cyprus", 3355, emptyList()),
;
override val code = this.name
override val type = LocType.COUNTRY
}

View File

@ -1,17 +0,0 @@
package net.helcel.beendroid.countries
enum class LocType {
WORLD, GROUP, CUSTOM_GROUP, COUNTRY, STATE;
}
interface GeoLoc {
val code : String
val fullName : String
val area : Int
val type : LocType
val children : List<GeoLoc>
val isEnd: Boolean
get() = children.isEmpty() || type == LocType.STATE
}

View File

@ -1,82 +0,0 @@
package net.helcel.beendroid.countries
import net.helcel.beendroid.countries.Country.*
enum class Group(override val fullName: String, override val children: List<Country>) : GeoLoc {
EEE("Europe",listOf(
ALB, AND, AUT, BLR, BEL, BIH, BGR, HRV, CYP, CZE, DNK, EST, FIN, FRA,
DEU, GRC, HUN, ISL, IRL, ITA, KAZ, XKO, LVA, LIE, LTU, LUX, MLT, MDA,
MCO, MNE, NLD, MKD, NOR, POL, PRT, ROU, RUS, SMR, SRB, SVK, SVN, ESP,
SWE, CHE, UKR, GBR, VAT, XAD,
)),
ABB("Asia", listOf(
AFG, ARM, AZE, BHR, BGD, BTN, BRN, KHM, CHN, GEO, HKG, IND, IDN, IRN,
IRQ, ISR, JPN, JOR, KWT, KGZ, LAO, LBN, MAC, MYS, MDV, MNG, MMR,
NPL, PRK, OMN, PAK, PSE, PHL, QAT, SAU, SGP, KOR, LKA, SYR, TWN, TJK,
THA, TLS, TUR, TKM, ARE, UZB, VNM, YEM, ZNC,
)),
FFF("Africa", listOf(
DZA, AGO, BDI, BEN, BWA, BFA, BDI, CPV, CMR, CAF, TCD, COM, COG, COD, CIV, DJI, EGY,
GNQ, ERI, SWZ, ETH, GAB, GMB, GHA, GIN, GNB, KEN, LSO, LBR, LBY, MDG, MWI, MLI, MRT,
MUS, MYT, MAR, MOZ, NAM, NER, NGA, COD, REU, RWA, STP, SEN, SYC, SLE, SOM, ZAF, SSD,
SHN, SDN, TZA, TGO, TUN, UGA, COD, ZMB, ZWE,
ESH,
)),
NNN("North America", listOf(
ABW, AIA, ATG, BHS, BRB, BLZ, BMU, VGB, CAN, CYM, CRI, CUB, CUW, DMA,
DOM, SLV, GRL, GRD, GLP, GTM, HTI, HND, JAM, MTQ, MEX, MSR, ANT, CUW,
NIC, PAN, PRI, KNA, LCA, MAF, SPM, VCT, TTO, TCA, USA, XCL,
)),
SRR("South America", listOf(
ARG, BOL, BRA, CHL, COL, ECU, FLK, GUF, GUY, PRY, PER, SUR, URY, VEN,
)),
UUU("Oceania", listOf(
ASM, AUS, COK, FJI, PYF, GUM, KIR, MHL, FSM, NRU, NCL, NZL, NIU, NFK,
MNP, PLW, PNG, PCN, SLB, TKL, TON, TUV, VUT, WLF,
)),
XXX("Others", listOf(
ATA, // Antarctica: not in any other region
ALA, // Åland Islands: an autonomous region of Finland, but not a member of the EU or UN
BES, // Bonaire, Sint Eustatius and Saba: special municipalities of the Netherlands in the Caribbean
BVT, // Bouvet Island: an uninhabited territory of Norway in the South Atlantic
IOT, // British Indian Ocean Territory: a British overseas territory in the Indian Ocean
CXR, // Christmas Island: an Australian external territory in the Indian Ocean
CCK, // Cocos (Keeling) Islands: an Australian external territory in the Indian Ocean
FRO, // Faroe Islands: an autonomous region of Denmark
ATF, // French Southern and Antarctic Lands: a territory of France located in the southern Indian Ocean
GIB, // Gibraltar: a British overseas territory located at the southern tip of the Iberian Peninsula
GGY, // Guernsey: a British Crown dependency in the English Channel
HMD, // Heard Island and McDonald Islands: an uninhabited Australian external territory in the southern Indian Ocean
IMN, // Isle of Man: a British Crown dependency located in the Irish Sea
JEY, // Jersey: a British Crown dependency located in the English Channel
BLM, // Saint Barthélemy: an overseas collectivity of France in the Caribbean
WSM, // Samoa: an independent island nation in the South Pacific
SXM, // Sint Maarten: a constituent country of the Kingdom of the Netherlands in the Caribbean
SGS, // South Georgia and the South Sandwich Islands: a British overseas territory in the southern Atlantic Ocean
SJM, // Svalbard and Jan Mayen: an archipelago administered by Norway
UMI, // United States Minor Outlying Islands: a collection of nine insular areas of the United States
VIR, // United States Virgin Islands: an unincorporated territory of the United States in the Caribbean
)),
ZZZ("Undefined", listOf(
)),
NTT("NATO", listOf(
ALB, BEL, BGR, CAN, HRV, CZE, DNK, EST, FRA, DEU, GRC, HUN, ISL, ITA, LVA, LTU, LUX,
MNE, NLD, NOR, POL, PRT, ROU, SVK, SVN, ESP, TUR, GBR, USA
))
;
override val area = children.fold(0) { acc, i ->
acc + i.area
}
private val isInWorld = listOf("EEE","ABB","FFF","NNN","SRR","UUU","XXX").contains(this.name)
override val type: LocType = if (isInWorld) LocType.GROUP else LocType.CUSTOM_GROUP
override val code = this.name
}

View File

@ -1,532 +0,0 @@
package net.helcel.beendroid.countries
enum class State(override val fullName: String, override val area: Int) : GeoLoc {
AFG_BD("Badakhshan", 44851),
AFG_BDG("Badghis", 22447),
AFG_BGL("Baghlan", 21397),
AFG_BAL("Balkh", 17430),
AFG_BAM("Bamyan", 14056),
AFG_DAY("Daykundi", 18279),
AFG_FRA("Farah", 48402),
AFG_FYB("Faryab", 20517),
AFG_GHA("Ghazni", 22440),
AFG_GHO("Ghor", 36294),
AFG_HEL("Helmand", 58971),
AFG_HER("Herat", 54588),
AFG_JOW("Jowzjan", 12172),
AFG_KAB("Kabul", 4900),
AFG_KAN("Kandahar", 54610),
AFG_KAP("Kapisa", 1829),
AFG_KHO("Khost", 3869),
AFG_KNR("Kunar", 9423),
AFG_KDZ("Kunduz", 8019),
AFG_LAG("Laghman", 3844),
AFG_LOG("Logar", 3522),
AFG_NAN("Nangarhar", 7387),
AFG_NIM("Nimroz", 41600),
AFG_NUR("Nuristan", 9288),
AFG_PAN("Paktia", 6635),
AFG_PAR("Paktika", 19308),
AFG_PIA("Panjshir", 325),
AFG_PRI("Parwan", 5964),
AFG_SAM("Samangan", 11497),
AFG_SAR("Sar-e Pol", 16392),
AFG_SHA("Shamali Plain", 1272),
AFG_SOL("Sar-e Pol", 25481),
AFG_URO("Urozgan", 12238),
AFG_WAR("Wardak", 8894),
AFG_ZAB("Zabul", 17296),
ALB_BR("Berat", 1792),
ALB_BU("Dibër", 2581),
ALB_DI("Durrës", 766),
ALB_EL("Elbasan", 3196),
ALB_FR("Fier", 1904),
ALB_GJ("Gjirokastër", 2886),
ALB_KO("Korçë", 3710),
ALB_KU("Kukës", 2373),
ALB_LE("Lezhë", 1555),
ALB_SH("Shkodër", 3677),
ALB_TR("Tirana", 1014),
ALB_VL("Vlorë", 1609),
DZA_01("Adrar", 402160),
DZA_44("Aïn Defla", 72028),
DZA_46("Aïn Témouchent", 2739),
DZA_16("Algiers", 2735),
DZA_23("Annaba", 1497),
DZA_05("Batna", 11920),
DZA_07("Béchar", 161400),
DZA_02("Béjaïa", 6476),
DZA_06("Biskra", 20848),
DZA_08("Blida", 1447),
DZA_09("Bordj Bou Arréridj", 4185),
DZA_10("Bouira", 4479),
DZA_34("Boumerdès", 1510),
DZA_35("Chlef", 7323),
DZA_25("Constantine", 2082),
DZA_17("Djelfa", 66411),
DZA_32("El Bayadh", 78300),
DZA_39("El Oued", 54400),
DZA_36("El Tarf", 3500),
DZA_47("Ghardaïa", 86400),
DZA_24("Guelma", 4196),
DZA_33("Illizi", 284936),
DZA_18("Jijel", 2577),
DZA_40("Khenchela", 9161),
DZA_03("Laghouat", 25733),
DZA_29("Mascara", 5635),
DZA_26("Médéa", 8739),
DZA_43("Mila", 7904),
DZA_27("Mostaganem", 2132),
DZA_28("Msila", 18432),
DZA_45("Naama", 32530),
DZA_31("Oran", 2249),
DZA_30("Ouargla", 541310),
DZA_04("Oum El Bouaghi", 7267),
DZA_48("Relizane", 4921),
DZA_20("Saïda", 6168),
DZA_19("Sétif", 6984),
DZA_22("Skikda", 4751),
DZA_21("Souk Ahras", 4321),
DZA_41("Tamanghasset", 556200),
DZA_12("Tébessa", 14297),
DZA_14("Tiaret", 21214),
DZA_37("Tindouf", 159000),
DZA_42("Tissemsilt", 3798),
DZA_38("Tizi Ouzou", 3798),
DZA_15("Tlemcen", 7970),
AGO_BGO("Bengo", 31648),
AGO_BGU("Benguela", 31931),
AGO_BIE("Bié", 70156),
AGO_CAB("Cabinda", 7289),
AGO_CCU("Cuando Cubango", 199049),
AGO_CNO("Cuanza Norte", 24398),
AGO_CUS("Cuanza Sul", 55500),
AGO_CNN("Cunene", 77614),
AGO_HUA("Huambo", 34049),
AGO_HUI("Huíla", 79091),
AGO_LNO("Lunda Norte", 103760),
AGO_LSU("Lunda Sul", 77475),
AGO_LUA("Luanda", 18113),
AGO_MAL("Malanje", 97225),
AGO_MOX("Moxico", 223023),
AGO_NAM("Namibe", 58477),
AGO_UIG("Uíge", 58698),
AGO_ZAI("Zaire", 40170),
ARG_BA("Buenos Aires", 307571),
ARG_C("Ciudad Autónoma de Buenos Aires", 203),
ARG_K("Catamarca", 102606),
ARG_H("Chaco", 99633),
ARG_U("Chubut", 224686),
ARG_X("Córdoba", 165321),
ARG_W("Corrientes", 88199),
ARG_E("Entre Ríos", 78781),
ARG_P("Formosa", 72066),
ARG_Y("Jujuy", 53219),
ARG_L("La Pampa", 143440),
ARG_F("La Rioja", 89680),
ARG_M("Mendoza", 148827),
ARG_N("Misiones", 29801),
ARG_Q("Neuquén", 94078),
ARG_R("Río Negro", 203013),
ARG_A("Salta", 155488),
ARG_J("San Juan", 89651),
ARG_D("San Luis", 76748),
ARG_Z("Santa Cruz", 243943),
ARG_S("Santa Fe", 133007),
ARG_G("Santiago del Estero", 136351),
ARG_V("Tierra del Fuego", 21363),
ARG_T("Tucumán", 222524),
ARM_AR("Aragatsotn", 2096),
ARM_ARA("Ararat", 2096),
ARM_AV("Armavir", 1242),
ARM_G("Gegharkunik", 5346),
ARM_LO("Lori", 3775),
ARM_KOT("Kotayk", 2086),
ARM_SH("Shirak", 2684),
ARM_SU("Syunik", 4505),
ARM_TV("Tavush", 2700),
ARM_VA("Vayots Dzor", 2308),
ARM_ER("Yerevan", 223),
AUS_ACT("Australian Capital Territory", 2358),
AUS_NSW("New South Wales", 800642),
AUS_NT("Northern Territory", 1348646),
AUS_QLD("Queensland", 1859900),
AUS_SA("South Australia", 984377),
AUS_TAS("Tasmania", 68401),
AUS_VIC("Victoria", 227416),
AUS_WA("Western Australia", 2525275),
AUT_B("Burgenland", 3960),
AUT_K("Carinthia", 9539),
AUT_NO("Lower Austria", 19186),
AUT_OO("Upper Austria", 11983),
AUT_S("Salzburg", 7169),
AUT_ST("Styria", 16420),
AUT_T("Tyrol", 12639),
AUT_V("Vorarlberg", 2601),
AUT_W("Vienna", 415),
BEL_BRU("Brussels-Capital Region", 162),
BEL_VAN("Flemish Region", 13790),
BEL_WAL("Walloon Region", 16640),
CHE_AG("Aargau", 1404),
CHE_AR("Appenzell Ausserrhoden", 243),
CHE_AI("Appenzell Innerrhoden", 173),
CHE_BL("Basel-Landschaft", 518),
CHE_BS("Basel-Stadt", 37),
CHE_BE("Bern", 5959),
CHE_FR("Fribourg", 1671),
CHE_GE("Geneva", 282),
CHE_GL("Glarus", 685),
CHE_GR("Graubünden", 7105),
CHE_JU("Jura", 838),
CHE_LU("Lucerne", 1493),
CHE_NE("Neuchâtel", 803),
CHE_NW("Nidwalden", 276),
CHE_OW("Obwalden", 491),
CHE_SH("Schaffhausen", 298),
CHE_SZ("Schwyz", 908),
CHE_SO("Solothurn", 791),
CHE_SG("St. Gallen", 2026),
CHE_TG("Thurgau", 991),
CHE_TI("Ticino", 2812),
CHE_UR("Uri", 1077),
CHE_VS("Valais", 5224),
CHE_VD("Vaud", 3212),
CHE_ZG("Zug", 239),
CHE_ZH("Zurich", 1729),
DEU_BW("Baden-Württemberg", 35752),
DEU_BY("Bavaria", 70552),
DEU_BE("Berlin", 891),
DEU_BB("Brandenburg", 29654),
DEU_HB("Bremen", 419),
DEU_HH("Hamburg", 755),
DEU_HE("Hesse", 21115),
DEU_MV("Mecklenburg-Vorpommern", 23215),
DEU_NI("Lower Saxony", 47709),
DEU_NW("North Rhine-Westphalia", 34085),
DEU_RP("Rhineland-Palatinate", 19854),
DEU_SL("Saarland", 2569),
DEU_SN("Saxony", 18417),
DEU_ST("Saxony-Anhalt", 20452),
DEU_SH("Schleswig-Holstein", 15799),
DEU_TH("Thuringia", 16202),
FRA_01("Ain", 5762),
FRA_02("Aisne", 7369),
FRA_03("Allier", 7379),
FRA_04("Alpes-de-Haute-Provence", 6925),
FRA_05("Hautes-Alpes", 5549),
FRA_06("Alpes-Maritimes", 4299),
FRA_07("Ardèche", 5529),
FRA_08("Ardennes", 5227),
FRA_09("Ariège", 4890),
FRA_10("Aube", 6060),
FRA_11("Aude", 6139),
FRA_12("Aveyron", 8733),
FRA_13("Bouches-du-Rhône", 5087),
FRA_14("Calvados", 5546),
FRA_15("Cantal", 5774),
FRA_16("Charente", 5974),
FRA_17("Charente-Maritime", 6864),
FRA_18("Cher", 7234),
FRA_19("Corrèze", 5857),
FRA_21("Côte-d'Or", 8763),
FRA_22("Côtes-d'Armor", 6873),
FRA_23("Creuse", 5561),
FRA_24("Dordogne", 9060),
FRA_25("Doubs", 5230),
FRA_26("Drôme", 6535),
FRA_27("Eure", 6040),
FRA_28("Eure-et-Loir", 5886),
FRA_29("Finistère", 6733),
FRA_2A("Corse-du-Sud", 4014),
FRA_2B("Haute-Corse", 4666),
FRA_30("Gard", 5855),
FRA_31("Haute-Garonne", 6306),
FRA_32("Gers", 6257),
FRA_33("Gironde", 9975),
FRA_34("Hérault", 6224),
FRA_35("Ille-et-Vilaine", 6775),
FRA_36("Indre", 6903),
FRA_37("Indre-et-Loire", 6106),
FRA_38("Isère", 7436),
FRA_39("Jura", 4999),
FRA_40("Landes", 9243),
FRA_41("Loir-et-Cher", 6343),
FRA_42("Loire", 4783),
FRA_43("Haute-Loire", 4978),
FRA_44("Loire-Atlantique", 6811),
FRA_45("Loiret", 6777),
FRA_46("Lot", 5225),
FRA_47("Lot-et-Garonne", 5385),
FRA_48("Lozère", 5167),
FRA_49("Maine-et-Loire", 7080),
FRA_50("Manche", 5987),
FRA_51("Marne", 8212),
FRA_52("Haute-Marne", 6223),
FRA_53("Mayenne", 5166),
FRA_54("Meurthe-et-Moselle", 5224),
FRA_55("Meuse", 6240),
FRA_56("Morbihan", 6820),
FRA_57("Moselle", 6170),
FRA_58("Nièvre", 6819),
FRA_59("Nord", 5743),
FRA_60("Oise", 5860),
FRA_61("Orne", 6100),
FRA_62("Pas-de-Calais", 6657),
FRA_63("Puy-de-Dôme", 7970),
FRA_64("Pyrénées-Atlantiques", 7660),
FRA_65("Hautes-Pyrénées", 4464),
FRA_66("Pyrénées-Orientales", 4114),
FRA_67("Bas-Rhin", 4758),
FRA_68("Haut-Rhin", 3525),
FRA_69("Rhône", 3242),
FRA_70("Haute-Saône", 5361),
FRA_71("Saône-et-Loire", 8577),
FRA_72("Sarthe", 6205),
FRA_73("Savoie", 6012),
FRA_74("Haute-Savoie", 4389),
FRA_75("Paris", 105),
FRA_76("Seine-Maritime", 6279),
FRA_77("Seine-et-Marne", 5913),
FRA_78("Yvelines", 2284),
FRA_79("Deux-Sèvres", 5998),
FRA_80("Somme", 6174),
FRA_81("Tarn", 5758),
FRA_82("Tarn-et-Garonne", 3718),
FRA_83("Var", 6015),
FRA_84("Vaucluse", 3567),
FRA_85("Vendée", 6726),
FRA_86("Vienne", 6990),
FRA_87("Haute-Vienne", 5563),
FRA_88("Vosges", 5888),
FRA_89("Yonne", 7427),
FRA_90("Territoire de Belfort", 609),
FRA_91("Essonne", 1804),
FRA_92("Hauts-de-Seine", 176),
FRA_93("Seine-Saint-Denis", 236),
FRA_94("Val-de-Marne", 245),
FRA_95("Val-d'Oise", 1246),
FRA_971("Guadeloupe", 1628),
FRA_972("Martinique", 1128),
FRA_973("French Guiana", 83534),
FRA_974("Réunion", 2504),
FRA_976("Mayotte", 376),
ITA_AG("Agrigento", 3041),
ITA_AL("Alessandria", 3528),
ITA_AN("Ancona", 1947),
ITA_AO("Aosta", 3263),
ITA_AR("Arezzo", 3234),
ITA_AP("Ascoli Piceno", 1550),
ITA_AT("Asti", 1480),
ITA_AV("Avellino", 2846),
ITA_BA("Bari", 3567),
ITA_BT("Barletta-Andria-Trani", 1543),
ITA_BL("Belluno", 3677),
ITA_BN("Benevento", 2296),
ITA_BG("Bergamo", 2755),
ITA_BI("Biella", 913),
ITA_BO("Bologna", 3702),
ITA_BZ("Bolzano", 7400),
ITA_BS("Brescia", 4762),
ITA_BR("Brindisi", 1360),
ITA_CA("Cagliari", 8503),
ITA_CL("Caltanissetta", 2566),
ITA_CB("Campobasso", 2166),
ITA_CI("Carbonia-Iglesias", 4002),
ITA_CE("Caserta", 2171),
ITA_CT("Catania", 3575),
ITA_CZ("Catanzaro", 2492),
ITA_CH("Chieti", 3646),
ITA_CO("Como", 1232),
ITA_CS("Cosenza", 6825),
ITA_CR("Cremona", 1776),
ITA_KR("Crotone", 1744),
ITA_CN("Cuneo", 6900),
ITA_EN("Enna", 2644),
ITA_FM("Fermo", 862),
ITA_FE("Ferrara", 2631),
ITA_FI("Florence", 3539),
ITA_FG("Foggia", 7003),
ITA_FC("Forlì-Cesena", 2374),
ITA_FR("Frosinone", 3241),
ITA_GE("Genoa", 1837),
ITA_GO("Gorizia", 466),
ITA_GR("Grosseto", 4502),
ITA_IM("Imperia", 1102),
ITA_IS("Isernia", 1687),
ITA_SP("La Spezia", 882),
ITA_AQ("L'Aquila", 5336),
ITA_LT("Latina", 2259),
ITA_LE("Lecce", 2561),
ITA_LC("Lecco", 816),
ITA_LI("Livorno", 1141),
ITA_LO("Lodi", 782),
ITA_LU("Lucca", 1771),
ITA_MC("Macerata", 2720),
ITA_MN("Mantua", 2250),
ITA_MS("Massa and Carrara", 1153),
ITA_MT("Matera", 3507),
ITA_ME("Messina", 3241),
ITA_MI("Milan", 1821),
ITA_MO("Modena", 2168),
ITA_MB("Monza and Brianza", 405),
ITA_NA("Naples", 1171),
ITA_NO("Novara", 1030),
ITA_NU("Nuoro", 5418),
ITA_OT("Olbia-Tempio", 3331),
ITA_OR("Oristano", 3477),
ITA_PD("Padua", 2710),
ITA_PA("Palermo", 4993),
ITA_PR("Parma", 3466),
ITA_PV("Pavia", 2961),
ITA_PG("Perugia", 6175),
ITA_PS("Pesaro and Urbino", 2915),
ITA_PE("Pescara", 1260),
ITA_PC("Piacenza", 2586),
ITA_PI("Pisa", 2472),
ITA_PT("Pistoia", 965),
ITA_PN("Pordenone", 2534),
ITA_PZ("Potenza", 6588),
ITA_PO("Prato", 365),
ITA_RG("Ragusa", 1649),
ITA_RA("Ravenna", 1857),
ITA_RC("Reggio Calabria", 3034),
ITA_RE("Reggio Emilia", 2297),
ITA_RI("Rieti", 2745),
ITA_RN("Rimini", 864),
ITA_RO("Rovigo", 1780),
ITA_SA("Salerno", 4060),
ITA_SS("Sassari", 4990),
ITA_SV("Savona", 1554),
ITA_SI("Siena", 3807),
ITA_SR("Siracusa", 2108),
ITA_SO("Sondrio", 3232),
ITA_TA("Taranto", 2496),
ITA_TE("Teramo", 1953),
ITA_TR("Terni", 2124),
ITA_TO("Turin", 6824),
ITA_TP("Trapani", 2461),
ITA_TN("Trento", 6212),
ITA_TV("Treviso", 2455),
ITA_TS("Trieste", 212),
ITA_UD("Udine", 4850),
ITA_VA("Varese", 1193),
ITA_VE("Venice", 2464),
ITA_VB("Verbano-Cusio-Ossola", 2252),
ITA_VC("Vercelli", 2100),
ITA_VI("Vicenza", 2712),
ITA_VT("Viterbo", 3617),
JPN_HO("Hokkaido", 83424),
JPN_AO("Aomori", 12891),
JPN_IW("Iwate", 15275),
JPN_MI("Miyagi", 7286),
JPN_AK("Akita", 11637),
JPN_YA("Yamagata", 9323),
JPN_FU("Fukushima", 13784),
JPN_IB("Ibaraki", 6095),
JPN_TOC("Tochigi", 6408),
JPN_GU("Gunma", 6362),
JPN_SA("Saitama", 3798),
JPN_CH("Chiba", 5156),
JPN_TY("Tokyo", 2187),
JPN_KA("Kanagawa", 2416),
JPN_NI("Niigata", 12584),
JPN_TOY("Toyama", 4247),
JPN_ISH("Ishikawa", 4186),
JPN_FK("Fukui", 4181),
JPN_YAM("Yamanashi", 4465),
JPN_NG("Nagano", 13562),
JPN_GI("Gifu", 10621),
JPN_SHI("Shizuoka", 7786),
JPN_AI("Aichi", 5172),
JPN_ME("Mie", 5774),
JPN_SHG("Shiga", 4017),
JPN_KY("Kyoto", 4612),
JPN_OS("Osaka", 19014),
JPN_HY("Hyogo", 8395),
JPN_NA("Nara", 3691),
JPN_WK("Wakayama", 4726),
JPN_TO("Tottori", 3507),
JPN_SM("Shimane", 6708),
JPN_OKY("Okayama", 7114),
JPN_HR("Hiroshima", 8479),
JPN_YG("Yamaguchi", 6112),
JPN_TS("Tokushima", 4147),
JPN_KG("Kagawa", 1862),
JPN_EH("Ehime", 5676),
JPN_KC("Kochi", 7105),
JPN_FKK("Fukuoka", 4986),
JPN_SG("Saga", 2433),
JPN_NGS("Nagasaki", 4132),
JPN_KM("Kumamoto", 7409),
JPN_OT("Oita", 6341),
JPN_MY("Miyazaki", 7775),
JPN_KGS("Kagoshima", 9186),
JPN_OK("Okinawa", 2281),
USA_AL("Alabama", 135767),
USA_AK("Alaska", 1723337),
USA_AZ("Arizona", 295234),
USA_AR("Arkansas", 137732),
USA_CA("California", 423967),
USA_CO("Colorado", 269601),
USA_CT("Connecticut", 14356),
USA_DE("Delaware", 6446),
USA_FL("Florida", 170312),
USA_GA("Georgia", 153910),
USA_HI("Hawaii", 28314),
USA_ID("Idaho", 216443),
USA_IL("Illinois", 149995),
USA_IN("Indiana", 94327),
USA_IA("Iowa", 145746),
USA_KS("Kansas", 213100),
USA_KY("Kentucky", 104656),
USA_LA("Louisiana", 135659),
USA_ME("Maine", 91634),
USA_MD("Maryland", 32131),
USA_MA("Massachusetts", 27336),
USA_MI("Michigan", 250487),
USA_MN("Minnesota", 225163),
USA_MS("Mississippi", 125438),
USA_MO("Missouri", 180540),
USA_MT("Montana", 380831),
USA_NE("Nebraska", 200330),
USA_NV("Nevada", 286380),
USA_NH("New Hampshire", 24214),
USA_NJ("New Jersey", 22591),
USA_NM("New Mexico", 314917),
USA_NY("New York", 141297),
USA_NC("North Carolina", 139390),
USA_ND("North Dakota", 183107),
USA_OH("Ohio", 116098),
USA_OK("Oklahoma", 181037),
USA_OR("Oregon", 254799),
USA_PA("Pennsylvania", 119280),
USA_RI("Rhode Island", 4002),
USA_SC("South Carolina", 82933),
USA_SD("South Dakota", 199730),
USA_TN("Tennessee", 109153),
USA_TX("Texas", 695662),
USA_UT("Utah", 219882),
USA_VT("Vermont", 24906),
USA_VA("Virginia", 110787),
USA_WA("Washington", 184661),
USA_WV("West Virginia", 62755),
USA_WI("Wisconsin", 169634),
USA_WY("Wyoming", 253335),
UNDEFINED("?",0),
;
override val code = this.name
override val children = emptyList<GeoLoc>()
override val type = LocType.STATE
}

View File

@ -1,46 +0,0 @@
package net.helcel.beendroid.helper
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.ColorDrawable
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import net.helcel.beendroid.R
import net.helcel.beendroid.countries.GeoLoc
var visits : Visits? = null
var groups : Groups? = null
var selected_group : Groups.Group? = null
var selected_geoloc: GeoLoc? = null
val groupsSerial = Groups.GroupsSerializer()
val visitsSerial = Visits.VisitsSerializer()
private var sharedPreferences: SharedPreferences? = null
fun loadData(ctx: Context, id:Int) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
val groupsString = sharedPreferences!!.getString("groups_$id",null)
val visitsString = sharedPreferences!!.getString("visits_$id",null)
groups = if(!groupsString.isNullOrEmpty()) groupsSerial.readFrom(groupsString.byteInputStream()) else groupsSerial.defaultValue
visits = if(!visitsString.isNullOrEmpty()) visitsSerial.readFrom(visitsString.byteInputStream()) else visitsSerial.defaultValue
// Add default group "Visited" with app's color if there is no group already
if (groups!!.size() == 0) {
groups!!.setGroup(1, "Visited", ColorDrawable(ContextCompat.getColor(ctx, R.color.blue)))
saveData()
}
}
fun saveData() {
if(groups!!.id != visits!!.id) return
val id = groups!!.id
val editor = sharedPreferences!!.edit()
editor.putString("groups_$id", groupsSerial.writeTo(groups!!))
editor.putString("visits_$id", visitsSerial.writeTo(visits!!))
editor.apply()
}

View File

@ -1,35 +0,0 @@
package net.helcel.beendroid.helper
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.util.TypedValue
import androidx.appcompat.app.AppCompatActivity
import androidx.core.graphics.ColorUtils
fun colorWrapper(ctx : Context, res: Int): ColorDrawable {
val colorPrimaryTyped = TypedValue()
ctx.theme.resolveAttribute(res, colorPrimaryTyped, true)
return ColorDrawable(colorPrimaryTyped.data)
}
fun colorToHex6(c: ColorDrawable): String {
return '#'+colorToHex8(c).substring(3)
}
@OptIn(ExperimentalStdlibApi::class)
fun colorToHex8(c: ColorDrawable): String {
return '#'+c.color.toHexString()
}
fun createActionBar(ctx: AppCompatActivity, title: String) {
ctx.supportActionBar?.setBackgroundDrawable(colorWrapper(ctx, android.R.attr.colorPrimary))
ctx.supportActionBar?.title = title
ctx.supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
fun getContrastColor(color: Int): Int {
val whiteContrast = ColorUtils.calculateContrast(Color.WHITE, color)
val blackContrast = ColorUtils.calculateContrast(Color.BLACK, color)
return if (whiteContrast > blackContrast) Color.WHITE else Color.BLACK
}

View File

@ -1,32 +0,0 @@
package net.helcel.beendroid.svg
import android.content.Context
import net.helcel.beendroid.countries.World
import net.helcel.beendroid.helper.colorToHex6
import net.helcel.beendroid.helper.colorWrapper
import net.helcel.beendroid.helper.groups
import net.helcel.beendroid.helper.visits
class CSSWrapper(ctx: Context) {
private val colorForeground: String = colorToHex6(colorWrapper(ctx, android.R.attr.panelColorBackground))
private val colorBackground: String = colorToHex6(colorWrapper(ctx, android.R.attr.colorBackground))
fun get() : String {
return listOf(World.WWW.children
.filter { visits!!.getVisited(it)!=0}
.map { "#${it.code}{fill:${colorToHex6(groups!!.getGroupFromKey(visits!!.getVisited(it))!!.color)};}"}
.fold(""){acc, s-> acc + s},
World.WWW.children
.filter { visits!!.getVisited(it)==0 }
.map { cg -> cg.children
.filter { visits!!.getVisited(it)!=0 }
.map { "#${it.code}{fill:${colorToHex6(groups!!.getGroupFromKey(visits!!.getVisited(it))!!.color)};}"}
.fold(""){acc, s-> acc + s}
}.fold(""){acc,s->acc+s},
).fold(""){acc,s-> acc+s}+
"svg{fill:$colorForeground;stroke:$colorBackground;stroke-width:0.1;}"
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:theme="@style/Theme.Beendroid"
android:theme="@style/Theme.Beans"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.tabs.TabLayout
@ -15,21 +15,4 @@
android:layout_height="0dp"
android:layout_weight="1" />
<!-- <androidx.core.widget.NestedScrollView-->
<!-- android:id="@+id/sv"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:scrollbars="vertical">-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/list"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:nestedScrollingEnabled="false"-->
<!-- android:scrollbars="vertical" />-->
<!-- </androidx.core.widget.NestedScrollView>-->
</LinearLayout>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:theme="@style/Theme.Beendroid"
android:theme="@style/Theme.Beans"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:theme="@style/Theme.Beendroid"
android:theme="@style/Theme.Beans"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.SettingsActivity">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:theme="@style/Theme.Beendroid"
android:theme="@style/Theme.Beans"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -49,7 +49,7 @@
android:layout_marginBottom="15dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/beendroid_is_foss"
android:text="@string/beans_is_foss"
android:textAlignment="center" />
<TextView
@ -60,7 +60,7 @@
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:autoLink="web"
android:text="@string/beendroid_repo"
android:text="@string/beans_repo"
android:textAlignment="center" />
</LinearLayout>

View File

@ -1,30 +0,0 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:layout_marginEnd="32dp"
android:layout_weight="1"
android:contentDescription="TODO" android:text="@string/group_add"
android:src="@drawable/add"
android:backgroundTint="@color/blue"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -6,13 +6,14 @@
android:orientation="vertical"
android:padding="16dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/group_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:autofillHints=""
android:hint="@string/name"
android:inputType="text"
android:autofillHints="" />
android:inputType="text" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -22,11 +23,11 @@
android:id="@+id/colorView"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/colorR"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/black"/>
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.slider.Slider
@ -64,9 +65,11 @@
app:trackColorActive="@color/blue" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/textView"
android:layout_width="wrap_content"
@ -77,11 +80,46 @@
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/group_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:autofillHints=""
android:hint="@string/color_rrggbb"
android:inputType="text"
android:maxLength="6" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/delete"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cancel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btnOk"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@ -1,17 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/groups_color"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/clear"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@ -51,26 +51,6 @@
app:layout_constraintTop_toTopOf="@id/textView"
app:layout_constraintVertical_bias="0.5" />
<LinearLayout
android:id="@+id/sub_item"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="24dp"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/checkBox">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,7 +1,7 @@
<menu 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"
tools:context="net.helcel.beendroid.activity.MainActivity" >
tools:context="net.helcel.beans.activity.MainActivity" >
<item
android:id="@+id/action_edit"

View File

@ -10,4 +10,9 @@
<item>@string/counters</item>
<item>@string/percentages</item>
</string-array>
<string-array name="entries_onoff">
<item>@string/on</item>
<item>@string/off</item>
</string-array>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BeenDroid</string>
<string name="app_name">Beans</string>
<string name="app_version">1.0</string>
<string name="action_settings">Settings</string>
<string name="action_stat">Stats</string>
@ -13,16 +13,25 @@
<string name="counters">Prefer counters (#)</string>
<string name="percentages">Prefer percentages (%)</string>
<string name="licenses">Licenses</string>
<string name="key_group">Groups</string>
<string name="key_regional">Regional</string>
<string name="about">About</string>
<string name="beendroid_is_foss">BeenDroid is free and open source software, licensed under the GNU General Public License (version 3 or later)</string>
<string name="beendroid_repo">Project repository: https://git.helcel.net/helcel/beendroid\n Feel free to report issues or contribute to the project.</string>
<string name="beans_is_foss">Beans is free and open source software, licensed under the GNU General Public License (version 3 or later)</string>
<string name="beans_repo">Project repository: https://git.helcel.net/helcel/beans\n Feel free to report issues or contribute to the project.</string>
<string name="foss_licenses">Free and open source dependencies and licenses</string>
<string name="about_beendroid">About the BeenDroid application</string>
<string name="about_beans">About the Beans application</string>
<string name="delete_group">Are your sure you want to delete this group and remove all its country mappings?</string>
<string name="group_add">Add</string>
<string name="add">Add</string>
<string name="clear">Clear</string>
<string name="logo">Logo</string>
<string name="name">Name</string>
<string name="rate">%1$d/%2$d</string>
<string name="percentage">%1$d&#65285;</string>
<string name="color_rrggbb">RRGGBB</string>
<string name="hashtag">#</string>
<string name="on">On</string>
<string name="off">Off</string>
<string name="delete">Delete</string>
<string name="cancel">Cancel</string>
<string name="ok">Ok</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hashtag">#</string>
</resources>

View File

@ -1,5 +1,5 @@
<resources>
<style name="Theme.Beendroid" parent="Theme.Material3.DayNight">
<style name="Theme.Beans" parent="Theme.Material3.DayNight">
<item name="colorPrimary">@color/blue</item>
<item name="background">@color/darkgray</item>
<item name="android:colorPrimary">?attr/colorPrimary</item>

View File

@ -1,41 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="@style/Theme.Beendroid">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:theme="@style/Theme.Beans">
<ListPreference
app:defaultValue="@string/off"
app:enabled="true"
app:key="@string/key_theme"
app:icon="@drawable/palette"
app:title="@string/key_theme"
app:useSimpleSummaryProvider="true"
app:entries="@array/entries_theme"
app:entryValues="@array/entries_theme"
app:defaultValue="@string/system" />
app:entries="@array/entries_onoff"
app:entryValues="@array/entries_onoff"
app:icon="@drawable/edit"
app:key="@string/key_group"
app:title="@string/key_group"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="@string/off"
app:enabled="true"
app:entries="@array/entries_onoff"
app:entryValues="@array/entries_onoff"
app:icon="@drawable/edit"
app:key="@string/key_regional"
app:title="@string/key_regional"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="@string/counters"
app:enabled="true"
app:key="@string/key_stats"
app:icon="@drawable/stats"
app:title="@string/key_stats"
app:useSimpleSummaryProvider="true"
app:entries="@array/entries_stats"
app:entryValues="@array/entries_stats"
app:defaultValue="@string/counters" />
app:icon="@drawable/stats"
app:key="@string/key_stats"
app:title="@string/key_stats"
app:useSimpleSummaryProvider="true" />
<Preference
android:summary="@string/foss_licenses"
app:enabled="true"
app:key="@string/licenses"
app:icon="@drawable/licenses"
app:title="@string/licenses"
android:summary="@string/foss_licenses"/>
app:key="@string/licenses"
app:title="@string/licenses" />
<Preference
android:summary="@string/about_beans"
app:enabled="true"
app:key="@string/about"
app:icon="@drawable/about"
app:title="@string/about"
android:summary="@string/about_beendroid"/>
app:key="@string/about"
app:title="@string/about" />
</PreferenceScreen>

View File

@ -1,105 +0,0 @@
#!/bin/node
import {readFileSync,createWriteStream,writeFileSync, existsSync} from 'fs';
import {get as httpsGet} from 'https';
import mapshaper from 'mapshaper';
import {GeoJSON2SVG} from 'geojson2svg';
const LOCAL_SVG_PATH = "./app/src/main/assets/"
const GADM_VERSION="4.1"
const GADM_BASEPATH="https://geodata.ucdavis.edu/gadm"
const countries =
[
"AFG","XAD","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATG","ARG","ARM","ABW","AUS","AUT","AZE",
"BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA", "IOT","VGB","BRN","BGR","BFA","BDI","KHM",
"CMR","CAN","CPV","XCA","CYM","CAF","TCD","CHL","CHN","CXR","XCL","CCK","COL","COM","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","COD",
"DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF",
"GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","HND","HUN",
"ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","XKO","KWT","KGZ",
"LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","SXM",
"MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR",
"NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","PRK","ZNC","MNP","NOR","OMN",
"PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","COG","REU","ROU","RUS","RWA","BLM","MAF",
"SHN","KNA","LCA","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SGS","KOR","SSD","ESP",
"LKA","SDN","SUR","SJM","SWZ","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA",
"UKR","ARE","GBR","USA","UMI","URY","UZB","VUT","VAT","VEN","VNM","VIR","WLF","ESH","YEM","ZMB","ZWE"
]
const url_0 = (country) => `${GADM_BASEPATH}/gadm${GADM_VERSION}/json/gadm${GADM_VERSION.replace(".","")}_${country}_0.json`;
const url_1 = (country) => `${GADM_BASEPATH}/gadm${GADM_VERSION}/json/gadm${GADM_VERSION.replace(".","")}_${country}_1.json.zip`;
const dl0 = (country) => new Promise((resolve,_reject) => {
const filepath = `temp/${country}_0.json`
if (existsSync(filepath)){
return resolve(filepath)
}
try{
httpsGet(url_0(country), r=>{
const file = createWriteStream(filepath);
r.pipe(file);
file.on("finish", ()=>{
file.close();
resolve(filepath)
})
})
}catch(e){
console.log("DL Error:",country)
console.log(e)
resolve("")
}
})
const parse0 = (country) => new Promise((resolve, _reject) => {
const filepath = `temp/${country}_0.json`
try{
let geo0 = JSON.parse(readFileSync(filepath))
simplify(geo0)
.then(geo1=>{
resolve(toSVG(geo1).join(''))
})
}catch(e){
console.log(country," PARSE Error")
console.log(e)
resolve('')
}
});
const toSVG = (geojson)=> new GeoJSON2SVG({
viewportSize: {width:720,height:720},
attributes: {},
mapExtent: {left: -180, bottom: -90, right: 180, top: 90},
precision: 0,
output:'svg'
}).convert(geojson)
const simplify = (geo0) => mapshaper.applyCommands(`-i data.json -simplify 5% visvalingam weighted -o data.json rfc7946 -o data.svg `, { 'data.json': geo0}).then(res=>{
const geo1 = JSON.parse(res['data.json'].toString())
const svg = res['data.svg'].toString()
console.log(svg)
geo1.features = geo1.features.filter(e=>e.geometry != null)
return geo1
})
async function run(){
const cp = countries.map(c=>
dl0(c).then(_=> parse0(c)).then(r=>{
writeFileSync(LOCAL_SVG_PATH+c+"_0.psvg",r)
return r
})
)
const cpp = await Promise.all(cp)
// console.log(cpp)
var svgStr = `<svg id="map" xmlns="http://www.w3.org/2000/svg" width="1200" height="1200" x="0" y="0" >`+
cpp.join('')
+ `</svg>`;
writeFileSync('./temp/example.svg',svgStr);
cpp.forEach(e=>{
writeFileSync
})
}
run()

151
genenum.js Normal file
View File

@ -0,0 +1,151 @@
#!/bin/node
import {readFileSync, existsSync} from 'fs'
import area from '@turf/area'
import * as turf from '@turf/turf'
const countries =
[
"AFG","XAD","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATG","ARG","ARM","ABW","AUS","AUT","AZE",
"BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA", "IOT","VGB","BRN","BGR","BFA","BDI","KHM",
"CMR","CAN","CPV","XCA","CYM","CAF","TCD","CHL","CHN","CXR","XCL","CCK","COL","COM","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","COD",
"DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF",
"GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","HND","HUN",
"ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","XKO","KWT","KGZ",
"LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","SXM",
"MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR",
"NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","PRK","ZNC","MNP","NOR","OMN",
"PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","COG","REU","ROU","RUS","RWA","BLM","MAF",
"SHN","KNA","LCA","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SGS","KOR","SSD","ESP",
"LKA","SDN","SUR","SJM","SWZ","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA",
"UKR","ARE","GBR","USA","UMI","URY","UZB","VUT","VAT","VEN","VNM","VIR","WLF","ESH","YEM","ZMB","ZWE"
]
const groups = {
"EEE":["ALB","AND","AUT","BLR","BEL","BIH","BGR","HRV","CYP","CZE","DNK","EST","FIN","FRA","DEU","GRC","HUN","ISL","IRL","ITA","KAZ","XKO","LVA","LIE","LTU","LUX","MLT","MDA","MCO","MNE","NLD","MKD","NOR","POL","PRT","ROU","RUS","SMR","SRB","SVK","SVN","ESP","SWE","CHE","UKR","GBR","VAT","XAD"],
"ABB":["AFG","ARM","AZE","BHR","BGD","BTN","BRN","KHM","CHN","GEO","HKG","IND","IDN","IRN","IRQ","ISR","JPN","JOR","KWT","KGZ","LAO","LBN","MAC","MYS","MDV","MNG","MMR","NPL","PRK","OMN","PAK","PSE","PHL","QAT","SAU","SGP","KOR","LKA","SYR","TWN","TJK","THA","TLS","TUR","TKM","ARE","UZB","VNM","YEM","ZNC"],
"FFF":["DZA","AGO","BDI","BEN","BWA","BFA","BDI","CPV","CMR","CAF","TCD","COM","COG","COD","CIV","DJI","EGY","GNQ","ERI","SWZ","ETH","GAB","GMB","GHA","GIN","GNB","KEN","LSO","LBR","LBY","MDG","MWI","MLI","MRT","MUS","MYT","MAR","MOZ","NAM","NER","NGA","COD","REU","RWA","STP","SEN","SYC","SLE","SOM","ZAF","SSD","SHN","SDN","TZA","TGO","TUN","UGA","COD","ZMB","ZWE","ESH"],
"NNN":["ABW","AIA","ATG","BHS","BRB","BLZ","BMU","VGB","CAN","CYM","CRI","CUB","CUW","DMA","DOM","SLV","GRL","GRD","GLP","GTM","HTI","HND","JAM","MTQ","MEX","MSR","ANT","CUW","NIC","PAN","PRI","KNA","LCA","MAF","SPM","VCT","TTO","TCA","USA","XCL"],
"SRR":["ARG","BOL","BRA","CHL","COL","ECU","FLK","GUF","GUY","PRY","PER","SUR","URY","VEN"],
"UUU":["ASM","AUS","COK","FJI","PYF","GUM","KIR","MHL","FSM","NRU","NCL","NZL","NIU","NFK","MNP","PLW","PNG","PCN","SLB","TKL","TON","TUV","VUT","WLF"],
"XXX":[
"ATA", // Antarctica: not in any other region
"ALA",// Åland Islands: an autonomous region of Finland, but not a member of the EU or UN
"BES",// Bonaire, Sint Eustatius and Saba: special municipalities of the Netherlands in the Caribbean
"BVT",// Bouvet Island: an uninhabited territory of Norway in the South Atlantic
"IOT",// British Indian Ocean Territory: a British overseas territory in the Indian Ocean
"CXR",// Christmas Island: an Australian external territory in the Indian Ocean
"CCK",// Cocos (Keeling) Islands: an Australian external territory in the Indian Ocean
"FRO",// Faroe Islands: an autonomous region of Denmark
"ATF",// French Southern and Antarctic Lands: a territory of France located in the southern Indian Ocean
"GIB",// Gibraltar: a British overseas territory located at the southern tip of the Iberian Peninsula
"GGY",// Guernsey: a British Crown dependency in the English Channel
"HMD",// Heard Island and McDonald Islands: an uninhabited Australian external territory in the southern Indian Ocean
"IMN",// Isle of Man: a British Crown dependency located in the Irish Sea
"JEY",// Jersey: a British Crown dependency located in the English Channel
"BLM",// Saint Barthélemy: an overseas collectivity of France in the Caribbean
"WSM",// Samoa: an independent island nation in the South Pacific
"SXM",// Sint Maarten: a constituent country of the Kingdom of the Netherlands in the Caribbean
"SGS",// South Georgia and the South Sandwich Islands: a British overseas territory in the southern Atlantic Ocean
"SJM",// Svalbard and Jan Mayen: an archipelago administered by Norway
"UMI",// United States Minor Outlying Islands: a collection of nine insular areas of the United States
"VIR",// United States Virgin Islands: an unincorporated territory of the United States in the Caribbean
]
}
var dict0 = {}
var dict1 = {}
const formatStr = (str)=> str.replace(/(?<!\b\w)\B[A-Z]|,(?!$)/g, match => {
if (match.startsWith(',')) {
return ', ';
} else {
return ' ' + match;
}})
const parse0 = (country) => {
const filepath = `temp/0/${country}.json`
try{
let geo0 = JSON.parse(readFileSync(filepath))
let area = turf.area(geo0)
for(let f of geo0.features){
let feat = f.properties
if (feat.GID_0==country){
let gr = ""
for(let g in groups){
if(groups[g].includes(country)){
gr = g
}
}
dict0[feat.GID_0] = `${country}|${gr}|${formatStr(feat.COUNTRY)}|${Math.round(area/1e6)}`
}
}
}catch(e){
console.log(country," PARSE Error")
console.log(e)
}
}
const parse1 = (country) => {
const filepath = `temp/1/${country}.json`
try{
if(!existsSync(filepath)){
// console.log(`No L1 for ${country}`)
return
}
let geo0 = JSON.parse(readFileSync(filepath))
for(let f of geo0.features){
let feat = f.properties
let area = turf.area(f.geometry)
dict1[feat.GID] = `${feat.GID}|${country}|${formatStr(feat.NAME)}|${Math.round(area/1e6)}`
}
}catch(e){
console.log(country," PARSE Error")
console.log(e)
}
}
var mis = []
const mergePrint = (c)=>{
// console.log(dict0[c])
for (const key in dict1) {
if (key.startsWith(c)) {
console.log(dict1[key])
mis.push(key)
}}
}
const wgPrint = ()=>{
console.log("WWW||World|-1")
console.log("XXX|WWW|Other|-1")
console.log("EEE|WWW|Europe|-1")
console.log("ABB|WWW|Asia|-1")
console.log("FFF|WWW|Africa|-1")
console.log("NNN|WWW|North America|-1")
console.log("SRR|WWW|South America|-1")
console.log("UUU|WWW|Oceana|-1")
}
async function run(){
countries.forEach(c=>parse0(c))
countries.forEach(c=>parse1(c))
// wgPrint()
countries.forEach(c=>mergePrint(c))
for (const key in dict1) {
if (!mis.includes(key)){
console.log(dict1[key])
}
}
}
run()

View File

@ -64,7 +64,13 @@ download_1() {
unzip -q -o "$output_dir/$1.json.zip" -d "$output_dir"
fi
if [ -f "$output_dir/gadm41_${1}_1.json" ]; then
sed -E 's/"gadm41_([A-Z]*)_1"/"\1"/g' "$output_dir/gadm41_${1}_1.json" > "$output_dir/$1.json"
jq '.features[] |= . + {properties: (.properties | .GID_1 = (.GID_0 + "_" + (
if .HASC_1 != "NA" then (.HASC_1 | split(".") | .[-1])
elif .ISO_1 != "NA" then (.ISO_1 | split("-") | .[-1])
else (.CC_1)
end
)))}' "$output_dir/gadm41_${1}_1.json" > "$output_dir/$1.json.1"
sed -E 's/"[gadm41_]*([A-Z]*)_1"/"\1"/g' "$output_dir/$1.json.1" > "$output_dir/$1.json"
fi
}
@ -83,7 +89,8 @@ toSVG_0() {
done
"$mapshaper" -i combine-files ${input_files[@]} -simplify 0.005 weighted keep-shapes resolution=1200x1200 -proj webmercator -o ./app/src/main/assets/mercator0.svg svg-data=GID_0,COUNTRY id-field=GID_0
"$mapshaper" -i combine-files ${input_files[@]} -proj webmercator -simplify 0.005 weighted keep-shapes resolution=1200x1200 -o ./app/src/main/assets/mercator0.svg svg-data=GID_0,COUNTRY id-field=GID_0
"$mapshaper" -i combine-files ${input_files[@]} -proj aeqd +lat_0=90 -simplify 0.005 weighted keep-shapes resolution=1200x1200 -o ./app/src/main/assets/aeqd0.svg svg-data=GID_0,COUNTRY id-field=GID_0
}
toSVG_1() {
@ -100,7 +107,28 @@ toSVG_1() {
fi
done
"$mapshaper" -i combine-files ${input_files[@]} -simplify 0.005 weighted keep-shapes resolution=1200x1200 -proj webmercator -o ./app/src/main/assets/mercator1.svg svg-data=GID_0,COUNTRY,GID_1,NAME_1 id-field=GID_1,GID_0
"$mapshaper" -i combine-files ${input_files[@]} -proj webmercator -simplify 0.005 weighted keep-shapes resolution=1200x1200 -o ./app/src/main/assets/mercator1.svg svg-data=GID_0,COUNTRY,GID,NAME id-field=GID
"$mapshaper" -i combine-files ${input_files[@]} -proj aeqd +lat_0=90 -simplify 0.005 weighted keep-shapes resolution=1200x1200 -o ./app/src/main/assets/aeqd1.svg svg-data=GID_0,COUNTRY,GID,NAME id-field=GID
}
toSVG_01() {
input_files=()
for country in "${countries[@]}"
do
input_file0="./temp/0/${country}.json"
input_file1="./temp/1/${country}.json"
if [ -f "$input_file1" ]; then
input_files+=("$input_file1")
fi
if [ -f "$input_file0" ]; then
input_files+=("$input_file0")
fi
done
"$mapshaper" -i combine-files ${input_files[@]} -proj webmercator -simplify 0.005 weighted keep-shapes resolution=1200x1200 -o ./app/src/main/assets/mercator01.svg svg-data=GID_0,COUNTRY,GID,NAME id-field=GID
"$mapshaper" -i combine-files ${input_files[@]} -proj aeqd +lat_0=90 -simplify 0.005 weighted keep-shapes resolution=1200x1200 -o ./app/src/main/assets/aeqd01.svg svg-data=GID_0,COUNTRY,GID,NAME id-field=GID
}
do_1() {
@ -119,3 +147,4 @@ do_0() {
do_1
# toSVG_0
toSVG_1
toSVG_01

View File

@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=false
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the

0
out.txt Normal file
View File

251
out0.txt Normal file
View File

@ -0,0 +1,251 @@
AFG("Afghanistan",645487,listOf(AFG_BD,AFG_BG,AFG_BL,AFG_BK,AFG_BM,AFG_DK,AFG_FH,AFG_FB,AFG_GZ,AFG_GR,AFG_HM,AFG_HR,AFG_JW,AFG_KB,AFG_KD,AFG_KP,AFG_KT,AFG_KR,AFG_KZ,AFG_LA,AFG_LW,AFG_NG,AFG_NM,AFG_NR,AFG_PK,AFG_PT,AFG_PJ,AFG_PV,AFG_SM,AFG_SP,AFG_TK,AFG_OZ,AFG_VR,AFG_ZB)),
XAD("Akrotiriand Dhekelia",234,listOf(XAD_NA,XAD_NA)),
ALA("Åland",1483,listOf(ALA_AR,ALA_CO,ALA_MH)),
ALB("Albania",28755,listOf(ALB_BE,ALB_DB,ALB_DU,ALB_EB,ALB_FI,ALB_GK,ALB_KE,ALB_KK,ALB_LZ,ALB_SD,ALB_TI,ALB_VR)),
DZA("Algeria",2316624,listOf(DZA_AR,DZA_AD,DZA_AT,DZA_AL,DZA_AN,DZA_BT,DZA_BC,DZA_BJ,DZA_BS,DZA_BL,DZA_BB,DZA_BU,DZA_BM,DZA_CH,DZA_CO,DZA_DJ,DZA_EB,DZA_EO,DZA_ET,DZA_GR,DZA_GL,DZA_IL,DZA_JJ,DZA_KH,DZA_LG,DZA_MS,DZA_MC,DZA_MD,DZA_ML,DZA_MG,DZA_NA,DZA_OR,DZA_OG,DZA_OB,DZA_RE,DZA_SD,DZA_SF,DZA_SB,DZA_SK,DZA_SA,DZA_TM,DZA_TB,DZA_TR,DZA_TN,DZA_TP,DZA_TS,DZA_TO,DZA_TL)),
ASM("American Samoa",205,listOf(ASM_ET,ASM_MA,ASM_UU,ASM_WT)),
AND("Andorra",451,listOf(AND_AN,AND_CA,AND_EN,AND_EE,AND_MA,AND_OR,AND_JL)),
AGO("Angola",1254492,listOf(AGO_BO,AGO_BG,AGO_BI,AGO_CB,AGO_CC,AGO_CN,AGO_CS,AGO_CU,AGO_HM,AGO_HL,AGO_LU,AGO_LN,AGO_LS,AGO_ML,AGO_MX,AGO_NA,AGO_UI,AGO_ZA)),
AIA("Anguilla",80,listOf(AIA_BP,AIA_NA,AIA_EE,AIA_GH,AIA_IH,AIA_NH,AIA_NS,AIA_NA,AIA_SG,AIA_SH,AIA_NA,AIA_NA,AIA_SO,AIA_ST,AIA_TF,AIA_TQ,AIA_TV,AIA_WE)),
ATG("Antiguaand Barbuda",438,listOf(ATG_BB,ATG_RD,ATG_GE,ATG_JO,ATG_MA,ATG_PA,ATG_PE,ATG_PH)),
ARG("Argentina",2785500,listOf(ARG_BA,ARG_CT,ARG_CC,ARG_CH,ARG_DF,ARG_CB,ARG_CN,ARG_ER,ARG_FM,ARG_JY,ARG_LP,ARG_LR,ARG_MZ,ARG_MN,ARG_NQ,ARG_RN,ARG_SA,ARG_SJ,ARG_SL,ARG_SC,ARG_SF,ARG_SE,ARG_TF,ARG_TM)),
ARM("Armenia",29724,listOf(ARM_AG,ARM_AR,ARM_AV,ARM_ER,ARM_GR,ARM_KT,ARM_LO,ARM_SH,ARM_SU,ARM_TV,ARM_VD)),
ABW("Aruba",183,emptyList()),
AUS("Australia",7720095,listOf(AUS_AS,AUS_AC,AUS_CR,AUS_JB,AUS_NS,AUS_NT,AUS_QL,AUS_SA,AUS_TS,AUS_VI,AUS_WA)),
AUT("Austria",83897,listOf(AUT_BU,AUT_KA,AUT_NO,AUT_OO,AUT_SZ,AUT_ST,AUT_TR,AUT_VO,AUT_WI)),
AZE("Azerbaijan",86331,listOf(AZE_NA,AZE_NA,AZE_NA,AZE_NA,AZE_NA,AZE_LA,AZE_NA,AZE_NA,AZE_NA,AZE_NA)),
BHS("Bahamas",13437,listOf(BHS_AK,BHS_BR,BHS_BI,BHS_BP,BHS_CI,BHS_CB,BHS_CN,BHS_CE,BHS_FP,BHS_CK,BHS_EB,BHS_EM,BHS_GC,BHS_HB,BHS_HT,BHS_IN,BHS_LI,BHS_MC,BHS_MG,BHS_MI,BHS_NW,BHS_NB,BHS_NN,BHS_NE,BHS_RI,BHS_RC,BHS_SS,BHS_SB,BHS_SN,BHS_SE,BHS_SW,BHS_WB)),
BHR("Bahrain",718,listOf(BHR_CA,BHR_MU,BHR_NO,BHR_SO)),
BGD("Bangladesh",140002,listOf(BGD_BA,BGD_CG,BGD_DH,BGD_KH,BGD_MM,BGD_RS,BGD_RP,BGD_SY)),
BRB("Barbados",437,listOf(BRB_CC,BRB_AN,BRB_GE,BRB_JM,BRB_JN,BRB_JS,BRB_LU,BRB_MI,BRB_PE,BRB_PH,BRB_TH)),
BLR("Belarus",206665,listOf(BLR_BR,BLR_HO,BLR_HR,BLR_MI,BLR_MI,BLR_MA,BLR_VI)),
BEL("Belgium",30668,listOf(BEL_NA,BEL_NA,BEL_NA)),
BLZ("Belize",22164,listOf(BLZ_BZ,BLZ_CY,BLZ_CZ,BLZ_OW,BLZ_SC,BLZ_TO)),
BEN("Benin",116014,listOf(BEN_AL,BEN_AK,BEN_AQ,BEN_BO,BEN_CL,BEN_DO,BEN_CF,BEN_LI,BEN_MO,BEN_OU,BEN_PL,BEN_ZO)),
BMU("Bermuda",68,listOf(BMU_DE,BMU_HA,BMU_HC,BMU_PA,BMU_PE,BMU_SC,BMU_SG,BMU_SA,BMU_SM,BMU_SO,BMU_WA)),
BTN("Bhutan",38913,listOf(BTN_BU,BTN_CK,BTN_DA,BTN_GA,BTN_HA,BTN_LH,BTN_MO,BTN_PR,BTN_PM,BTN_PN,BTN_SJ,BTN_SM,BTN_GE,BTN_TM,BTN_TY,BTN_TA,BTN_TO,BTN_CR,BTN_WP,BTN_SG)),
BOL("Bolivia",1090425,listOf(BOL_EB,BOL_CQ,BOL_CB,BOL_LP,BOL_OR,BOL_PA,BOL_PO,BOL_SC,BOL_TR)),
BES("Bonaire, Sint Eustatiusand Saba",325,listOf(BES_BO,BES_SA,BES_SE)),
BIH("Bosniaand Herzegovina",51081,listOf(BIH_BR,BIH_BF,BIH_SR)),
BWA("Botswana",580648,listOf(BWA_CE,BWA_CH,BWA_FR,BWA_GB,BWA_GH,BWA_JW,BWA_KG,BWA_KL,BWA_KW,BWA_LB,BWA_NE,BWA_NC,BWA_SP,BWA_SR,BWA_SO,BWA_ST)),
BVT("Bouvet Island",77,emptyList()),
BRA("Brazil",8560656,listOf(BRA_AC,BRA_AL,BRA_AP,BRA_AM,BRA_BA,BRA_CE,BRA_DF,BRA_ES,BRA_GO,BRA_MA,BRA_MT,BRA_MS,BRA_MG,BRA_PA,BRA_PB,BRA_PR,BRA_PE,BRA_PI,BRA_RJ,BRA_RN,BRA_RS,BRA_RO,BRA_RR,BRA_SC,BRA_SP,BRA_SE,BRA_TO)),
IOT("British Indian Ocean Territory",65,emptyList()),
VGB("British Virgin Islands",169,listOf(VGB_NA,VGB_NA,VGB_NA,VGB_NA,VGB_NA)),
BRN("Brunei",5815,listOf(BRN_BE,BRN_BM,BRN_TE,BRN_TU)),
BGR("Bulgaria",111647,listOf(BGR_BL,BGR_BR,BGR_DO,BGR_GB,BGR_SG,BGR_KK,BGR_KZ,BGR_KY,BGR_LV,BGR_MT,BGR_PZ,BGR_PN,BGR_PV,BGR_PD,BGR_RG,BGR_RS,BGR_SH,BGR_SI,BGR_SL,BGR_SM,BGR_SF,BGR_SZ,BGR_TU,BGR_VN,BGR_VT,BGR_VD,BGR_VR,BGR_YA)),
BFA("Burkina Faso",274620,listOf(BFA_BO,BFA_CD,BFA_CT,BFA_CE,BFA_CN,BFA_CO,BFA_CS,BFA_ES,BFA_HB,BFA_NO,BFA_PC,BFA_SA,BFA_SO)),
BDI("Burundi",27113,listOf(BDI_BB,BDI_BM,BDI_BU,BDI_BR,BDI_CA,BDI_CI,BDI_GI,BDI_KR,BDI_KY,BDI_KI,BDI_MA,BDI_MV,BDI_MY,BDI_MW,BDI_NG,BDI_RT,BDI_RY)),
KHM("Cambodia",182800,listOf(KHM_OM,KHM_BA,KHM_KM,KHM_KG,KHM_KS,KHM_KT,KHM_KP,KHM_KN,KHM_KK,KHM_,KHM_KH,KHM_PL,KHM_KA,KHM_MK,KHM_OC,KHM_PP,KHM_PO,KHM_PH,KHM_PY,KHM_RO,KHM_SI,KHM_ST,KHM_SR,KHM_TA,KHM_TB)),
CMR("Cameroon",469101,listOf(CMR_AD,CMR_CE,CMR_ES,CMR_EN,CMR_LT,CMR_NO,CMR_NW,CMR_OU,CMR_SU,CMR_SW)),
CAN("Canada",9925768,listOf(CAN_AB,CAN_BC,CAN_MB,CAN_NB,CAN_NF,CAN_NT,CAN_NS,CAN_NU,CAN_ON,CAN_PE,CAN_QC,CAN_SK,CAN_YT)),
CPV("Cabo Verde",4115,listOf(CPV_BV,CPV_BR,CPV_MA,CPV_MO,CPV_PA,CPV_PN,CPV_PC,CPV_RB,CPV_RG,CPV_RS,CPV_SL,CPV_CT,CPV_CT,CPV_CZ,CPV_SD,CPV_FP,CPV_LO,CPV_SM,CPV_SS,CPV_SV,CPV_TF,CPV_TS)),
XCA("Caspian Sea",371885,emptyList()),
CYM("Cayman Islands",282,listOf(CYM_BT,CYM_EE,CYM_GT,CYM_NS,CYM_SI,CYM_WB)),
CAF("Central African Republic",624264,listOf(CAF_BB,CAF_BG,CAF_BK,CAF_HM,CAF_HK,CAF_KG,CAF_LB,CAF_HS,CAF_MB,CAF_KB,CAF_NM,CAF_MP,CAF_UK,CAF_AC,CAF_OP,CAF_SE,CAF_VK)),
TCD("Chad",1277250,listOf(TCD_BG,TCD_BA,TCD_BR,TCD_CB,TCD_EE,TCD_EO,TCD_GR,TCD_HD,TCD_KM,TCD_LC,TCD_LO,TCD_LR,TCD_MA,TCD_ME,TCD_MW,TCD_MC,TCD_OA,TCD_SA,TCD_SI,TCD_TA,TCD_TI,TCD_NJ,TCD_BI)),
CHL("Chile",753785,listOf(CHL_AN,CHL_AR,CHL_AP,CHL_AT,CHL_AI,CHL_BI,CHL_CO,CHL_LI,CHL_LL,CHL_LR,CHL_MA,CHL_ML,CHL_NB,CHL_RM,CHL_TA,CHL_VS)),
CHN("China",9405272,listOf(CHN_AH,CHN_BJ,CHN_CQ,CHN_FJ,CHN_GS,CHN_GD,CHN_GX,CHN_GZ,CHN_HA,CHN_HB,CHN_HL,CHN_HE,CHN_,CHN_HU,CHN_HN,CHN_JS,CHN_JX,CHN_JL,CHN_LN,CHN_,CHN_NM,CHN_NX,CHN_QH,CHN_SA,CHN_SD,CHN_SH,CHN_SX,CHN_SC,CHN_TJ,CHN_XJ,Z02_XJ,Z03_XJ,CHN_XZ,Z03_XZ,Z08_XZ,CHN_YN,CHN_ZJ)),
CXR("Christmas Island",140,emptyList()),
XCL("Clipperton Island",10,emptyList()),
CCK("Cocos Islands",14,emptyList()),
COL("Colombia",1144791,listOf(COL_AM,COL_AN,COL_AR,COL_AT,COL_DC,COL_BL,COL_BY,COL_CL,COL_CQ,COL_CS,COL_CA,COL_CE,COL_CH,COL_CO,COL_CU,COL_GN,COL_GV,COL_HU,COL_LG,COL_MA,COL_ME,COL_NA,COL_NS,COL_PU,COL_QD,COL_RI,COL_SA,COL_ST,COL_SU,COL_TO,COL_VC,COL_VP,COL_VD)),
COM("Comoros",1684,listOf(COM_MO,COM_GC,COM_AN)),
COK("Cook Islands",281,listOf(COK_NA,COK_NA,COK_NA,COK_NA,COK_NA,COK_NA,COK_NA,COK_NA,COK_NA,COK_NA,COK_NA)),
CRI("Costa Rica",51511,listOf(CRI_AL,CRI_CA,CRI_GU,CRI_HE,CRI_LI,CRI_PU,CRI_SJ)),
CIV("Côted'Ivoire",323636,listOf(CIV_AB,CIV_BA,CIV_CM,CIV_DE,CIV_GD,CIV_LA,CIV_LN,CIV_MN,CIV_SM,CIV_SV,CIV_VB,CIV_WB,CIV_YM,CIV_ZA)),
HRV("Croatia",57065,listOf(HRV_BB,HRV_SP,HRV_DN,HRV_GZ,HRV_IS,HRV_KA,HRV_KK,HRV_KZ,HRV_LS,HRV_ME,HRV_OB,HRV_PS,HRV_PG,HRV_SB,HRV_SM,HRV_SD,HRV_VA,HRV_VP,HRV_VS,HRV_ZD,HRV_ZG)),
CUB("Cuba",111255,listOf(CUB_CM,CUB_CA,CUB_CF,CUB_CH,CUB_GR,CUB_GU,CUB_HO,CUB_IJ,CUB_LH,CUB_LT,CUB_MA,CUB_MQ,CUB_PR,CUB_SS,CUB_SC,CUB_VC)),
CUW("Curaçao",440,emptyList()),
CYP("Cyprus",5733,listOf(CYP_FA,CYP_LA,CYP_LI,CYP_NI,CYP_PA)),
CZE("Czechia",78754,listOf(CZE_CK,CZE_BK,CZE_KK,CZE_JK,CZE_HK,CZE_LK,CZE_VK,CZE_OK,CZE_EK,CZE_PK,CZE_SK,CZE_SK,CZE_UK,CZE_ZK)),
COD("Democratic Republicofthe Congo",2344314,listOf(COD_BU,COD_ET,COD_HK,COD_HL,COD_HU,COD_IT,COD_KS,COD_LL,COD_KO,COD_KN,COD_BC,COD_KG,COD_KU,COD_LM,COD_LB,COD_MA,COD_MN,COD_MO,COD_NK,COD_NU,COD_SN,COD_SK,COD_SU,COD_TG,COD_TO,COD_TP)),
DNK("Denmark",43034,listOf(DNK_HS,DNK_MJ,DNK_ND,DNK_SL,DNK_SD)),
DJI("Djibouti",22509,listOf(DJI_AS,DJI_AR,DJI_DK,DJI_DB,DJI_OB,DJI_TA)),
DMA("Dominica",759,listOf(DMA_AN,DMA_DA,DMA_GO,DMA_JN,DMA_JH,DMA_LU,DMA_MA,DMA_PK,DMA_PL,DMA_PR)),
DOM("Dominican Republic",48348,listOf(DOM_AZ,DOM_BR,DOM_BH,DOM_DA,DOM_NC,DOM_DU,DOM_SE,DOM_ES,DOM_HM,DOM_IN,DOM_AL,DOM_EP,DOM_RO,DOM_VE,DOM_MT,DOM_MN,DOM_MC,DOM_MP,DOM_PN,DOM_PV,DOM_PP,DOM_SC,DOM_SM,DOM_CR,DOM_JO,DOM_JU,DOM_PM,DOM_SZ,DOM_ST,DOM_SR,DOM_SD,DOM_VA)),
ECU("Ecuador",258071,listOf(ECU_AZ,ECU_BO,ECU_CN,ECU_CR,ECU_CB,ECU_CT,ECU_EO,ECU_ES,ECU_GA,ECU_GU,ECU_IM,ECU_LJ,ECU_LR,ECU_MN,ECU_MS,ECU_NA,ECU_OR,ECU_PA,ECU_PI,ECU_SE,ECU_SD,ECU_SU,ECU_TU,ECU_ZC)),
EGY("Egypt",987766,listOf(EGY_DQ,EGY_BA,EGY_BH,EGY_FY,EGY_GH,EGY_IK,EGY_IS,EGY_JZ,EGY_MF,EGY_MN,EGY_QH,EGY_QL,EGY_UQ,EGY_WJ,EGY_SW,EGY_SQ,EGY_AN,EGY_AT,EGY_BN,EGY_BS,EGY_DT,EGY_JS,EGY_KS,EGY_MT,EGY_QN,EGY_SS,EGY_SJ)),
SLV("El Salvador",20545,listOf(SLV_AH,SLV_CA,SLV_CH,SLV_CU,SLV_LI,SLV_PA,SLV_UN,SLV_MO,SLV_SM,SLV_SS,SLV_SV,SLV_SA,SLV_SO,SLV_US)),
GNQ("Equatorial Guinea",27138,listOf(GNQ_AN,GNQ_BN,GNQ_BS,GNQ_CS,GNQ_KN,GNQ_LI,GNQ_WN)),
ERI("Eritrea",121150,listOf(ERI_AN,ERI_DU,ERI_DK,ERI_GB,ERI_MA,ERI_SK)),
EST("Estonia",45354,listOf(EST_HA,EST_HI,EST_IV,EST_JR,EST_JN,EST_LN,EST_LV,EST_PR,EST_NA,EST_PL,EST_RA,EST_SA,EST_TA,EST_VG,EST_VD,EST_VR)),
ETH("Ethiopia",1136255,listOf(ETH_AA,ETH_AF,ETH_AM,ETH_BE,ETH_DD,ETH_GA,ETH_HA,ETH_OR,ETH_SO,ETH_SN,ETH_TI)),
FLK("Falkland Islands",12370,emptyList()),
FRO("Faroe Islands",1434,listOf(FRO_OS,FRO_NO,FRO_SA,FRO_ST,FRO_SN|FO,FRO_VG)),
FJI("Fiji",19057,listOf(FJI_CE,FJI_EA,FJI_NO,FJI_RO,FJI_W)),
FIN("Finland",335489,listOf(FIN_IS,FIN_LP,FIN_OU,FIN_ES,FIN_LS)),
FRA("France",549335,listOf(FRA_AR,FRA_BF,FRA_BT,FRA_CN,FRA_CE,FRA_AO,FRA_NC,FRA_IF,FRA_ND,FRA_AC,FRA_LP,FRA_PL,FRA_PR)),
GUF("French Guiana",83856,listOf(GUF_CY,GUF_SL)),
PYF("French Polynesia",4053,listOf(PYF_TI,PYF_WI,PYF_MI,PYF_LI,PYF_TG)),
ATF("French Southern Territories",7852,listOf(ATF_CR,ATF_NA,ATF_AS,ATF_KG)),
GAB("Gabon",266332,listOf(GAB_ES,GAB_HO,GAB_MO,GAB_NG,GAB_NY,GAB_OI,GAB_OL,GAB_OM,GAB_WN)),
GMB("Gambia",10731,listOf(GMB_BJ,GMB_LR,GMB_MC,GMB_NB,GMB_UR,GMB_WE)),
GEO("Georgia",69893,listOf(GEO_AB,GEO_AJ,GEO_GU,GEO_IM,GEO_KA,GEO_KK,GEO_MM,GEO_RK,GEO_SZ,GEO_SJ,GEO_SD,GEO_TB)),
DEU("Germany",357324,listOf(DEU_BW,DEU_BY,DEU_BE,DEU_BR,DEU_HB,DEU_HH,DEU_HE,DEU_MV,DEU_NI,DEU_NW,DEU_RP,DEU_SL,DEU_SN,DEU_ST,DEU_SH,DEU_TH)),
GHA("Ghana",241025,listOf(GHA_AF,GHA_AH,GHA_BO,GHA_BE,GHA_CP,GHA_EP,GHA_AA,GHA_NE,GHA_NP,GHA_OT,GHA_SV,GHA_UE,GHA_UW,GHA_TV,GHA_WP,GHA_WN)),
GIB("Gibraltar",7,emptyList()),
GRC("Greece",132751,listOf(GRC_AI,GRC_MA,GRC_AT,GRC_CR,GRC_EM,GRC_MH,GRC_PW,GRC_TC)),
GRL("Greenland",2139125,listOf(GRL_KU,GRL_UO,GRL_QS,GRL_QT,GRL_SE)),
GRD("Grenada",362,listOf(GRD_CA,GRD_AN,GRD_DA,GRD_GE,GRD_JO,GRD_MA,GRD_PA)),
GLP("Guadeloupe",1658,listOf(GLP_BT,GLP_PP)),
GUM("Guam",554,listOf(GUM_AH,GUM_AT,GUM_AS,GUM_BA,GUM_CP,GUM_DD,GUM_AN,GUM_IN,GUM_MA,GUM_ME,GUM_MT,GUM_PI,GUM_SR,GUM_SJ,GUM_TF,GUM_TM,GUM_UM,GUM_YG,GUM_YN)),
GTM("Guatemala",109777,listOf(GTM_AV,GTM_BV,GTM_CM,GTM_CQ,GTM_PR,GTM_ES,GTM_GU,GTM_HU,GTM_IZ,GTM_JA,GTM_JU,GTM_PE,GTM_QZ,GTM_QC,GTM_RE,GTM_SA,GTM_SM,GTM_SR,GTM_SO,GTM_SU,GTM_TO,GTM_ZA)),
GGY("Guernsey",88,listOf(GGY_AL,GGY_CA,GGY_FO,GGY_AN,GGY_MA,GGY_PP,GGY_SB,GGY_SM,GGY_SV,GGY_SK,GGY_TV,GGY_VA)),
GIN("Guinea",246356,listOf(GIN_NA,GIN_C,GIN_NA,GIN_K,GIN_NA,GIN_NA,GIN_NA,GIN_NA)),
GNB("Guinea-Bissau",34088,listOf(GNB_BA,GNB_BM,GNB_BS,GNB_BL,GNB_CA,GNB_GA,GNB_OI,GNB_QU,GNB_TO)),
GUY("Guyana",211133,listOf(GUY_BA,GUY_CU,GUY_DE,GUY_EB,GUY_ES,GUY_MA,GUY_PM,GUY_PT,GUY_UD,GUY_UT)),
HTI("Haiti",27258,listOf(HTI_CE,HTI_GR,HTI_AR,HTI_NI,HTI_ND,HTI_NE,HTI_NO,HTI_OU,HTI_SD,HTI_SE)),
HMD("Heard Islandand Mc Donald Island",362,emptyList()),
HND("Honduras",112950,listOf(HND_AT,HND_CH,HND_CL,HND_CM,HND_CP,HND_CR,HND_EP,HND_FM,HND_GD,HND_IN,HND_IB,HND_LP,HND_LE,HND_OC,HND_OL,HND_CP,HND_VA,HND_YO)),
HUN("Hungary",92993,listOf(HUN_BK,HUN_BA,HUN_BE,HUN_BZ,HUN_BU,HUN_CS,HUN_FE,HUN_GS,HUN_HB,HUN_HE,HUN_JN,HUN_KE,HUN_NO,HUN_PE,HUN_SO,HUN_SZ,HUN_TO,HUN_VA,HUN_VE,HUN_ZA)),
ISL("Iceland",101781,listOf(ISL_AL,ISL_HO,ISL_NE,ISL_NV,ISL_SL,ISL_SU,ISL_VF,ISL_VL)),
IND("India",3166019,listOf(IND_AN,IND_AP,IND_AR,Z07_AR,IND_AS,IND_BR,IND_CH,IND_CT,IND_DN,IND_DD,IND_GA,IND_GJ,IND_HR,IND_HP,Z04_HP,Z09_HP,Z01_JK,IND_JH,IND_KA,IND_KL,IND_LD,IND_MP,IND_MH,IND_MN,IND_ML,IND_MZ,IND_NL,IND_DL,IND_OR,IND_PY,IND_PB,IND_RJ,IND_SK,IND_TN,IND_TG,IND_TR,IND_UP,IND_UT,Z05_UT,Z09_UT,IND_WB)),
IDN("Indonesia",1902704,listOf(IDN_AC,IDN_BA,IDN_BB,IDN_BT,IDN_BE,IDN_GO,IDN_JK,IDN_JA,IDN_JR,IDN_JT,IDN_JI,IDN_KB,IDN_KS,IDN_KT,IDN_KM,IDN_KU,IDN_KR,IDN_LA,IDN_MA,IDN_MU,IDN_NB,IDN_NT,IDN_PA,IDN_IB,IDN_RI,IDN_SR,IDN_SE,IDN_ST,IDN_SG,IDN_SW,IDN_SB,IDN_SL,IDN_SU,IDN_YO)),
IRN("Iran",1626366,listOf(IRN_AL,IRN_AR,IRN_BS,IRN_CM,IRN_EA,IRN_ES,IRN_FA,IRN_GI,IRN_GO,IRN_HD,IRN_HG,IRN_IL,IRN_KE,IRN_BK,IRN_KZ,IRN_KB,IRN_KD,IRN_LO,IRN_MK,IRN_MN,IRN_KS,IRN_QZ,IRN_QM,IRN_KV,IRN_SM,IRN_SB,IRN_KJ,IRN_TH,IRN_WA,IRN_YA,IRN_ZA)),
IRQ("Iraq",437670,listOf(IRQ_AN,IRQ_BA,IRQ_MU,IRQ_QA,IRQ_NA,IRQ_AR,IRQ_SU,IRQ_TS,IRQ_BB,IRQ_BG,IRQ_DQ,IRQ_DA,IRQ_DI,IRQ_KA,IRQ_MA,IRQ_NI,IRQ_SD,IRQ_WA)),
IRL("Ireland",70131,listOf(IRL_CW,IRL_CN,IRL_CE,IRL_DL,IRL_DN,IRL_GY,IRL_KY,IRL_KE,IRL_KK,IRL_LS,IRL_LM,IRL_LK,IRL_LD,IRL_LH,IRL_MO,IRL_MH,IRL_MN,IRL_OY,IRL_RN,IRL_SO,IRL_TY,IRL_WD,IRL_WH,IRL_WX,IRL_WW,IRL_CK)),
IMN("Isleof Man",578,listOf(IMN_AY,IMN_RU,IMN_MC,IMN_MD,IMN_AY,IMN_RU,IMN_MD,IMN_GR,IMN_GB,IMN_MC,IMN_AY,IMN_RU,IMN_MD,IMN_MC,IMN_MD,IMN_GB,IMN_GB,IMN_RU,IMN_RU,IMN_AY,IMN_MD)),
ISR("Israel",22226,listOf(ISR_NA,ISR_HD,ISR_HA,ISR_HM,ISR_HZ,ISR_JM,ISR_TA)),
ITA("Italy",300894,listOf(ITA_65,ITA_16,ITA_77,ITA_78,ITA_72,ITA_45,ITA_36,ITA_62,ITA_42,ITA_25,ITA_57,ITA_67,ITA_21,ITA_88,ITA_19,ITA_52,ITA_32,ITA_55,ITA_23,ITA_34)),
JAM("Jamaica",11061,listOf(JAM_CL,JAM_HA,JAM_KI,JAM_MA,JAM_PO,JAM_SD,JAM_SN,JAM_SC,JAM_SE,JAM_SJ,JAM_SM,JAM_ST,JAM_TR,JAM_WE)),
JPN("Japan",373106,listOf(JPN_AI,JPN_AK,JPN_AO,JPN_CH,JPN_EH,JPN_FI,JPN_FO,JPN_FS,JPN_GF,JPN_GM,JPN_HS,JPN_HK,JPN_HG,JPN_IB,JPN_IS,JPN_IW,JPN_KG,JPN_KS,JPN_KN,JPN_KC,JPN_KM,JPN_KY,JPN_ME,JPN_MG,JPN_MZ,JPN_NN,JPN_NS,JPN_NR,JPN_NI,JPN_OT,JPN_OY,JPN_ON,JPN_OS,JPN_SG,JPN_ST,JPN_SH,JPN_SM,JPN_SZ,JPN_TC,JPN_TS,JPN_TK,JPN_TT,JPN_TY,JPN_WK,JPN_YT,JPN_YC,JPN_YN)),
JEY("Jersey",125,listOf(JEY_GR,JEY_BR,JEY_CL,JEY_HE,JEY_JO,JEY_LA,JEY_MT,JEY_MY,JEY_OU,JEY_PE,JEY_SA,JEY_TR)),
JOR("Jordan",89464,listOf(JOR_AJ,JOR_AM,JOR_AQ,JOR_BA,JOR_IR,JOR_JA,JOR_KA,JOR_MN,JOR_MD,JOR_MA,JOR_AT,JOR_AZ)),
KAZ("Kazakhstan",2728680,listOf(KAZ_AA,KAZ_AM,KAZ_AT,KAZ_AR,KAZ_EK,KAZ_MG,KAZ_NK,KAZ_PA,KAZ_QG,KAZ_QS,KAZ_QO,KAZ_SK,KAZ_WK,KAZ_ZM)),
KEN("Kenya",589936,listOf(KEN_BA,KEN_BO,KEN_BN,KEN_BS,KEN_EM,KEN_EB,KEN_GA,KEN_HB,KEN_IS,KEN_KJ,KEN_KK,KEN_KR,KEN_KB,KEN_KF,KEN_KY,KEN_KI,KEN_KU,KEN_KT,KEN_KW,KEN_LK,KEN_LM,KEN_MC,KEN_MK,KEN_MD,KEN_MB,KEN_ME,KEN_MG,KEN_MM,KEN_MU,KEN_NB,KEN_NK,KEN_ND,KEN_NR,KEN_NM,KEN_NN,KEN_NI,KEN_SA,KEN_SI,KEN_TT,KEN_TR,KEN_NT,KEN_TN,KEN_TU,KEN_UG,KEN_VI,KEN_WJ,KEN_WP)),
KIR("Kiribati",1017,emptyList()),
XKO("Kosovo",10843,listOf(XKO_NA,XKO_NA,XKO_KM,XKO_PE,XKO_NA,XKO_PZ,XKO_NA)),
KWT("Kuwait",17486,listOf(KWT_AH,KWT_FA,KWT_JA,KWT_KU,KWT_HW,KWT_MU)),
KGZ("Kyrgyzstan",197618,listOf(KGZ_BA,KGZ_GB,KGZ_CU,KGZ_DA,KGZ_NA,KGZ_OS,KGZ_OS,KGZ_TL,KGZ_YK)),
LAO("Laos",231104,listOf(LAO_AT,LAO_BK,LAO_BL,LAO_CH,LAO_HO,LAO_KH,LAO_LM,LAO_LP,LAO_OU,LAO_PH,LAO_SL,LAO_SV,LAO_VI,LAO_VT,LAO_XA,LAO_XS,LAO_XE,LAO_XI)),
LVA("Latvia",64537,listOf(LVA_,LVA_,LVA_,LVA_,LVA_)),
LBN("Lebanon",10265,listOf(LBN_NA,LBN_NA,LBN_NA,LBN_NA,LBN_NA,LBN_NA,LBN_NA,LBN_NA)),
LSO("Lesotho",30653,listOf(LSO_BE,LSO_BB,LSO_LE,LSO_MF,LSO_MS,LSO_MH,LSO_MK,LSO_QN,LSO_QT,LSO_TT)),
LBR("Liberia",96550,listOf(LBR_BM,LBR_BG,LBR_GP,LBR_GB,LBR_CM,LBR_GD,LBR_GK,LBR_LF,LBR_MG,LBR_MY,LBR_MO,LBR_NI,LBR_RG,LBR_RI,LBR_SI)),
LBY("Libya",1622430,listOf(LBY_BN,LBY_JK,LBY_JG,LBY_JR,LBY_JF,LBY_KU,LBY_MA,LBY_MR,LBY_AW,LBY_NK,LBY_ZW,LBY_BG,LBY_DA,LBY_GH,LBY_MS,LBY_MU,LBY_NT,LBY_SA,LBY_ST,LBY_TR,LBY_WH,LBY_WS)),
LIE("Liechtenstein",159,listOf(LIE_BA,LIE_ES,LIE_GA,LIE_MA,LIE_PL,LIE_RU,LIE_SN,LIE_SB,LIE_TN,LIE_TB,LIE_VA)),
LTU("Lithuania",64862,listOf(LTU_AS,LTU_KS,LTU_KP,LTU_MA,LTU_PA,LTU_SH,LTU_TG,LTU_TL,LTU_UN,LTU_VI)),
LUX("Luxembourg",2579,listOf(LUX_DI,LUX_GR,LUX_LU)),
SXM("Sint Maarten",38,emptyList()),
MKD("North Macedonia",24930,listOf(MKD_AD,MKD_AR,MKD_BR,MKD_TL,MKD_BG,MKD_VJ,MKD_BS,MKD_BN,MKD_BU,MKD_CI,MKD_CA,MKD_CE,MKD_CZ,MKD_CH,MKD_CS,MKD_DB,MKD_DA,MKD_DL,MKD_DM,MKD_DK,MKD_DE,MKD_GB,MKD_GV,MKD_GP,MKD_GT,MKD_GR,MKD_IL,MKD_JG,MKD_KB,MKD_KX,MKD_AV,MKD_KH,MKD_VD,MKD_OC,MKD_KN,MKD_KY,MKD_KZ,MKD_KG,MKD_KS,MKD_UM,MKD_NA,MKD_LI,MKD_LO,MKD_MK,MKD_MD,MKD_MR,MKD_MG,MKD_NG,MKD_NV,MKD_NS,MKD_OD,MKD_PH,MKD_PE,MKD_PN,MKD_PP,MKD_PT,MKD_RV,MKD_RN,MKD_RE,MKD_RM,MKD_AJ,MKD_SS,MKD_SD,MKD_NA,MKD_ST,MKD_UG,MKD_RU,MKD_SU,MKD_SO,MKD_SL,MKD_TR,MKD_ET,MKD_VA,MKD_VL,MKD_VE,MKD_VV,MKD_NI,MKD_VH,MKD_ZK,MKD_ZE,MKD_ZR)),
MDG("Madagascar",594538,listOf(MDG_T,MDG_D,MDG_F,MDG_M,MDG_A,MDG_NA)),
MWI("Malawi",118637,listOf(MWI_BA,MWI_BL,MWI_CK,MWI_CR,MWI_CT,MWI_DE,MWI_DO,MWI_KR,MWI_KS,MWI_LK,MWI_LI,MWI_MA,MWI_MG,MWI_MC,MWI_MJ,MWI_MN,MWI_MZ,MWI_NN,MWI_NA,MWI_NK,MWI_NS,MWI_NU,MWI_NI,MWI_PH,MWI_RU,MWI_SA,MWI_TH,MWI_ZO)),
MYS("Malaysia",331770,listOf(MYS_JH,MYS_KH,MYS_KN,MYS_KL,MYS_LA,MYS_ME,MYS_NS,MYS_PH,MYS_PK,MYS_PL,MYS_PG,MYS_PJ,MYS_SA,MYS_SK,MYS_SL,MYS_TE)),
MDV("Maldives",281,emptyList()),
MLI("Mali",1258093,listOf(MLI_BA,MLI_GA,MLI_KY,MLI_KD,MLI_KK,MLI_MO,MLI_SG,MLI_SK,MLI_TB)),
MLT("Malta",324,listOf(MLT_CE,MLT_GO,MLT_SO,MLT_NO,MLT_SE)),
MHL("Marshall Islands",285,listOf(MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_KWA,MHL_NA,MHL_NA,MHL_NA,MHL_MAJ,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA,MHL_NA)),
MTQ("Martinique",1124,listOf(MTQ_FF,MTQ_MA,MTQ_TR,MTQ_SP)),
MRT("Mauritania",1046483,listOf(MRT_AD,MRT_AS,MRT_BR,MRT_DN,MRT_GO,MRT_GD,MRT_HC,MRT_HG,MRT_IN,MRT_NO,MRT_TG,MRT_TZ,MRT_TR)),
MUS("Mauritius",2036,listOf(MUS_AG,MUS_BL,MUS_FL,MUS_GP,MUS_MO,MUS_PA,MUS_PW,MUS_PL,MUS_RR,MUS_RO,MUS_CC,MUS_SA)),
MYT("Mayotte",394,listOf(MYT_01,MYT_,MYT_,MYT_04,MYT_05,MYT_06,MYT_07,MYT_08,MYT_,MYT_10,MYT_13,MYT_,MYT_12,MYT_,MYT_,MYT_,MYT_17)),
MEX("México",1960059,listOf(MEX_AG,MEX_BN,MEX_BS,MEX_CM,MEX_CP,MEX_CH,MEX_CA,MEX_CL,MEX_DF,MEX_DU,MEX_GJ,MEX_GR,MEX_HI,MEX_JA,MEX_MX,MEX_MC,MEX_MR,MEX_NA,MEX_NL,MEX_OA,MEX_PU,MEX_QE,MEX_QR,MEX_SL,MEX_SI,MEX_SO,MEX_TB,MEX_TM,MEX_TL,MEX_VE,MEX_YU,MEX_ZA)),
FSM("Micronesia",770,listOf(FSM_CH,FSM_KO,FSM_PO,FSM_YA)),
MDA("Moldova",33889,listOf(MDA_AN,MDA_BT,MDA_BA,MDA_BD,MDA_BR,MDA_CH,MDA_CA,MDA_CN,MDA_CU,MDA_CV,MDA_CS,MDA_CR,MDA_DO,MDA_DR,MDA_DB,MDA_ED,MDA_FA,MDA_FL,MDA_GA,MDA_GL,MDA_HI,MDA_IA,MDA_LE,MDA_NI,MDA_OC,MDA_OH,MDA_RZ,MDA_RS,MDA_SI,MDA_SD,MDA_SO,MDA_SV,MDA_ST,MDA_TA,MDA_TE,MDA_DU,MDA_UG)),
MCO("Monaco",2,emptyList()),
MNG("Mongolia",1565638,listOf(MNG_AR,MNG_BO,MNG_BH,MNG_BU,MNG_DA,MNG_DD,MNG_DG,MNG_DU,MNG_DZ,MNG_GA,MNG_GS,MNG_HN,MNG_HD,MNG_HG,MNG_OG,MNG_ER,MNG_OH,MNG_SL,MNG_SB,MNG_TO,MNG_UB,MNG_UV)),
MNE("Montenegro",13342,listOf(MNE_AN,MNE_BA,MNE_BE,MNE_BP,MNE_BU,MNE_CE,MNE_DA,MNE_HN,MNE_KL,MNE_KT,MNE_MK,MNE_NK,MNE_PV,MNE_PL,MNE_PU,MNE_PG,MNE_RO,MNE_SA,MNE_TI,MNE_UL,MNE_ZA)),
MSR("Montserrat",101,listOf(MSR_SA,MSR_SG,MSR_SP)),
MAR("Morocco",414714,listOf(MAR_CO,MAR_DA,MAR_FB,MAR_GB,MAR_GC,MAR_GE,MAR_LB,MAR_MK,MAR_MT,MAR_OR,MAR_RZ,MAR_SM,MAR_TD,MAR_TO,MAR_TH)),
MOZ("Mozambique",791805,listOf(MOZ_CD,MOZ_GA,MOZ_IN,MOZ_MN,MOZ_MP,MOZ_MC,MOZ_NM,MOZ_NS,MOZ_SO,MOZ_TE,MOZ_ZA)),
MMR("Myanmar",672590,listOf(MMR_AY,MMR_BA,MMR_CH,MMR_KC,MMR_KH,MMR_KN,MMR_MG,MMR_MD,MMR_MO,MMR_NY,MMR_RA,MMR_SA,MMR_SH,MMR_TN,MMR_YA)),
NAM("Namibia",828017,listOf(NAM_KA,NAM_ER,NAM_HA,NAM_OK,NAM_KH,NAM_KU,NAM_OW,NAM_OH,NAM_OS,NAM_ON,NAM_OT,NAM_OD,NAM_CA)),
NRU("Nauru",22,listOf(NRU_AI,NRU_AB,NRU_AT,NRU_AR,NRU_BA,NRU_BO,NRU_BU,NRU_DE,NRU_EW,NRU_IJ,NRU_ME,NRU_NI,NRU_UA,NRU_YA)),
NPL("Nepal",148210,listOf(NPL_MM,NPL_PW,NPL_SP,NPL_MP,NPL_PM)),
NLD("Netherlands",37624,listOf(NLD_DR,NLD_FL,NLD_FR,NLD_GE,NLD_GR,NLD_NA,NLD_LI,NLD_NB,NLD_NH,NLD_OV,NLD_UT,NLD_ZE,NLD_NA,NLD_NA)),
NCL("New Caledonia",18916,listOf(NCL_IL,NCL_NO,NCL_SU)),
NZL("New Zealand",268937,listOf(NZL_AU,NZL_BP,NZL_CA,NZL_CI,NZL_GI,NZL_HB,NZL_MW,NZL_MA,NZL_NE,NZL_01,NZL_NO,NZL_OT,NZL_02,NZL_SO,NZL_TK,NZL_TS,NZL_WK,NZL_WG,NZL_WC)),
NIC("Nicaragua",128957,listOf(NIC_AN,NIC_AS,NIC_BO,NIC_CA,NIC_CI,NIC_CO,NIC_ES,NIC_GR,NIC_JI,NIC_,NIC_LE,NIC_MD,NIC_MN,NIC_MS,NIC_MT,NIC_NS,NIC_SJ,NIC_RI)),
NER("Niger",1190189,listOf(NER_AG,NER_DF,NER_DS,NER_MA,NER_NI,NER_TH,NER_TL,NER_ZI)),
NGA("Nigeria",914161,listOf(NGA_AB,NGA_AD,NGA_AK,NGA_AN,NGA_BA,NGA_BY,NGA_BE,NGA_BO,NGA_CR,NGA_DE,NGA_EB,NGA_ED,NGA_EK,NGA_EN,NGA_FC,NGA_GO,NGA_IM,NGA_JI,NGA_KD,NGA_KN,NGA_KT,NGA_KE,NGA_KO,NGA_KW,NGA_LA,NGA_NA,NGA_NI,NGA_OG,NGA_ON,NGA_OS,NGA_OY,NGA_PL,NGA_RI,NGA_SO,NGA_TA,NGA_YO,NGA_ZA)),
NIU("Niue",268,emptyList()),
NFK("Norfolk Island",41,emptyList()),
PRK("North Korea",122844,listOf(PRK_CH,PRK_HG,PRK_HN,PRK_WB,PRK_WN,PRK_KS,PRK_KW,PRK_NA,PRK_PB,PRK_PN,PRK_PY,PRK_NJ,PRK_YG,PRK_NA)),
ZNC("Northern Cyprus",3321,listOf(ZNC_NA,ZNC_NA,ZNC_NA,ZNC_NA,ZNC_NA)),
MNP("Northern Mariana Islands",506,listOf(MNP_NI,MNP_RO,MNP_SA,MNP_TI)),
NOR("Norway",323747,listOf(NOR_AK,NOR_OF,NOR_AA,NOR_BU,NOR_FI,NOR_HE,NOR_HO,NOR_MR,NOR_NT,NOR_NO,NOR_OP,NOR_OS,NOR_RO,NOR_SF,NOR_ST,NOR_TE,NOR_TR,NOR_VA,NOR_VF)),
OMN("Oman",310686,listOf(OMN_DA,OMN_BN,OMN_BS,OMN_DH,OMN_ZA,OMN_WU,OMN_SN,OMN_SS,OMN_JA,OMN_MU,OMN_MA)),
PAK("Pakistan",877139,listOf(Z06_JK,PAK_BA,PAK_TA,Z06_NA,PAK_IS,PAK_NW,PAK_PB,PAK_SD)),
PLW("Palau",484,listOf(PLW_AM,PLW_AR,PLW_PE,PLW_HA,PLW_KA,PLW_KO,PLW_ME,PLW_ND,PLW_NC,PLW_NM,PLW_NP,PLW_NS,PLW_NL,PLW_NW,PLW_PE,PLW_SO)),
PSE("Palestine",6238,listOf(PSE_GZ,PSE_WE)),
PAN("Panama",75933,listOf(PAN_BC,PAN_CH,PAN_CC,PAN_CL,PAN_DR,PAN_EM,PAN_HE,PAN_SB,PAN_LS,PAN_NB,PAN_PN,PAN_PO,PAN_VR)),
PNG("Papua New Guinea",466628,listOf(PNG_NS,PNG_CE,PNG_CH,PNG_EN,PNG_ES,PNG_EH,PNG_EG,PNG_GU,PNG_HE,PNG_JI,PNG_MD,PNG_MN,PNG_MB,PNG_MR,PNG_NC,PNG_NI,PNG_NO,PNG_SA,PNG_SL,PNG_WN,PNG_WE,PNG_WL)),
PRY("Paraguay",401148,listOf(PRY_AG,PRY_AA,PRY_AM,PRY_AS,PRY_BQ,PRY_CG,PRY_CZ,PRY_CY,PRY_CE,PRY_CN,PRY_CR,PRY_GU,PRY_IT,PRY_MI,PRY_NE,PRY_PG,PRY_PH,PRY_SP)),
PER("Peru",1300636,listOf(PER_AM,PER_AN,PER_AP,PER_AR,PER_AY,PER_CJ,PER_CL,PER_CS,PER_HV,PER_HC,PER_IC,PER_JU,PER_LL,PER_LB,PER_LR,PER_LP,PER_LO,PER_MD,PER_MQ,PER_PA,PER_PI,PER_PU,PER_SM,PER_TA,PER_TU,PER_UC)),
PHL("Philippines",297628,listOf(PHL_AB,PHL_AN,PHL_AS,PHL_AK,PHL_AL,PHL_AQ,PHL_AP,PHL_AU,PHL_BS,PHL_BA,PHL_BN,PHL_BT,PHL_BG,PHL_BI,PHL_BO,PHL_BK,PHL_BU,PHL_CG,PHL_CN,PHL_CS,PHL_CM,PHL_CP,PHL_CT,PHL_CV,PHL_CB,PHL_CL,PHL_DV,PHL_DS,PHL_DO,PHL_DI,PHL_ES,PHL_GU,PHL_IF,PHL_IN,PHL_IS,PHL_II,PHL_IB,PHL_KA,PHL_LU,PHL_LG,PHL_LN,PHL_LS,PHL_LE,PHL_MG,PHL_MQ,PHL_MB,PHL_MM,PHL_MD,PHL_MN,PHL_MT,PHL_ND,PHL_NR,PHL_NC,PHL_NS,PHL_NE,PHL_NV,PHL_MC,PHL_MR,PHL_PL,PHL_PM,PHL_PN,PHL_QZ,PHL_QR,PHL_RI,PHL_RO,PHL_SM,PHL_SG,PHL_SQ,PHL_SR,PHL_SC,PHL_SL,PHL_SK,PHL_SU,PHL_SN,PHL_SS,PHL_TR,PHL_TT,PHL_PN,PHL_ZN,PHL_ZS,PHL_ZY)),
PCN("Pitcairn Islands",54,emptyList()),
POL("Poland",311892,listOf(POL_02,POL_04,POL_10,POL_06,POL_08,POL_12,POL_14,POL_16,POL_18,POL_20,POL_22,POL_24,POL_26,POL_28,POL_30,POL_32)),
PRT("Portugal",91999,listOf(PRT_AV,PRT_AC,PRT_BE,PRT_BR,PRT_BA,PRT_CB,PRT_CO,PRT_EV,PRT_FA,PRT_GU,PRT_LE,PRT_LI,PRT_NA,PRT_PA,PRT_PO,PRT_SA,PRT_SE,PRT_VC,PRT_VR,PRT_VI)),
PRI("Puerto Rico",9019,listOf(PRI_AJ,PRI_AD,PRI_AL,PRI_AB,PRI_AI,PRI_AN,PRI_AC,PRI_AR,PRI_BC,PRI_BQ,PRI_BY,PRI_CR,PRI_CG,PRI_CA,PRI_CV,PRI_CN,PRI_CT,PRI_CY,PRI_CB,PRI_CL,PRI_CD,PRI_CO,PRI_CM,PRI_CZ,PRI_CU,PRI_DO,PRI_FJ,PRI_FL,PRI_GC,PRI_GM,PRI_GL,PRI_GB,PRI_GR,PRI_HA,PRI_HO,PRI_HU,PRI_IS,PRI_JY,PRI_JD,PRI_JC,PRI_LJ,PRI_LR,PRI_LM,PRI_LP,PRI_LZ,PRI_LQ,PRI_MT,PRI_MR,PRI_MB,PRI_MG,PRI_MC,PRI_MV,PRI_NG,PRI_NR,PRI_OR,PRI_PT,PRI_PN,PRI_PO,PRI_QB,PRI_RC,PRI_RG,PRI_SB,PRI_SA,PRI_SG,PRI_SJ,PRI_SL,PRI_SS,PRI_SI,PRI_TA,PRI_TB,PRI_TJ,PRI_UT,PRI_VA,PRI_VB,PRI_VQ,PRI_VL,PRI_YB,PRI_YU)),
QAT("Qatar",11633,listOf(QAT_DA,QAT_DY,QAT_KR,QAT_WA,QAT_RY,QAT_MS,QAT_SL)),
COG("Republicofthe Congo",344030,listOf(COG_BO,COG_BR,COG_CU,COG_CO,COG_KO,COG_LE,COG_LI,COG_NI,COG_PL,COG_PN,COG_PO,COG_SA)),
REU("Réunion",2526,listOf(REU_BN,REU_DN,REU_PL,REU_PR)),
ROU("Romania",238297,listOf(ROU_AB,ROU_AR,ROU_AG,ROU_BC,ROU_BH,ROU_BN,ROU_BT,ROU_BR,ROU_BV,ROU_BI,ROU_BZ,ROU_CL,ROU_CS,ROU_CJ,ROU_CT,ROU_CV,ROU_DB,ROU_DJ,ROU_GL,ROU_GR,ROU_GJ,ROU_HR,ROU_HD,ROU_IL,ROU_IS,ROU_IF,ROU_MM,ROU_MH,ROU_MS,ROU_NT,ROU_OT,ROU_PH,ROU_SJ,ROU_SM,ROU_SB,ROU_SV,ROU_TR,ROU_TM,ROU_TL,ROU_VL,ROU_VS,ROU_VN)),
RUS("Russia",16869756,listOf(RUS_AD,RUS_AL,RUS_AM,RUS_AR,RUS_AS,RUS_BK,RUS_BL,RUS_BR,RUS_BU,RUS_CN,RUS_CL,RUS_CK,RUS_CV,RUS_SP,RUS_DA,RUS_GA,RUS_IN,RUS_IK,RUS_IV,RUS_KB,RUS_KN,RUS_KL,RUS_KG,RUS_KQ,RUS_KC,RUS_KI,RUS_KE,RUS_KH,RUS_KK,RUS_KM,RUS_KV,RUS_KO,RUS_KT,RUS_KD,RUS_KX,RUS_KU,RUS_KS,RUS_LN,RUS_LP,RUS_MG,RUS_ME,RUS_MR,RUS_NA,RUS_MS,RUS_MM,RUS_NN,RUS_NZ,RUS_NO,RUS_NG,RUS_NS,RUS_OM,RUS_OL,RUS_OB,RUS_PZ,RUS_PE,RUS_PR,RUS_PS,RUS_RO,RUS_RZ,RUS_SK,RUS_SL,RUS_SA,RUS_SR,RUS_SM,RUS_ST,RUS_SV,RUS_TB,RUS_TT,RUS_TO,RUS_TL,RUS_TU,RUS_TV,RUS_TY,RUS_UD,RUS_UL,RUS_VL,RUS_VG,RUS_VO,RUS_VR,RUS_YN,RUS_YS,RUS_YV,RUS_ZB)),
RWA("Rwanda",25449,listOf(RWA_NO,RWA_SU,RWA_ES,RWA_OU,RWA_KV)),
BLM("Saint-Barthélemy",21,listOf(BLM_NA,BLM_NA)),
MAF("Saint-Martin",56,emptyList()),
SHN("Saint Helena, Ascensionand Tris",412,listOf(SHN_AC,SHN_SH,SHN_TA)),
KNA("Saint Kittsand Nevis",269,listOf(KNA_CC,KNA_AS,KNA_GB,KNA_GG,KNA_JW,KNA_JC,KNA_JF,KNA_MC,KNA_PP,KNA_PL,KNA_PB,KNA_TL,KNA_TM,KNA_TP)),
LCA("Saint Lucia",618,listOf(LCA_AR,LCA_CN,LCA_CS,LCA_CH,LCA_DE,LCA_GI,LCA_LB,LCA_MI,LCA_CO,LCA_VF)),
SPM("Saint Pierreand Miquelon",227,listOf(SPM_ML,SPM_SP)),
VCT("Saint Vincentandthe Grenadines",400,listOf(VCT_CH,VCT_GT,VCT_AN,VCT_DA,VCT_GE,VCT_PA)),
WSM("Samoa",2871,listOf(WSM_AA,WSM_AL,WSM_AT,WSM_FA,WSM_GE,WSM_GI,WSM_PA,WSM_SA,WSM_TU,WSM_VF,WSM_VS)),
SMR("San Marino",61,listOf(SMR_AC,SMR_BM,SMR_CH,SMR_DO,SMR_FA,SMR_FI,SMR_MG,SMR_SM,SMR_SE)),
STP("SãoToméand Príncipe",1009,listOf(STP_PR,STP_ST)),
SAU("Saudi Arabia",1931654,listOf(SAU_AS,SAU_BA,SAU_HS,SAU_JF,SAU_MD,SAU_QS,SAU_RI,SAU_SH,SAU_HA,SAU_JZ,SAU_MK,SAU_NJ,SAU_TB)),
SEN("Senegal",198056,listOf(SEN_DK,SEN_DB,SEN_FK,SEN_KF,SEN_KC,SEN_KG,SEN_KD,SEN_LG,SEN_MT,SEN_ST,SEN_SD,SEN_TB,SEN_TH,SEN_ZG)),
SRB("Serbia",78247,listOf(SRB_BO,SRB_BR,SRB_BG,SRB_JA,SRB_JC,SRB_JN,SRB_KB,SRB_MA,SRB_MR,SRB_NS,SRB_PC,SRB_PI,SRB_PD,SRB_PM,SRB_RN,SRB_RS,SRB_SC,SRB_SN,SRB_SD,SRB_SM,SRB_SU,SRB_TO,SRB_ZJ,SRB_ZC,SRB_ZL)),
SYC("Seychelles",492,listOf(SYC_PI,SYC_AB,SYC_ET,SYC_RO,SYC_LO,SYC_BL,SYC_BS,SYC_BV,SYC_BA,SYC_BO,SYC_CA,SYC_RA,SYC_GL,SYC_GM,SYC_GP,SYC_DI,SYC_LM,SYC_MB,SYC_MF,SYC_OI,SYC_PL,SYC_PR,SYC_PG,SYC_RC,SYC_SL,SYC_TA)),
SLE("Sierra Leone",73067,listOf(SLE_EA,SLE_NO,SLE_SO,SLE_WE)),
SGP("Singapore",700,listOf(SGP_NA,SGP_NA,SGP_NA,SGP_NA,SGP_NA)),
SVK("Slovakia",49055,listOf(SVK_BC,SVK_BL,SVK_KI,SVK_NI,SVK_PV,SVK_TC,SVK_TA,SVK_ZI)),
SVN("Slovenia",19951,listOf(SVN_GO,SVN_SP,SVN_NA,SVN_KO,SVN_NO,SVN_JP,SVN_LJ,SVN_PD,SVN_PM,SVN_SA,SVN_PS,SVN_ZS)),
SLB("Solomon Islands",28686,listOf(SLB_CN,SLB_CH,SLB_GU,SLB_CT,SLB_IS,SLB_MK,SLB_ML,SLB_RB,SLB_TE,SLB_WE)),
SOM("Somalia",637672,listOf(SOM_AW,SOM_BK,SOM_BN,SOM_BR,SOM_BY,SOM_GA,SOM_GE,SOM_HI,SOM_JD,SOM_JH,SOM_MU,SOM_NU,SOM_SA,SOM_SD,SOM_SH,SOM_SO,SOM_TO,SOM_WO)),
ZAF("South Africa",1224059,listOf(ZAF_EC,ZAF_FS,ZAF_GT,ZAF_NL,ZAF_NP,ZAF_MP,ZAF_NW,ZAF_NC,ZAF_WC)),
SGS("South Georgiaandthe South Sand",4085,emptyList()),
KOR("South Korea",100721,listOf(KOR_PU,KOR_GB,KOR_GN,KOR_TG,KOR_TJ,KOR_KW,KOR_KJ,KOR_KG,KOR_KB,KOR_KN,KOR_IN,KOR_CJ,KOR_CB,KOR_CN,KOR_SJ,KOR_SO,KOR_UL)),
SSD("South Sudan",632186,listOf(SSD_BG,SSD_EE,SSD_JG,SSD_EB,SSD_NB,SSD_WH,SSD_UN,SSD_WR,SSD_WB,SSD_WE)),
ESP("Spain",506617,listOf(ESP_AN,ESP_AR,ESP_CB,ESP_CM,ESP_CL,ESP_CT,ESP_ML,ESP_MD,ESP_NA,ESP_VC,ESP_EX,ESP_GA,ESP_PM,ESP_CN,ESP_LO,ESP_PV,ESP_AS,ESP_MU)),
LKA("Sri Lanka",66267,listOf(LKA_AP,LKA_AD,LKA_BD,LKA_BC,LKA_CO,LKA_GL,LKA_GQ,LKA_HB,LKA_JA,LKA_KT,LKA_KY,LKA_KE,LKA_KL,LKA_KG,LKA_MB,LKA_MT,LKA_MH,LKA_MJ,LKA_MP,LKA_NW,LKA_PR,LKA_PX,LKA_RN,LKA_TC,LKA_VA)),
SDN("Sudan",1882758,listOf(SDN_GZ,SDN_GD,SDN_BN,SDN_CD,SDN_ED,SDN_KA,SDN_KH,SDN_ND,SDN_KN,SDN_NO,SDN_RS,SDN_RN,SDN_SI,SDN_SD,SDN_KS,SDN_WD,SDN_KN,SDN_WN)),
SUR("Suriname",147402,listOf(SUR_BR,SUR_CM,SUR_CR,SUR_MA,SUR_NI,SUR_PR,SUR_PM,SUR_SA,SUR_SI,SUR_WA)),
SJM("Svalbardand Jan Mayen",59960,listOf(SJM_JN,SJM_SV)),
SWZ("Swaziland",17451,listOf(SWZ_HH,SWZ_LU,SWZ_MA,SWZ_SH)),
SWE("Sweden",448298,listOf(SWE_BL,SWE_KO,SWE_GV,SWE_GT,SWE_HA,SWE_JA,SWE_JO,SWE_KA,SWE_KR,SWE_NB,SWE_OR,SWE_OG,SWE_SN,SWE_SD,SWE_ST,SWE_UP,SWE_VR,SWE_VB,SWE_VN,SWE_VM,SWE_VG)),
CHE("Switzerland",41217,listOf(CHE_AG,CHE_AR,CHE_AI,CHE_BL,CHE_BS,CHE_BE,CHE_FR,CHE_GE,CHE_GL,CHE_GR,CHE_JU,CHE_LU,CHE_NE,CHE_NW,CHE_OW,CHE_SG,CHE_SH,CHE_SZ,CHE_SO,CHE_TG,CHE_TI,CHE_UR,CHE_VS,CHE_VD,CHE_ZG,CHE_ZH)),
SYR("Syria",187360,listOf(SYR_HA,SYR_HL,SYR_RA,SYR_SU,SYR_DI,SYR_DR,SYR_DY,SYR_HM,SYR_HI,SYR_ID,SYR_LA,SYR_QU,SYR_RD,SYR_TA)),
TWN("Taiwan",36571,listOf(TWN_FK,TWN_KH,TWN_NT,TWN_TG,TWN_TN,TWN_TP,TWN_TA)),
TJK("Tajikistan",142330,listOf(TJK_RR,TJK_DU,TJK_BK,TJK_KL,TJK_LE)),
TZA("Tanzania",946695,listOf(TZA_AS,TZA_DS,TZA_DO,TZA_GE,TZA_IG,TZA_KG,TZA_PN,TZA_ZN,TZA_KA,TZA_KM,TZA_KL,TZA_PS,TZA_ZS,TZA_LI,TZA_MY,TZA_MA,TZA_MB,TZA_ZW,TZA_MO,TZA_MT,TZA_MZ,TZA_NJ,TZA_PW,TZA_RU,TZA_RV,TZA_SY,TZA_SI,TZA_SD,TZA_SO,TZA_TB,TZA_TN)),
THA("Thailand",516901,listOf(THA_AC,THA_AT,THA_BM,THA_BK,THA_BR,THA_CC,THA_CN,THA_CY,THA_CT,THA_CM,THA_CR,THA_CB,THA_CP,THA_KL,THA_KP,THA_KN,THA_KK,THA_KR,THA_LG,THA_LN,THA_LE,THA_LB,THA_MH,THA_MS,THA_MD,THA_NN,THA_NP,THA_NF,THA_NR,THA_NS,THA_NT,THA_NA,THA_NW,THA_NB,THA_NK,THA_NO,THA_PT,THA_PI,THA_PG,THA_PL,THA_PY,THA_PH,THA_PE,THA_PC,THA_PS,THA_PA,THA_PR,THA_PU,THA_PB,THA_PK,THA_RN,THA_RT,THA_RY,THA_RE,THA_SK,THA_SN,THA_SP,THA_SS,THA_SM,THA_SR,THA_SA,THA_SI,THA_SB,THA_SG,THA_SO,THA_SH,THA_ST,THA_SU,THA_TK,THA_TG,THA_TT,THA_UR,THA_UN,THA_UT,THA_UD,THA_YL,THA_YS)),
TLS("Timor-Leste",15012,listOf(TLS_AL,TLS_AN,TLS_AM,TLS_BC,TLS_BB,TLS_CL,TLS_DL,TLS_ER,TLS_BT,TLS_LQ,TLS_MT,TLS_MF,TLS_VQ)),
TGO("Togo",57272,listOf(TGO_CE,TGO_KA,TGO_MA,TGO_PL,TGO_SA)),
TKL("Tokelau",15,listOf(TKL_AT,TKL_FA,TKL_NU)),
TON("Tonga",762,listOf(TON_EU,TON_HA,TON_NI,TON_TT,TON_VA)),
TTO("Trinidadand Tobago",5193,listOf(TTO_AR,TTO_CH,TTO_CT,TTO_DM,TTO_MR,TTO_PD,TTO_PF,TTO_PS,TTO_PT,TTO_SF,TTO_SL,TTO_SN,TTO_SI,TTO_TB,TTO_TP)),
TUN("Tunisia",155257,listOf(TUN_AN,TUN_BJ,TUN_BA,TUN_BZ,TUN_GB,TUN_GF,TUN_JE,TUN_KR,TUN_KS,TUN_KB,TUN_KF,TUN_MH,TUN_MN,TUN_ME,TUN_MS,TUN_NB,TUN_SF,TUN_SZ,TUN_SL,TUN_SS,TUN_TA,TUN_TO,TUN_TU,TUN_ZA)),
TUR("Turkey",781794,listOf(TUR_AA,TUR_AD,TUR_AF,TUR_AG,TUR_AK,TUR_AM,TUR_AN,TUR_AL,TUR_AR,TUR_AV,TUR_AY,TUR_BK,TUR_BR,TUR_BM,TUR_BB,TUR_BC,TUR_BG,TUR_BT,TUR_BL,TUR_BD,TUR_BU,TUR_CK,TUR_CI,TUR_CM,TUR_DN,TUR_DY,TUR_DU,TUR_ED,TUR_EG,TUR_EN,TUR_EM,TUR_ES,TUR_GA,TUR_GI,TUR_GU,TUR_HK,TUR_HT,TUR_IG,TUR_IP,TUR_IB,TUR_IZ,TUR_KM,TUR_KB,TUR_KR,TUR_KA,TUR_KS,TUR_KY,TUR_KI,TUR_KK,TUR_KL,TUR_KH,TUR_KC,TUR_KO,TUR_KU,TUR_ML,TUR_MN,TUR_MR,TUR_IC,TUR_MG,TUR_MS,TUR_NV,TUR_NG,TUR_OR,TUR_OS,TUR_RI,TUR_SK,TUR_SS,TUR_SU,TUR_SI,TUR_SP,TUR_SR,TUR_SV,TUR_TG,TUR_TT,TUR_TB,TUR_TC,TUR_US,TUR_VA,TUR_YL,TUR_YZ,TUR_ZO)),
TKM("Turkmenistan",490273,listOf(TKM_AL,TKM_AB,TKM_BA,TKM_DA,TKM_LE,TKM_MA)),
TCA("Turksand Caicos Islands",995,listOf(TCA_NA,TCA_NA,TCA_NA,TCA_NA,TCA_NA,TCA_NA)),
TUV("Tuvalu",40,listOf(TUV_FN,TUV_NG,TUV_NA,TUV_NK,TUV_NT,TUV_NU,TUV_NF,TUV_NL,TUV_VI)),
UGA("Uganda",243045,listOf(UGA_AD,UGA_AC,UGA_AW,UGA_BG,UGA_BN,UGA_BS,UGA_BU,UGA_GL,UGA_HO,UGA_IN,UGA_JI,UGA_KA,UGA_BR,UGA_KD,UGA_KN,UGA_KM,UGA_KX,UGA_KE,UGA_UU,UGA_KP,UGA_KS,UGA_KK,UGA_KY,UGA_KI,UGA_KG,UGA_KR,UGA_TG,UGA_KF,UGA_KU,UGA_KJ,UGA_NA,UGA_NA,UGA_LA,UGA_LW,UGA_MA,UGA_MC,UGA_MG,UGA_ME,UGA_RR,UGA_MT,UGA_MY,UGA_MI,UGA_MD,UGA_MN,UGA_NP,UGA_NA,UGA_NE,UGA_NT,UGA_PD,UGA_PL,UGA_RA,UGA_RK,UGA_SE,UGA_SI,UGA_SR,UGA_TR,UGA_WA,UGA_YU)),
UKR("Ukraine",600816,listOf(UKR_,UKR_CK,UKR_CH,UKR_CV,UKR_KR,UKR_DP,UKR_DT,UKR_IF,UKR_KK,UKR_KS,UKR_KM,UKR_KV,UKR_KC,UKR_KH,UKR_LV,UKR_LH,UKR_MY,UKR_OD,UKR_PL,UKR_RV,UKR_SC,UKR_SM,UKR_TP,UKR_VI,UKR_VO,UKR_ZK,UKR_ZP,UKR_ZT)),
ARE("United Arab Emirates",71429,listOf(ARE_AZ,ARE_AJ,ARE_DU,ARE_FU,ARE_RK,ARE_SH,ARE_UQ)),
GBR("United Kingdom",244732,listOf(GBR_NIR,GBR_SCT,GBR_WLS,GBR_NA,NA_NA)),
USA("United States",9477483,listOf(USA_AL,USA_AK,USA_AZ,USA_AR,USA_CA,USA_CO,USA_CT,USA_DE,USA_DC,USA_FL,USA_GA,USA_HI,USA_ID,USA_IL,USA_IN,USA_IA,USA_KS,USA_KY,USA_LA,USA_ME,USA_MD,USA_MA,USA_MI,USA_MN,USA_MS,USA_MO,USA_MT,USA_NE,USA_NV,USA_NH,USA_NJ,USA_NM,USA_NY,USA_NC,USA_ND,USA_OH,USA_OK,USA_OR,USA_PA,USA_RI,USA_SC,USA_SD,USA_TN,USA_TX,USA_UT,USA_VT,USA_VA,USA_WA,USA_WV,USA_WI,USA_WY)),
UMI("United States Minor Outlying Isl",47,listOf(UMI_NA,UMI_NA,UMI_NA,UMI_NA,UMI_NA,UMI_NA,UMI_NA,UMI_NA,UMI_NA)),
URY("Uruguay",178103,listOf(URY_AR,URY_CA,URY_CL,URY_CO,URY_DU,URY_FS,URY_FD,URY_LA,URY_MA,URY_MO,URY_PA,URY_RN,URY_RV,URY_RO,URY_SA,URY_SJ,URY_SO,URY_TA,URY_TT)),
UZB("Uzbekistan",447894,listOf(UZB_AN,UZB_BU,UZB_FA,UZB_JI,UZB_NG,UZB_NW,UZB_QR,UZB_QA,UZB_SA,UZB_SI,UZB_SU,UZB_TA,UZB_TK,UZB_KH)),
VUT("Vanuatu",12384,listOf(VUT_ML,VUT_PM,VUT_SN,VUT_SE,VUT_TF,VUT_TR)),
VAT("Vatican City",1,emptyList()),
VEN("Venezuela",918303,listOf(VEN_Z,VEN_NA,VEN_C,VEN_D,VEN_E,VEN_NA,VEN_G,VEN_H,VEN_Y,VEN_DP,VEN_A,VEN_NA,VEN_NA,VEN_K,VEN_NA,VEN_M,VEN_N,VEN_O,VEN_P,VEN_R,VEN_NA,VEN_T,VEN_NA,VEN_U,VEN_V)),
VNM("Vietnam",331121,listOf(VNM_AG,VNM_BV,VNM_BG,VNM_BK,VNM_BL,VNM_BN,VNM_BR,VNM_BD,VNM_BI,VNM_BP,VNM_BU,VNM_CM,VNM_CN,VNM_CB,VNM_DA,VNM_DC,VNM_DO,VNM_DB,VNM_DN,VNM_DT,VNM_GL,VNM_HG,VNM_HM,VNM_HI,VNM_HT,VNM_HD,VNM_HP,VNM_HU,VNM_HC,VNM_HO,VNM_HY,VNM_KH,VNM_KG,VNM_KT,VNM_LI,VNM_LD,VNM_LS,VNM_LO,VNM_LA,VNM_ND,VNM_NA,VNM_NB,VNM_NT,VNM_PT,VNM_PY,VNM_QB,VNM_QM,VNM_QG,VNM_QN,VNM_QT,VNM_ST,VNM_SL,VNM_TN,VNM_TB,VNM_TY,VNM_TH,VNM_TT,VNM_TG,VNM_TV,VNM_TQ,VNM_VL,VNM_VC,VNM_YB)),
VIR("Virgin Islands, U.S.",364,listOf(VIR_SC,VIR_SJ,VIR_ST)),
WLF("Wallisand Futuna",157,listOf(WLF_AL,WLF_SI,WLF_UV)),
ESH("Western Sahara",268500,listOf(ESH_BO,ESH_ES,ESH_LA,ESH_OD)),
YEM("Yemen",454747,listOf(YEM_AD,YEM_AB,YEM_BA,YEM_DL,YEM_HU,YEM_JA,YEM_MR,YEM_MW,YEM_13,YEM_AM,YEM_DH,YEM_HD,YEM_HJ,YEM_IB,YEM_LA,YEM_MA,YEM_31,YEM_SD,YEM_SN,YEM_SH,YEM_TA)),
ZMB("Zambia",755679,listOf(ZMB_CE,ZMB_CO,ZMB_EA,ZMB_LP,ZMB_LS,ZMB_MU,ZMB_NW,ZMB_NO,ZMB_SO,ZMB_WE)),
ZWE("Zimbabwe",392107,listOf(ZWE_BU,ZWE_HA,ZWE_MA,ZWE_MC,ZWE_ME,ZWE_MW,ZWE_MV,ZWE_MN,ZWE_MS,ZWE_MI)),

View File

@ -6,6 +6,7 @@
"@turf/projection": "^6.5.0",
"@turf/simplify": "^6.5.0",
"@turf/truncate": "^6.5.0",
"@turf/turf": "^6.5.0",
"geojson2svg": "^2.0.1",
"mapshaper": "^0.6.79"
},

View File

@ -14,5 +14,5 @@ dependencyResolutionManagement {
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "BeenDroid"
rootProject.name = "Beans"
include ':app'

1460
yarn.lock

File diff suppressed because it is too large Load Diff