diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..a5845c0 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index fdf8d99..e805548 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/other.xml b/.idea/other.xml new file mode 100644 index 0000000..0d3a1fb --- /dev/null +++ b/.idea/other.xml @@ -0,0 +1,263 @@ + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 4f4ce21..8018ab4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,12 +10,11 @@ keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { compileSdk 34 - buildToolsVersion = '30.0.3' defaultConfig { applicationId "com.avs.sea.battle" - minSdkVersion 19 + minSdkVersion 21 targetSdkVersion 34 - versionCode 11 + versionCode 13 versionName "1.0.$versionCode" vectorDrawables.useSupportLibrary = true resourceConfigurations += ['en', 'uk', 'ru'] @@ -55,23 +54,23 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.core:core-ktx:1.12.0' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'androidx.core:core-ktx:1.13.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.google.android.material:material:1.11.0' + implementation 'com.google.android.material:material:1.12.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' testImplementation "org.mockito:mockito-core:3.3.0" - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.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" + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2" kapt "com.android.databinding:compiler:3.1.4" implementation 'androidx.lifecycle:lifecycle-extensions:2.2.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' + androidTestImplementation 'androidx.test:rules:1.6.1' + implementation 'com.google.android.play:review:2.0.1' + implementation 'com.google.android.play:review-ktx:2.0.1' } diff --git a/app/release/app-release.aab b/app/release/app-release.aab index 2cb6c51..b705c20 100644 Binary files a/app/release/app-release.aab and b/app/release/app-release.aab differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ac8935a..e8de0b0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,13 +5,14 @@ - @@ -21,8 +22,7 @@ + android:parentActivityName="com.avs.sea.battle.main.MainActivity" /> \ No newline at end of file diff --git a/app/src/main/java/com/avs/sea/battle/Constants.kt b/app/src/main/java/com/avs/sea/battle/Constants.kt index 14374d1..878586e 100644 --- a/app/src/main/java/com/avs/sea/battle/Constants.kt +++ b/app/src/main/java/com/avs/sea/battle/Constants.kt @@ -11,4 +11,4 @@ const val SHARE_INTENT_TYPE = "text/plain" const val DEV_NAME = "Alina Stepanova" const val PRIVACY_POLICY_URL = "https://alinastepanova.github.io/SeaBattle/" const val PLAY_MARKET_URL = "https://play.google.com/store/apps/details?id=$NAMESPACE" -val RECIPIENTS = arrayOf("alina.stepanova.work@gmail.com") +const val RECIPIENTS = "alina.stepanova.work@gmail.com" diff --git a/app/src/main/java/com/avs/sea/battle/Utils.kt b/app/src/main/java/com/avs/sea/battle/Utils.kt index a531f17..3f85295 100644 --- a/app/src/main/java/com/avs/sea/battle/Utils.kt +++ b/app/src/main/java/com/avs/sea/battle/Utils.kt @@ -1,32 +1,16 @@ package com.avs.sea.battle -import android.app.Activity import android.content.Context import android.content.Intent -import android.content.pm.ResolveInfo import android.content.res.Configuration -import android.graphics.Color import android.net.Uri -import java.util.* -fun openGmail(activity: Activity, email: Array, subject: String?): Intent { - val emailIntent = Intent(Intent.ACTION_SEND) - emailIntent.putExtra(Intent.EXTRA_EMAIL, email) - emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject) - emailIntent.type = "text/plain" - val pm = activity.packageManager - val matches = pm.queryIntentActivities(emailIntent, 0) - var best: ResolveInfo? = null - for (info in matches) { - if (info.activityInfo.packageName.endsWith(".gm") - || info.activityInfo.name.lowercase(Locale.getDefault()).contains("gmail") - ) best = info - } - if (best != null) emailIntent.setClassName( - best.activityInfo.packageName, - best.activityInfo.name - ) - return emailIntent +fun openGmail(email: String, subject: String?): Intent { + val intent = Intent(Intent.ACTION_SENDTO) + intent.setData(Uri.parse("mailto:")) + intent.putExtra(Intent.EXTRA_EMAIL, arrayOf(email)) + intent.putExtra(Intent.EXTRA_SUBJECT, subject) + return intent } fun getShareIntent(context: Context): Intent { diff --git a/app/src/main/java/com/avs/sea/battle/main/MainActivity.kt b/app/src/main/java/com/avs/sea/battle/main/MainActivity.kt index 9c84079..63534c7 100644 --- a/app/src/main/java/com/avs/sea/battle/main/MainActivity.kt +++ b/app/src/main/java/com/avs/sea/battle/main/MainActivity.kt @@ -150,7 +150,7 @@ class MainActivity : AppCompatActivity(), PopupMenu.OnMenuItemClickListener { val call = { startActivity( openGmail( - this, RECIPIENTS, + RECIPIENTS, resources.getString(R.string.app_name) ) ) @@ -187,9 +187,13 @@ class MainActivity : AppCompatActivity(), PopupMenu.OnMenuItemClickListener { val manager = ReviewManagerFactory.create(context) val request = manager.requestReviewFlow() request.addOnCompleteListener { - val flow = manager.launchReviewFlow(this, it.result) - flow.addOnCompleteListener { - Log.d("Review", "Review flow completed") + try { + val flow = manager.launchReviewFlow(this, it.result) + flow.addOnCompleteListener { + Log.d("Review", "Review flow completed") + } + } catch (e: Exception) { + Log.e("Review", "Error: ${e.message}") } } } diff --git a/app/src/main/java/com/avs/sea/battle/main/MainViewModel.kt b/app/src/main/java/com/avs/sea/battle/main/MainViewModel.kt index 9e7f5de..dd7f5ce 100644 --- a/app/src/main/java/com/avs/sea/battle/main/MainViewModel.kt +++ b/app/src/main/java/com/avs/sea/battle/main/MainViewModel.kt @@ -13,8 +13,8 @@ import kotlinx.coroutines.* class MainViewModel : ViewModel() { private lateinit var activePlayer: Player - private var _selectedByPersonCoordinate = MutableLiveData() - val selectedByPersonCoordinate: LiveData + private var _selectedByPersonCoordinate = MutableLiveData() + val selectedByPersonCoordinate: LiveData get() = _selectedByPersonCoordinate private var _selectedByComputerCoordinate = MutableLiveData() val selectedByComputerCoordinate: LiveData 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 fa811f9..a2aec8c 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 @@ -8,7 +8,6 @@ import android.graphics.Color import android.graphics.Paint import android.graphics.Path import android.util.AttributeSet -import android.util.Log import android.util.TypedValue import android.view.View import androidx.core.content.ContextCompat diff --git a/app/src/main/res/layout-land-v21/activity_main.xml b/app/src/main/res/layout-land-v21/activity_main.xml deleted file mode 100644 index 51d1344..0000000 --- a/app/src/main/res/layout-land-v21/activity_main.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 56e9be4..51d1344 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -141,6 +141,8 @@ style="?android:attr/progressBarStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:indeterminateTint="?attr/colorAccent" + android:indeterminateTintMode="src_in" android:visibility="invisible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/viewPerson" diff --git a/app/src/main/res/layout-v21/activity_main.xml b/app/src/main/res/layout-v21/activity_main.xml deleted file mode 100644 index 79876e1..0000000 --- a/app/src/main/res/layout-v21/activity_main.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4db1cf6..79876e1 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -41,10 +41,9 @@ android:paddingEnd="@dimen/dimen_10dp" android:singleLine="false" android:text="@string/status_welcome_text" - android:maxLines="2" + android:textSize="@dimen/text_size_16sp" android:layout_marginStart="@dimen/dimen_4dp" android:layout_marginEnd="@dimen/dimen_4dp" - android:textSize="@dimen/text_size_16sp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -147,6 +146,8 @@ style="?android:attr/progressBarStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:indeterminateTint="?attr/colorAccent" + android:indeterminateTintMode="src_in" android:visibility="invisible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/test/java/com/avs/sea/battle/main/ShotManagerTest.kt b/app/src/test/java/com/avs/sea/battle/main/ShotManagerTest.kt index b8230a1..478a8a2 100644 --- a/app/src/test/java/com/avs/sea/battle/main/ShotManagerTest.kt +++ b/app/src/test/java/com/avs/sea/battle/main/ShotManagerTest.kt @@ -1,15 +1,15 @@ package com.avs.sea.battle.main -import com.avs.sea.battle.TWO_DECK_SHIP_SIZE import com.avs.sea.battle.battle_field.Cell import com.avs.sea.battle.battle_field.CellState import com.avs.sea.battle.battle_field.Coordinate import com.avs.sea.battle.ships.Orientation +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test -import org.junit.Assert.* - class ShotManagerTest { private lateinit var shotManager: ShotManager diff --git a/app/src/test/java/com/avs/sea/battle/ships/ShipTest.kt b/app/src/test/java/com/avs/sea/battle/ships/ShipTest.kt index 616011f..5a759e1 100644 --- a/app/src/test/java/com/avs/sea/battle/ships/ShipTest.kt +++ b/app/src/test/java/com/avs/sea/battle/ships/ShipTest.kt @@ -40,7 +40,7 @@ class ShipTest { @Test fun getShipOrientation() { assertTrue(fourDeckShip.getShipOrientation().name.isNotEmpty()) - assertTrue(threeDeckShip.getShipOrientation() in Orientation.values()) + assertTrue(threeDeckShip.getShipOrientation() in Orientation.entries.toTypedArray()) } @Test diff --git a/build.gradle b/build.gradle index 1b9ed45..3d61811 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.9.0' + ext.kotlin_version = '1.9.20' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.2.1' + classpath 'com.android.tools.build:gradle:8.5.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 95b9377..0d290c2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,5 @@ 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=true android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1fb451e..cc129a6 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-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip diff --git a/index.html b/index.html index b146c37..14e9f3e 100644 --- a/index.html +++ b/index.html @@ -53,9 +53,8 @@

Privacy Policy

used by the app

+
  • Google Play Services (https://www.google.com/policies/privacy/) +

    Log Data