Extract code to other modules

This commit is contained in:
Lucas Lima 2020-12-31 15:01:51 -03:00 committed by Lucas Nunes
parent 108afb0842
commit 748ea2ba1e
149 changed files with 929 additions and 258 deletions

1
about/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

70
about/build.gradle Normal file
View file

@ -0,0 +1,70 @@
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(':i18n')
implementation project(':preferences')
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'
}

0
about/consumer-rules.pro Normal file
View file

21
about/proguard-rules.pro vendored Normal file
View file

@ -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

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.lucasnlm.antimine.about">
<application>
<activity
android:name="dev.lucasnlm.antimine.text.TextActivity"
android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="dev.lucasnlm.antimine.about.AboutActivity" />
</activity>
<activity
android:name="dev.lucasnlm.antimine.about.AboutActivity"
android:label="@string/about"
android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="dev.lucasnlm.antimine.GameActivity" />
</activity>
</application>
</manifest>

View file

@ -4,14 +4,12 @@ import android.os.Bundle
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.ui.ThematicActivity
import dev.lucasnlm.antimine.ThematicActivity
import dev.lucasnlm.antimine.about.viewmodel.AboutEvent import dev.lucasnlm.antimine.about.viewmodel.AboutEvent
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
import dev.lucasnlm.antimine.about.views.info.AboutInfoFragment import dev.lucasnlm.antimine.about.views.info.AboutInfoFragment
import dev.lucasnlm.antimine.about.views.licenses.LicensesFragment import dev.lucasnlm.antimine.about.views.licenses.LicensesFragment
import dev.lucasnlm.antimine.about.views.translators.TranslatorsFragment import dev.lucasnlm.antimine.about.views.translators.TranslatorsFragment
import dev.lucasnlm.antimine.support.SupportAppDialogFragment
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
@ -26,9 +24,6 @@ class AboutActivity : ThematicActivity(R.layout.activity_empty) {
lifecycleScope.launchWhenCreated { lifecycleScope.launchWhenCreated {
aboutViewModel.observeEvent().collect { event -> aboutViewModel.observeEvent().collect { event ->
when (event) { when (event) {
AboutEvent.SupportUs -> {
showSupportAppDialog()
}
AboutEvent.ThirdPartyLicenses -> { AboutEvent.ThirdPartyLicenses -> {
replaceFragment(LicensesFragment(), LicensesFragment.TAG) replaceFragment(LicensesFragment(), LicensesFragment.TAG)
} }
@ -50,11 +45,4 @@ class AboutActivity : ThematicActivity(R.layout.activity_empty) {
replace(R.id.content, fragment) replace(R.id.content, fragment)
}.commitAllowingStateLoss() }.commitAllowingStateLoss()
} }
private fun showSupportAppDialog() {
if (supportFragmentManager.findFragmentByTag(SupportAppDialogFragment.TAG) == null) {
SupportAppDialogFragment.newRequestSupportDialog(applicationContext)
.show(supportFragmentManager, SupportAppDialogFragment.TAG)
}
}
} }

View file

@ -1,7 +1,6 @@
package dev.lucasnlm.antimine.about.viewmodel package dev.lucasnlm.antimine.about.viewmodel
enum class AboutEvent { enum class AboutEvent {
SupportUs,
ThirdPartyLicenses, ThirdPartyLicenses,
SourceCode, SourceCode,
Translators, Translators,

View file

@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.about.viewmodel
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
class AboutViewModel( class AboutViewModel(

View file

@ -5,20 +5,15 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import dev.lucasnlm.antimine.BuildConfig import dev.lucasnlm.antimine.about.BuildConfig
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.about.viewmodel.AboutEvent import dev.lucasnlm.antimine.about.viewmodel.AboutEvent
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
import dev.lucasnlm.external.IBillingManager
import kotlinx.android.synthetic.main.fragment_about_info.* import kotlinx.android.synthetic.main.fragment_about_info.*
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.sharedViewModel import org.koin.androidx.viewmodel.ext.android.sharedViewModel
class AboutInfoFragment : Fragment(R.layout.fragment_about_info) { class AboutInfoFragment : Fragment(R.layout.fragment_about_info) {
private val aboutViewModel: AboutViewModel by sharedViewModel() private val aboutViewModel: AboutViewModel by sharedViewModel()
private val preferencesRepository: IPreferencesRepository by inject()
private val billingManager: IBillingManager by inject()
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
@ -40,14 +35,6 @@ class AboutInfoFragment : Fragment(R.layout.fragment_about_info) {
} }
} }
if (preferencesRepository.isPremiumEnabled() && billingManager.isEnabled()) {
supportUs.visibility = View.GONE
} else {
supportUs.setOnClickListener {
aboutViewModel.sendEvent(AboutEvent.SupportUs)
}
}
thirdsParties.setOnClickListener { thirdsParties.setOnClickListener {
aboutViewModel.sendEvent(AboutEvent.ThirdPartyLicenses) aboutViewModel.sendEvent(AboutEvent.ThirdPartyLicenses)
} }

View file

@ -5,7 +5,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.text.TextActivity import dev.lucasnlm.antimine.text.TextActivity
import dev.lucasnlm.antimine.about.viewmodel.License import dev.lucasnlm.antimine.about.viewmodel.License

View file

@ -6,7 +6,7 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
import kotlinx.android.synthetic.main.fragment_licenses.* import kotlinx.android.synthetic.main.fragment_licenses.*
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect

View file

@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.about.views.translators
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.about.viewmodel.TranslationInfo import dev.lucasnlm.antimine.about.viewmodel.TranslationInfo
class TranslatorsAdapter( class TranslatorsAdapter(

View file

@ -8,7 +8,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel import dev.lucasnlm.antimine.about.viewmodel.AboutViewModel
import kotlinx.android.synthetic.main.fragment_translators.* import kotlinx.android.synthetic.main.fragment_translators.*
import kotlinx.android.synthetic.main.view_translator.view.* import kotlinx.android.synthetic.main.view_translator.view.*

View file

@ -6,10 +6,10 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.annotation.RawRes import androidx.annotation.RawRes
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.about.R
import dev.lucasnlm.antimine.ThematicActivity
import dev.lucasnlm.antimine.text.viewmodel.TextEvent import dev.lucasnlm.antimine.text.viewmodel.TextEvent
import dev.lucasnlm.antimine.text.viewmodel.TextViewModel import dev.lucasnlm.antimine.text.viewmodel.TextViewModel
import dev.lucasnlm.antimine.ui.ThematicActivity
import kotlinx.android.synthetic.main.activity_text.* import kotlinx.android.synthetic.main.activity_text.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect

View file

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content" android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true" />
tools:context="dev.lucasnlm.antimine.about.AboutActivity" />

View file

@ -66,18 +66,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/version_layout"> app:layout_constraintTop_toBottomOf="@+id/version_layout">
<Button
android:id="@+id/supportUs"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/support_title"
android:textStyle="bold" />
<Space
android:layout_width="match_parent"
android:layout_height="24dp" />
<Button <Button
android:id="@+id/thirdsParties" android:id="@+id/thirdsParties"
style="?android:attr/borderlessButtonStyle" style="?android:attr/borderlessButtonStyle"

View file

@ -5,7 +5,6 @@ plugins {
id 'kotlin-kapt' id 'kotlin-kapt'
} }
if (System.getenv('IS_GOOGLE_BUILD')) { if (System.getenv('IS_GOOGLE_BUILD')) {
apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.firebase.crashlytics'
} }
@ -102,6 +101,10 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':external') implementation project(':external')
implementation project(':common') implementation project(':common')
implementation project(':about')
implementation project(':ui')
implementation project(':preferences')
implementation project(':core')
googleImplementation project(':proprietary') googleImplementation project(':proprietary')
googleInstantImplementation project(':proprietary') googleInstantImplementation project(':proprietary')

View file

@ -85,23 +85,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name="dev.lucasnlm.antimine.text.TextActivity"
android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="dev.lucasnlm.antimine.about.AboutActivity" />
</activity>
<activity
android:name="dev.lucasnlm.antimine.about.AboutActivity"
android:label="@string/about"
android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="dev.lucasnlm.antimine.GameActivity" />
</activity>
<activity <activity
android:label="@string/themes" android:label="@string/themes"
android:name="dev.lucasnlm.antimine.theme.ThemeActivity" android:name="dev.lucasnlm.antimine.theme.ThemeActivity"

View file

@ -37,8 +37,8 @@ import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.control.ControlDialogFragment import dev.lucasnlm.antimine.control.ControlDialogFragment
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.custom.CustomLevelDialogFragment import dev.lucasnlm.antimine.custom.CustomLevelDialogFragment
import dev.lucasnlm.antimine.history.HistoryActivity import dev.lucasnlm.antimine.history.HistoryActivity
import dev.lucasnlm.antimine.gameover.EndGameDialogFragment import dev.lucasnlm.antimine.gameover.EndGameDialogFragment
@ -53,6 +53,7 @@ import dev.lucasnlm.antimine.support.SupportAppDialogFragment
import dev.lucasnlm.antimine.theme.ThemeActivity import dev.lucasnlm.antimine.theme.ThemeActivity
import dev.lucasnlm.antimine.tutorial.view.TutorialCompleteDialogFragment import dev.lucasnlm.antimine.tutorial.view.TutorialCompleteDialogFragment
import dev.lucasnlm.antimine.tutorial.view.TutorialLevelFragment import dev.lucasnlm.antimine.tutorial.view.TutorialLevelFragment
import dev.lucasnlm.antimine.ui.ThematicActivity
import dev.lucasnlm.external.IBillingManager import dev.lucasnlm.external.IBillingManager
import dev.lucasnlm.external.IInstantAppManager import dev.lucasnlm.external.IInstantAppManager
import dev.lucasnlm.external.IFeatureFlagManager import dev.lucasnlm.external.IFeatureFlagManager
@ -60,9 +61,6 @@ import dev.lucasnlm.external.IPlayGamesManager
import dev.lucasnlm.external.ReviewWrapper import dev.lucasnlm.external.ReviewWrapper
import dev.lucasnlm.external.model.PurchaseInfo import dev.lucasnlm.external.model.PurchaseInfo
import kotlinx.android.synthetic.main.activity_game.* import kotlinx.android.synthetic.main.activity_game.*
import kotlinx.android.synthetic.main.activity_game.minesCount
import kotlinx.android.synthetic.main.activity_game.timer
import kotlinx.android.synthetic.main.activity_tv_game.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
@ -412,7 +410,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
ActionBarDrawerToggle( ActionBarDrawerToggle(
this@GameActivity, this@GameActivity,
drawer, drawer,
toolbar, null,
R.string.open_menu, R.string.open_menu,
R.string.close_menu R.string.close_menu
).apply { ).apply {
@ -607,7 +605,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
private fun showAbout() { private fun showAbout() {
analyticsManager.sentEvent(Analytics.OpenAbout) analyticsManager.sentEvent(Analytics.OpenAbout)
Intent(this, AboutActivity::class.java).apply { Intent(this, dev.lucasnlm.antimine.about.AboutActivity::class.java).apply {
startActivity(this) startActivity(this)
} }
} }

View file

@ -5,7 +5,7 @@ import dev.lucasnlm.antimine.common.level.di.LevelModule
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.di.CommonModule import dev.lucasnlm.antimine.core.di.CommonModule
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.di.AppModule import dev.lucasnlm.antimine.di.AppModule
import dev.lucasnlm.antimine.di.ViewModelModule import dev.lucasnlm.antimine.di.ViewModelModule
import dev.lucasnlm.external.IAdsManager import dev.lucasnlm.external.IAdsManager

View file

@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.cloud
import dev.lucasnlm.antimine.common.level.database.models.toHashMap import dev.lucasnlm.antimine.common.level.database.models.toHashMap
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.external.ICloudStorageManager import dev.lucasnlm.external.ICloudStorageManager
import dev.lucasnlm.external.IPlayGamesManager import dev.lucasnlm.external.IPlayGamesManager
import dev.lucasnlm.external.model.CloudSave import dev.lucasnlm.external.model.CloudSave

View file

@ -14,7 +14,7 @@ import dev.lucasnlm.antimine.control.view.ControlItemView
import dev.lucasnlm.antimine.control.view.SimpleControlItemView import dev.lucasnlm.antimine.control.view.SimpleControlItemView
import dev.lucasnlm.antimine.control.viewmodel.ControlEvent import dev.lucasnlm.antimine.control.viewmodel.ControlEvent
import dev.lucasnlm.antimine.control.viewmodel.ControlViewModel import dev.lucasnlm.antimine.control.viewmodel.ControlViewModel
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel

View file

@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.control.models package dev.lucasnlm.antimine.control.models
import androidx.annotation.StringRes import androidx.annotation.StringRes
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
data class ControlDetails( data class ControlDetails(
val id: Long, val id: Long,

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.control.viewmodel package dev.lucasnlm.antimine.control.viewmodel
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
sealed class ControlEvent { sealed class ControlEvent {
data class SelectControlStyle( data class SelectControlStyle(

View file

@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.control.viewmodel package dev.lucasnlm.antimine.control.viewmodel
import dev.lucasnlm.antimine.control.models.ControlDetails import dev.lucasnlm.antimine.control.models.ControlDetails
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
data class ControlState( data class ControlState(
val selectedIndex: Int, val selectedIndex: Int,

View file

@ -2,8 +2,8 @@ package dev.lucasnlm.antimine.control.viewmodel
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.control.models.ControlDetails import dev.lucasnlm.antimine.control.models.ControlDetails
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow

View file

@ -11,9 +11,9 @@ import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment import androidx.appcompat.app.AppCompatDialogFragment
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.custom.viewmodel.CreateGameViewModel import dev.lucasnlm.antimine.custom.viewmodel.CreateGameViewModel
import dev.lucasnlm.antimine.custom.viewmodel.CustomEvent import dev.lucasnlm.antimine.custom.viewmodel.CustomEvent
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.custom.viewmodel package dev.lucasnlm.antimine.custom.viewmodel
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.custom.viewmodel package dev.lucasnlm.antimine.custom.viewmodel
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
sealed class CustomEvent { sealed class CustomEvent {
data class UpdateCustomGameEvent( data class UpdateCustomGameEvent(

View file

@ -18,7 +18,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.gameover.model.GameResult import dev.lucasnlm.antimine.gameover.model.GameResult
import dev.lucasnlm.antimine.gameover.viewmodel.EndGameDialogEvent import dev.lucasnlm.antimine.gameover.viewmodel.EndGameDialogEvent
import dev.lucasnlm.antimine.gameover.viewmodel.EndGameDialogViewModel import dev.lucasnlm.antimine.gameover.viewmodel.EndGameDialogViewModel
@ -42,7 +42,7 @@ class EndGameDialogFragment : AppCompatDialogFragment() {
private val instantAppManager: IInstantAppManager by inject() private val instantAppManager: IInstantAppManager by inject()
private val endGameViewModel by viewModel<EndGameDialogViewModel>() private val endGameViewModel by viewModel<EndGameDialogViewModel>()
private val gameViewModel by sharedViewModel<GameViewModel>() private val gameViewModel by sharedViewModel<GameViewModel>()
private val preferencesRepository: IPreferencesRepository by inject() private val preferencesRepository: dev.lucasnlm.antimine.preferences.IPreferencesRepository by inject()
private val billingManager: IBillingManager by inject() private val billingManager: IBillingManager by inject()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {

View file

@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.history
import android.os.Bundle import android.os.Bundle
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.ThematicActivity import dev.lucasnlm.antimine.ui.ThematicActivity
import dev.lucasnlm.antimine.history.views.HistoryFragment import dev.lucasnlm.antimine.history.views.HistoryFragment
class HistoryActivity : ThematicActivity(R.layout.activity_empty) { class HistoryActivity : ThematicActivity(R.layout.activity_empty) {

View file

@ -5,7 +5,7 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import dev.lucasnlm.antimine.DeepLink import dev.lucasnlm.antimine.DeepLink
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow

View file

@ -7,9 +7,8 @@ import android.view.MenuItem
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.ThematicActivity import dev.lucasnlm.antimine.ui.ThematicActivity
import dev.lucasnlm.antimine.cloud.CloudSaveManager import dev.lucasnlm.antimine.cloud.CloudSaveManager
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
class PreferencesActivity : class PreferencesActivity :

View file

@ -15,9 +15,9 @@ import dev.lucasnlm.antimine.BuildConfig
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.view.paintOnCanvas import dev.lucasnlm.antimine.common.level.view.paintOnCanvas
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.File import java.io.File

View file

@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import dev.lucasnlm.antimine.common.level.database.models.Stats import dev.lucasnlm.antimine.common.level.database.models.Stats
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.support.IapHandler import dev.lucasnlm.antimine.support.IapHandler
import dev.lucasnlm.external.ICloudStorageManager import dev.lucasnlm.external.ICloudStorageManager
import dev.lucasnlm.external.model.CloudSave import dev.lucasnlm.external.model.CloudSave

View file

@ -8,8 +8,8 @@ import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.ThematicActivity import dev.lucasnlm.antimine.ui.ThematicActivity
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.stats.view.StatsAdapter import dev.lucasnlm.antimine.stats.view.StatsAdapter
import dev.lucasnlm.antimine.stats.viewmodel.StatsEvent import dev.lucasnlm.antimine.stats.viewmodel.StatsEvent
import dev.lucasnlm.antimine.stats.viewmodel.StatsViewModel import dev.lucasnlm.antimine.stats.viewmodel.StatsViewModel
@ -23,7 +23,7 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
class StatsActivity : ThematicActivity(R.layout.activity_stats) { class StatsActivity : ThematicActivity(R.layout.activity_stats) {
private val statsViewModel by viewModel<StatsViewModel>() private val statsViewModel by viewModel<StatsViewModel>()
private val instantAppManager: IInstantAppManager by inject() private val instantAppManager: IInstantAppManager by inject()
private val themeRepository: IThemeRepository by inject() private val themeRepository: dev.lucasnlm.antimine.ui.repository.IThemeRepository by inject()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

View file

@ -8,7 +8,7 @@ import android.widget.TextView
import androidx.cardview.widget.CardView import androidx.cardview.widget.CardView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.stats.model.StatsModel import dev.lucasnlm.antimine.stats.model.StatsModel
import kotlinx.android.synthetic.main.view_stats.view.* import kotlinx.android.synthetic.main.view_stats.view.*

View file

@ -3,11 +3,11 @@ package dev.lucasnlm.antimine.stats.viewmodel
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.common.level.database.models.Stats import dev.lucasnlm.antimine.common.level.database.models.Stats
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
import dev.lucasnlm.antimine.stats.model.StatsModel import dev.lucasnlm.antimine.stats.model.StatsModel
import dev.lucasnlm.antimine.stats.model.StatsState import dev.lucasnlm.antimine.stats.model.StatsState

View file

@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.support
import android.content.Context import android.content.Context
import android.widget.Toast import android.widget.Toast
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.external.IBillingManager import dev.lucasnlm.external.IBillingManager
import dev.lucasnlm.external.model.PurchaseInfo import dev.lucasnlm.external.model.PurchaseInfo
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers

View file

@ -14,7 +14,7 @@ import androidx.lifecycle.lifecycleScope
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.external.Ads import dev.lucasnlm.external.Ads
import dev.lucasnlm.external.IAdsManager import dev.lucasnlm.external.IAdsManager
import dev.lucasnlm.external.IBillingManager import dev.lucasnlm.external.IBillingManager

View file

@ -6,15 +6,15 @@ import android.view.MenuItem
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import dev.lucasnlm.antimine.R import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.ThematicActivity
import dev.lucasnlm.antimine.cloud.CloudSaveManager import dev.lucasnlm.antimine.cloud.CloudSaveManager
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.support.SupportAppDialogFragment import dev.lucasnlm.antimine.support.SupportAppDialogFragment
import dev.lucasnlm.antimine.theme.view.ThemeAdapter import dev.lucasnlm.antimine.theme.view.ThemeAdapter
import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent
import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel
import dev.lucasnlm.antimine.ui.ThematicActivity
import dev.lucasnlm.external.IBillingManager import dev.lucasnlm.external.IBillingManager
import kotlinx.android.synthetic.main.activity_game.* import kotlinx.android.synthetic.main.activity_game.*
import kotlinx.android.synthetic.main.activity_theme.* import kotlinx.android.synthetic.main.activity_theme.*

View file

@ -10,7 +10,7 @@ import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
import dev.lucasnlm.antimine.common.level.view.AreaAdapter import dev.lucasnlm.antimine.common.level.view.AreaAdapter
import dev.lucasnlm.antimine.common.level.view.AreaView import dev.lucasnlm.antimine.common.level.view.AreaView
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent
import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel
import kotlinx.android.synthetic.main.view_theme.view.* import kotlinx.android.synthetic.main.view_theme.view.*

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.theme.viewmodel package dev.lucasnlm.antimine.theme.viewmodel
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
sealed class ThemeEvent { sealed class ThemeEvent {
data class Unlock( data class Unlock(

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.theme.viewmodel package dev.lucasnlm.antimine.theme.viewmodel
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
data class ThemeState( data class ThemeState(
val current: AppTheme, val current: AppTheme,

View file

@ -2,10 +2,10 @@ package dev.lucasnlm.antimine.theme.viewmodel
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.core.themes.repository.Themes import dev.lucasnlm.antimine.ui.repository.Themes
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
import dev.lucasnlm.external.IBillingManager import dev.lucasnlm.external.IBillingManager
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow

View file

@ -14,8 +14,8 @@ import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.view.AreaAdapter import dev.lucasnlm.antimine.common.level.view.AreaAdapter
import dev.lucasnlm.antimine.common.level.view.AreaView import dev.lucasnlm.antimine.common.level.view.AreaView
import dev.lucasnlm.antimine.common.level.view.AreaViewHolder import dev.lucasnlm.antimine.common.level.view.AreaViewHolder
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.tutorial.viewmodel.TutorialViewModel import dev.lucasnlm.antimine.tutorial.viewmodel.TutorialViewModel
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch

View file

@ -15,7 +15,7 @@ import dev.lucasnlm.antimine.common.level.models.Event
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration import dev.lucasnlm.antimine.common.level.view.SpaceItemDecoration
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.tutorial.viewmodel.TutorialViewModel import dev.lucasnlm.antimine.tutorial.viewmodel.TutorialViewModel
import kotlinx.android.synthetic.main.fragment_tutorial_level.* import kotlinx.android.synthetic.main.fragment_tutorial_level.*
import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.asFlow

View file

@ -13,10 +13,10 @@ import dev.lucasnlm.antimine.common.level.utils.IHapticFeedbackManager
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager import dev.lucasnlm.antimine.core.sound.ISoundManager
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.tutorial.view.TutorialField import dev.lucasnlm.antimine.tutorial.view.TutorialField
import dev.lucasnlm.external.IPlayGamesManager import dev.lucasnlm.external.IPlayGamesManager
import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.channels.ConflatedBroadcastChannel
@ -26,7 +26,7 @@ class TutorialViewModel(
savesRepository: ISavesRepository, savesRepository: ISavesRepository,
statsRepository: IStatsRepository, statsRepository: IStatsRepository,
dimensionRepository: IDimensionRepository, dimensionRepository: IDimensionRepository,
themeRepository: IThemeRepository, themeRepository: dev.lucasnlm.antimine.ui.repository.IThemeRepository,
soundManager: ISoundManager, soundManager: ISoundManager,
minefieldRepository: IMinefieldRepository, minefieldRepository: IMinefieldRepository,
analyticsManager: IAnalyticsManager, analyticsManager: IAnalyticsManager,

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Splash" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>

View file

@ -3,9 +3,8 @@ package dev.lucasnlm.antimine.control
import dev.lucasnlm.antimine.IntentViewModelTest import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.control.viewmodel.ControlEvent import dev.lucasnlm.antimine.control.viewmodel.ControlEvent
import dev.lucasnlm.antimine.control.viewmodel.ControlViewModel import dev.lucasnlm.antimine.control.viewmodel.ControlViewModel
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import io.mockk.verify import io.mockk.verify
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals

View file

@ -1,11 +1,10 @@
package dev.lucasnlm.antimine.custom package dev.lucasnlm.antimine.custom
import dev.lucasnlm.antimine.IntentViewModelTest import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.custom.viewmodel.CreateGameViewModel import dev.lucasnlm.antimine.custom.viewmodel.CreateGameViewModel
import dev.lucasnlm.antimine.custom.viewmodel.CustomEvent import dev.lucasnlm.antimine.custom.viewmodel.CustomEvent
import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
@ -26,7 +25,7 @@ class CreateGameViewModelTest : IntentViewModelTest() {
@Test @Test
fun testSetNewCustomValues() { fun testSetNewCustomValues() {
val preferenceRepository: IPreferencesRepository = mockk { val preferenceRepository: dev.lucasnlm.antimine.preferences.IPreferencesRepository = mockk {
every { customGameMode() } returns Minefield(10, 12, 9) every { customGameMode() } returns Minefield(10, 12, 9)
every { updateCustomGameMode(any()) } returns Unit every { updateCustomGameMode(any()) } returns Unit
} }

View file

@ -1,11 +1,11 @@
package dev.lucasnlm.antimine.di package dev.lucasnlm.antimine.di
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager import dev.lucasnlm.antimine.core.sound.ISoundManager
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.core.themes.repository.Themes.LightTheme import dev.lucasnlm.antimine.ui.repository.Themes.LightTheme
import dev.lucasnlm.antimine.mocks.FixedDimensionRepository import dev.lucasnlm.antimine.mocks.FixedDimensionRepository
import dev.lucasnlm.antimine.mocks.MockPreferencesRepository import dev.lucasnlm.antimine.mocks.MockPreferencesRepository
import org.koin.dsl.bind import org.koin.dsl.bind
@ -23,7 +23,7 @@ val TestCommonModule = module {
} bind ISoundManager::class } bind ISoundManager::class
single { single {
object : IThemeRepository { object : dev.lucasnlm.antimine.ui.repository.IThemeRepository {
override fun getCustomTheme(): AppTheme? = null override fun getCustomTheme(): AppTheme? = null
override fun getTheme(): AppTheme = LightTheme override fun getTheme(): AppTheme = LightTheme
@ -34,5 +34,5 @@ val TestCommonModule = module {
override fun reset(): AppTheme = LightTheme override fun reset(): AppTheme = LightTheme
} }
} bind IThemeRepository::class } bind dev.lucasnlm.antimine.ui.repository.IThemeRepository::class
} }

View file

@ -5,7 +5,7 @@ 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.Save
import dev.lucasnlm.antimine.common.level.database.models.SaveStatus import dev.lucasnlm.antimine.common.level.database.models.SaveStatus
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
import dev.lucasnlm.antimine.history.viewmodel.HistoryEvent import dev.lucasnlm.antimine.history.viewmodel.HistoryEvent
import dev.lucasnlm.antimine.history.viewmodel.HistoryState import dev.lucasnlm.antimine.history.viewmodel.HistoryState

View file

@ -1,17 +1,18 @@
package dev.lucasnlm.antimine.mocks package dev.lucasnlm.antimine.mocks
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
class FixedMinefieldRepository : IMinefieldRepository { class FixedMinefieldRepository : IMinefieldRepository {
override fun fromDifficulty( override fun fromDifficulty(
difficulty: Difficulty, difficulty: Difficulty,
dimensionRepository: IDimensionRepository, dimensionRepository: IDimensionRepository,
preferencesRepository: IPreferencesRepository preferencesRepository: IPreferencesRepository
): Minefield = Minefield(9, 9, 9) ): Minefield =
Minefield(9, 9, 9)
override fun randomSeed(): Long = 0L override fun randomSeed(): Long = 0L
} }

View file

@ -1,8 +1,8 @@
package dev.lucasnlm.antimine.mocks package dev.lucasnlm.antimine.mocks
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
class MockPreferencesRepository : IPreferencesRepository { class MockPreferencesRepository : IPreferencesRepository {
private var customMinefield = Minefield(9, 9, 9) private var customMinefield = Minefield(9, 9, 9)

View file

@ -2,11 +2,11 @@ package dev.lucasnlm.antimine.stats.viewmodel
import dev.lucasnlm.antimine.IntentViewModelTest import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.common.level.database.models.Stats import dev.lucasnlm.antimine.common.level.database.models.Stats
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.MemoryStatsRepository import dev.lucasnlm.antimine.common.level.repository.MemoryStatsRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import kotlinx.coroutines.test.runBlockingTest import kotlinx.coroutines.test.runBlockingTest
@ -47,7 +47,11 @@ class StatsViewModelTest : IntentViewModelTest() {
super.setup() super.setup()
every { prefsRepository.getStatsBase() } returns 0 every { prefsRepository.getStatsBase() } returns 0
every { prefsRepository.isPremiumEnabled() } returns false every { prefsRepository.isPremiumEnabled() } returns false
every { minefieldRepository.fromDifficulty(any(), any(), any()) } returns Minefield(6, 12, 9) every { minefieldRepository.fromDifficulty(any(), any(), any()) } returns Minefield(
6,
12,
9
)
} }
@Test @Test

View file

@ -3,11 +3,11 @@ package dev.lucasnlm.antimine.theme
import dev.lucasnlm.antimine.IntentViewModelTest import dev.lucasnlm.antimine.IntentViewModelTest
import dev.lucasnlm.antimine.common.R import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.core.themes.model.AreaPalette import dev.lucasnlm.antimine.ui.model.AreaPalette
import dev.lucasnlm.antimine.core.themes.model.Assets import dev.lucasnlm.antimine.ui.model.Assets
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent import dev.lucasnlm.antimine.theme.viewmodel.ThemeEvent
import dev.lucasnlm.antimine.theme.viewmodel.ThemeState import dev.lucasnlm.antimine.theme.viewmodel.ThemeState
import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel import dev.lucasnlm.antimine.theme.viewmodel.ThemeViewModel
@ -129,7 +129,7 @@ class ThemeViewModelTest : IntentViewModelTest() {
@Test @Test
fun testInitialValue() { fun testInitialValue() {
val themeRepository = mockk<IThemeRepository> { val themeRepository = mockk<dev.lucasnlm.antimine.ui.repository.IThemeRepository> {
every { getAllThemes() } returns allThemes every { getAllThemes() } returns allThemes
every { getTheme() } returns gardenTheme every { getTheme() } returns gardenTheme
} }
@ -146,7 +146,7 @@ class ThemeViewModelTest : IntentViewModelTest() {
@Test @Test
fun testChangeValue() { fun testChangeValue() {
val themeRepository = mockk<IThemeRepository> { val themeRepository = mockk<dev.lucasnlm.antimine.ui.repository.IThemeRepository> {
every { getAllThemes() } returns allThemes every { getAllThemes() } returns allThemes
every { getTheme() } returns gardenTheme every { getTheme() } returns gardenTheme
every { setTheme(any()) } returns Unit every { setTheme(any()) } returns Unit
@ -175,7 +175,7 @@ class ThemeViewModelTest : IntentViewModelTest() {
@Test @Test
fun testChangeValueWithoutExtras() { fun testChangeValueWithoutExtras() {
val themeRepository = mockk<IThemeRepository> { val themeRepository = mockk<dev.lucasnlm.antimine.ui.repository.IThemeRepository> {
every { getAllThemes() } returns allThemes every { getAllThemes() } returns allThemes
every { getTheme() } returns gardenTheme every { getTheme() } returns gardenTheme
every { setTheme(any()) } returns Unit every { setTheme(any()) } returns Unit

View file

@ -7,7 +7,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.2' classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21'
if (System.getenv('IS_GOOGLE_BUILD')) { if (System.getenv('IS_GOOGLE_BUILD')) {
classpath 'com.google.gms:google-services:4.3.4' classpath 'com.google.gms:google-services:4.3.4'

View file

@ -40,6 +40,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':external') implementation project(':external')
implementation project(':i18n') implementation project(':i18n')
implementation project(':preferences')
implementation project(':ui')
// AndroidX // AndroidX
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'

View file

@ -10,7 +10,7 @@ import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Mark import dev.lucasnlm.antimine.common.level.models.Mark
import dev.lucasnlm.antimine.common.level.view.AreaAdapter import dev.lucasnlm.antimine.common.level.view.AreaAdapter
import dev.lucasnlm.antimine.common.level.view.paintOnCanvas import dev.lucasnlm.antimine.common.level.view.paintOnCanvas
import dev.lucasnlm.antimine.core.themes.repository.Themes.LightTheme import dev.lucasnlm.antimine.ui.repository.Themes.LightTheme
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test

View file

@ -9,11 +9,11 @@ import dev.lucasnlm.antimine.common.level.logic.MinefieldCreator
import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.models.Score import dev.lucasnlm.antimine.common.level.models.Score
import dev.lucasnlm.antimine.common.level.solver.LimitedBruteForceSolver import dev.lucasnlm.antimine.common.level.solver.LimitedBruteForceSolver
import dev.lucasnlm.antimine.core.control.ActionResponse import dev.lucasnlm.antimine.preferences.models.ActionResponse
import dev.lucasnlm.antimine.core.control.GameControl import dev.lucasnlm.antimine.preferences.models.GameControl
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlin.random.Random import kotlin.random.Random

View file

@ -4,7 +4,7 @@ import androidx.room.TypeConverter
import com.squareup.moshi.JsonAdapter import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
class MinefieldConverter { class MinefieldConverter {
private val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build() private val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
@ -14,7 +14,11 @@ class MinefieldConverter {
@TypeConverter @TypeConverter
fun toMinefield(jsonInput: String): Minefield = fun toMinefield(jsonInput: String): Minefield =
jsonAdapter.fromJson(jsonInput) ?: Minefield(9, 9, 9) jsonAdapter.fromJson(jsonInput) ?: Minefield(
9,
9,
9
)
@TypeConverter @TypeConverter
fun toJsonString(field: Minefield): String = jsonAdapter.toJson(field) fun toJsonString(field: Minefield): String = jsonAdapter.toJson(field)

View file

@ -6,7 +6,7 @@ import androidx.room.PrimaryKey
import androidx.room.TypeConverters import androidx.room.TypeConverters
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.database.converters.AreaConverter 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.FirstOpenConverter
import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverter import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverter

View file

@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.common.level.logic package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import kotlin.math.floor import kotlin.math.floor
import kotlin.random.Random import kotlin.random.Random

View file

@ -4,7 +4,7 @@ import android.content.Context
import android.content.res.Resources import android.content.res.Resources
import android.content.res.TypedArray import android.content.res.TypedArray
import dev.lucasnlm.antimine.common.R import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
interface IDimensionRepository { interface IDimensionRepository {
fun areaSize(): Float fun areaSize(): Float

View file

@ -1,8 +1,8 @@
package dev.lucasnlm.antimine.common.level.repository package dev.lucasnlm.antimine.common.level.repository
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import kotlin.random.Random import kotlin.random.Random
interface IMinefieldRepository { interface IMinefieldRepository {

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.repository package dev.lucasnlm.antimine.common.level.repository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
interface ITipRepository { interface ITipRepository {
fun setExtraTips(amount: Int) fun setExtraTips(amount: Int)

View file

@ -16,8 +16,8 @@ import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch

View file

@ -10,7 +10,7 @@ import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
import dev.lucasnlm.antimine.common.level.models.Mark import dev.lucasnlm.antimine.common.level.models.Mark
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
fun Area.paintOnCanvas( fun Area.paintOnCanvas(
context: Context, context: Context,

View file

@ -16,7 +16,7 @@ import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings import dev.lucasnlm.antimine.common.level.models.AreaPaintSettings
import dev.lucasnlm.antimine.common.level.models.Mark import dev.lucasnlm.antimine.common.level.models.Mark
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.ui.model.AppTheme
class AreaView : View { class AreaView : View {
// Used on Wear OS // Used on Wear OS

View file

@ -7,11 +7,11 @@ import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dev.lucasnlm.antimine.common.R import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
import dev.lucasnlm.antimine.common.level.widget.FixedGridLayoutManager import dev.lucasnlm.antimine.common.level.widget.FixedGridLayoutManager
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.sharedViewModel import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import kotlin.math.nextDown import kotlin.math.nextDown

View file

@ -10,7 +10,7 @@ import dev.lucasnlm.antimine.common.level.database.models.Save
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Event import dev.lucasnlm.antimine.common.level.models.Event
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
@ -20,12 +20,12 @@ import dev.lucasnlm.antimine.common.level.utils.Clock
import dev.lucasnlm.antimine.common.level.utils.IHapticFeedbackManager import dev.lucasnlm.antimine.common.level.utils.IHapticFeedbackManager
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.control.ActionResponse import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.control.GameControl
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager import dev.lucasnlm.antimine.core.sound.ISoundManager
import dev.lucasnlm.antimine.core.themes.model.AppTheme import dev.lucasnlm.antimine.preferences.models.ActionResponse
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.preferences.models.GameControl
import dev.lucasnlm.antimine.ui.model.AppTheme
import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.external.Achievement import dev.lucasnlm.external.Achievement
import dev.lucasnlm.external.IPlayGamesManager import dev.lucasnlm.external.IPlayGamesManager
import dev.lucasnlm.external.Leaderboard import dev.lucasnlm.external.Leaderboard

View file

@ -13,24 +13,6 @@ import androidx.recyclerview.widget.LinearSmoothScroller
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Recycler import androidx.recyclerview.widget.RecyclerView.Recycler
/**
* A [RecyclerView.LayoutManager] implementation
* that places children in a two-dimensional grid, sized to a fixed column count
* value. User scrolling is possible in both horizontal and vertical directions
* to view the data set.
*
*
* The column count is controllable via [.setTotalColumnCount]. The layout manager
* will generate the number of rows necessary to accommodate the data set based on
* the fixed column count.
*
*
* This manager does make some assumptions to simplify the implementation:
*
* * All child views are assumed to be the same size
* * The window of visible views is a constant
*
*/
class FixedGridLayoutManager : RecyclerView.LayoutManager() { class FixedGridLayoutManager : RecyclerView.LayoutManager() {
companion object { companion object {

View file

@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.core.analytics.models
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Score import dev.lucasnlm.antimine.common.level.models.Score
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
sealed class Analytics( sealed class Analytics(
val name: String, val name: String,

View file

@ -3,14 +3,14 @@ package dev.lucasnlm.antimine.core.di
import android.view.ViewConfiguration import android.view.ViewConfiguration
import dev.lucasnlm.antimine.common.level.repository.DimensionRepository import dev.lucasnlm.antimine.common.level.repository.DimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesManager import dev.lucasnlm.antimine.preferences.IPreferencesManager
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import dev.lucasnlm.antimine.core.preferences.PreferencesManager import dev.lucasnlm.antimine.preferences.PreferencesManager
import dev.lucasnlm.antimine.core.preferences.PreferencesRepository import dev.lucasnlm.antimine.preferences.PreferencesRepository
import dev.lucasnlm.antimine.core.sound.ISoundManager import dev.lucasnlm.antimine.core.sound.ISoundManager
import dev.lucasnlm.antimine.core.sound.SoundManager import dev.lucasnlm.antimine.core.sound.SoundManager
import dev.lucasnlm.antimine.core.themes.repository.IThemeRepository import dev.lucasnlm.antimine.ui.repository.IThemeRepository
import dev.lucasnlm.antimine.core.themes.repository.ThemeRepository import dev.lucasnlm.antimine.ui.repository.ThemeRepository
import org.koin.dsl.bind import org.koin.dsl.bind
import org.koin.dsl.module import org.koin.dsl.module
@ -19,9 +19,16 @@ val CommonModule = module {
single { DimensionRepository(get(), get()) } bind IDimensionRepository::class single { DimensionRepository(get(), get()) } bind IDimensionRepository::class
single { PreferencesRepository(get(), ViewConfiguration.getLongPressTimeout()) } bind IPreferencesRepository::class single {
PreferencesRepository(
get(),
ViewConfiguration.getLongPressTimeout()
)
} bind IPreferencesRepository::class
single { SoundManager(get()) } bind ISoundManager::class single { SoundManager(get()) } bind ISoundManager::class
single { ThemeRepository(get(), get()) } bind IThemeRepository::class single {
ThemeRepository(get(), get())
} bind IThemeRepository::class
} }

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.database.converters package dev.lucasnlm.antimine.common.level.database.converters
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import org.junit.Test import org.junit.Test
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals

View file

@ -1,10 +1,10 @@
package dev.lucasnlm.antimine.common.level.di package dev.lucasnlm.antimine.common.level.di
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository import dev.lucasnlm.antimine.common.level.repository.IMinefieldRepository
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
class FixedMinefieldRepository : IMinefieldRepository { class FixedMinefieldRepository : IMinefieldRepository {
override fun fromDifficulty( override fun fromDifficulty(

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.logic package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import kotlinx.coroutines.test.runBlockingTest import kotlinx.coroutines.test.runBlockingTest
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
@ -10,7 +10,14 @@ class FlagAssistantTest {
@Test @Test
fun testRunAssistant() = runBlockingTest { fun testRunAssistant() = runBlockingTest {
repeat(20) { takeMines -> repeat(20) { takeMines ->
val creator = MinefieldCreator(Minefield(8, 8, 25), Random(200)) val creator = MinefieldCreator(
Minefield(
8,
8,
25
),
Random(200)
)
val map = creator.create(50, false).toMutableList() val map = creator.create(50, false).toMutableList()
map.filter { it.hasMine } map.filter { it.hasMine }
@ -43,7 +50,14 @@ class FlagAssistantTest {
repeat(20) { takeMines -> repeat(20) { takeMines ->
val seed = 10 * takeMines val seed = 10 * takeMines
val creator = MinefieldCreator(Minefield(8, 8, 25), Random(seed)) val creator = MinefieldCreator(
Minefield(
8,
8,
25
),
Random(seed)
)
val map = creator.create(50, false).toMutableList() val map = creator.create(50, false).toMutableList()
map.filter { it.hasMine } map.filter { it.hasMine }

View file

@ -2,11 +2,10 @@ package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.GameController import dev.lucasnlm.antimine.common.level.GameController
import dev.lucasnlm.antimine.common.level.models.Area import dev.lucasnlm.antimine.common.level.models.Area
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.models.Score import dev.lucasnlm.antimine.common.level.models.Score
import dev.lucasnlm.antimine.core.control.ControlStyle import dev.lucasnlm.antimine.preferences.models.ControlStyle
import dev.lucasnlm.antimine.core.control.GameControl import dev.lucasnlm.antimine.core.control.GameControl
import kotlinx.coroutines.flow.single
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runBlockingTest import kotlinx.coroutines.test.runBlockingTest

View file

@ -1,6 +1,6 @@
package dev.lucasnlm.antimine.common.level.logic package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import kotlin.random.Random import kotlin.random.Random

View file

@ -3,11 +3,11 @@ package dev.lucasnlm.antimine.common.level.logic
import com.nhaarman.mockitokotlin2.doReturn import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.mock
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.common.level.repository.MinefieldRepository import dev.lucasnlm.antimine.common.level.repository.MinefieldRepository
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
import dev.lucasnlm.antimine.common.level.repository.Size import dev.lucasnlm.antimine.common.level.repository.Size
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test

View file

@ -1,7 +1,7 @@
package dev.lucasnlm.antimine.common.level.logic package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.models.Mark import dev.lucasnlm.antimine.common.level.models.Mark
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue

View file

@ -1,8 +1,8 @@
package dev.lucasnlm.antimine.common.level.repository package dev.lucasnlm.antimine.common.level.repository
import dev.lucasnlm.antimine.common.level.models.Difficulty import dev.lucasnlm.antimine.common.level.models.Difficulty
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository import dev.lucasnlm.antimine.preferences.IPreferencesRepository
import io.mockk.every import io.mockk.every
import io.mockk.mockk import io.mockk.mockk
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals

View file

@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.common.level.solver
import dev.lucasnlm.antimine.common.level.logic.MinefieldCreator import dev.lucasnlm.antimine.common.level.logic.MinefieldCreator
import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import org.junit.Assert.assertFalse import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test

View file

@ -2,7 +2,7 @@ package dev.lucasnlm.antimine.common.level.solver
import dev.lucasnlm.antimine.common.level.logic.MinefieldCreator import dev.lucasnlm.antimine.common.level.logic.MinefieldCreator
import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler import dev.lucasnlm.antimine.common.level.logic.MinefieldHandler
import dev.lucasnlm.antimine.common.level.models.Minefield import dev.lucasnlm.antimine.preferences.models.Minefield
import org.junit.Assert.assertFalse import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test

View file

@ -5,7 +5,7 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test
private class TestPreferenceManager : IPreferencesManager { private class TestPreferenceManager : dev.lucasnlm.antimine.preferences.IPreferencesManager {
val values = mutableMapOf<String, Any>() val values = mutableMapOf<String, Any>()
override fun getBoolean(key: String, defaultValue: Boolean): Boolean { override fun getBoolean(key: String, defaultValue: Boolean): Boolean {
@ -37,7 +37,8 @@ class PreferencesRepositoryTest {
@Test @Test
fun testProgressValue() { fun testProgressValue() {
val preferenceManager = TestPreferenceManager() val preferenceManager = TestPreferenceManager()
val preferencesRepository = PreferencesRepository(preferenceManager, 400) val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
assertEquals(0, preferencesRepository.getProgressiveValue()) assertEquals(0, preferencesRepository.getProgressiveValue())
@ -63,7 +64,8 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_double_click_open", true) preferenceManager.putBoolean("preference_double_click_open", true)
assertTrue(preferenceManager.values["preference_double_click_open"] as Boolean) assertTrue(preferenceManager.values["preference_double_click_open"] as Boolean)
val preferencesRepository = PreferencesRepository(preferenceManager, 400) val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_double_click_open"] == null) assertTrue(preferenceManager.values["preference_double_click_open"] == null)
assertEquals(1, preferenceManager.values["preference_control_style"]) assertEquals(1, preferenceManager.values["preference_control_style"])
@ -76,7 +78,8 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_double_click_open", false) preferenceManager.putBoolean("preference_double_click_open", false)
assertFalse(preferenceManager.values["preference_double_click_open"] as Boolean) assertFalse(preferenceManager.values["preference_double_click_open"] as Boolean)
val preferencesRepository = PreferencesRepository(preferenceManager, 400) val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_double_click_open"] == null) assertTrue(preferenceManager.values["preference_double_click_open"] == null)
assertFalse(preferenceManager.getBoolean("preference_double_click_open", false)) assertFalse(preferenceManager.getBoolean("preference_double_click_open", false))
@ -88,7 +91,8 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_large_area", true) preferenceManager.putBoolean("preference_large_area", true)
assertTrue(preferenceManager.values["preference_large_area"] as Boolean) assertTrue(preferenceManager.values["preference_large_area"] as Boolean)
val preferencesRepository = PreferencesRepository(preferenceManager, 400) val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_large_area"] == null) assertTrue(preferenceManager.values["preference_large_area"] == null)
assertEquals(63, preferenceManager.getInt("preference_area_size", -1)) assertEquals(63, preferenceManager.getInt("preference_area_size", -1))
@ -97,7 +101,7 @@ class PreferencesRepositoryTest {
@Test @Test
fun testMigrationLargeAreaOff() { fun testMigrationLargeAreaOff() {
val preferenceManager = TestPreferenceManager() val preferenceManager = TestPreferenceManager()
PreferencesRepository(preferenceManager, 400) dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_large_area"] == null) assertTrue(preferenceManager.values["preference_large_area"] == null)
assertEquals(50, preferenceManager.getInt("preference_area_size", -1)) assertEquals(50, preferenceManager.getInt("preference_area_size", -1))
@ -109,7 +113,7 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_large_area", false) preferenceManager.putBoolean("preference_large_area", false)
assertEquals(false, preferenceManager.values["preference_large_area"] as Boolean) assertEquals(false, preferenceManager.values["preference_large_area"] as Boolean)
PreferencesRepository(preferenceManager, 400) dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_large_area"] == null) assertTrue(preferenceManager.values["preference_large_area"] == null)
assertEquals(50, preferenceManager.getInt("preference_area_size", -1)) assertEquals(50, preferenceManager.getInt("preference_area_size", -1))

View file

@ -6,7 +6,7 @@ import org.junit.Test
class ThemeRepositoryTest { class ThemeRepositoryTest {
@Test @Test
fun getAllThemesMustNotHaveDuplicatedIds() { fun getAllThemesMustNotHaveDuplicatedIds() {
val customThemes = Themes.getAllCustom() val customThemes = dev.lucasnlm.antimine.ui.repository.Themes.getAllCustom()
customThemes.distinctBy { it.id }.count() customThemes.distinctBy { it.id }.count()
assertEquals(customThemes.size, customThemes.distinctBy { it.id }.count()) assertEquals(customThemes.size, customThemes.distinctBy { it.id }.count())
} }

Some files were not shown because too many files have changed in this diff Show more