Compare commits
15 Commits
0.1a-rc1
...
a3f81c95a0
Author | SHA1 | Date | |
---|---|---|---|
|
a3f81c95a0 | ||
|
d041df9805 | ||
|
01dab6aa30 | ||
|
bafd3cea14 | ||
|
ec52574ae3 | ||
|
923404ebc5
|
||
|
32ba5e0b07 | ||
|
72b2148e4b | ||
|
513660b3a4 | ||
|
443d62b6df
|
||
|
a360c7496b
|
||
|
3fe83cff2e
|
||
|
71acf04f20 | ||
|
b1de332134
|
||
|
112745188f
|
@@ -48,17 +48,17 @@ jobs:
|
|||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
|
|
||||||
- name: Build APK
|
- name: Build APK
|
||||||
run: ./gradlew assemble
|
run: ./gradlew assembleSignedRelease
|
||||||
|
|
||||||
# - name: Upload APK
|
|
||||||
# uses: actions/upload-artifact@v4
|
|
||||||
# with:
|
|
||||||
# name: app.apk
|
|
||||||
# path: app/build/outputs/apk/release/app-release.apk
|
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
app/build/outputs/apk/release/app-release.apk
|
app/build/outputs/apk/signedRelease/app-signedRelease.apk
|
||||||
|
prerelease: |
|
||||||
|
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+[a-z]+$ ]]; then
|
||||||
|
echo "false"
|
||||||
|
else
|
||||||
|
echo "true"
|
||||||
|
fi
|
@@ -5,6 +5,7 @@ plugins {
|
|||||||
id 'com.mikepenz.aboutlibraries.plugin' version '11.1.1'
|
id 'com.mikepenz.aboutlibraries.plugin' version '11.1.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace 'net.helcel.beans'
|
namespace 'net.helcel.beans'
|
||||||
compileSdk 34
|
compileSdk 34
|
||||||
@@ -16,22 +17,37 @@ android {
|
|||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "0.1a"
|
versionName "0.1a"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
create("release") {
|
create("release") {
|
||||||
|
try {
|
||||||
|
def keystorePropertiesFile = rootProject.file("app/keystore.properties")
|
||||||
|
def keystoreProperties = new Properties()
|
||||||
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||||
|
|
||||||
keyAlias keystoreProperties['keyAlias']
|
keyAlias keystoreProperties['keyAlias']
|
||||||
keyPassword keystoreProperties['keyPassword']
|
keyPassword keystoreProperties['keyPassword']
|
||||||
storeFile file(keystoreProperties['storeFile'])
|
storeFile file(keystoreProperties['storeFile'])
|
||||||
storePassword keystoreProperties['storePassword']
|
storePassword keystoreProperties['storePassword']
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
println("File not found: ${e.message}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
debuggable true
|
||||||
|
}
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
shrinkResources false
|
shrinkResources false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
signedRelease {
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
signingConfig = signingConfigs.getByName("release")
|
signingConfig = signingConfigs.getByName("release")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1896,7 +1896,7 @@ MAR_FB|MAR|Fès-Boulemane|19366
|
|||||||
MAR_GB|MAR|Gharb-Chrarda-Béni Hssen|8782
|
MAR_GB|MAR|Gharb-Chrarda-Béni Hssen|8782
|
||||||
MAR_GC|MAR|Grand Casablanca|879
|
MAR_GC|MAR|Grand Casablanca|879
|
||||||
MAR_GE|MAR|Guelmim-Es-Semara|64701
|
MAR_GE|MAR|Guelmim-Es-Semara|64701
|
||||||
MAR_LB|MAR|Laâyoune-Boujdour-Sakia El H|5763
|
MAR_LB|MAR|Laâyoune-Boujdour-Sakia El Hamra|5763
|
||||||
MAR_MK|MAR|Marrakech-Tensift-Al Haouz|32483
|
MAR_MK|MAR|Marrakech-Tensift-Al Haouz|32483
|
||||||
MAR_MT|MAR|Meknès-Tafilalet|60303
|
MAR_MT|MAR|Meknès-Tafilalet|60303
|
||||||
MAR_OR|MAR|Oriental|59914
|
MAR_OR|MAR|Oriental|59914
|
||||||
@@ -3293,9 +3293,9 @@ ARE_RK|ARE|Ras Al-Khaimah|2442
|
|||||||
ARE_SH|ARE|Sharjah|2529
|
ARE_SH|ARE|Sharjah|2529
|
||||||
ARE_UQ|ARE|Ummal-Qaywayn|746
|
ARE_UQ|ARE|Ummal-Qaywayn|746
|
||||||
GBR_NIR|GBR|Northern Ireland|14134
|
GBR_NIR|GBR|Northern Ireland|14134
|
||||||
GBR_SCT|GBR|Scotland|78704
|
GBR_SCT|GBR|Scotland|79121
|
||||||
GBR_WLS|GBR|Wales|20818
|
GBR_WLS|GBR|Wales|20818
|
||||||
GBR_NA|GBR|NA|130659
|
GBR_NA|GBR|England|130659
|
||||||
USA_AL|USA|Alabama|133995
|
USA_AL|USA|Alabama|133995
|
||||||
USA_AK|USA|Alaska|1501231
|
USA_AK|USA|Alaska|1501231
|
||||||
USA_AZ|USA|Arizona|296082
|
USA_AZ|USA|Arizona|296082
|
||||||
@@ -3532,4 +3532,3 @@ Z05_UT|IND|Uttarakhand|259
|
|||||||
Z09_UT|IND|Uttarakhand|987
|
Z09_UT|IND|Uttarakhand|987
|
||||||
Z06_JK|PAK|Azad Kashmir|13931
|
Z06_JK|PAK|Azad Kashmir|13931
|
||||||
Z06_NA|PAK|Gilgit-Baltistan|68053
|
Z06_NA|PAK|Gilgit-Baltistan|68053
|
||||||
GBR_EN|GBR|England|417
|
|
||||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 6.5 MiB After Width: | Height: | Size: 6.5 MiB |
@@ -13,12 +13,15 @@ import net.helcel.beans.activity.fragment.EditPlaceColorFragment
|
|||||||
import net.helcel.beans.activity.fragment.EditPlaceFragment
|
import net.helcel.beans.activity.fragment.EditPlaceFragment
|
||||||
import net.helcel.beans.countries.GeoLoc
|
import net.helcel.beans.countries.GeoLoc
|
||||||
import net.helcel.beans.databinding.ItemListGeolocBinding
|
import net.helcel.beans.databinding.ItemListGeolocBinding
|
||||||
|
import net.helcel.beans.helper.AUTO_GROUP
|
||||||
import net.helcel.beans.helper.Data
|
import net.helcel.beans.helper.Data
|
||||||
|
import net.helcel.beans.helper.NO_GROUP
|
||||||
import net.helcel.beans.helper.Settings
|
import net.helcel.beans.helper.Settings
|
||||||
import net.helcel.beans.helper.Theme.colorWrapper
|
import net.helcel.beans.helper.Theme.colorWrapper
|
||||||
|
|
||||||
class GeolocListAdapter(
|
class GeolocListAdapter(
|
||||||
private val ctx: EditPlaceFragment, private val l: GeoLoc, private val pager: ViewPagerAdapter
|
private val ctx: EditPlaceFragment, private val l: GeoLoc, private val pager: ViewPagerAdapter,
|
||||||
|
private val parentHolder: FoldingListViewHolder?
|
||||||
) : RecyclerView.Adapter<GeolocListAdapter.FoldingListViewHolder>() {
|
) : RecyclerView.Adapter<GeolocListAdapter.FoldingListViewHolder>() {
|
||||||
|
|
||||||
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): FoldingListViewHolder {
|
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): FoldingListViewHolder {
|
||||||
@@ -27,7 +30,7 @@ class GeolocListAdapter(
|
|||||||
viewGroup,
|
viewGroup,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
return FoldingListViewHolder(ctx.requireActivity(), binding)
|
return FoldingListViewHolder(ctx.requireActivity(), binding, parentHolder, l)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) {
|
||||||
@@ -35,7 +38,7 @@ class GeolocListAdapter(
|
|||||||
holder.bind(el)
|
holder.bind(el)
|
||||||
holder.addListeners(el) {
|
holder.addListeners(el) {
|
||||||
if (el.children.isNotEmpty())
|
if (el.children.isNotEmpty())
|
||||||
pager.addFragment(ctx, EditPlaceFragment(el, pager))
|
pager.addFragment(ctx, EditPlaceFragment(el, pager, holder))
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,21 +49,13 @@ class GeolocListAdapter(
|
|||||||
|
|
||||||
class FoldingListViewHolder(
|
class FoldingListViewHolder(
|
||||||
private val ctx: FragmentActivity,
|
private val ctx: FragmentActivity,
|
||||||
private val _binding: ItemListGeolocBinding
|
private val _binding: ItemListGeolocBinding,
|
||||||
|
private val _parentHolder: FoldingListViewHolder? = null,
|
||||||
|
private val _parentGeoLoc: GeoLoc,
|
||||||
) : RecyclerView.ViewHolder(_binding.root) {
|
) : RecyclerView.ViewHolder(_binding.root) {
|
||||||
|
|
||||||
private fun bindGroup(el: GeoLoc) {
|
private fun bindGroup(el: GeoLoc) {
|
||||||
val numerator = el.children.map { Data.visits.getVisited(it) != 0 }.count { it }
|
refreshCount(el)
|
||||||
val denominator = el.children.size
|
|
||||||
|
|
||||||
_binding.count.text = when (Settings.getStatPref(ctx)) {
|
|
||||||
ctx.getString(R.string.percentages) -> ctx.getString(
|
|
||||||
R.string.percentage,
|
|
||||||
(100 * (numerator.toFloat() / denominator.toFloat())).toInt()
|
|
||||||
)
|
|
||||||
|
|
||||||
else -> ctx.getString(R.string.rate, numerator, denominator)
|
|
||||||
}
|
|
||||||
_binding.textView.setTypeface(null, Typeface.BOLD)
|
_binding.textView.setTypeface(null, Typeface.BOLD)
|
||||||
_binding.textView.backgroundTintList = ColorStateList.valueOf(
|
_binding.textView.backgroundTintList = ColorStateList.valueOf(
|
||||||
colorWrapper(
|
colorWrapper(
|
||||||
@@ -104,16 +99,17 @@ class GeolocListAdapter(
|
|||||||
"AddColorDialogFragment"
|
"AddColorDialogFragment"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
_parentHolder?.refresh(_parentGeoLoc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onColorDialogDismiss(clear: Boolean) {
|
fun onColorDialogDismiss(clear: Boolean) {
|
||||||
if (clear) {
|
if (clear) {
|
||||||
Data.visits.setVisited(Data.selected_geoloc, 0)
|
Data.visits.setVisited(Data.selected_geoloc, NO_GROUP)
|
||||||
Data.saveData()
|
Data.saveData()
|
||||||
}
|
}
|
||||||
if (Data.selected_group != null && Data.selected_geoloc != null) {
|
if (Data.selected_group != null && Data.selected_geoloc != null) {
|
||||||
Data.visits.setVisited(Data.selected_geoloc, Data.selected_group?.key ?: 0)
|
Data.visits.setVisited(Data.selected_geoloc, Data.selected_group?.key ?: NO_GROUP)
|
||||||
Data.saveData()
|
Data.saveData()
|
||||||
}
|
}
|
||||||
Data.selected_geoloc?.let { refreshCheck(it) }
|
Data.selected_geoloc?.let { refreshCheck(it) }
|
||||||
@@ -122,6 +118,24 @@ class GeolocListAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshCheck(geoLoc: GeoLoc) {
|
private fun refreshCheck(geoLoc: GeoLoc) {
|
||||||
|
_binding.checkBox.checkedState =
|
||||||
|
if (Data.visits.getVisited(geoLoc) !in listOf(NO_GROUP, AUTO_GROUP)) {
|
||||||
|
MaterialCheckBox.STATE_CHECKED
|
||||||
|
}
|
||||||
|
else if (geoLoc.children.isNotEmpty() && geoLoc.children.all { Data.visits.getVisited(it) != NO_GROUP }) {
|
||||||
|
Data.visits.setVisited(geoLoc, AUTO_GROUP)
|
||||||
|
MaterialCheckBox.STATE_CHECKED
|
||||||
|
}
|
||||||
|
else if (geoLoc.children.any { Data.visits.getVisited(it) != NO_GROUP }) {
|
||||||
|
Data.visits.setVisited(geoLoc, AUTO_GROUP)
|
||||||
|
MaterialCheckBox.STATE_INDETERMINATE
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Data.visits.setVisited(geoLoc, NO_GROUP)
|
||||||
|
MaterialCheckBox.STATE_UNCHECKED
|
||||||
|
}
|
||||||
|
Data.saveData()
|
||||||
|
|
||||||
var col = Data.groups.getGroupFromKey(Data.visits.getVisited(geoLoc)).color
|
var col = Data.groups.getGroupFromKey(Data.visits.getVisited(geoLoc)).color
|
||||||
if (col.color == Color.TRANSPARENT) {
|
if (col.color == Color.TRANSPARENT) {
|
||||||
col = colorWrapper(
|
col = colorWrapper(
|
||||||
@@ -130,13 +144,29 @@ class GeolocListAdapter(
|
|||||||
)
|
)
|
||||||
col.alpha = 64
|
col.alpha = 64
|
||||||
}
|
}
|
||||||
_binding.checkBox.checkedState =
|
|
||||||
if (Data.visits.getVisited(geoLoc) != 0) MaterialCheckBox.STATE_CHECKED
|
|
||||||
else if (geoLoc.children.any { Data.visits.getVisited(it) != 0 }) MaterialCheckBox.STATE_INDETERMINATE
|
|
||||||
else MaterialCheckBox.STATE_UNCHECKED
|
|
||||||
|
|
||||||
_binding.checkBox.buttonTintList = ColorStateList.valueOf(col.color)
|
_binding.checkBox.buttonTintList = ColorStateList.valueOf(col.color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun refreshCount(geoLoc: GeoLoc) {
|
||||||
|
val numerator = geoLoc.children.map { Data.visits.getVisited(it) != NO_GROUP }.count { it }
|
||||||
|
val denominator = geoLoc.children.size
|
||||||
|
_binding.count.text = when (Settings.getStatPref(ctx)) {
|
||||||
|
ctx.getString(R.string.percentages) -> ctx.getString(
|
||||||
|
R.string.percentage,
|
||||||
|
(100 * (numerator.toFloat() / denominator.toFloat())).toInt()
|
||||||
|
)
|
||||||
|
else -> ctx.getString(R.string.rate, numerator, denominator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun refresh(geoLoc: GeoLoc) {
|
||||||
|
// Refresh
|
||||||
|
refreshCheck(geoLoc)
|
||||||
|
refreshCount(geoLoc)
|
||||||
|
|
||||||
|
// Recursively refresh parent
|
||||||
|
_parentHolder?.refresh(_parentGeoLoc)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,11 +8,12 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import net.helcel.beans.activity.adapter.GeolocListAdapter
|
import net.helcel.beans.activity.adapter.GeolocListAdapter
|
||||||
|
import net.helcel.beans.activity.adapter.GeolocListAdapter.FoldingListViewHolder
|
||||||
import net.helcel.beans.activity.adapter.ViewPagerAdapter
|
import net.helcel.beans.activity.adapter.ViewPagerAdapter
|
||||||
import net.helcel.beans.countries.GeoLoc
|
import net.helcel.beans.countries.GeoLoc
|
||||||
import net.helcel.beans.databinding.FragmentEditPlacesBinding
|
import net.helcel.beans.databinding.FragmentEditPlacesBinding
|
||||||
|
|
||||||
class EditPlaceFragment(val loc: GeoLoc, private val pager: ViewPagerAdapter) : Fragment() {
|
class EditPlaceFragment(val loc: GeoLoc, private val pager: ViewPagerAdapter, private val holder: FoldingListViewHolder? = null) : Fragment() {
|
||||||
private lateinit var _binding: FragmentEditPlacesBinding
|
private lateinit var _binding: FragmentEditPlacesBinding
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
@@ -26,7 +27,7 @@ class EditPlaceFragment(val loc: GeoLoc, private val pager: ViewPagerAdapter) :
|
|||||||
_binding.list.setHasFixedSize(true)
|
_binding.list.setHasFixedSize(true)
|
||||||
_binding.list.layoutManager =
|
_binding.list.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
|
||||||
_binding.list.adapter = GeolocListAdapter(this, loc, pager)
|
_binding.list.adapter = GeolocListAdapter(this, loc, pager, holder)
|
||||||
return _binding.root
|
return _binding.root
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -17,8 +17,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||||||
findPreference<Preference>(getString(R.string.key_regional))?.setOnPreferenceChangeListener { _, key ->
|
findPreference<Preference>(getString(R.string.key_regional))?.setOnPreferenceChangeListener { _, key ->
|
||||||
when (key as String) {
|
when (key as String) {
|
||||||
ctx.getString(R.string.off) -> GeoLocImporter.clearStates()
|
ctx.getString(R.string.off) -> GeoLocImporter.clearStates()
|
||||||
ctx.getString(R.string.on) -> GeoLocImporter.importStates(ctx)
|
ctx.getString(R.string.on) -> GeoLocImporter.importStates(ctx, true)
|
||||||
else -> GeoLocImporter.clearStates()
|
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@@ -8,8 +8,6 @@ enum class Country(
|
|||||||
HKG("Hong Kong", 1104),
|
HKG("Hong Kong", 1104),
|
||||||
MAC("Macao", 32),
|
MAC("Macao", 32),
|
||||||
ANT("Netherlands Antilles", 800),
|
ANT("Netherlands Antilles", 800),
|
||||||
|
|
||||||
|
|
||||||
AFG("Afghanistan", 645487),
|
AFG("Afghanistan", 645487),
|
||||||
XAD("Akrotiri and Dhekelia", 234),
|
XAD("Akrotiri and Dhekelia", 234),
|
||||||
ALA("Åland", 1483),
|
ALA("Åland", 1483),
|
||||||
@@ -217,7 +215,7 @@ enum class Country(
|
|||||||
SLB("Solomon Islands", 28686),
|
SLB("Solomon Islands", 28686),
|
||||||
SOM("Somalia", 637672),
|
SOM("Somalia", 637672),
|
||||||
ZAF("South Africa", 1224059),
|
ZAF("South Africa", 1224059),
|
||||||
SGS("South Georgia and the South Sand", 4085),
|
SGS("South Georgia and the South Sandwich Islands", 4085),
|
||||||
KOR("South Korea", 100721),
|
KOR("South Korea", 100721),
|
||||||
SSD("South Sudan", 632186),
|
SSD("South Sudan", 632186),
|
||||||
ESP("Spain", 506617),
|
ESP("Spain", 506617),
|
||||||
@@ -248,7 +246,7 @@ enum class Country(
|
|||||||
ARE("United Arab Emirates", 71429),
|
ARE("United Arab Emirates", 71429),
|
||||||
GBR("United Kingdom", 244732),
|
GBR("United Kingdom", 244732),
|
||||||
USA("United States", 9477483),
|
USA("United States", 9477483),
|
||||||
UMI("United States Minor Outlying Isl", 47),
|
UMI("United States Minor Outlying Islands", 47),
|
||||||
URY("Uruguay", 178103),
|
URY("Uruguay", 178103),
|
||||||
UZB("Uzbekistan", 447894),
|
UZB("Uzbekistan", 447894),
|
||||||
VUT("Vanuatu", 12384),
|
VUT("Vanuatu", 12384),
|
||||||
|
@@ -7,8 +7,8 @@ import java.io.InputStreamReader
|
|||||||
|
|
||||||
object GeoLocImporter {
|
object GeoLocImporter {
|
||||||
|
|
||||||
fun importStates(ctx: Context) {
|
fun importStates(ctx: Context, force: Boolean = false) {
|
||||||
if (!Settings.isRegional(ctx)) {
|
if (!Settings.isRegional(ctx) and !force) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val fs = BufferedReader(InputStreamReader(ctx.assets.open("geoloc_state.txt")))
|
val fs = BufferedReader(InputStreamReader(ctx.assets.open("geoloc_state.txt")))
|
||||||
|
@@ -6,6 +6,8 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
|
|
||||||
EEE(
|
EEE(
|
||||||
"Europe", listOf(
|
"Europe", listOf(
|
||||||
|
XAD,
|
||||||
|
ALA,// Åland Islands: an autonomous region of Finland, but not a member of the EU or UN
|
||||||
ALB,
|
ALB,
|
||||||
AND,
|
AND,
|
||||||
AUT,
|
AUT,
|
||||||
@@ -18,14 +20,19 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
CZE,
|
CZE,
|
||||||
DNK,
|
DNK,
|
||||||
EST,
|
EST,
|
||||||
|
FRO, // Faroe Islands: an autonomous region of Denmark
|
||||||
FIN,
|
FIN,
|
||||||
FRA,
|
FRA,
|
||||||
DEU,
|
DEU,
|
||||||
|
GIB, // Gibraltar: a British overseas territory located at the southern tip of the Iberian Peninsula
|
||||||
GRC,
|
GRC,
|
||||||
|
GGY, // Guernsey: a British Crown dependency in the English Channel
|
||||||
HUN,
|
HUN,
|
||||||
ISL,
|
ISL,
|
||||||
IRL,
|
IRL,
|
||||||
|
IMN, // Isle of Man: a British Crown dependency located in the Irish Sea
|
||||||
ITA,
|
ITA,
|
||||||
|
JEY, // Jersey: a British Crown dependency located in the English Channel
|
||||||
KAZ,
|
KAZ,
|
||||||
XKO,
|
XKO,
|
||||||
LVA,
|
LVA,
|
||||||
@@ -48,12 +55,12 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
SVK,
|
SVK,
|
||||||
SVN,
|
SVN,
|
||||||
ESP,
|
ESP,
|
||||||
|
SJM, // Svalbard and Jan Mayen: an archipelago administered by Norway
|
||||||
SWE,
|
SWE,
|
||||||
CHE,
|
CHE,
|
||||||
UKR,
|
UKR,
|
||||||
GBR,
|
GBR,
|
||||||
VAT,
|
VAT,
|
||||||
XAD,
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
ABB(
|
ABB(
|
||||||
@@ -64,9 +71,12 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
BHR,
|
BHR,
|
||||||
BGD,
|
BGD,
|
||||||
BTN,
|
BTN,
|
||||||
|
IOT, // British Indian Ocean Territory: a British overseas territory in the Indian Ocean
|
||||||
BRN,
|
BRN,
|
||||||
KHM,
|
KHM,
|
||||||
|
CCK, // Cocos (Keeling) Islands: an Australian external territory in the Indian Ocean
|
||||||
CHN,
|
CHN,
|
||||||
|
CXR, // Christmas Island: an Australian external territory in the Indian Ocean
|
||||||
GEO,
|
GEO,
|
||||||
HKG,
|
HKG,
|
||||||
IND,
|
IND,
|
||||||
@@ -131,8 +141,8 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
EGY,
|
EGY,
|
||||||
GNQ,
|
GNQ,
|
||||||
ERI,
|
ERI,
|
||||||
SWZ,
|
|
||||||
ETH,
|
ETH,
|
||||||
|
ATF, // French Southern and Antarctic Lands: a territory of France located in the southern Indian Ocean
|
||||||
GAB,
|
GAB,
|
||||||
GMB,
|
GMB,
|
||||||
GHA,
|
GHA,
|
||||||
@@ -165,6 +175,7 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
SSD,
|
SSD,
|
||||||
SHN,
|
SHN,
|
||||||
SDN,
|
SDN,
|
||||||
|
SWZ,
|
||||||
TZA,
|
TZA,
|
||||||
TGO,
|
TGO,
|
||||||
TUN,
|
TUN,
|
||||||
@@ -184,9 +195,11 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
BRB,
|
BRB,
|
||||||
BLZ,
|
BLZ,
|
||||||
BMU,
|
BMU,
|
||||||
|
BES, // Bonaire, Sint Eustatius and Saba: special municipalities of the Netherlands in the Caribbean
|
||||||
VGB,
|
VGB,
|
||||||
CAN,
|
CAN,
|
||||||
CYM,
|
CYM,
|
||||||
|
XCL,
|
||||||
CRI,
|
CRI,
|
||||||
CUB,
|
CUB,
|
||||||
CUW,
|
CUW,
|
||||||
@@ -208,15 +221,18 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
NIC,
|
NIC,
|
||||||
PAN,
|
PAN,
|
||||||
PRI,
|
PRI,
|
||||||
|
BLM, // Saint Barthélemy: an overseas collectivity of France in the Caribbean
|
||||||
KNA,
|
KNA,
|
||||||
LCA,
|
LCA,
|
||||||
MAF,
|
MAF,
|
||||||
SPM,
|
SPM,
|
||||||
VCT,
|
VCT,
|
||||||
|
SXM, // Sint Maarten: a constituent country of the Kingdom of the Netherlands in the Caribbean
|
||||||
TTO,
|
TTO,
|
||||||
TCA,
|
TCA,
|
||||||
USA,
|
USA,
|
||||||
XCL,
|
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
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
SRR(
|
SRR(
|
||||||
@@ -257,6 +273,7 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
PLW,
|
PLW,
|
||||||
PNG,
|
PNG,
|
||||||
PCN,
|
PCN,
|
||||||
|
WSM, // Samoa: an independent island nation in the South Pacific
|
||||||
SLB,
|
SLB,
|
||||||
TKL,
|
TKL,
|
||||||
TON,
|
TON,
|
||||||
@@ -269,26 +286,9 @@ enum class Group(override val fullName: String, override val children: List<GeoL
|
|||||||
XXX(
|
XXX(
|
||||||
"Others", listOf(
|
"Others", listOf(
|
||||||
ATA, // Antarctica: not in any other region
|
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
|
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
|
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
|
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
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ fun loadData(ctx: Context, id:Int) {
|
|||||||
|
|
||||||
// Add default group "Visited" with app's color if there is no group already
|
// Add default group "Visited" with app's color if there is no group already
|
||||||
if (groups.size() == 0) {
|
if (groups.size() == 0) {
|
||||||
groups.setGroup(1, "Visited", ColorDrawable(ContextCompat.getColor(ctx, R.color.blue)))
|
groups.setGroup(DEFAULT_GROUP, "Visited", ColorDrawable(ContextCompat.getColor(ctx, R.color.blue)))
|
||||||
saveData()
|
saveData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,6 +13,10 @@ import kotlin.random.Random
|
|||||||
private const val randSeed = 0
|
private const val randSeed = 0
|
||||||
private val rnd = Random(randSeed)
|
private val rnd = Random(randSeed)
|
||||||
|
|
||||||
|
const val NO_GROUP = 0
|
||||||
|
const val DEFAULT_GROUP = 1
|
||||||
|
const val AUTO_GROUP = -1
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Groups(val id: Int, private val grps: HashMap<Int, Group>) {
|
class Groups(val id: Int, private val grps: HashMap<Int, Group>) {
|
||||||
|
|
||||||
@@ -30,7 +34,7 @@ class Groups(val id: Int, private val grps: HashMap<Int, Group>) {
|
|||||||
|
|
||||||
fun genKey(): Int {
|
fun genKey(): Int {
|
||||||
val key = rnd.nextInt()
|
val key = rnd.nextInt()
|
||||||
if (grps.containsKey(key) || key == 0) return genKey()
|
if (grps.containsKey(key) || key in listOf(NO_GROUP, DEFAULT_GROUP, AUTO_GROUP)) return genKey()
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ class Visits(val id: Int, private val locs: HashMap<String, Int>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getVisited(key: GeoLoc): Int {
|
fun getVisited(key: GeoLoc): Int {
|
||||||
return locs.getOrDefault(key.code, 0)
|
return getVisited(key.code)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getVisited(key: String): Int {
|
private fun getVisited(key: String): Int {
|
||||||
|
@@ -4,47 +4,55 @@ import android.content.Context
|
|||||||
import net.helcel.beans.countries.World
|
import net.helcel.beans.countries.World
|
||||||
import net.helcel.beans.helper.Data.groups
|
import net.helcel.beans.helper.Data.groups
|
||||||
import net.helcel.beans.helper.Data.visits
|
import net.helcel.beans.helper.Data.visits
|
||||||
|
import net.helcel.beans.helper.Settings
|
||||||
import net.helcel.beans.helper.Theme.colorToHex6
|
import net.helcel.beans.helper.Theme.colorToHex6
|
||||||
import net.helcel.beans.helper.Theme.colorWrapper
|
import net.helcel.beans.helper.Theme.colorWrapper
|
||||||
|
|
||||||
class CSSWrapper(ctx: Context) {
|
class CSSWrapper(private val ctx: Context) {
|
||||||
|
|
||||||
private val colorForeground: String =
|
private val colorForeground: String =
|
||||||
colorToHex6(colorWrapper(ctx, android.R.attr.panelColorBackground))
|
colorToHex6(colorWrapper(ctx, android.R.attr.panelColorBackground))
|
||||||
private val colorBackground: String =
|
private val colorBackground: String =
|
||||||
colorToHex6(colorWrapper(ctx, android.R.attr.colorBackground))
|
colorToHex6(colorWrapper(ctx, android.R.attr.colorBackground))
|
||||||
|
|
||||||
private val baseCSS: String
|
private val continents: String = World.WWW.children.joinToString(",") { "#${it.code}2" }
|
||||||
|
private val countries: String = World.WWW.children.joinToString(",") { itt ->
|
||||||
|
itt.children.joinToString(",") { "#${it.code}2" }
|
||||||
|
}
|
||||||
|
private val regional: String = World.WWW.children.joinToString(",") { itt ->
|
||||||
|
itt.children.joinToString(",") { "#${it.code}1" }
|
||||||
|
}
|
||||||
|
private val countryOnlyCSS: String =
|
||||||
|
"svg{fill:$colorForeground;stroke:$colorBackground;stroke-width:0.1;}" +
|
||||||
|
"${regional}{display:none;}"
|
||||||
|
private val countryRegionalCSS: String =
|
||||||
|
"svg{fill:$colorForeground;stroke:$colorBackground;stroke-width:0.01;}" +
|
||||||
|
"$continents,$countries{fill:none;stroke:$colorBackground;stroke-width:0.1;}"
|
||||||
private var customCSS: String = ""
|
private var customCSS: String = ""
|
||||||
|
|
||||||
init {
|
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:$colorBackground;stroke-width:0.1;fill:none}"
|
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refresh() {
|
private fun refresh() {
|
||||||
|
val id = if (Settings.isRegional(ctx)) "1" else "2"
|
||||||
customCSS = visits.getVisitedByValue().map { (k, v) ->
|
customCSS = visits.getVisitedByValue().map { (k, v) ->
|
||||||
if (groups.getGroupFromKey(k).key == 0)
|
if (groups.getGroupFromKey(k).key == 0)
|
||||||
""
|
""
|
||||||
else
|
else
|
||||||
v.joinToString(",") { "#${it}1,#${it}" } + "{fill:${
|
v.joinToString(",") { "#${it}$id,#${it}" } + "{fill:${
|
||||||
colorToHex6(
|
colorToHex6(groups.getGroupFromKey(k).color)
|
||||||
groups.getGroupFromKey(
|
|
||||||
k
|
|
||||||
).color
|
|
||||||
)
|
|
||||||
};}"
|
};}"
|
||||||
}.joinToString("")
|
}.joinToString("")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(): String {
|
fun get(): String {
|
||||||
refresh()
|
refresh()
|
||||||
return baseCSS + customCSS
|
return if (Settings.isRegional(ctx)) {
|
||||||
|
countryRegionalCSS + customCSS
|
||||||
|
} else {
|
||||||
|
countryOnlyCSS + customCSS
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
16
app/src/main/res/drawable/group.xml
Normal file
16
app/src/main/res/drawable/group.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<vector
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:width="24dp"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<path android:fillColor="?attr/colorOnBackground" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
|
||||||
|
|
||||||
|
<path android:fillColor="?attr/colorPrimary" android:pathData="M8,14m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
|
||||||
|
|
||||||
|
<path android:fillColor="?attr/colorPrimary" android:pathData="M12,8m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
|
||||||
|
|
||||||
|
<path android:fillColor="?attr/colorPrimary" android:pathData="M16,14m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"/>
|
||||||
|
|
||||||
|
</vector>
|
12
app/src/main/res/drawable/zoomin.xml
Normal file
12
app/src/main/res/drawable/zoomin.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<vector
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:width="24dp"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<path android:fillColor="?attr/colorOnBackground" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||||
|
|
||||||
|
<path android:fillColor="?attr/colorPrimary" android:pathData="M12,10h-2v2H9v-2H7V9h2V7h1v2h2v1z"/>
|
||||||
|
|
||||||
|
</vector>
|
@@ -4,23 +4,13 @@
|
|||||||
android:theme="@style/Theme.Beans">
|
android:theme="@style/Theme.Beans">
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:defaultValue="@string/off"
|
app:defaultValue="@string/system"
|
||||||
app:enabled="true"
|
app:enabled="true"
|
||||||
app:entries="@array/entries_onoff"
|
app:entries="@array/entries_theme"
|
||||||
app:entryValues="@array/entries_onoff"
|
app:entryValues="@array/entries_theme"
|
||||||
app:icon="@drawable/edit"
|
app:icon="@drawable/palette"
|
||||||
app:key="@string/key_group"
|
app:key="@string/key_theme"
|
||||||
app:title="@string/key_group"
|
app:title="@string/key_theme"
|
||||||
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" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
@@ -34,18 +24,30 @@
|
|||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:defaultValue="@string/system"
|
app:defaultValue="@string/off"
|
||||||
app:enabled="true"
|
app:enabled="true"
|
||||||
app:entries="@array/entries_theme"
|
app:allowDividerAbove="true"
|
||||||
app:entryValues="@array/entries_theme"
|
app:entries="@array/entries_onoff"
|
||||||
app:icon="@drawable/palette"
|
app:entryValues="@array/entries_onoff"
|
||||||
app:key="@string/key_theme"
|
app:icon="@drawable/group"
|
||||||
app:title="@string/key_theme"
|
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/zoomin"
|
||||||
|
app:key="@string/key_regional"
|
||||||
|
app:title="@string/key_regional"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:summary="@string/foss_licenses"
|
android:summary="@string/foss_licenses"
|
||||||
app:enabled="true"
|
app:enabled="true"
|
||||||
|
app:allowDividerAbove="true"
|
||||||
app:icon="@drawable/licenses"
|
app:icon="@drawable/licenses"
|
||||||
app:key="@string/licenses"
|
app:key="@string/licenses"
|
||||||
app:title="@string/licenses" />
|
app:title="@string/licenses" />
|
||||||
|
Reference in New Issue
Block a user