diff --git a/app/build.gradle b/app/build.gradle
index 6ed47e82..db40c685 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -105,6 +105,8 @@ dependencies {
implementation project(':about')
implementation project(':ui')
implementation project(':preferences')
+ implementation project(':themes')
+ implementation project(':purchases')
implementation project(':core')
googleImplementation project(':proprietary')
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b5ff9552..9b1771d9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -85,16 +85,6 @@
-
-
-
-
{
diff --git a/app/src/main/java/dev/lucasnlm/antimine/tutorial/view/TutorialLevelFragment.kt b/app/src/main/java/dev/lucasnlm/antimine/tutorial/view/TutorialLevelFragment.kt
index 12bfeb21..dcb72bd7 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/tutorial/view/TutorialLevelFragment.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/tutorial/view/TutorialLevelFragment.kt
@@ -12,8 +12,8 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.common.level.models.Event
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
-import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
+import dev.lucasnlm.antimine.ui.view.SpaceItemDecoration
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.tutorial.viewmodel.TutorialViewModel
diff --git a/app/src/main/java/dev/lucasnlm/antimine/tutorial/viewmodel/TutorialViewModel.kt b/app/src/main/java/dev/lucasnlm/antimine/tutorial/viewmodel/TutorialViewModel.kt
index 848c239a..f8bc640b 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/tutorial/viewmodel/TutorialViewModel.kt
+++ b/app/src/main/java/dev/lucasnlm/antimine/tutorial/viewmodel/TutorialViewModel.kt
@@ -2,8 +2,8 @@ package dev.lucasnlm.antimine.tutorial.viewmodel
import android.content.Context
import dev.lucasnlm.antimine.common.R
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
@@ -11,8 +11,8 @@ import dev.lucasnlm.antimine.common.level.repository.ITipRepository
import dev.lucasnlm.antimine.common.level.utils.Clock
import dev.lucasnlm.antimine.common.level.utils.IHapticFeedbackManager
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.external.IAnalyticsManager
+import dev.lucasnlm.antimine.core.models.Analytics
import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager
diff --git a/app/src/test/java/dev/lucasnlm/antimine/di/TestAppModule.kt b/app/src/test/java/dev/lucasnlm/antimine/di/TestAppModule.kt
index 29a4f57c..93e62a7e 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/di/TestAppModule.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/di/TestAppModule.kt
@@ -4,7 +4,7 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import dev.lucasnlm.antimine.core.analytics.DebugAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
+import dev.lucasnlm.external.IAnalyticsManager
import dev.lucasnlm.antimine.share.ShareManager
import dev.lucasnlm.external.Achievement
import dev.lucasnlm.external.IBillingManager
diff --git a/app/src/test/java/dev/lucasnlm/antimine/di/TestCommonModule.kt b/app/src/test/java/dev/lucasnlm/antimine/di/TestCommonModule.kt
index d1fd6b75..cbc4d4b6 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/di/TestCommonModule.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/di/TestCommonModule.kt
@@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.di
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager
import dev.lucasnlm.antimine.ui.model.AppTheme
diff --git a/app/src/test/java/dev/lucasnlm/antimine/history/HistoryViewModelTest.kt b/app/src/test/java/dev/lucasnlm/antimine/history/HistoryViewModelTest.kt
index c46d91ec..5d80a13e 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/history/HistoryViewModelTest.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/history/HistoryViewModelTest.kt
@@ -4,7 +4,7 @@ import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.common.level.database.models.FirstOpen
import dev.lucasnlm.antimine.common.level.database.models.Save
import dev.lucasnlm.antimine.common.level.database.models.SaveStatus
-import dev.lucasnlm.antimine.common.level.models.Difficulty
+import dev.lucasnlm.antimine.core.models.Difficulty
import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
import dev.lucasnlm.antimine.history.viewmodel.HistoryEvent
diff --git a/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedDimensionRepository.kt b/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedDimensionRepository.kt
index 8955e46c..58258d7e 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedDimensionRepository.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedDimensionRepository.kt
@@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.mocks
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
-import dev.lucasnlm.antimine.common.level.repository.Size
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
+import dev.lucasnlm.antimine.core.repository.Size
class FixedDimensionRepository : IDimensionRepository {
override fun areaSize(): Float = 50.0f
diff --git a/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedMinefieldRepository.kt b/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedMinefieldRepository.kt
index 5f0f20f3..28d67ed0 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedMinefieldRepository.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/mocks/FixedMinefieldRepository.kt
@@ -1,8 +1,8 @@
package dev.lucasnlm.antimine.mocks
-import dev.lucasnlm.antimine.common.level.models.Difficulty
+import dev.lucasnlm.antimine.core.models.Difficulty
import dev.lucasnlm.antimine.preferences.models.Minefield
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
diff --git a/app/src/test/java/dev/lucasnlm/antimine/stats/viewmodel/StatsViewModelTest.kt b/app/src/test/java/dev/lucasnlm/antimine/stats/viewmodel/StatsViewModelTest.kt
index 19d6b5f9..2a5ba159 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/stats/viewmodel/StatsViewModelTest.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/stats/viewmodel/StatsViewModelTest.kt
@@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.stats.viewmodel
import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.common.level.database.models.Stats
import dev.lucasnlm.antimine.preferences.models.Minefield
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.MemoryStatsRepository
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
diff --git a/app/src/test/java/dev/lucasnlm/antimine/theme/ThemeViewModelTest.kt b/app/src/test/java/dev/lucasnlm/antimine/theme/ThemeViewModelTest.kt
index 6aeef7eb..ef02eb3d 100644
--- a/app/src/test/java/dev/lucasnlm/antimine/theme/ThemeViewModelTest.kt
+++ b/app/src/test/java/dev/lucasnlm/antimine/theme/ThemeViewModelTest.kt
@@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.theme
import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.common.R
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
+import dev.lucasnlm.external.IAnalyticsManager
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.ui.model.AreaPalette
diff --git a/common/build.gradle b/common/build.gradle
index 4c383baf..8544a96e 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -38,6 +38,7 @@ dependencies {
// Dependencies must be hardcoded to support F-droid
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation project(':core')
implementation project(':external')
implementation project(':i18n')
implementation project(':preferences')
diff --git a/common/src/androidTest/java/dev/lucasnlm/antimine/view/common/level/view/AreaScreenshot.kt b/common/src/androidTest/java/dev/lucasnlm/antimine/view/common/level/view/AreaScreenshot.kt
index 6338079e..cac59ffc 100644
--- a/common/src/androidTest/java/dev/lucasnlm/antimine/view/common/level/view/AreaScreenshot.kt
+++ b/common/src/androidTest/java/dev/lucasnlm/antimine/view/common/level/view/AreaScreenshot.kt
@@ -6,10 +6,9 @@ import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import androidx.test.platform.app.InstrumentationRegistry
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.Mark
import dev.lucasnlm.antimine.common.level.view.AreaAdapter
-import dev.lucasnlm.antimine.common.level.view.paintOnCanvas
import dev.lucasnlm.antimine.ui.repository.Themes.LightTheme
import org.junit.Assert.assertTrue
import org.junit.Before
@@ -20,7 +19,7 @@ import java.io.FileOutputStream
class AreaScreenshot {
private lateinit var context: Context
- private fun saveImage(area: Area, fileName: String, ambientMode: Boolean): File {
+ private fun saveImage(area: dev.lucasnlm.antimine.core.models.Area, fileName: String, ambientMode: Boolean): File {
val paintSettings = AreaAdapter.createAreaPaintSettings(context, 128.0f, 3)
val size = paintSettings.rectF.width().toInt()
val testPadding = 4
@@ -73,7 +72,7 @@ class AreaScreenshot {
return result
}
- private fun screenshotTest(area: Area, fileName: String, ambientMode: Boolean = false) {
+ private fun screenshotTest(area: dev.lucasnlm.antimine.core.models.Area, fileName: String, ambientMode: Boolean = false) {
val current = saveImage(area, fileName, ambientMode)
assertTrue("$fileName doesn't match the reference", compareScreenshot(current, fileName))
}
@@ -85,25 +84,25 @@ class AreaScreenshot {
@Test
fun testCoveredArea() {
- val area = Area(0, 0, 0, isCovered = true)
+ val area = dev.lucasnlm.antimine.core.models.Area(0, 0, 0, isCovered = true)
screenshotTest(area, "covered.png")
}
@Test
fun testCoveredAreaAmbientMode() {
- val area = Area(0, 0, 0, isCovered = true)
+ val area = dev.lucasnlm.antimine.core.models.Area(0, 0, 0, isCovered = true)
screenshotTest(area, "covered_ambient.png", true)
}
@Test
fun testUncoveredArea() {
- val area = Area(0, 0, 0, isCovered = false)
+ val area = dev.lucasnlm.antimine.core.models.Area(0, 0, 0, isCovered = false)
screenshotTest(area, "uncovered.png")
}
@Test
fun testUncoveredAreaAmbientMode() {
- val area = Area(0, 0, 0, isCovered = false)
+ val area = dev.lucasnlm.antimine.core.models.Area(0, 0, 0, isCovered = false)
screenshotTest(area, "uncovered_ambient.png", ambientMode = true)
}
@@ -112,7 +111,7 @@ class AreaScreenshot {
repeat(8) {
val id = it + 1
screenshotTest(
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -129,7 +128,7 @@ class AreaScreenshot {
repeat(8) {
val id = it + 1
screenshotTest(
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -144,55 +143,55 @@ class AreaScreenshot {
@Test
fun testCoveredAreaWithFlag() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
isCovered = true,
- mark = Mark.Flag
+ mark = dev.lucasnlm.antimine.core.models.Mark.Flag
)
screenshotTest(area, "covered_flag.png")
}
@Test
fun testCoveredAreaWithFlagAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
isCovered = true,
- mark = Mark.Flag
+ mark = dev.lucasnlm.antimine.core.models.Mark.Flag
)
screenshotTest(area, "covered_flag_ambient.png", true)
}
@Test
fun testCoveredAreaWithQuestion() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
isCovered = true,
- mark = Mark.Question
+ mark = dev.lucasnlm.antimine.core.models.Mark.Question
)
screenshotTest(area, "covered_question.png")
}
@Test
fun testCoveredAreaWithQuestionAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
isCovered = true,
- mark = Mark.Question
+ mark = dev.lucasnlm.antimine.core.models.Mark.Question
)
screenshotTest(area, "covered_question_ambient.png", true)
}
@Test
fun testCoveredAreaHighlighted() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -204,7 +203,7 @@ class AreaScreenshot {
@Test
fun testCoveredAreaHighlightedAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -216,7 +215,7 @@ class AreaScreenshot {
@Test
fun testCoveredAreaWithMine() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -228,7 +227,7 @@ class AreaScreenshot {
@Test
fun testCoveredAreaWithMineAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -240,7 +239,7 @@ class AreaScreenshot {
@Test
fun testUncoveredAreaWithMine() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -252,7 +251,7 @@ class AreaScreenshot {
@Test
fun testUncoveredAreaWithMineAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -264,7 +263,7 @@ class AreaScreenshot {
@Test
fun testUncoveredAreaHighlighted() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -277,7 +276,7 @@ class AreaScreenshot {
@Test
fun testUncoveredAreaHighlightedAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -290,7 +289,7 @@ class AreaScreenshot {
@Test
fun testUncoveredAreaWithMineExploded() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -303,7 +302,7 @@ class AreaScreenshot {
@Test
fun testUncoveredAreaWithMineExplodedAmbient() {
- val area = Area(
+ val area = dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -319,7 +318,7 @@ class AreaScreenshot {
repeat(8) {
val id = it + 1
screenshotTest(
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
@@ -337,7 +336,7 @@ class AreaScreenshot {
repeat(8) {
val id = it + 1
screenshotTest(
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
0,
0,
0,
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/GameController.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/GameController.kt
index 4804683f..fe17eccb 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/GameController.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/GameController.kt
@@ -7,11 +7,11 @@ import dev.lucasnlm.antimine.common.level.database.models.Stats
import dev.lucasnlm.antimine.common.level.logic.FlagAssistant
import dev.lucasnlm.antimine.common.level.logic.MinefieldCreator
import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Difficulty
+import dev.lucasnlm.antimine.core.models.Area
import dev.lucasnlm.antimine.preferences.models.Minefield
-import dev.lucasnlm.antimine.common.level.models.Score
+import dev.lucasnlm.antimine.core.models.Score
import dev.lucasnlm.antimine.common.level.solver.LimitedBruteForceSolver
+import dev.lucasnlm.antimine.core.models.Difficulty
import dev.lucasnlm.antimine.preferences.models.ActionResponse
import dev.lucasnlm.antimine.preferences.models.GameControl
import kotlinx.coroutines.flow.flow
@@ -56,7 +56,7 @@ class GameController {
fun field() = field
- fun field(predicate: (Area) -> Boolean) = field.filter(predicate)
+ fun field(predicate: (dev.lucasnlm.antimine.core.models.Area) -> Boolean) = field.filter(predicate)
fun mines() = field.filter { it.hasMine }
@@ -77,7 +77,7 @@ class GameController {
firstOpen = FirstOpen.Position(safeId)
}
- private fun handleAction(target: Area, actionResponse: ActionResponse?) {
+ private fun handleAction(target: dev.lucasnlm.antimine.core.models.Area, actionResponse: ActionResponse?) {
val mustPlantMines = !hasMines()
val minefieldHandler: MinefieldHandler
@@ -175,7 +175,7 @@ class GameController {
}
}
- fun getScore() = Score(
+ fun getScore() = dev.lucasnlm.antimine.core.models.Score(
mines().count { !it.mistake && it.mark.isFlag() },
getMinesCount(),
field.count()
@@ -192,7 +192,7 @@ class GameController {
fun findExplodedMine() = mines().firstOrNull { it.mistake }
- fun takeExplosionRadius(target: Area): List =
+ fun takeExplosionRadius(target: dev.lucasnlm.antimine.core.models.Area): List =
mines().filter { it.isCovered && it.mark.isNone() }.sortedBy {
val dx1 = (it.posX - target.posX)
val dy1 = (it.posY - target.posY)
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverter.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverter.kt
index 1f7962b5..8fe73f33 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverter.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverter.kt
@@ -5,21 +5,21 @@ import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
-import dev.lucasnlm.antimine.common.level.models.Area
+import dev.lucasnlm.antimine.core.models.Area
import java.lang.reflect.Type
class AreaConverter {
private val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
- private val jsonAdapter: JsonAdapter>
+ private val jsonAdapter: JsonAdapter>
init {
- val type: Type = Types.newParameterizedType(List::class.java, Area::class.java)
+ val type: Type = Types.newParameterizedType(List::class.java, dev.lucasnlm.antimine.core.models.Area::class.java)
this.jsonAdapter = moshi.adapter(type)
}
@TypeConverter
- fun toAreaList(jsonInput: String): List = jsonAdapter.fromJson(jsonInput) ?: listOf()
+ fun toAreaList(jsonInput: String): List = jsonAdapter.fromJson(jsonInput) ?: listOf()
@TypeConverter
- fun toJsonString(field: List): String = jsonAdapter.toJson(field)
+ fun toJsonString(field: List): String = jsonAdapter.toJson(field)
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/DifficultyConverter.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/DifficultyConverter.kt
index 4e8cf85d..c7d43684 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/DifficultyConverter.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/database/converters/DifficultyConverter.kt
@@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.common.level.database.converters
import androidx.room.TypeConverter
-import dev.lucasnlm.antimine.common.level.models.Difficulty
+import dev.lucasnlm.antimine.core.models.Difficulty
class DifficultyConverter {
@TypeConverter
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/database/models/Save.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/database/models/Save.kt
index 38c6fe9c..b0165a3f 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/database/models/Save.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/database/models/Save.kt
@@ -4,12 +4,11 @@ import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.database.converters.AreaConverter
import dev.lucasnlm.antimine.common.level.database.converters.FirstOpenConverter
import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverter
+import dev.lucasnlm.antimine.core.models.Difficulty
@Entity
data class Save(
@@ -41,7 +40,7 @@ data class Save(
@TypeConverters(AreaConverter::class)
@ColumnInfo(name = "field")
- val field: List,
+ val field: List,
@ColumnInfo(name = "actions")
val actions: Int,
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/FlagAssistant.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/FlagAssistant.kt
index ae7b177e..f096ac71 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/FlagAssistant.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/FlagAssistant.kt
@@ -1,10 +1,10 @@
package dev.lucasnlm.antimine.common.level.logic
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.Mark
class FlagAssistant(
- private val field: MutableList,
+ private val field: MutableList,
) {
fun runFlagAssistant() {
// Must not select Mark.PurposefulNone, only Mark.None. Otherwise, it will flag
@@ -14,9 +14,9 @@ class FlagAssistant(
.forEach(::putFlagIfIsolated)
}
- fun result(): List = field.toList()
+ fun result(): List = field.toList()
- private fun putFlagIfIsolated(it: Area) {
+ private fun putFlagIfIsolated(it: dev.lucasnlm.antimine.core.models.Area) {
val neighbors = field.filterNeighborsOf(it)
val neighborsCount = neighbors.count()
val revealedNeighborsCount = neighbors.count { neighbor ->
@@ -24,7 +24,7 @@ class FlagAssistant(
}
if (revealedNeighborsCount == neighborsCount) {
- field[it.id] = it.copy(mark = Mark.Flag)
+ field[it.id] = it.copy(mark = dev.lucasnlm.antimine.core.models.Mark.Flag)
}
}
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldCreator.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldCreator.kt
index 47ed39c0..0e958d73 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldCreator.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldCreator.kt
@@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.logic
-import dev.lucasnlm.antimine.common.level.models.Area
+import dev.lucasnlm.antimine.core.models.Area
import dev.lucasnlm.antimine.preferences.models.Minefield
import kotlin.math.floor
import kotlin.random.Random
@@ -9,7 +9,7 @@ class MinefieldCreator(
private val minefield: Minefield,
private val randomGenerator: Random,
) {
- private fun createMutableEmpty(): List {
+ private fun createMutableEmpty(): List {
val width = minefield.width
val height = minefield.height
val fieldLength = width * height
@@ -17,7 +17,7 @@ class MinefieldCreator(
return (0 until fieldLength).map { index ->
val yPosition = floor((index / width).toDouble()).toInt()
val xPosition = (index % width)
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
index,
xPosition,
yPosition,
@@ -27,11 +27,11 @@ class MinefieldCreator(
}
}
- fun createEmpty(): List {
+ fun createEmpty(): List {
return createMutableEmpty()
}
- fun create(safeIndex: Int, safeZone: Boolean): List {
+ fun create(safeIndex: Int, safeZone: Boolean): List {
return createMutableEmpty().toMutableList().apply {
// Plant mines and setup number tips
if (safeZone) { filterNotNeighborsOf(safeIndex) } else { filterNot { it.id == safeIndex } }
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldExt.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldExt.kt
index b0566e98..1f5264ab 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldExt.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldExt.kt
@@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.logic
-import dev.lucasnlm.antimine.common.level.models.Area
+import dev.lucasnlm.antimine.core.models.Area
import kotlin.math.absoluteValue
fun List.withId(id: Int) = this.first { it.id == id }
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandler.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandler.kt
index c47af9af..df6c41a5 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandler.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandler.kt
@@ -1,20 +1,20 @@
package dev.lucasnlm.antimine.common.level.logic
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.Mark
class MinefieldHandler(
- private val field: MutableList,
+ private val field: MutableList,
private val useQuestionMark: Boolean,
) {
fun showAllMines() {
- field.filter { it.hasMine && it.mark != Mark.Flag }
+ field.filter { it.hasMine && it.mark != dev.lucasnlm.antimine.core.models.Mark.Flag }
.forEach { field[it.id] = it.copy(isCovered = false) }
}
fun flagAllMines() {
field.filter { it.hasMine }
- .forEach { field[it.id] = it.copy(mark = Mark.Flag) }
+ .forEach { field[it.id] = it.copy(mark = dev.lucasnlm.antimine.core.models.Mark.Flag) }
}
fun revealAllEmptyAreas() {
@@ -36,7 +36,7 @@ class MinefieldHandler(
fun removeMarkAt(index: Int) {
field.getOrNull(index)?.let {
- field[it.id] = it.copy(mark = Mark.PurposefulNone)
+ field[it.id] = it.copy(mark = dev.lucasnlm.antimine.core.models.Mark.PurposefulNone)
}
}
@@ -45,9 +45,9 @@ class MinefieldHandler(
if (it.isCovered) {
field[index] = it.copy(
mark = when (it.mark) {
- Mark.PurposefulNone, Mark.None -> Mark.Flag
- Mark.Flag -> if (useQuestionMark) Mark.Question else Mark.None
- Mark.Question -> Mark.None
+ dev.lucasnlm.antimine.core.models.Mark.PurposefulNone, dev.lucasnlm.antimine.core.models.Mark.None -> dev.lucasnlm.antimine.core.models.Mark.Flag
+ dev.lucasnlm.antimine.core.models.Mark.Flag -> if (useQuestionMark) dev.lucasnlm.antimine.core.models.Mark.Question else dev.lucasnlm.antimine.core.models.Mark.None
+ dev.lucasnlm.antimine.core.models.Mark.Question -> dev.lucasnlm.antimine.core.models.Mark.None
}
)
}
@@ -59,7 +59,7 @@ class MinefieldHandler(
if (isCovered) {
field[index] = copy(
isCovered = false,
- mark = Mark.None,
+ mark = dev.lucasnlm.antimine.core.models.Mark.None,
mistake = (!passive && hasMine) || (!hasMine && mark.isFlag())
)
@@ -111,5 +111,5 @@ class MinefieldHandler(
}
}
- fun result(): List = field.toList()
+ fun result(): List = field.toList()
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt
index 96ec0104..eb6d0ac1 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Status.kt
@@ -7,6 +7,6 @@ sealed class Status {
class Over(
val time: Long = 0L,
- val score: Score? = null,
+ val score: dev.lucasnlm.antimine.core.models.Score? = null,
) : Status()
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/repository/MinefieldRepository.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/repository/MinefieldRepository.kt
index ca46cc2f..3bac83bd 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/repository/MinefieldRepository.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/repository/MinefieldRepository.kt
@@ -1,6 +1,7 @@
package dev.lucasnlm.antimine.common.level.repository
-import dev.lucasnlm.antimine.common.level.models.Difficulty
+import dev.lucasnlm.antimine.core.models.Difficulty
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import kotlin.random.Random
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/BruteForceSolver.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/BruteForceSolver.kt
index 99838725..e875dfa1 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/BruteForceSolver.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/BruteForceSolver.kt
@@ -1,10 +1,10 @@
package dev.lucasnlm.antimine.common.level.solver
import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler
-import dev.lucasnlm.antimine.common.level.models.Area
+import dev.lucasnlm.antimine.core.models.Area
open class BruteForceSolver : GameSolver() {
- override fun trySolve(minefield: MutableList): Boolean {
+ override fun trySolve(minefield: MutableList): Boolean {
val minefieldHandler = MinefieldHandler(minefield, false)
do {
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/GameSolver.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/GameSolver.kt
index 5336a033..fa32d402 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/GameSolver.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/solver/GameSolver.kt
@@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.solver
-import dev.lucasnlm.antimine.common.level.models.Area
+import dev.lucasnlm.antimine.core.models.Area
abstract class GameSolver {
/**
@@ -12,5 +12,5 @@ abstract class GameSolver {
* Try solve the given [minefield].
* Returns true if it's solvable or false otherwise.
*/
- abstract fun trySolve(minefield: MutableList): Boolean
+ abstract fun trySolve(minefield: MutableList): Boolean
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaAdapter.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaAdapter.kt
index 361da2a7..a91fbf1a 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaAdapter.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaAdapter.kt
@@ -2,23 +2,21 @@ package dev.lucasnlm.antimine.common.level.view
import android.annotation.SuppressLint
import android.content.Context
-import android.graphics.Paint
-import android.graphics.RectF
-import android.graphics.Typeface
import android.util.Log
import android.view.GestureDetector
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import dev.lucasnlm.antimine.common.R
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.AreaPaintSettings
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
-import kotlinx.coroutines.GlobalScope
+import dev.lucasnlm.antimine.ui.view.AreaView
+import dev.lucasnlm.antimine.ui.view.createAreaPaintSettings
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
class AreaAdapter(
@@ -26,6 +24,7 @@ class AreaAdapter(
private val viewModel: GameViewModel,
private val preferencesRepository: IPreferencesRepository,
dimensionRepository: IDimensionRepository,
+ private val coroutineScope: CoroutineScope,
) : RecyclerView.Adapter() {
private var field = listOf()
@@ -70,7 +69,7 @@ class AreaAdapter(
}
clickEnabled -> {
requestFocus()
- GlobalScope.launch {
+ coroutineScope.launch {
action(position)
}
true
@@ -175,21 +174,5 @@ class AreaAdapter(
companion object {
val TAG = AreaAdapter::class.simpleName!!
-
- fun createAreaPaintSettings(context: Context, size: Float, squareRadius: Int): AreaPaintSettings {
- val resources = context.resources
- return AreaPaintSettings(
- Paint().apply {
- isAntiAlias = true
- isDither = true
- style = Paint.Style.FILL
- textSize = 18.0f * context.resources.displayMetrics.density
- typeface = Typeface.DEFAULT_BOLD
- textAlign = Paint.Align.CENTER
- },
- RectF(0.0f, 0.0f, size, size),
- resources.getDimension(R.dimen.field_radius) * squareRadius
- )
- }
}
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt
index 2bfcaea5..76e1ff20 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/view/CommonLevelFragment.kt
@@ -5,12 +5,13 @@ import android.os.Bundle
import android.view.View
import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment
+import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.RecyclerView
import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.preferences.models.Minefield
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.common.level.widget.FixedGridLayoutManager
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
@@ -21,7 +22,7 @@ abstract class CommonLevelFragment(@LayoutRes val contentLayoutId: Int) : Fragme
protected val dimensionRepository: IDimensionRepository by inject()
protected val gameViewModel by sharedViewModel()
protected val areaAdapter by lazy {
- AreaAdapter(requireContext(), gameViewModel, preferencesRepository, dimensionRepository)
+ AreaAdapter(requireContext(), gameViewModel, preferencesRepository, dimensionRepository, lifecycleScope)
}
protected lateinit var recyclerGrid: RecyclerView
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/viewmodel/GameViewModel.kt b/common/src/main/java/dev/lucasnlm/antimine/common/level/viewmodel/GameViewModel.kt
index 4c4ed092..569e9413 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/viewmodel/GameViewModel.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/common/level/viewmodel/GameViewModel.kt
@@ -7,19 +7,19 @@ import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.common.level.GameController
import dev.lucasnlm.antimine.common.level.database.models.FirstOpen
import dev.lucasnlm.antimine.common.level.database.models.Save
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Difficulty
+import dev.lucasnlm.antimine.core.models.Area
import dev.lucasnlm.antimine.common.level.models.Event
import dev.lucasnlm.antimine.preferences.models.Minefield
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
import dev.lucasnlm.antimine.common.level.repository.ITipRepository
import dev.lucasnlm.antimine.common.level.utils.Clock
import dev.lucasnlm.antimine.common.level.utils.IHapticFeedbackManager
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.external.IAnalyticsManager
+import dev.lucasnlm.antimine.core.models.Analytics
+import dev.lucasnlm.antimine.core.models.Difficulty
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager
import dev.lucasnlm.antimine.preferences.models.ActionResponse
@@ -59,7 +59,7 @@ open class GameViewModel(
private var initialized = false
private var currentDifficulty: Difficulty = Difficulty.Standard
- val field = MutableLiveData>()
+ val field = MutableLiveData>()
val elapsedTimeSeconds = MutableLiveData()
val mineCount = MutableLiveData()
val difficulty = MutableLiveData()
@@ -90,7 +90,7 @@ open class GameViewModel(
eventObserver.postValue(Event.StartNewGame)
analyticsManager.sentEvent(
- Analytics.NewGame(
+ dev.lucasnlm.antimine.core.models.Analytics.NewGame(
minefield,
newDifficulty,
gameController.seed,
@@ -123,7 +123,7 @@ open class GameViewModel(
}
saveId.postValue(save.uid.toLong())
- analyticsManager.sentEvent(Analytics.ResumePreviousGame)
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.ResumePreviousGame)
return setup
}
@@ -144,7 +144,7 @@ open class GameViewModel(
eventObserver.postValue(Event.ResumeGame)
analyticsManager.sentEvent(
- Analytics.RetryGame(
+ dev.lucasnlm.antimine.core.models.Analytics.RetryGame(
setup,
currentDifficulty,
gameController.seed,
@@ -310,19 +310,19 @@ open class GameViewModel(
private fun onFeedbackAnalytics(action: ActionResponse, index: Int) {
when (action) {
ActionResponse.OpenTile -> {
- analyticsManager.sentEvent(Analytics.OpenTile(index))
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.OpenTile(index))
}
ActionResponse.SwitchMark -> {
- analyticsManager.sentEvent(Analytics.SwitchMark(index))
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.SwitchMark(index))
}
ActionResponse.HighlightNeighbors -> {
- analyticsManager.sentEvent(Analytics.HighlightNeighbors(index))
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.HighlightNeighbors(index))
}
ActionResponse.OpenNeighbors -> {
- analyticsManager.sentEvent(Analytics.OpenNeighbors(index))
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.OpenNeighbors(index))
}
ActionResponse.OpenOrMark -> {
- analyticsManager.sentEvent(Analytics.OpenOrFlagTile(index))
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.OpenOrFlagTile(index))
}
}
}
@@ -430,7 +430,7 @@ open class GameViewModel(
suspend fun gameOver(fromResumeGame: Boolean) {
gameController.run {
- analyticsManager.sentEvent(Analytics.GameOver(clock.time(), getScore()))
+ analyticsManager.sentEvent(dev.lucasnlm.antimine.core.models.Analytics.GameOver(clock.time(), getScore()))
if (!fromResumeGame) {
if (preferencesRepository.useHapticFeedback()) {
@@ -473,7 +473,7 @@ open class GameViewModel(
fun victory() {
gameController.run {
analyticsManager.sentEvent(
- Analytics.Victory(
+ dev.lucasnlm.antimine.core.models.Analytics.Victory(
clock.time(),
getScore(),
currentDifficulty
diff --git a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/DebugAnalyticsManager.kt b/common/src/main/java/dev/lucasnlm/antimine/core/analytics/DebugAnalyticsManager.kt
index a26b9699..d8c02c94 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/DebugAnalyticsManager.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/core/analytics/DebugAnalyticsManager.kt
@@ -2,7 +2,8 @@ package dev.lucasnlm.antimine.core.analytics
import android.content.Context
import android.util.Log
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.antimine.core.models.Analytics
+import dev.lucasnlm.external.IAnalyticsManager
class DebugAnalyticsManager : IAnalyticsManager {
override fun setup(context: Context, properties: Map) {
@@ -11,7 +12,7 @@ class DebugAnalyticsManager : IAnalyticsManager {
}
}
- override fun sentEvent(event: Analytics) {
+ override fun sentEvent(event: dev.lucasnlm.antimine.core.models.Analytics) {
val message = if (event.extra.isNotEmpty()) {
"Sent event: '${event.name}' with ${event.extra}"
} else {
diff --git a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/ProdAnalyticsManager.kt b/common/src/main/java/dev/lucasnlm/antimine/core/analytics/ProdAnalyticsManager.kt
index eb96ba07..b79d7a3c 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/ProdAnalyticsManager.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/core/analytics/ProdAnalyticsManager.kt
@@ -1,7 +1,8 @@
package dev.lucasnlm.antimine.core.analytics
import android.content.Context
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.antimine.core.models.Analytics
+import dev.lucasnlm.external.IAnalyticsManager
import dev.lucasnlm.external.IExternalAnalyticsWrapper
class ProdAnalyticsManager(
@@ -11,7 +12,7 @@ class ProdAnalyticsManager(
analyticsWrapper.setup(context, properties)
}
- override fun sentEvent(event: Analytics) {
+ override fun sentEvent(event: dev.lucasnlm.antimine.core.models.Analytics) {
analyticsWrapper.sendEvent(event.name, event.extra)
}
}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/core/di/CommonModule.kt b/common/src/main/java/dev/lucasnlm/antimine/core/di/CommonModule.kt
index bbdc10f7..33a6b238 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/core/di/CommonModule.kt
+++ b/common/src/main/java/dev/lucasnlm/antimine/core/di/CommonModule.kt
@@ -1,8 +1,8 @@
package dev.lucasnlm.antimine.core.di
import android.view.ViewConfiguration
-import dev.lucasnlm.antimine.common.level.repository.DimensionRepository
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
+import dev.lucasnlm.antimine.core.repository.DimensionRepository
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.IPreferencesManager
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.preferences.PreferencesManager
diff --git a/common/src/test/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverterTest.kt b/common/src/test/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverterTest.kt
index cee5730f..baef12f3 100644
--- a/common/src/test/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverterTest.kt
+++ b/common/src/test/java/dev/lucasnlm/antimine/common/level/database/converters/AreaConverterTest.kt
@@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.common.level.database.converters
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.Mark
import org.junit.Test
import org.junit.Assert.assertEquals
@@ -66,39 +66,39 @@ class AreaConverterTest {
private val areaList =
listOf(
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
1, 2, 3, 5,
hasMine = false,
mistake = false,
isCovered = true,
- mark = Mark.None,
+ mark = dev.lucasnlm.antimine.core.models.Mark.None,
highlighted = true,
revealed = false,
),
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
2, 5, 3, 0,
hasMine = true,
mistake = true,
isCovered = false,
- mark = Mark.PurposefulNone,
+ mark = dev.lucasnlm.antimine.core.models.Mark.PurposefulNone,
highlighted = false,
revealed = false,
),
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
3, 1, 1, 3,
hasMine = true,
mistake = false,
isCovered = true,
- mark = Mark.Flag,
+ mark = dev.lucasnlm.antimine.core.models.Mark.Flag,
highlighted = true,
revealed = false,
),
- Area(
+ dev.lucasnlm.antimine.core.models.Area(
4, 0, 0, 6,
hasMine = false,
mistake = false,
isCovered = true,
- mark = Mark.Question,
+ mark = dev.lucasnlm.antimine.core.models.Mark.Question,
highlighted = true,
revealed = true,
)
diff --git a/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/GameControllerTest.kt b/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/GameControllerTest.kt
index e55c64fb..26ac0c67 100644
--- a/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/GameControllerTest.kt
+++ b/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/GameControllerTest.kt
@@ -1,9 +1,9 @@
package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.GameController
-import dev.lucasnlm.antimine.common.level.models.Area
+import dev.lucasnlm.antimine.core.models.Area
import dev.lucasnlm.antimine.preferences.models.Minefield
-import dev.lucasnlm.antimine.common.level.models.Score
+import dev.lucasnlm.antimine.core.models.Score
import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.control.GameControl
import kotlinx.coroutines.launch
@@ -39,7 +39,7 @@ class GameControllerTest {
@Test
fun testGetScore() = runBlockingTest {
withGameController { controller ->
- assertEquals(Score(0, 20, 100), controller.getScore())
+ assertEquals(dev.lucasnlm.antimine.core.models.Score(0, 20, 100), controller.getScore())
repeat(20) { markedMines ->
controller
@@ -51,7 +51,7 @@ class GameControllerTest {
controller.fakeLongPress(it.id)
}
- assertEquals(Score(markedMines, 20, 100), controller.getScore())
+ assertEquals(dev.lucasnlm.antimine.core.models.Score(markedMines, 20, 100), controller.getScore())
}
}
}
@@ -59,7 +59,7 @@ class GameControllerTest {
@Test
fun testGetScoreWithQuestion() = runBlockingTest {
withGameController { controller ->
- assertEquals(Score(0, 20, 100), controller.getScore())
+ assertEquals(dev.lucasnlm.antimine.core.models.Score(0, 20, 100), controller.getScore())
controller.useQuestionMark(true)
controller
@@ -71,7 +71,7 @@ class GameControllerTest {
controller.fakeLongPress(it.id)
}
- assertEquals(Score(0, 20, 100), controller.getScore())
+ assertEquals(dev.lucasnlm.antimine.core.models.Score(0, 20, 100), controller.getScore())
}
}
@@ -528,7 +528,7 @@ class GameControllerTest {
}
}
- private fun GameController.at(index: Int): Area {
+ private fun GameController.at(index: Int): dev.lucasnlm.antimine.core.models.Area {
return this.field().first { it.id == index }
}
diff --git a/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandlerTest.kt b/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandlerTest.kt
index 7d491687..0305ad7d 100644
--- a/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandlerTest.kt
+++ b/common/src/test/java/dev/lucasnlm/antimine/common/level/logic/MinefieldHandlerTest.kt
@@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.logic
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Mark
import dev.lucasnlm.antimine.preferences.models.Minefield
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -26,7 +26,7 @@ class MinefieldHandlerTest {
assertTrue(handler.result()[3].isCovered)
handler.openAt(3, false, openNeighbors = false)
assertFalse(handler.result()[3].isCovered)
- assertEquals(Mark.None, handler.result()[3].mark)
+ assertEquals(dev.lucasnlm.antimine.core.models.Mark.None, handler.result()[3].mark)
}
}
@@ -36,7 +36,7 @@ class MinefieldHandlerTest {
assertTrue(handler.result()[3].isCovered)
handler.openAt(3, false, openNeighbors = false)
assertFalse(handler.result()[3].isCovered)
- assertEquals(Mark.None, handler.result()[3].mark)
+ assertEquals(dev.lucasnlm.antimine.core.models.Mark.None, handler.result()[3].mark)
}
}
@@ -55,7 +55,7 @@ class MinefieldHandlerTest {
handler.switchMarkAt(3)
handler.removeMarkAt(3)
- assertTrue(handler.result()[3].mark == Mark.PurposefulNone)
+ assertTrue(handler.result()[3].mark == dev.lucasnlm.antimine.core.models.Mark.PurposefulNone)
assertTrue(handler.result()[3].mark.isNone())
}
}
diff --git a/core/build.gradle b/core/build.gradle
index e077eb32..44442a7c 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -34,6 +34,8 @@ android {
}
dependencies {
+ implementation project(':preferences')
+
// Kotlin
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10'
diff --git a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/models/Analytics.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/Analytics.kt
similarity index 95%
rename from common/src/main/java/dev/lucasnlm/antimine/core/analytics/models/Analytics.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/models/Analytics.kt
index 3b41fb21..5e480317 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/models/Analytics.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/Analytics.kt
@@ -1,7 +1,5 @@
-package dev.lucasnlm.antimine.core.analytics.models
+package dev.lucasnlm.antimine.core.models
-import dev.lucasnlm.antimine.common.level.models.Difficulty
-import dev.lucasnlm.antimine.common.level.models.Score
import dev.lucasnlm.antimine.preferences.models.Minefield
sealed class Analytics(
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Area.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt
similarity index 86%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/models/Area.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt
index 24c0057d..0bec23a3 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Area.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.models
+package dev.lucasnlm.antimine.core.models
data class Area(
val id: Int,
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/AreaPaintSettings.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/AreaPaintSettings.kt
similarity index 76%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/models/AreaPaintSettings.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/models/AreaPaintSettings.kt
index 6aab09ec..851308ba 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/AreaPaintSettings.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/AreaPaintSettings.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.models
+package dev.lucasnlm.antimine.core.models
import android.graphics.Paint
import android.graphics.RectF
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Difficulty.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/Difficulty.kt
similarity index 78%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/models/Difficulty.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/models/Difficulty.kt
index a25ed1f1..ec00517c 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Difficulty.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/Difficulty.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.models
+package dev.lucasnlm.antimine.core.models
enum class Difficulty(
val text: String,
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Mark.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/Mark.kt
similarity index 87%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/models/Mark.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/models/Mark.kt
index 248941c3..fb12e67d 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Mark.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/Mark.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.models
+package dev.lucasnlm.antimine.core.models
enum class Mark {
None,
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Score.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/Score.kt
similarity index 65%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/models/Score.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/models/Score.kt
index 17a5c395..4f794324 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/models/Score.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/Score.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.models
+package dev.lucasnlm.antimine.core.models
data class Score(
val rightMines: Int,
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/repository/DimensionRepository.kt b/core/src/main/java/dev/lucasnlm/antimine/core/repository/DimensionRepository.kt
similarity index 96%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/repository/DimensionRepository.kt
rename to core/src/main/java/dev/lucasnlm/antimine/core/repository/DimensionRepository.kt
index 403ea2f6..c92b901e 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/repository/DimensionRepository.kt
+++ b/core/src/main/java/dev/lucasnlm/antimine/core/repository/DimensionRepository.kt
@@ -1,9 +1,9 @@
-package dev.lucasnlm.antimine.common.level.repository
+package dev.lucasnlm.antimine.core.repository
import android.content.Context
import android.content.res.Resources
import android.content.res.TypedArray
-import dev.lucasnlm.antimine.common.R
+import dev.lucasnlm.antimine.core.R
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
interface IDimensionRepository {
diff --git a/common/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml
similarity index 100%
rename from common/src/main/res/values/dimens.xml
rename to core/src/main/res/values/dimens.xml
diff --git a/external/build.gradle b/external/build.gradle
index 105d135a..3110b80c 100644
--- a/external/build.gradle
+++ b/external/build.gradle
@@ -33,7 +33,7 @@ android {
dependencies {
// Dependencies must be hardcoded to support F-droid
- implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation project(':core')
// Kotlin
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
diff --git a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/IAnalyticsManager.kt b/external/src/main/java/dev/lucasnlm/external/IAnalyticsManager.kt
similarity index 61%
rename from common/src/main/java/dev/lucasnlm/antimine/core/analytics/IAnalyticsManager.kt
rename to external/src/main/java/dev/lucasnlm/external/IAnalyticsManager.kt
index b50d19aa..732f1e17 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/core/analytics/IAnalyticsManager.kt
+++ b/external/src/main/java/dev/lucasnlm/external/IAnalyticsManager.kt
@@ -1,7 +1,7 @@
-package dev.lucasnlm.antimine.core.analytics
+package dev.lucasnlm.external
import android.content.Context
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.antimine.core.models.Analytics
interface IAnalyticsManager {
fun setup(context: Context, properties: Map)
diff --git a/purchases/.gitignore b/purchases/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/purchases/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/purchases/build.gradle b/purchases/build.gradle
new file mode 100644
index 00000000..29d20940
--- /dev/null
+++ b/purchases/build.gradle
@@ -0,0 +1,76 @@
+plugins {
+ id 'com.android.library'
+ id 'kotlin-android'
+}
+
+android {
+ compileSdkVersion 30
+
+ defaultConfig {
+ minSdkVersion 21
+ targetSdkVersion 30
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+}
+
+dependencies {
+ implementation project(':core')
+ implementation project(':i18n')
+ implementation project(':preferences')
+ implementation project(':ui')
+ implementation project(':external')
+
+ // AndroidX
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.activity:activity-ktx:1.1.0'
+ implementation 'androidx.fragment:fragment-ktx:1.2.5'
+
+ // RecyclerView
+ implementation 'androidx.recyclerview:recyclerview:1.2.0-beta01'
+
+ // Constraint
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+
+ // Lifecycle
+ api 'android.arch.lifecycle:extensions:1.1.1'
+ implementation 'android.arch.lifecycle:viewmodel:1.1.1'
+
+ // Koin
+ implementation 'org.koin:koin-android:2.2.1'
+ implementation 'org.koin:koin-androidx-viewmodel:2.2.1'
+ testImplementation 'org.koin:koin-test:2.2.1'
+
+ // Coroutines
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.2'
+
+ // Kotlin Lib
+ implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10'
+
+ // Unit Tests
+ testImplementation 'junit:junit:4.13.1'
+ testImplementation 'org.mockito:mockito-core:2.24.0'
+ testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
+ testImplementation "io.mockk:mockk:1.10.3"
+}
\ No newline at end of file
diff --git a/purchases/consumer-rules.pro b/purchases/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
diff --git a/purchases/proguard-rules.pro b/purchases/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/purchases/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/purchases/src/androidTest/java/dev/lucasnlm/antimine/purchases/ExampleInstrumentedTest.kt b/purchases/src/androidTest/java/dev/lucasnlm/antimine/purchases/ExampleInstrumentedTest.kt
new file mode 100644
index 00000000..0fc0a75d
--- /dev/null
+++ b/purchases/src/androidTest/java/dev/lucasnlm/antimine/purchases/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package dev.lucasnlm.antimine.purchases
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("dev.lucasnlm.antimine.purchases.test", appContext.packageName)
+ }
+}
diff --git a/purchases/src/main/AndroidManifest.xml b/purchases/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..b9ec08e8
--- /dev/null
+++ b/purchases/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/dev/lucasnlm/antimine/support/SupportAppDialogFragment.kt b/purchases/src/main/java/dev/lucasnlm/antimine/purchases/SupportAppDialogFragment.kt
similarity index 95%
rename from app/src/main/java/dev/lucasnlm/antimine/support/SupportAppDialogFragment.kt
rename to purchases/src/main/java/dev/lucasnlm/antimine/purchases/SupportAppDialogFragment.kt
index e4b7e70a..4768b900 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/support/SupportAppDialogFragment.kt
+++ b/purchases/src/main/java/dev/lucasnlm/antimine/purchases/SupportAppDialogFragment.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.support
+package dev.lucasnlm.antimine.purchases
import android.annotation.SuppressLint
import android.app.Dialog
@@ -11,14 +11,13 @@ import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.lifecycle.lifecycleScope
-import dev.lucasnlm.antimine.R
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.external.IAnalyticsManager
+import dev.lucasnlm.antimine.core.models.Analytics
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.external.Ads
import dev.lucasnlm.external.IAdsManager
import dev.lucasnlm.external.IBillingManager
-import dev.lucasnlm.external.InstantAppManager
+import dev.lucasnlm.external.IInstantAppManager
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
@@ -27,7 +26,7 @@ class SupportAppDialogFragment : AppCompatDialogFragment() {
private val analyticsManager: IAnalyticsManager by inject()
private val preferenceRepository: IPreferencesRepository by inject()
private val adsManager: IAdsManager by inject()
- private val instantAppManager: InstantAppManager by inject()
+ private val instantAppManager: IInstantAppManager by inject()
private lateinit var unlockMessage: String
private var targetThemeId: Long = -1L
@@ -43,7 +42,7 @@ class SupportAppDialogFragment : AppCompatDialogFragment() {
unlockMessage =
(arguments?.getString(UNLOCK_LABEL) ?: savedInstanceState?.getString(UNLOCK_LABEL))
- ?: getString(R.string.support_action)
+ ?: getString(R.string.support_action)
targetThemeId =
(arguments?.getLong(TARGET_THEME_ID, -1L)) ?: -1L
}
diff --git a/app/src/main/res/layout/dialog_payments.xml b/purchases/src/main/res/layout/dialog_payments.xml
similarity index 100%
rename from app/src/main/res/layout/dialog_payments.xml
rename to purchases/src/main/res/layout/dialog_payments.xml
diff --git a/purchases/src/test/java/dev/lucasnlm/antimine/purchases/ExampleUnitTest.kt b/purchases/src/test/java/dev/lucasnlm/antimine/purchases/ExampleUnitTest.kt
new file mode 100644
index 00000000..6d9b0d58
--- /dev/null
+++ b/purchases/src/test/java/dev/lucasnlm/antimine/purchases/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package dev.lucasnlm.antimine.purchases
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/settings.gradle b/settings.gradle
index e95c56da..0b3266ea 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,3 +7,5 @@ include ':ui'
include ':preferences'
include ':core'
include ':control'
+include ':themes'
+include ':purchases'
diff --git a/themes/.gitignore b/themes/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/themes/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/themes/build.gradle b/themes/build.gradle
new file mode 100644
index 00000000..5f1babaa
--- /dev/null
+++ b/themes/build.gradle
@@ -0,0 +1,78 @@
+plugins {
+ id 'com.android.library'
+ id 'kotlin-android'
+ id 'kotlin-android-extensions'
+}
+
+android {
+ compileSdkVersion 30
+
+ defaultConfig {
+ minSdkVersion 21
+ targetSdkVersion 30
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+}
+
+dependencies {
+ implementation project(':core')
+ implementation project(':external')
+ implementation project(':i18n')
+ implementation project(':preferences')
+ implementation project(':purchases')
+ implementation project(':ui')
+
+ // AndroidX
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.activity:activity-ktx:1.1.0'
+ implementation 'androidx.fragment:fragment-ktx:1.2.5'
+
+ // RecyclerView
+ implementation 'androidx.recyclerview:recyclerview:1.2.0-beta01'
+
+ // Constraint
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+
+ // Lifecycle
+ api 'android.arch.lifecycle:extensions:1.1.1'
+ implementation 'android.arch.lifecycle:viewmodel:1.1.1'
+
+ // Koin
+ implementation 'org.koin:koin-android:2.2.1'
+ implementation 'org.koin:koin-androidx-viewmodel:2.2.1'
+ testImplementation 'org.koin:koin-test:2.2.1'
+
+ // Coroutines
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
+ testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.2'
+
+ // Kotlin Lib
+ implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10'
+
+ // Unit Tests
+ testImplementation 'junit:junit:4.13.1'
+ testImplementation 'org.mockito:mockito-core:2.24.0'
+ testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
+ testImplementation "io.mockk:mockk:1.10.3"
+}
\ No newline at end of file
diff --git a/themes/consumer-rules.pro b/themes/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
diff --git a/themes/proguard-rules.pro b/themes/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/themes/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/themes/src/androidTest/java/dev/lucasnlm/antimine/themes/ExampleInstrumentedTest.kt b/themes/src/androidTest/java/dev/lucasnlm/antimine/themes/ExampleInstrumentedTest.kt
new file mode 100644
index 00000000..a8c1c7c7
--- /dev/null
+++ b/themes/src/androidTest/java/dev/lucasnlm/antimine/themes/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package dev.lucasnlm.antimine.themes
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("dev.lucasnlm.antimine.themes.test", appContext.packageName)
+ }
+}
diff --git a/themes/src/main/AndroidManifest.xml b/themes/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..c87ea118
--- /dev/null
+++ b/themes/src/main/AndroidManifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/dev/lucasnlm/antimine/theme/ThemeActivity.kt b/themes/src/main/java/dev/lucasnlm/antimine/themes/ThemeActivity.kt
similarity index 87%
rename from app/src/main/java/dev/lucasnlm/antimine/theme/ThemeActivity.kt
rename to themes/src/main/java/dev/lucasnlm/antimine/themes/ThemeActivity.kt
index 45b1b421..f7dab5a1 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/theme/ThemeActivity.kt
+++ b/themes/src/main/java/dev/lucasnlm/antimine/themes/ThemeActivity.kt
@@ -1,21 +1,20 @@
-package dev.lucasnlm.antimine.theme
+package dev.lucasnlm.antimine.themes
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
-import dev.lucasnlm.antimine.R
-import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
-import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration
+import dev.lucasnlm.antimine.core.cloud.CloudSaveManager
+import dev.lucasnlm.antimine.core.repository.IDimensionRepository
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
-import dev.lucasnlm.antimine.support.SupportAppDialogFragment
-import dev.lucasnlm.antimine.theme.view.ThemeAdapter
-import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent
-import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel
+import dev.lucasnlm.antimine.purchases.SupportAppDialogFragment
+import dev.lucasnlm.antimine.themes.view.ThemeAdapter
+import dev.lucasnlm.antimine.themes.viewmodel.ThemeEvent
+import dev.lucasnlm.antimine.themes.viewmodel.ThemeViewModel
import dev.lucasnlm.antimine.ui.ThematicActivity
+import dev.lucasnlm.antimine.ui.view.SpaceItemDecoration
import dev.lucasnlm.external.IBillingManager
-import kotlinx.android.synthetic.main.activity_game.*
import kotlinx.android.synthetic.main.activity_theme.*
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.singleOrNull
diff --git a/app/src/main/java/dev/lucasnlm/antimine/theme/view/ExampleField.kt b/themes/src/main/java/dev/lucasnlm/antimine/themes/view/ExampleField.kt
similarity index 92%
rename from app/src/main/java/dev/lucasnlm/antimine/theme/view/ExampleField.kt
rename to themes/src/main/java/dev/lucasnlm/antimine/themes/view/ExampleField.kt
index ad8020db..da5a460d 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/theme/view/ExampleField.kt
+++ b/themes/src/main/java/dev/lucasnlm/antimine/themes/view/ExampleField.kt
@@ -1,7 +1,7 @@
-package dev.lucasnlm.antimine.theme.view
+package dev.lucasnlm.antimine.themes.view
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.Mark
object ExampleField {
fun getField() = listOf(
diff --git a/app/src/main/java/dev/lucasnlm/antimine/theme/view/ThemeAdapter.kt b/themes/src/main/java/dev/lucasnlm/antimine/themes/view/ThemeAdapter.kt
similarity index 86%
rename from app/src/main/java/dev/lucasnlm/antimine/theme/view/ThemeAdapter.kt
rename to themes/src/main/java/dev/lucasnlm/antimine/themes/view/ThemeAdapter.kt
index 1147894a..542e58d4 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/theme/view/ThemeAdapter.kt
+++ b/themes/src/main/java/dev/lucasnlm/antimine/themes/view/ThemeAdapter.kt
@@ -1,18 +1,18 @@
-package dev.lucasnlm.antimine.theme.view
+package dev.lucasnlm.antimine.themes.view
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import dev.lucasnlm.antimine.R
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
-import dev.lucasnlm.antimine.common.level.view.AreaAdapter
-import dev.lucasnlm.antimine.common.level.view.AreaView
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.AreaPaintSettings
+import dev.lucasnlm.antimine.ui.view.createAreaPaintSettings
+import dev.lucasnlm.antimine.themes.R
import dev.lucasnlm.antimine.ui.model.AppTheme
-import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent
-import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel
+import dev.lucasnlm.antimine.themes.viewmodel.ThemeEvent
+import dev.lucasnlm.antimine.themes.viewmodel.ThemeViewModel
+import dev.lucasnlm.antimine.ui.view.AreaView
import kotlinx.android.synthetic.main.view_theme.view.*
class ThemeAdapter(
@@ -45,7 +45,7 @@ class ThemeAdapter(
override fun onBindViewHolder(holder: ThemeViewHolder, position: Int) {
val theme = themes[position]
- val paintSettings = AreaAdapter.createAreaPaintSettings(
+ val paintSettings = createAreaPaintSettings(
holder.itemView.context,
areaSize,
squareRadius
diff --git a/app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeEvent.kt b/themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeEvent.kt
similarity index 85%
rename from app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeEvent.kt
rename to themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeEvent.kt
index 96b33279..c8e307ae 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeEvent.kt
+++ b/themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeEvent.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.theme.viewmodel
+package dev.lucasnlm.antimine.themes.viewmodel
import dev.lucasnlm.antimine.ui.model.AppTheme
diff --git a/app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeState.kt b/themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeState.kt
similarity index 73%
rename from app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeState.kt
rename to themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeState.kt
index 0d2c7f7d..a2ba599f 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeState.kt
+++ b/themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeState.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.theme.viewmodel
+package dev.lucasnlm.antimine.themes.viewmodel
import dev.lucasnlm.antimine.ui.model.AppTheme
diff --git a/app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeViewModel.kt b/themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeViewModel.kt
similarity index 92%
rename from app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeViewModel.kt
rename to themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeViewModel.kt
index fe4cfde8..5cdb3122 100644
--- a/app/src/main/java/dev/lucasnlm/antimine/theme/viewmodel/ThemeViewModel.kt
+++ b/themes/src/main/java/dev/lucasnlm/antimine/themes/viewmodel/ThemeViewModel.kt
@@ -1,12 +1,12 @@
-package dev.lucasnlm.antimine.theme.viewmodel
+package dev.lucasnlm.antimine.themes.viewmodel
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.antimine.core.models.Analytics
import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.ui.repository.Themes
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
+import dev.lucasnlm.external.IAnalyticsManager
import dev.lucasnlm.external.IBillingManager
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
diff --git a/app/src/main/res/layout/activity_theme.xml b/themes/src/main/res/layout/activity_theme.xml
similarity index 100%
rename from app/src/main/res/layout/activity_theme.xml
rename to themes/src/main/res/layout/activity_theme.xml
diff --git a/app/src/main/res/layout/view_theme.xml b/themes/src/main/res/layout/view_theme.xml
similarity index 88%
rename from app/src/main/res/layout/view_theme.xml
rename to themes/src/main/res/layout/view_theme.xml
index b8087782..29e4bfd6 100644
--- a/app/src/main/res/layout/view_theme.xml
+++ b/themes/src/main/res/layout/view_theme.xml
@@ -21,14 +21,14 @@
android:layout_gravity="center"
android:columnCount="3">
-
-
-
-
-
-
-
-
-
+
diff --git a/themes/src/test/java/dev/lucasnlm/antimine/themes/ExampleUnitTest.kt b/themes/src/test/java/dev/lucasnlm/antimine/themes/ExampleUnitTest.kt
new file mode 100644
index 00000000..a21b1d93
--- /dev/null
+++ b/themes/src/test/java/dev/lucasnlm/antimine/themes/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package dev.lucasnlm.antimine.themes
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/ui/build.gradle b/ui/build.gradle
index 7662fbf0..addeba94 100644
--- a/ui/build.gradle
+++ b/ui/build.gradle
@@ -34,6 +34,8 @@ android {
}
dependencies {
+ implementation project(':core')
+ implementation project(':i18n')
implementation project(':preferences')
// AndroidX
@@ -41,6 +43,9 @@ dependencies {
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
+ // RecyclerView
+ implementation 'androidx.recyclerview:recyclerview:1.2.0-beta01'
+
// Constraint
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaPainter.kt b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/AreaPainter.kt
similarity index 96%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaPainter.kt
rename to ui/src/main/java/dev/lucasnlm/antimine/ui/view/AreaPainter.kt
index fbf528d7..7a797131 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaPainter.kt
+++ b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/AreaPainter.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.view
+package dev.lucasnlm.antimine.ui.view
import android.content.Context
import android.graphics.Canvas
@@ -6,10 +6,10 @@ import android.graphics.Paint
import android.graphics.Rect
import android.graphics.RectF
import androidx.core.content.ContextCompat
-import dev.lucasnlm.antimine.common.R
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.core.models.Area
+import dev.lucasnlm.antimine.core.models.AreaPaintSettings
+import dev.lucasnlm.antimine.core.models.Mark
+import dev.lucasnlm.antimine.ui.R
import dev.lucasnlm.antimine.ui.model.AppTheme
fun Area.paintOnCanvas(
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaView.kt b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/AreaView.kt
similarity index 87%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaView.kt
rename to ui/src/main/java/dev/lucasnlm/antimine/ui/view/AreaView.kt
index 5000ab5c..508bf197 100755
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/AreaView.kt
+++ b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/AreaView.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.view
+package dev.lucasnlm.antimine.ui.view
import android.annotation.SuppressLint
import android.content.Context
@@ -12,10 +12,7 @@ import android.view.MotionEvent
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
-import dev.lucasnlm.antimine.common.R
-import dev.lucasnlm.antimine.common.level.models.Area
-import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
-import dev.lucasnlm.antimine.common.level.models.Mark
+import dev.lucasnlm.antimine.ui.R
import dev.lucasnlm.antimine.ui.model.AppTheme
class AreaView : View {
@@ -23,8 +20,8 @@ class AreaView : View {
private var isAmbientMode: Boolean = false
private var isLowBitAmbient: Boolean = false
- private var area: Area? = null
- private lateinit var paintSettings: AreaPaintSettings
+ private var area: dev.lucasnlm.antimine.core.models.Area? = null
+ private lateinit var paintSettings: dev.lucasnlm.antimine.core.models.AreaPaintSettings
private lateinit var theme: AppTheme
private val gestureDetector: GestureDetector by lazy {
@@ -49,11 +46,11 @@ class AreaView : View {
}
fun bindField(
- area: Area,
+ area: dev.lucasnlm.antimine.core.models.Area,
theme: AppTheme,
isAmbientMode: Boolean,
isLowBitAmbient: Boolean,
- paintSettings: AreaPaintSettings
+ paintSettings: dev.lucasnlm.antimine.core.models.AreaPaintSettings
) {
this.paintSettings = paintSettings
@@ -87,12 +84,12 @@ class AreaView : View {
override fun onTouchEvent(event: MotionEvent?): Boolean =
gestureDetector.onTouchEvent(event) || super.onTouchEvent(event)
- private fun bindContentDescription(area: Area) {
+ private fun bindContentDescription(area: dev.lucasnlm.antimine.core.models.Area) {
contentDescription = when {
- area.mark == Mark.Flag -> {
+ area.mark == dev.lucasnlm.antimine.core.models.Mark.Flag -> {
context.getString(if (area.mistake) R.string.desc_wrongly_marked_area else R.string.desc_marked_area)
}
- area.mark == Mark.Question -> context.getString(R.string.desc_marked_area)
+ area.mark == dev.lucasnlm.antimine.core.models.Mark.Question -> context.getString(R.string.desc_marked_area)
area.isCovered -> context.getString(R.string.desc_convered_area)
!area.isCovered && area.minesAround > 0 -> area.minesAround.toString()
!area.isCovered && area.hasMine -> context.getString(R.string.exploded_mine)
diff --git a/ui/src/main/java/dev/lucasnlm/antimine/ui/view/CreateAreaPaintSettings.kt b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/CreateAreaPaintSettings.kt
new file mode 100644
index 00000000..cf71bacf
--- /dev/null
+++ b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/CreateAreaPaintSettings.kt
@@ -0,0 +1,24 @@
+package dev.lucasnlm.antimine.ui.view
+
+import android.content.Context
+import android.graphics.Paint
+import android.graphics.RectF
+import android.graphics.Typeface
+import dev.lucasnlm.antimine.core.R
+import dev.lucasnlm.antimine.core.models.AreaPaintSettings
+
+fun createAreaPaintSettings(context: Context, size: Float, squareRadius: Int): AreaPaintSettings {
+ val resources = context.resources
+ return AreaPaintSettings(
+ Paint().apply {
+ isAntiAlias = true
+ isDither = true
+ style = Paint.Style.FILL
+ textSize = 18.0f * context.resources.displayMetrics.density
+ typeface = Typeface.DEFAULT_BOLD
+ textAlign = Paint.Align.CENTER
+ },
+ RectF(0.0f, 0.0f, size, size),
+ resources.getDimension(R.dimen.field_radius) * squareRadius
+ )
+}
diff --git a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/SpaceItemDecoration.kt b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/SpaceItemDecoration.kt
similarity index 92%
rename from common/src/main/java/dev/lucasnlm/antimine/common/level/view/SpaceItemDecoration.kt
rename to ui/src/main/java/dev/lucasnlm/antimine/ui/view/SpaceItemDecoration.kt
index 6e718c3e..e84892ae 100644
--- a/common/src/main/java/dev/lucasnlm/antimine/common/level/view/SpaceItemDecoration.kt
+++ b/ui/src/main/java/dev/lucasnlm/antimine/ui/view/SpaceItemDecoration.kt
@@ -1,4 +1,4 @@
-package dev.lucasnlm.antimine.common.level.view
+package dev.lucasnlm.antimine.ui.view
import android.graphics.Rect
import android.view.View
diff --git a/wear/src/main/java/dev/lucasnlm/antimine/wear/MainApplication.kt b/wear/src/main/java/dev/lucasnlm/antimine/wear/MainApplication.kt
index a543b4dd..26f5c0b1 100644
--- a/wear/src/main/java/dev/lucasnlm/antimine/wear/MainApplication.kt
+++ b/wear/src/main/java/dev/lucasnlm/antimine/wear/MainApplication.kt
@@ -2,8 +2,8 @@ package dev.lucasnlm.antimine.wear
import android.app.Application
import dev.lucasnlm.antimine.common.level.di.LevelModule
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.models.Analytics
+import dev.lucasnlm.external.IAnalyticsManager
+import dev.lucasnlm.antimine.core.models.Analytics
import dev.lucasnlm.antimine.core.di.CommonModule
import dev.lucasnlm.antimine.wear.di.AppModule
import dev.lucasnlm.antimine.wear.di.ViewModelModule
diff --git a/wear/src/main/java/dev/lucasnlm/antimine/wear/WatchLevelFragment.kt b/wear/src/main/java/dev/lucasnlm/antimine/wear/WatchLevelFragment.kt
index 2ab8986b..0ad02972 100644
--- a/wear/src/main/java/dev/lucasnlm/antimine/wear/WatchLevelFragment.kt
+++ b/wear/src/main/java/dev/lucasnlm/antimine/wear/WatchLevelFragment.kt
@@ -8,7 +8,7 @@ import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.common.level.models.AmbientSettings
import dev.lucasnlm.antimine.common.level.models.Event
import dev.lucasnlm.antimine.common.level.view.CommonLevelFragment
-import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration
+import dev.lucasnlm.antimine.ui.view.SpaceItemDecoration
import dev.lucasnlm.antimine.common.level.widget.FixedGridLayoutManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
diff --git a/wear/src/main/java/dev/lucasnlm/antimine/wear/di/AppModule.kt b/wear/src/main/java/dev/lucasnlm/antimine/wear/di/AppModule.kt
index 4cdc1448..f8674924 100644
--- a/wear/src/main/java/dev/lucasnlm/antimine/wear/di/AppModule.kt
+++ b/wear/src/main/java/dev/lucasnlm/antimine/wear/di/AppModule.kt
@@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.wear.di
import dev.lucasnlm.antimine.common.BuildConfig
import dev.lucasnlm.antimine.core.analytics.DebugAnalyticsManager
-import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
+import dev.lucasnlm.external.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.ProdAnalyticsManager
import dev.lucasnlm.external.AdsManager
import dev.lucasnlm.external.BillingManager