Skip to content

Commit

Permalink
Merge pull request #105 from lucasnlm/pump-version
Browse files Browse the repository at this point in the history
Pump version
  • Loading branch information
lucasnlm committed Jun 23, 2020
2 parents 13b1e3c + c9f7c1e commit ce34506
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 101 deletions.
16 changes: 9 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ android {

defaultConfig {
// versionCode and versionName must be hardcoded to support F-droid
versionCode 701011
versionName '7.1.1'
applicationId 'dev.lucanlm.antimine'
versionCode 701041
versionName '7.1.4'
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
Expand Down Expand Up @@ -51,10 +50,13 @@ android {
productFlavors {
google {
dimension 'version'
applicationId 'dev.lucasnlm.antimine'
}

foss {
dimension 'version'
// There's a typo on F-Droid release :(
applicationId 'dev.lucanlm.antimine'
}
}
}
Expand Down Expand Up @@ -90,11 +92,11 @@ dependencies {
implementation 'com.google.android.material:material:1.1.0'

// Dagger
implementation 'com.google.dagger:hilt-android:2.28-alpha'
implementation 'com.google.dagger:hilt-android:2.28.1-alpha'
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01'
kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha'
testImplementation 'com.google.dagger:hilt-android-testing:2.28-alpha'
kaptTest 'com.google.dagger:hilt-android-compiler:2.28-alpha'
kapt 'com.google.dagger:hilt-android-compiler:2.28.1-alpha'
testImplementation 'com.google.dagger:hilt-android-testing:2.28.1-alpha'
kaptTest 'com.google.dagger:hilt-android-compiler:2.28.1-alpha'

// Kotlin
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
android:saveEnabled="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:configChanges="screenSize|orientation"
android:theme="@style/AppTheme.NoActionBar">

<tools:validation testUrl="https://www.lucasnlm.dev/antimine" />
Expand Down
34 changes: 0 additions & 34 deletions app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -504,40 +504,6 @@ class GameActivity : AppCompatActivity() {
)
}
}
Event.ResumeVictory -> {
val score = Score(
rightMines,
totalMines,
totalArea
)
status = Status.Over(currentTime, score)
invalidateOptionsMenu()
viewModel.stopClock()

if (viewModel.isCurrentGame()) {
waitAndShowEndGameDialog(
victory = true,
await = true
)
}
}
Event.ResumeGameOver -> {
val score = Score(
rightMines,
totalMines,
totalArea
)
status = Status.Over(currentTime, score)
invalidateOptionsMenu()
viewModel.stopClock()

if (viewModel.isCurrentGame()) {
waitAndShowEndGameDialog(
victory = false,
await = true
)
}
}
else -> { }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package dev.lucasnlm.antimine.history

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import dagger.hilt.android.AndroidEntryPoint
import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.history.views.HistoryFragment

@AndroidEntryPoint
class HistoryActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
73 changes: 40 additions & 33 deletions app/src/main/java/dev/lucasnlm/antimine/level/view/LevelFragment.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.lucasnlm.antimine.level.view

import android.content.Context
import android.os.Bundle
import android.text.format.DateUtils
import android.view.View
Expand Down Expand Up @@ -32,37 +33,6 @@ open class LevelFragment : CommonLevelFragment() {

recyclerGrid = view.findViewById(R.id.recyclerGrid)

GlobalScope.launch {
val loadGameUid = checkLoadGameDeepLink()
val newGameDeepLink = checkNewGameDeepLink()
val retryDeepLink = checkRetryGameDeepLink()

val levelSetup = when {
loadGameUid != null -> viewModel.loadGame(loadGameUid)
newGameDeepLink != null -> viewModel.startNewGame(newGameDeepLink)
retryDeepLink != null -> viewModel.retryGame(retryDeepLink)
else -> viewModel.loadLastGame()
}

withContext(Dispatchers.Main) {
recyclerGrid.apply {
val horizontalPadding = calcHorizontalPadding(levelSetup.width)
val verticalPadding = calcVerticalPadding(levelSetup.height)
setHasFixedSize(true)
addItemDecoration(SpaceItemDecoration(R.dimen.field_padding))
setPadding(horizontalPadding, verticalPadding, 0, 0)
layoutManager = makeNewLayoutManager(levelSetup.width)
adapter = areaAdapter
alpha = 0.0f

animate().apply {
alpha(1.0f)
duration = DateUtils.SECOND_IN_MILLIS
}.start()
}
}
}

viewModel.run {
field.observe(
viewLifecycleOwner,
Expand All @@ -78,6 +48,7 @@ open class LevelFragment : CommonLevelFragment() {
val horizontalPadding = calcHorizontalPadding(it.width)
val verticalPadding = calcVerticalPadding(it.height)
layoutManager = makeNewLayoutManager(it.width)
setHasFixedSize(true)
setPadding(horizontalPadding, verticalPadding, 0, 0)
}
}
Expand All @@ -94,21 +65,57 @@ open class LevelFragment : CommonLevelFragment() {
viewLifecycleOwner,
Observer {
when (it) {
Event.Pause,
Event.ResumeGameOver,
Event.GameOver,
Event.Victory,
Event.ResumeVictory -> areaAdapter.setClickEnabled(false)
Event.Running,
Event.Resume,
Event.ResumeGame,
Event.StartNewGame -> areaAdapter.setClickEnabled(true)
else -> {
}
null -> { }
}
}
)
}
}

override fun onAttach(context: Context) {
super.onAttach(context)

GlobalScope.launch {
val loadGameUid = checkLoadGameDeepLink()
val newGameDeepLink = checkNewGameDeepLink()
val retryDeepLink = checkRetryGameDeepLink()

val levelSetup = when {
loadGameUid != null -> viewModel.loadGame(loadGameUid)
newGameDeepLink != null -> viewModel.startNewGame(newGameDeepLink)
retryDeepLink != null -> viewModel.retryGame(retryDeepLink)
else -> viewModel.loadLastGame()
}

withContext(Dispatchers.Main) {
recyclerGrid.apply {
val horizontalPadding = calcHorizontalPadding(levelSetup.width)
val verticalPadding = calcVerticalPadding(levelSetup.height)
addItemDecoration(SpaceItemDecoration(R.dimen.field_padding))
setPadding(horizontalPadding, verticalPadding, 0, 0)
layoutManager = makeNewLayoutManager(levelSetup.width)
setHasFixedSize(true)
adapter = areaAdapter
alpha = 0.0f

animate().apply {
alpha(1.0f)
duration = DateUtils.SECOND_IN_MILLIS
}.start()
}
}
}
}

private fun checkNewGameDeepLink(): Difficulty? = activity?.intent?.data?.let { uri ->
if (uri.scheme == DeepLink.SCHEME && uri.authority == DeepLink.NEW_GAME_AUTHORITY) {
when (uri.pathSegments.firstOrNull()) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28.1-alpha'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71'
}
}
Expand Down
12 changes: 6 additions & 6 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {

defaultConfig {
// versionCode and versionName must be hardcoded to support F-droid
versionCode 701011
versionName '7.1.1'
versionCode 701041
versionName '7.1.4'
minSdkVersion 16
targetSdkVersion 29
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down Expand Up @@ -54,11 +54,11 @@ dependencies {
implementation 'android.arch.lifecycle:viewmodel:1.1.1'

// Dagger
implementation 'com.google.dagger:hilt-android:2.28-alpha'
implementation 'com.google.dagger:hilt-android:2.28.1-alpha'
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01'
kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha'
testImplementation 'com.google.dagger:hilt-android-testing:2.28-alpha'
kaptTest 'com.google.dagger:hilt-android-compiler:2.28-alpha'
kapt 'com.google.dagger:hilt-android-compiler:2.28.1-alpha'
testImplementation 'com.google.dagger:hilt-android-testing:2.28.1-alpha'
kaptTest 'com.google.dagger:hilt-android-compiler:2.28.1-alpha'
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01"
kapt "androidx.hilt:hilt-compiler:1.0.0-alpha01"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package dev.lucasnlm.antimine.common.level.view

import android.content.Context
import android.os.Bundle
import android.util.DisplayMetrics
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.activity.viewModels
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -30,8 +32,8 @@ abstract class CommonLevelFragment : Fragment() {
savedInstanceState: Bundle?
): View? = inflater.inflate(levelFragmentResId, container, false)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
override fun onAttach(context: Context) {
super.onAttach(context)

activity?.let {
viewModel = it.viewModels<GameViewModel>().value
Expand All @@ -45,9 +47,9 @@ abstract class CommonLevelFragment : Fragment() {
}

protected fun calcHorizontalPadding(boardWidth: Int): Int {
val activity = requireActivity()
val windowManager = requireContext().getSystemService(Context.WINDOW_SERVICE) as WindowManager
val displayMetrics = DisplayMetrics()
activity.windowManager.defaultDisplay.getMetrics(displayMetrics)
windowManager.defaultDisplay.getMetrics(displayMetrics)

val width = displayMetrics.widthPixels
val recyclerViewWidth = (dimensionRepository.areaSize() * boardWidth)
Expand All @@ -56,12 +58,13 @@ abstract class CommonLevelFragment : Fragment() {
}

protected fun calcVerticalPadding(boardHeight: Int): Int {
val activity = requireActivity()
val context = requireContext()
val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
val displayMetrics = DisplayMetrics()
activity.windowManager.defaultDisplay.getMetrics(displayMetrics)
windowManager.defaultDisplay.getMetrics(displayMetrics)

val typedValue = TypedValue()
val actionBarHeight = if (activity.theme.resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) {
val actionBarHeight = if (context.theme.resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) {
TypedValue.complexToDimensionPixelSize(typedValue.data, resources.displayMetrics)
} else {
0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class GameViewModel @ViewModelInject constructor(
refreshAll()

when {
levelFacade.hasAnyMineExploded() -> eventObserver.postValue(Event.ResumeGameOver)
levelFacade.checkVictory() -> eventObserver.postValue(Event.ResumeVictory)
levelFacade.hasAnyMineExploded() -> eventObserver.postValue(Event.GameOver)
levelFacade.checkVictory() -> eventObserver.postValue(Event.Victory)
else -> eventObserver.postValue(Event.ResumeGame)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public void setTotalColumnCount(int count) {
requestLayout();
}

@Override
public boolean isAutoMeasureEnabled() {
return false;
}

/*
* You must return true from this method if you want your
* LayoutManager to support anything beyond "simple" item
Expand Down
4 changes: 2 additions & 2 deletions foss/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
compileSdkVersion 29

defaultConfig {
versionCode 701011 // MMmmPPv
versionName '7.1.1'
versionCode 701041 // MMmmPPv
versionName '7.1.4'
minSdkVersion 16
targetSdkVersion 29
resConfigs 'en', 'cs', 'de', 'el', 'es', 'fr', 'ja', 'pt', 'ru', 'tr', 'uk', 'vi', 'zh'
Expand Down
4 changes: 2 additions & 2 deletions proprietary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
compileSdkVersion 29

defaultConfig {
versionCode 701011 // MMmmPPv
versionName '7.1.1'
versionCode 701041 // MMmmPPv
versionName '7.1.4'
minSdkVersion 16
targetSdkVersion 29
resConfigs 'en', 'cs', 'de', 'el', 'es', 'fr', 'ja', 'pt', 'ru', 'tr', 'uk', 'vi', 'zh'
Expand Down
12 changes: 6 additions & 6 deletions wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {

defaultConfig {
// versionCode and versionName must be hardcoded to support F-droid
versionCode 701011
versionName '7.1.1'
versionCode 701041
versionName '7.1.4'
applicationId 'dev.lucasnlm.antimine'
minSdkVersion 23
targetSdkVersion 29
Expand Down Expand Up @@ -63,11 +63,11 @@ dependencies {
compileOnly 'com.google.android.wearable:wearable:2.5.0'

// Dagger
implementation 'com.google.dagger:hilt-android:2.28-alpha'
implementation 'com.google.dagger:hilt-android:2.28.1-alpha'
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01'
kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha'
testImplementation 'com.google.dagger:hilt-android-testing:2.28-alpha'
kaptTest 'com.google.dagger:hilt-android-compiler:2.28-alpha'
kapt 'com.google.dagger:hilt-android-compiler:2.28.1-alpha'
testImplementation 'com.google.dagger:hilt-android-testing:2.28.1-alpha'
kaptTest 'com.google.dagger:hilt-android-compiler:2.28.1-alpha'

// Kotlin
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
Expand Down

0 comments on commit ce34506

Please sign in to comment.