Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
meikpiep committed Feb 20, 2025
1 parent d98c684 commit fab0356
Show file tree
Hide file tree
Showing 46 changed files with 41 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,18 @@ class KeyPadFragment :
addButtonListeners(it)
}

if (layoutId != layoutCalculator.calculateLayoutId(game.grid)) {
requireActivity().recreate()
// this.requireView().forceLayout()
}

val viewModel: MainViewModel by viewModels()

lifecycleScope.launch {
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.uiState.collect {
if (it.state == MainUiState.PLAYING) {
requireActivity().runOnUiThread {
if (layoutId != layoutCalculator.calculateLayoutId(game.grid)) {
requireActivity().recreate()
} else {
setButtonStates()
}
}
requireActivity().runOnUiThread {
setButtonStates()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MainActivity : AppCompatActivity() {
private val applicationPreferences: ApplicationPreferences by inject()
private val activityUtils: ActivityUtils by inject()

private lateinit var binding: ActivityMainBinding
lateinit var binding: ActivityMainBinding
private lateinit var bottomAppBarService: MainBottomAppBarService

public override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
2 changes: 1 addition & 1 deletion gauguin-app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<FrameLayout
android:id="@+id/fastFinishingModeFrame"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/keypadFrame"
app:layout_constraintBottom_toBottomOf="@id/keypadFrame"
app:layout_constraintStart_toStartOf="@id/keypadFrame"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<FrameLayout
android:id="@+id/fastFinishingModeFrame"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/gridview"
app:layout_constraintEnd_toEndOf="@id/gameTopFrame"
app:layout_constraintTop_toBottomOf="@id/gameTopFrame"
Expand Down
2 changes: 1 addition & 1 deletion gauguin-app/src/main/res/layout-sw600dp/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<FrameLayout
android:id="@+id/fastFinishingModeFrame"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/keypadFrame"
app:layout_constraintBottom_toBottomOf="@id/keypadFrame"
app:layout_constraintStart_toStartOf="@id/keypadFrame"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<FrameLayout
android:id="@+id/fastFinishingModeFrame"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="16dp"
app:layout_constraintStart_toEndOf="@id/gridview"
Expand Down
4 changes: 2 additions & 2 deletions gauguin-app/src/main/res/layout-sw840dp/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@

<FrameLayout
android:id="@+id/fastFinishingModeFrame"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="16dp"
app:layout_constraintStart_toEndOf="@id/gridview"
Expand Down
11 changes: 4 additions & 7 deletions gauguin-app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<org.piepmeyer.gauguin.ui.grid.GridUI
android:id="@+id/gridview"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
Expand All @@ -49,8 +49,6 @@
android:id="@+id/keypadFrame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0.75"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -59,10 +57,9 @@

<FrameLayout
android:id="@+id/fastFinishingModeFrame"
android:layout_width="wrap_content"
android:layout_height="0dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0.75"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="96dp"
app:layout_constraintTop_toTopOf="@id/keypadFrame"
app:layout_constraintBottom_toBottomOf="@id/keypadFrame"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
android:layout_margin="16dp"
android:visibility="invisible"

android:backgroundTint="#50000000"
android:foregroundTint="?attr/colorCustomColor1"
style="@style/Widget.Material3.CardView.Elevated"
android:backgroundTint="?attr/colorCustomColor1"
android:foregroundTint="#50000000"
style="MaterialCarView.FastFinishingMode"
>

<androidx.constraintlayout.widget.ConstraintLayout
Expand Down Expand Up @@ -92,7 +92,7 @@
android:layout_margin="16dp"
android:text="@string/fast_finishing_mode_deactivate_fast_finishing_mode_button"
app:icon="@drawable/outline_clear_24"
style="@style/Widget.Material3.ExtendedFloatingActionButton.Icon.Tertiary"
style="@style/Widget.Material3.ExtendedFloatingActionButton.Icon.Surface"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
3 changes: 3 additions & 0 deletions gauguin-app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,7 @@
<item name="legendTextColor">?attr/colorOnSurface</item>
</style>


<style name="MaterialCarView.FastFinishingMode" parent="Widget.Material3.CardView.Outlined">
</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MainActivityScreenshotTest(
NewGame,
NewGameWithCellDetails,
GameWith6x6GridFromZeroOnPossibleIn3x3,
GameWith6x6GridFastFinishingMode,
GameWith7x7GridFromZeroOnPossibleIn3x3,
NewGameWithRectangularGrid,
NewGameWithRectangularGridAndFastFinishingMode,
Expand Down Expand Up @@ -100,6 +101,10 @@ class MainActivityScreenshotTest(
onActivityViaUiState()

gameLifecycle.stoppGameTimerAndResetGameTime()

while (it.binding.mainBottomAppBar.isLayoutRequested) {
Thread.sleep(100)
}
}

robolectricScreenshotRule
Expand Down Expand Up @@ -140,6 +145,17 @@ class MainActivityScreenshotTest(
game.gridUI.invalidate()
}

UiStateEnum.GameWith6x6GridFastFinishingMode -> {
preferences.gridTakesRemainingSpaceIfNecessary = false

game.updateGrid(createGrid(11, 11))

game.selectCell(game.grid.getCell(15))
game.enterFastFinishingMode()

game.gridUI.invalidate()
}

UiStateEnum.GameWith7x7GridFromZeroOnPossibleIn3x3 -> {
preferences.show3x3Pencils = true
game.updateGrid(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fab0356

Please sign in to comment.