Skip to content

Commit

Permalink
Add vertical menu and clear button (#59)
Browse files Browse the repository at this point in the history
* Adds vertical menu and clear button
  • Loading branch information
Jerboa-app authored Aug 15, 2024
1 parent f92a31d commit 1b89d9d
Show file tree
Hide file tree
Showing 15 changed files with 1,917 additions and 264 deletions.
14 changes: 8 additions & 6 deletions app/src/main/java/app/jerboa/spp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import app.jerboa.spp.viewmodel.SOCIAL
import app.jerboa.spp.composable.screen
import app.jerboa.spp.ui.theme.SPPTheme
import app.jerboa.spp.viewmodel.AboutViewModel
import app.jerboa.spp.viewmodel.MainMenuViewModel
import app.jerboa.spp.viewmodel.ToyMenuViewModel
import app.jerboa.spp.viewmodel.MenuPromptViewModel
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability
Expand Down Expand Up @@ -90,7 +90,7 @@ class MainActivity : AppCompatActivity() {
private val sppViewModel by viewModels<SPPViewModel>()
private val aboutViewModel by viewModels<AboutViewModel>()
private val menuPromptViewModel by viewModels<MenuPromptViewModel>()
private val mainMenuViewModel by viewModels<MainMenuViewModel>()
private val toyMenuViewModel by viewModels<ToyMenuViewModel>()

private var mediaPlayer = MediaPlayer()

Expand Down Expand Up @@ -131,7 +131,9 @@ class MainActivity : AppCompatActivity() {
"news" to R.drawable.news,
"pause" to R.drawable.pause,
"play" to R.drawable.play_button,
"freezer" to R.drawable.freezer
"freezer" to R.drawable.freezer,
"clear" to R.drawable.clear,
"toyMenu" to R.drawable.toymenu
)

private val rcAchievementUI = 9003
Expand Down Expand Up @@ -444,7 +446,7 @@ class MainActivity : AppCompatActivity() {
}
)

mainMenuViewModel.showToys.observe(
toyMenuViewModel.showToys.observe(
this, androidx.lifecycle.Observer { show ->
val prefs = getSharedPreferences("jerboa.app.spp.prefs", MODE_PRIVATE)
val prefsEdit = prefs.edit()
Expand Down Expand Up @@ -542,7 +544,7 @@ class MainActivity : AppCompatActivity() {
prefsEdit.apply()
}

mainMenuViewModel.onShowToysChanged(prefs.getBoolean("showToys", false))
toyMenuViewModel.onShowToysChanged(prefs.getBoolean("showToys", false))

// if (BuildConfig.DEBUG){
// prefs.edit().clear().apply()
Expand Down Expand Up @@ -600,7 +602,7 @@ class MainActivity : AppCompatActivity() {
sppViewModel,
aboutViewModel,
menuPromptViewModel,
mainMenuViewModel,
toyMenuViewModel,
Pair(width, height),
imageResources,
appInfo,
Expand Down
Loading

0 comments on commit 1b89d9d

Please sign in to comment.