From 65be3526a61aaa00ac9a5c9e6c4e1dca0f31a78f Mon Sep 17 00:00:00 2001 From: soraefir Date: Thu, 4 Apr 2024 00:14:33 +0200 Subject: [PATCH] [m] Prepare Release --- .github/workflow/build.yml | 64 + .gitignore | 8 + app/build.gradle | 17 +- app/src/main/assets/aeqd01.svg | 4887 ----------------- app/src/main/assets/geoloc_state.txt | 8 +- .../net/helcel/beans/activity/EditActivity.kt | 19 +- .../net/helcel/beans/activity/MainActivity.kt | 75 +- .../activity/adapter/GeolocListAdapter.kt | 108 +- .../activity/adapter/GroupListAdapter.kt | 41 +- .../activity/fragment/EditGroupAddFragment.kt | 84 +- .../fragment/EditPlaceColorFragment.kt | 31 +- .../java/net/helcel/beans/helper/Groups.kt | 31 +- .../java/net/helcel/beans/helper/Settings.kt | 7 + .../java/net/helcel/beans/helper/Theme.kt | 20 +- .../java/net/helcel/beans/helper/Various.kt | 20 - app/src/main/res/drawable/delete.xml | 41 + app/src/main/res/layout/activity_edit.xml | 9 +- app/src/main/res/layout/activity_main.xml | 11 +- app/src/main/res/layout/activity_stat.xml | 8 +- app/src/main/res/layout/fragment_about.xml | 36 +- .../res/layout/fragment_edit_groups_add.xml | 28 +- .../main/res/layout/fragment_edit_places.xml | 4 +- .../layout/fragment_edit_places_colors.xml | 14 +- app/src/main/res/layout/fragment_license.xml | 3 +- app/src/main/res/layout/item_list_geoloc.xml | 91 +- app/src/main/res/layout/item_list_group.xml | 61 +- app/src/main/res/xml/fragment_settings.xml | 10 + 27 files changed, 468 insertions(+), 5268 deletions(-) create mode 100644 .github/workflow/build.yml delete mode 100644 app/src/main/assets/aeqd01.svg delete mode 100644 app/src/main/java/net/helcel/beans/helper/Various.kt create mode 100644 app/src/main/res/drawable/delete.xml diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml new file mode 100644 index 0000000..5e6754a --- /dev/null +++ b/.github/workflow/build.yml @@ -0,0 +1,64 @@ +#file: noinspection SpellCheckingInspection + +name: CI-Android APK + +env: + main_project_module: app + playstore_name: Beans + +on: + push: + branches: [ main ] + tags: + - '**' + pull_request: + branches: [ main ] + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: set up secrets + run: | + echo "${{ secrets.RELEASE_KEYSTORE }}" > keystore.asc + echo "${{ secrets.RELEASE_KEY}}" > key.asc + gpg -d --passphrase "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" --batch keystore.asc > app/keystore.properties + gpg -d --passphrase "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" --batch key.asc > app/key.jks + + - uses: gradle/wrapper-validation-action@v2 + + - name: create and checkout branch + if: github.event_name == 'pull_request' + env: + BRANCH: ${{ github.head_ref }} + run: git checkout -B "$BRANCH" + + - name: set up JDK + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: "temurin" + cache: 'gradle' + + - name: Build APK + run: ./gradlew assemble + + # - name: Upload APK + # uses: actions/upload-artifact@v4 + # with: + # name: app.apk + # path: app/build/outputs/apk/release/app-release.apk + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + app/build/outputs/apk/release/app-release.apk \ No newline at end of file diff --git a/.gitignore b/.gitignore index e71a708..c0850d2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,12 @@ temp/ .externalNativeBuild .cxx .yarn +app/build/ +app/debug/ +app/release/ +captures/ +.externalNativeBuild +.cxx local.properties +keystore.properties +key.jks \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d945616..ce23ded 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,15 +14,25 @@ android { minSdk 28 targetSdk 34 versionCode 1 - versionName "1.0" + versionName "0.1a" } + signingConfigs { + create("release") { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } + } + + buildTypes { release { minifyEnabled true shrinkResources false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.debug + signingConfig = signingConfigs.getByName("release") } } compileOptions { @@ -49,6 +59,9 @@ android { } } +aboutLibraries { + exclusionPatterns = [~"androidx.*", ~"com.google.android.*", ~"org.jetbrains.*"] +} dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4' diff --git a/app/src/main/assets/aeqd01.svg b/app/src/main/assets/aeqd01.svg deleted file mode 100644 index 3084fa1..0000000 --- a/app/src/main/assets/aeqd01.svg +++ /dev/null @@ -1,4887 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/assets/geoloc_state.txt b/app/src/main/assets/geoloc_state.txt index 3f0cc1d..d9a46ab 100644 --- a/app/src/main/assets/geoloc_state.txt +++ b/app/src/main/assets/geoloc_state.txt @@ -1291,7 +1291,7 @@ IRL_WD|IRL|Waterford|1857 IRL_WH|IRL|Westmeath|1835 IRL_WX|IRL|Wexford|2367 IRL_WW|IRL|Wicklow|2022 -IRL_CK|IRL|NA|7488 +IRL_CK|IRL|Cork|7488 IMN_AY|IMN|Ramsey|4 IMN_RU|IMN|Port Saint Mary|2 IMN_MC|IMN|Michael|34 @@ -1931,7 +1931,7 @@ MMR_SA|MMR|Sagaing|96034 MMR_SH|MMR|Shan|156514 MMR_TN|MMR|Tanintharyi|41535 MMR_YA|MMR|Yangon|9607 -NAM_KA|NAM|!Karas|161821 +NAM_KA|NAM|Karas|161821 NAM_ER|NAM|Erongo|63918 NAM_HA|NAM|Hardap|110185 NAM_OK|NAM|Kavango|48945 @@ -1968,7 +1968,7 @@ NLD_FL|NLD|Flevoland|1466 NLD_FR|NLD|Fryslân|3573 NLD_GE|NLD|Gelderland|5102 NLD_GR|NLD|Groningen|2370 -NLD_NA|NLD|NA|3143 +NLD_SH|NLD|Zuid-Holland|3143 NLD_LI|NLD|Limburg|2159 NLD_NB|NLD|Noord-Brabant|5082 NLD_NH|NLD|Noord-Holland|2872 @@ -3532,4 +3532,4 @@ Z05_UT|IND|Uttarakhand|259 Z09_UT|IND|Uttarakhand|987 Z06_JK|PAK|Azad Kashmir|13931 Z06_NA|PAK|Gilgit-Baltistan|68053 -NA_NA|GBR|NA|417 +GBR_EN|GBR|England|417 diff --git a/app/src/main/java/net/helcel/beans/activity/EditActivity.kt b/app/src/main/java/net/helcel/beans/activity/EditActivity.kt index 75094ab..525e339 100644 --- a/app/src/main/java/net/helcel/beans/activity/EditActivity.kt +++ b/app/src/main/java/net/helcel/beans/activity/EditActivity.kt @@ -4,36 +4,31 @@ 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.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.databinding.ActivityEditBinding import net.helcel.beans.helper.Theme.createActionBar class EditActivity : AppCompatActivity() { - private lateinit var viewPager: ViewPager2 - private lateinit var tabLayout: TabLayout + private lateinit var _binding: ActivityEditBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + _binding = ActivityEditBinding.inflate(layoutInflater) - setContentView(R.layout.activity_edit) + setContentView(_binding.root) createActionBar(this, getString(R.string.action_edit)) - - viewPager = findViewById(R.id.pager) - tabLayout = findViewById(R.id.tab) - - val adapter = ViewPagerAdapter(supportFragmentManager, lifecycle, viewPager) - viewPager.adapter = adapter + val adapter = ViewPagerAdapter(supportFragmentManager, lifecycle, _binding.pager) + _binding.pager.adapter = adapter adapter.addFragment(null, EditPlaceFragment(World.WWW, adapter)) - TabLayoutMediator(tabLayout, viewPager) { tab, position -> + TabLayoutMediator(_binding.tab, _binding.pager) { tab, position -> tab.text = adapter.getLabel(position) }.attach() diff --git a/app/src/main/java/net/helcel/beans/activity/MainActivity.kt b/app/src/main/java/net/helcel/beans/activity/MainActivity.kt index beed2b0..bb3a48e 100644 --- a/app/src/main/java/net/helcel/beans/activity/MainActivity.kt +++ b/app/src/main/java/net/helcel/beans/activity/MainActivity.kt @@ -4,15 +4,13 @@ import android.content.Intent import android.graphics.drawable.PictureDrawable import android.os.Bundle import android.view.Menu -import android.view.MenuInflater import android.view.MenuItem import androidx.appcompat.app.AppCompatActivity -import androidx.core.view.MenuProvider import com.caverock.androidsvg.RenderOptions -import com.github.chrisbanes.photoview.PhotoView import net.helcel.beans.R import net.helcel.beans.countries.GeoLocImporter -import net.helcel.beans.helper.Data.loadData +import net.helcel.beans.databinding.ActivityMainBinding +import net.helcel.beans.helper.Data import net.helcel.beans.helper.Settings import net.helcel.beans.helper.Theme.colorWrapper import net.helcel.beans.svg.CSSWrapper @@ -20,8 +18,7 @@ import net.helcel.beans.svg.SVGWrapper class MainActivity : AppCompatActivity() { - - private lateinit var photoView: PhotoView + private lateinit var _binding: ActivityMainBinding private lateinit var psvg: SVGWrapper private lateinit var css: CSSWrapper @@ -31,55 +28,36 @@ class MainActivity : AppCompatActivity() { super.onRestart() } + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.menu_main, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + val d = when (item.itemId) { + R.id.action_edit -> EditActivity::class.java + R.id.action_stats -> StatActivity::class.java + R.id.action_settings -> SettingsActivity::class.java + else -> throw Exception("Non Existent Menu Item") + } + startActivity(Intent(this@MainActivity, d)) + return true + } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - - // Create action bar + _binding = ActivityMainBinding.inflate(layoutInflater) + Settings.start(this) supportActionBar?.setBackgroundDrawable(colorWrapper(this, android.R.attr.colorPrimary)) - // restore app theme & settings upon startup - Settings.start(this) - // Create menu in action bar - addMenuProvider(object : MenuProvider { - override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { - menuInflater.inflate(R.menu.menu_main, menu) - } + setContentView(_binding.root) - override fun onMenuItemSelected(menuItem: MenuItem): Boolean { - return when (menuItem.itemId) { - R.id.action_edit -> { - 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 - } - } - } - - }) - - // Populate map from list of countries - setContentView(R.layout.activity_main) - - photoView = findViewById(R.id.photo_view) - photoView.minimumScale = 1f - photoView.maximumScale = 40f + _binding.photoView.minimumScale = 1f + _binding.photoView.maximumScale = 40f GeoLocImporter.importStates(this) - loadData(this, Int.MIN_VALUE) + Data.loadData(this, Int.MIN_VALUE) psvg = SVGWrapper(this) css = CSSWrapper(this) @@ -88,9 +66,8 @@ class MainActivity : AppCompatActivity() { private fun refreshMap() { val opt: RenderOptions = RenderOptions.create() - css.refresh() opt.css(css.get()) - photoView.setImageDrawable(PictureDrawable(psvg.get()?.renderToPicture(opt))) + _binding.photoView.setImageDrawable(PictureDrawable(psvg.get()?.renderToPicture(opt))) } } \ No newline at end of file diff --git a/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt b/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt index 717b0f4..47144e5 100644 --- a/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt +++ b/app/src/main/java/net/helcel/beans/activity/adapter/GeolocListAdapter.kt @@ -4,32 +4,30 @@ 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.databinding.ItemListGeolocBinding import net.helcel.beans.helper.Data 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 + private val ctx: EditPlaceFragment, private val l: GeoLoc, private val pager: ViewPagerAdapter ) : RecyclerView.Adapter() { - 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) + val binding = ItemListGeolocBinding.inflate( + LayoutInflater.from(viewGroup.context), + viewGroup, + false + ) + return FoldingListViewHolder(ctx.requireActivity(), binding) } override fun onBindViewHolder(holder: FoldingListViewHolder, position: Int) { @@ -46,56 +44,51 @@ class GeolocListAdapter( 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) + class FoldingListViewHolder( + private val ctx: FragmentActivity, + private val _binding: ItemListGeolocBinding + ) : RecyclerView.ViewHolder(_binding.root) { - private val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx) - private val statsPref = sharedPreferences.getString( - ctx.getString(R.string.key_stats), - ctx.getString(R.string.counters) - ) + private fun bindGroup(el: GeoLoc) { + val numerator = el.children.map { Data.visits.getVisited(it) != 0 }.count { it } + 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.backgroundTintList = ColorStateList.valueOf( + colorWrapper( + ctx, + android.R.attr.panelColorBackground + ).color + ).withAlpha(64) + } fun bind(el: GeoLoc) { - textView.text = el.fullName - if (el.shouldShowChildren(ctx)) { - textView.setTypeface(null, Typeface.BOLD) + _binding.textView.text = el.fullName + _binding.textView.backgroundTintList = + ColorStateList.valueOf(colorWrapper(ctx, android.R.attr.colorBackground).color) - val numerator = el.children.map { Data.visits.getVisited(it) != 0 }.count { it } - val denominator = el.children.size + if (el.shouldShowChildren(ctx)) + bindGroup(el) - 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) - } else { - textView.backgroundTintList = - ColorStateList.valueOf(colorWrapper(ctx, android.R.attr.colorBackground).color) - } refreshCheck(el) } fun addListeners(el: GeoLoc, expandLambda: () -> Boolean) { if (el.shouldShowChildren(ctx)) { - textView.setOnClickListener { expandLambda() } + _binding.textView.setOnClickListener { expandLambda() } } - checkBox.setOnClickListener { + _binding.checkBox.setOnClickListener { Data.selected_geoloc = el if (Data.groups.size() == 1 && Settings.isSingleGroup(ctx)) { - if (checkBox.isChecked) { + if (_binding.checkBox.isChecked) { // If one has just checked the box (assign unique group) Data.selected_group = Data.groups.getUniqueEntry() onColorDialogDismiss(false) @@ -129,21 +122,20 @@ class GeolocListAdapter( } private fun refreshCheck(geoLoc: GeoLoc) { - var col = Data.groups.getGroupFromKey(Data.visits.getVisited(geoLoc)).color.color - if (col == Color.TRANSPARENT) - col = Color.GRAY - checkBox.checkedState = + var col = Data.groups.getGroupFromKey(Data.visits.getVisited(geoLoc)).color + if (col.color == Color.TRANSPARENT) { + col = colorWrapper( + ctx, + android.R.attr.panelColorBackground + ) + 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 - checkBox.buttonTintList = ColorStateList( - arrayOf( - intArrayOf(-android.R.attr.state_checked), - intArrayOf(android.R.attr.state_checked) - ), - intArrayOf(col, col) - ) + _binding.checkBox.buttonTintList = ColorStateList.valueOf(col.color) } } diff --git a/app/src/main/java/net/helcel/beans/activity/adapter/GroupListAdapter.kt b/app/src/main/java/net/helcel/beans/activity/adapter/GroupListAdapter.kt index 09b2353..1f4806a 100644 --- a/app/src/main/java/net/helcel/beans/activity/adapter/GroupListAdapter.kt +++ b/app/src/main/java/net/helcel/beans/activity/adapter/GroupListAdapter.kt @@ -1,15 +1,12 @@ 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.databinding.ItemListGroupBinding import net.helcel.beans.helper.Data import net.helcel.beans.helper.Groups import net.helcel.beans.helper.Theme.getContrastColor @@ -20,9 +17,9 @@ class GroupListAdapter( ) : RecyclerView.Adapter() { 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) + val binding = + ItemListGroupBinding.inflate(LayoutInflater.from(parent.context), parent, false) + return GroupViewHolder(binding, activity, selectDialog) } override fun onBindViewHolder(holder: GroupViewHolder, pos: Int) { @@ -34,41 +31,39 @@ class GroupListAdapter( } inner class GroupViewHolder( - itemView: View, + private val _binding: ItemListGroupBinding, 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) + ) : RecyclerView.ViewHolder(_binding.root) { private lateinit var dialogFragment: EditGroupAddFragment fun bind(entry: Pair) { - color.text = entry.second.name + _binding.groupColor.text = entry.second.name dialogFragment = EditGroupAddFragment(entry.first, { val newEntry = Data.groups.getGroupFromKey(entry.first) - color.text = newEntry.name + _binding.groupColor.text = newEntry.name val newEntryColor = newEntry.color.color val contrastNewEntryColor = getContrastColor(newEntryColor) - color.setBackgroundColor(newEntryColor) - color.setTextColor(contrastNewEntryColor) - entries.setTextColor(contrastNewEntryColor) - entries.text = "0" + _binding.groupColor.setBackgroundColor(newEntryColor) + _binding.groupColor.setTextColor(contrastNewEntryColor) + _binding.name.setTextColor(contrastNewEntryColor) + _binding.name.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() + _binding.groupColor.setBackgroundColor(entryColor) + _binding.groupColor.setTextColor(contrastEntryColor) + _binding.name.setTextColor(contrastEntryColor) + _binding.name.text = Data.visits.countVisited(entry.first).toString() - color.setOnClickListener { + _binding.groupColor.setOnClickListener { Data.selected_group = entry.second selectDialog.dismiss() } - color.setOnLongClickListener { + _binding.groupColor.setOnLongClickListener { dialogFragment.show( activity.supportFragmentManager, "AddColorDialogFragment" diff --git a/app/src/main/java/net/helcel/beans/activity/fragment/EditGroupAddFragment.kt b/app/src/main/java/net/helcel/beans/activity/fragment/EditGroupAddFragment.kt index e687d08..83b64ff 100644 --- a/app/src/main/java/net/helcel/beans/activity/fragment/EditGroupAddFragment.kt +++ b/app/src/main/java/net/helcel/beans/activity/fragment/EditGroupAddFragment.kt @@ -7,8 +7,6 @@ import android.os.Bundle 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 @@ -17,6 +15,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.slider.Slider import com.google.android.material.textfield.TextInputEditText import net.helcel.beans.R +import net.helcel.beans.databinding.FragmentEditGroupsAddBinding import net.helcel.beans.helper.Data import net.helcel.beans.helper.Groups import net.helcel.beans.helper.Theme.colorToHex6 @@ -26,51 +25,28 @@ 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 - - private lateinit var colorView: View - - private lateinit var colorEditR: Slider - private lateinit var colorEditG: Slider - private lateinit var colorEditB: Slider - - private lateinit var btnDelete: AppCompatButton - private lateinit var btnCancel: AppCompatButton - private lateinit var btnOk: AppCompatButton +) : DialogFragment() { + private lateinit var _binding: FragmentEditGroupsAddBinding private val grp = Data.groups.getGroupFromKey(key) + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val builder = AlertDialog.Builder(requireActivity()) - val inflater = requireActivity().layoutInflater - val view: View = inflater.inflate(R.layout.fragment_edit_groups_add, null) + val builder = MaterialAlertDialogBuilder(requireContext()) + _binding = FragmentEditGroupsAddBinding.inflate(layoutInflater) - colorNameEditText = view.findViewById(R.id.group_name) - colorEditText = view.findViewById(R.id.group_color) - colorView = view.findViewById(R.id.colorView) - colorEditR = view.findViewById(R.id.colorR) - colorEditG = view.findViewById(R.id.colorG) - colorEditB = view.findViewById(R.id.colorB) + setupSlider(_binding.colorR, grp.color.color.red / 255F) + setupSlider(_binding.colorG, grp.color.color.green / 255F) + setupSlider(_binding.colorB, grp.color.color.blue / 255F) + setupText(_binding.groupColor, grp) - setupSlider(colorEditR, grp.color.color.red / 255F) - setupSlider(colorEditG, grp.color.color.green / 255F) - setupSlider(colorEditB, grp.color.color.blue / 255F) + _binding.colorView.background = ColorDrawable(grp.color.color) - setupText(colorEditText, grp) - - colorView.background = ColorDrawable(grp.color.color) - - 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 + _binding.btnDelete.visibility = View.INVISIBLE + _binding.btnDelete.isEnabled = false } - btnDelete.setOnClickListener { + _binding.btnDelete.setOnClickListener { MaterialAlertDialogBuilder(requireActivity()) .setMessage(R.string.delete_group) .setPositiveButton(android.R.string.ok) { _, _ -> @@ -87,9 +63,9 @@ class EditGroupAddFragment( .show() } - btnOk.setOnClickListener { - val name = colorNameEditText.text.toString() - val color = colorEditText.text.toString() + _binding.btnOk.setOnClickListener { + val name = _binding.groupName.text.toString() + val color = _binding.groupColor.text.toString() val key = (if (key != 0) key else Data.groups.genKey()) Data.groups.setGroup(key, name, ColorDrawable(Color.parseColor("#$color"))) Data.saveData() @@ -97,12 +73,12 @@ class EditGroupAddFragment( dialog?.dismiss() } - btnCancel.setOnClickListener { + _binding.btnCancel.setOnClickListener { dialog?.cancel() } - colorNameEditText.setText(grp.name) - builder.setView(view) + _binding.groupName.setText(grp.name) + builder.setView(_binding.root) return builder.create() } @@ -110,11 +86,11 @@ class EditGroupAddFragment( s.setText(colorToHex6(ColorDrawable(grp?.color?.color ?: 0)).substring(1)) s.addTextChangedListener( EditTextListener( - colorEditR, - colorEditG, - colorEditB, - colorEditText, - colorView + _binding.colorR, + _binding.colorG, + _binding.colorB, + _binding.groupColor, + _binding.colorView ) ) } @@ -125,11 +101,11 @@ class EditGroupAddFragment( s.value = v s.addOnChangeListener( SliderOnChangeListener( - colorEditR, - colorEditG, - colorEditB, - colorEditText, - colorView + _binding.colorR, + _binding.colorG, + _binding.colorB, + _binding.groupColor, + _binding.colorView ) ) } diff --git a/app/src/main/java/net/helcel/beans/activity/fragment/EditPlaceColorFragment.kt b/app/src/main/java/net/helcel/beans/activity/fragment/EditPlaceColorFragment.kt index 705631b..4621df0 100644 --- a/app/src/main/java/net/helcel/beans/activity/fragment/EditPlaceColorFragment.kt +++ b/app/src/main/java/net/helcel/beans/activity/fragment/EditPlaceColorFragment.kt @@ -3,48 +3,41 @@ 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 com.google.android.material.dialog.MaterialAlertDialogBuilder import net.helcel.beans.activity.adapter.GeolocListAdapter import net.helcel.beans.activity.adapter.GroupListAdapter +import net.helcel.beans.databinding.FragmentEditPlacesColorsBinding import net.helcel.beans.helper.Data class EditPlaceColorFragment(private val parent: GeolocListAdapter.FoldingListViewHolder) : DialogFragment() { + + private lateinit var _binding: FragmentEditPlacesColorsBinding 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 { + val builder = MaterialAlertDialogBuilder(requireContext()) + _binding = FragmentEditPlacesColorsBinding.inflate(layoutInflater) + _binding.btnAdd.setOnClickListener { EditGroupAddFragment(0, { listAdapt.notifyItemInserted(Data.groups.findGroupPos(it)) }, {}).show(requireActivity().supportFragmentManager, "AddColorDialogFragment") } - btnClear.setOnClickListener { + _binding.btnClear.setOnClickListener { clear = true dialog?.dismiss() } - val dialog = builder.setView(view).create() + val dialog = builder.setView(_binding.root).create() listAdapt = GroupListAdapter(requireActivity(), this) - list = view.findViewById(R.id.groups_color)!! - list.layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false) - list.adapter = listAdapt + _binding.groupsColor.layoutManager = + LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false) + _binding.groupsColor.adapter = listAdapt return dialog } diff --git a/app/src/main/java/net/helcel/beans/helper/Groups.kt b/app/src/main/java/net/helcel/beans/helper/Groups.kt index e0ce668..7f396bf 100644 --- a/app/src/main/java/net/helcel/beans/helper/Groups.kt +++ b/app/src/main/java/net/helcel/beans/helper/Groups.kt @@ -12,11 +12,12 @@ import kotlin.random.Random private const val randSeed = 0 private val rnd = Random(randSeed) + @Serializable -class Groups(val id: Int, private val grps: HashMap) { +class Groups(val id: Int, private val grps: HashMap) { fun setGroup(key: Int, name: String, col: ColorDrawable) { - grps[key] = Group(key,name,col) + grps[key] = Group(key, name, col) } fun deleteGroup(key: Int) { @@ -24,12 +25,12 @@ class Groups(val id: Int, private val grps: HashMap) { } fun getGroupFromKey(key: Int): Group { - return grps.getOrDefault(key,EmptyGroup()) + return grps.getOrDefault(key, EmptyGroup()) } fun genKey(): Int { val key = rnd.nextInt() - if(grps.containsKey(key) || key == 0) return genKey() + if (grps.containsKey(key) || key == 0) return genKey() return key } @@ -46,32 +47,38 @@ class Groups(val id: Int, private val grps: HashMap) { } } - fun getGroupFromPos(pos: Int): Pair { + fun getGroupFromPos(pos: Int): Pair { 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,"") + class EmptyGroup : Group(0, "") @Serializable - open class Group(val key: Int, val name: String, @Serializable(with = ColorDrawableSerializer::class) val color: ColorDrawable = ColorDrawable(Color.TRANSPARENT)) + open class Group( + val key: Int, + val name: String, + @Serializable(with = Theme.ColorDrawableSerializer::class) val color: ColorDrawable = ColorDrawable( + Color.TRANSPARENT + ) + ) @OptIn(ExperimentalSerializationApi::class) @Serializer(Groups::class) - class GroupsSerializer{ + class GroupsSerializer { val defaultValue: Groups - get() = Groups(Int.MIN_VALUE,hashMapOf()) + get() = Groups(Int.MIN_VALUE, hashMapOf()) fun readFrom(input: InputStream): Groups { - return Json.decodeFromString(serializer(),input.readBytes().decodeToString()) + return Json.decodeFromString(serializer(), input.readBytes().decodeToString()) } fun writeTo(t: Groups): String { - return Json.encodeToString(serializer(),t).encodeToByteArray().decodeToString() + return Json.encodeToString(serializer(), t).encodeToByteArray().decodeToString() } } diff --git a/app/src/main/java/net/helcel/beans/helper/Settings.kt b/app/src/main/java/net/helcel/beans/helper/Settings.kt index 090e641..d5fe22c 100644 --- a/app/src/main/java/net/helcel/beans/helper/Settings.kt +++ b/app/src/main/java/net/helcel/beans/helper/Settings.kt @@ -30,6 +30,13 @@ object Settings { ) } + fun getStatPref(ctx: Context): String? { + return sp.getString( + ctx.getString(R.string.key_stats), + ctx.getString(R.string.counters) + ) + } + private fun getBooleanValue(ctx: Context, key: String?): Boolean { return when (key) { ctx.getString(R.string.on) -> true diff --git a/app/src/main/java/net/helcel/beans/helper/Theme.kt b/app/src/main/java/net/helcel/beans/helper/Theme.kt index 97fed2b..5e2f014 100644 --- a/app/src/main/java/net/helcel/beans/helper/Theme.kt +++ b/app/src/main/java/net/helcel/beans/helper/Theme.kt @@ -6,6 +6,11 @@ import android.graphics.drawable.ColorDrawable import android.util.TypedValue import androidx.appcompat.app.AppCompatActivity import androidx.core.graphics.ColorUtils +import kotlinx.serialization.KSerializer +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder object Theme { fun colorWrapper(ctx: Context, res: Int): ColorDrawable { @@ -34,4 +39,17 @@ object Theme { val blackContrast = ColorUtils.calculateContrast(Color.BLACK, color) return if (whiteContrast > blackContrast) Color.WHITE else Color.BLACK } -} \ No newline at end of file + + object ColorDrawableSerializer : KSerializer { + override val descriptor = PrimitiveSerialDescriptor("ColorDrawable", PrimitiveKind.INT) + + override fun deserialize(decoder: Decoder): ColorDrawable { + return ColorDrawable(decoder.decodeInt()) + } + + override fun serialize(encoder: Encoder, value: ColorDrawable) { + encoder.encodeInt(value.color) + } + } + +} diff --git a/app/src/main/java/net/helcel/beans/helper/Various.kt b/app/src/main/java/net/helcel/beans/helper/Various.kt deleted file mode 100644 index 1e7c7ba..0000000 --- a/app/src/main/java/net/helcel/beans/helper/Various.kt +++ /dev/null @@ -1,20 +0,0 @@ -package net.helcel.beans.helper - -import android.graphics.drawable.ColorDrawable -import kotlinx.serialization.KSerializer -import kotlinx.serialization.descriptors.PrimitiveKind -import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor -import kotlinx.serialization.encoding.Decoder -import kotlinx.serialization.encoding.Encoder - -object ColorDrawableSerializer : KSerializer { - override val descriptor = PrimitiveSerialDescriptor("ColorDrawable", PrimitiveKind.INT) - - override fun deserialize(decoder: Decoder): ColorDrawable { - return ColorDrawable(decoder.decodeInt()) - } - - override fun serialize(encoder: Encoder, value: ColorDrawable) { - encoder.encodeInt(value.color) - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable/delete.xml b/app/src/main/res/drawable/delete.xml new file mode 100644 index 0000000..0684f8d --- /dev/null +++ b/app/src/main/res/drawable/delete.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index ecb4144..3cbd689 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -1,13 +1,16 @@ + tools:context=".activity.EditActivity"> + + android:layout_height="wrap_content" /> - - + tools:context=".activity.MainActivity"> + + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_stat.xml b/app/src/main/res/layout/activity_stat.xml index 5234ec1..f529571 100644 --- a/app/src/main/res/layout/activity_stat.xml +++ b/app/src/main/res/layout/activity_stat.xml @@ -1,13 +1,15 @@ + tools:context=".activity.StatActivity"> + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 308daf4..457ee05 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -9,9 +9,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" - android:orientation="vertical" > + android:orientation="vertical"> - - + android:textStyle="bold" /> - + android:textAlignment="center" + android:textSize="25sp" /> - - diff --git a/app/src/main/res/layout/fragment_edit_groups_add.xml b/app/src/main/res/layout/fragment_edit_groups_add.xml index 9f99736..ab39507 100644 --- a/app/src/main/res/layout/fragment_edit_groups_add.xml +++ b/app/src/main/res/layout/fragment_edit_groups_add.xml @@ -1,10 +1,12 @@ + android:padding="16dp" + tools:context=".activity.fragment.EditGroupAddFragment"> - - - + android:layout_height="match_parent" + tools:context=".activity.fragment.EditPlaceFragment"> + android:padding="4dp"> - - + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_list_geoloc.xml b/app/src/main/res/layout/item_list_geoloc.xml index 8972855..f04218b 100644 --- a/app/src/main/res/layout/item_list_geoloc.xml +++ b/app/src/main/res/layout/item_list_geoloc.xml @@ -1,57 +1,52 @@ - - + + app:cornerRadius="4dp" + app:layout_constraintBottom_toBottomOf="@id/checkBox" + app:layout_constraintEnd_toStartOf="@id/checkBox" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - + - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/item_list_group.xml b/app/src/main/res/layout/item_list_group.xml index 0d62230..6793698 100644 --- a/app/src/main/res/layout/item_list_group.xml +++ b/app/src/main/res/layout/item_list_group.xml @@ -1,41 +1,34 @@ - - + -