From f57bd92d729d41c13b66a8b110d47152f35590ab Mon Sep 17 00:00:00 2001 From: AlinaStepanova Date: Sat, 30 Dec 2023 21:34:37 +0100 Subject: [PATCH 01/13] update dependencies --- .idea/deploymentTargetDropDown.xml | 30 ++++++++++++++---------- .idea/gradle.xml | 5 ++-- .idea/kotlinc.xml | 6 +++++ .idea/migrations.xml | 10 ++++++++ .idea/misc.xml | 2 +- app/build.gradle | 3 ++- app/src/main/AndroidManifest.xml | 3 +-- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 .idea/kotlinc.xml create mode 100644 .idea/migrations.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index c00d563..f51a409 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -1,17 +1,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index ce86a83..0897082 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,16 +4,15 @@ diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..ff9696e --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 1ea0cd8..6b043fd 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,7 +16,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index af84cd7..3499bca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,7 +20,7 @@ android { versionCode 8 versionName "8" vectorDrawables.useSupportLibrary = true - resConfigs "en", "uk", "ru" + resConfigs 'en', 'uk', 'ru' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { @@ -41,6 +41,7 @@ android { dataBinding { enabled = true } + namespace 'com.avs.sea.battle' } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4983ed6..d3463a3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/build.gradle b/build.gradle index e50e635..615c520 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:7.4.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 701b567..6af3199 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip From 148c3a8d1555a4e4d763b188c3b2e2f053af9aa3 Mon Sep 17 00:00:00 2001 From: AlinaStepanova Date: Sat, 30 Dec 2023 23:08:38 +0100 Subject: [PATCH 02/13] upgrade to sdk 33 --- .idea/compiler.xml | 2 +- .idea/kotlinc.xml | 2 +- .idea/misc.xml | 2 +- app/build.gradle | 20 ++++++++++++++------ build.gradle | 4 ++-- gradle.properties | 3 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..b589d56 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index ff9696e..fdf8d99 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 6b043fd..c69f4ce 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,7 +16,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 3499bca..dd7ae79 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,8 +2,6 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - apply plugin: 'kotlin-kapt' def keystorePropertiesFile = rootProject.file("keystore.properties") @@ -11,16 +9,16 @@ def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { - compileSdkVersion 32 + compileSdkVersion 33 buildToolsVersion '30.0.3' defaultConfig { applicationId "com.avs.sea.battle" minSdkVersion 19 - targetSdkVersion 32 + targetSdkVersion 33 versionCode 8 versionName "8" vectorDrawables.useSupportLibrary = true - resConfigs 'en', 'uk', 'ru' + resourceConfigurations += ['en', 'uk', 'ru'] testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { @@ -41,6 +39,16 @@ android { dataBinding { enabled = true } + buildFeatures { + viewBinding = true + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = '17' + } namespace 'com.avs.sea.battle' } @@ -48,7 +56,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.core:core-ktx:1.10.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.13.2' diff --git a/build.gradle b/build.gradle index 615c520..0659ab7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.7.0' + ext.kotlin_version = '1.9.0' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 23339e0..9e73ebc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,6 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6af3199..1fb451e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip From 07f3d23586e94a5c0ed1f6514dccb24885901afc Mon Sep 17 00:00:00 2001 From: AlinaStepanova Date: Sat, 30 Dec 2023 23:14:45 +0100 Subject: [PATCH 03/13] upgrade to sdk 34 --- app/build.gradle | 6 +++--- .../com/avs/sea/battle/views/ComputerSquareView.kt | 10 +++++----- .../java/com/avs/sea/battle/views/PersonSquareView.kt | 8 ++++---- .../main/java/com/avs/sea/battle/views/SquareView.kt | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dd7ae79..1e21455 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,12 +9,12 @@ def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { - compileSdkVersion 33 - buildToolsVersion '30.0.3' + compileSdk 34 + buildToolsVersion = '30.0.3' defaultConfig { applicationId "com.avs.sea.battle" minSdkVersion 19 - targetSdkVersion 33 + targetSdkVersion 34 versionCode 8 versionName "8" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/com/avs/sea/battle/views/ComputerSquareView.kt b/app/src/main/java/com/avs/sea/battle/views/ComputerSquareView.kt index 0fd3110..1c273ef 100644 --- a/app/src/main/java/com/avs/sea/battle/views/ComputerSquareView.kt +++ b/app/src/main/java/com/avs/sea/battle/views/ComputerSquareView.kt @@ -40,25 +40,25 @@ class ComputerSquareView : SquareView { setOnTouchListener(OnTouchListener(getCustomOnTouchListener())) } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) if (shipsCoordinates.isNotEmpty()) { for (ship in shipsCoordinates) { - canvas?.drawSquare(ship.y, ship.x, paintShipSquare) + canvas.drawSquare(ship.y, ship.x, paintShipSquare) } } if (dotsCoordinates.isNotEmpty()) { for (coordinate in dotsCoordinates) { - canvas?.drawDot(coordinate) + canvas.drawDot(coordinate) } } if (crossesCoordinates.isNotEmpty()) { for (cross in crossesCoordinates) { - canvas?.drawCross(cross.y, cross.x) + canvas.drawCross(cross.y, cross.x) } } if (selectedSquare != null) { - canvas?.drawSquare(selectedSquare!!.x, selectedSquare!!.y, paintSelected) + canvas.drawSquare(selectedSquare!!.x, selectedSquare!!.y, paintSelected) } } diff --git a/app/src/main/java/com/avs/sea/battle/views/PersonSquareView.kt b/app/src/main/java/com/avs/sea/battle/views/PersonSquareView.kt index 2057878..c04e8ed 100644 --- a/app/src/main/java/com/avs/sea/battle/views/PersonSquareView.kt +++ b/app/src/main/java/com/avs/sea/battle/views/PersonSquareView.kt @@ -30,21 +30,21 @@ class PersonSquareView : SquareView { crossesCoordinates = arrayListOf() } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) if (shipsCoordinates.isNotEmpty()) { for (ship in shipsCoordinates) { - canvas?.drawSquare(ship.y, ship.x, paintShipSquare) + canvas.drawSquare(ship.y, ship.x, paintShipSquare) } } if (dotsCoordinates.isNotEmpty()) { for (coordinate in dotsCoordinates) { - canvas?.drawDot(coordinate) + canvas.drawDot(coordinate) } } if (crossesCoordinates.isNotEmpty()) { for (cross in crossesCoordinates) { - canvas?.drawCross(cross.y, cross.x) + canvas.drawCross(cross.y, cross.x) } } } diff --git a/app/src/main/java/com/avs/sea/battle/views/SquareView.kt b/app/src/main/java/com/avs/sea/battle/views/SquareView.kt index 944e57a..e76be13 100644 --- a/app/src/main/java/com/avs/sea/battle/views/SquareView.kt +++ b/app/src/main/java/com/avs/sea/battle/views/SquareView.kt @@ -65,10 +65,10 @@ abstract class SquareView : View { screenWidth = MeasureSpec.getSize(widthMeasureSpec).toFloat() } - override fun onDraw(canvas: Canvas?) { + override fun onDraw(canvas: Canvas) { paint.color = Color.BLACK paint.strokeWidth = lineWidth - canvas?.let { + canvas.let { drawHorizontalLines(it) drawVerticalLines(it) } From fe4996efead257b50e32053ce8c1817de309c772 Mon Sep 17 00:00:00 2001 From: AlinaStepanova Date: Sat, 30 Dec 2023 23:40:47 +0100 Subject: [PATCH 04/13] upgrade dependencies --- app/build.gradle | 16 ++++++++-------- gradle.properties | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1e21455..24f6cca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,22 +55,22 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'androidx.core:core-ktx:1.10.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.core:core-ktx:1.12.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' testImplementation "org.mockito:mockito-core:3.3.0" - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0' - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1" + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2" kapt "com.android.databinding:compiler:3.1.4" implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - androidTestImplementation 'androidx.test:rules:1.4.0' + androidTestImplementation 'androidx.test:rules:1.5.0' implementation 'com.google.android.play:core:1.10.3' implementation 'com.google.android.play:core-ktx:1.8.1' } diff --git a/gradle.properties b/gradle.properties index 9e73ebc..95b9377 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,5 +20,5 @@ android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official android.defaults.buildfeatures.buildconfig=true -android.nonTransitiveRClass=false +android.nonTransitiveRClass=true android.nonFinalResIds=false From debcf0073c8838160f1408f06338ad223a317aa5 Mon Sep 17 00:00:00 2001 From: AlinaStepanova Date: Sun, 7 Jan 2024 21:37:25 +0100 Subject: [PATCH 05/13] start to implement dark theme --- .idea/deploymentTargetDropDown.xml | 4 ++-- .idea/misc.xml | 1 - app/build.gradle | 1 + app/src/main/java/com/avs/sea/battle/Utils.kt | 7 +++++++ .../java/com/avs/sea/battle/views/SquareView.kt | 14 +++++++++++--- app/src/main/res/drawable/square_background.xml | 4 ++-- app/src/main/res/layout-v21/activity_main.xml | 4 +--- app/src/main/res/values/styles.xml | 11 ++++++----- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index f51a409..551cab9 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -10,12 +10,12 @@ - + - + diff --git a/.idea/misc.xml b/.idea/misc.xml index c69f4ce..1180ed2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -