Skip to content

Commit f20be3b

Browse files
authored
Merge branch 'main' into tech/version-bump
2 parents acbbefb + b57df04 commit f20be3b

40 files changed

+264
-327
lines changed

androidApp/main/app/src/debug/res/layout/activity_main.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636

3737
</androidx.drawerlayout.widget.DrawerLayout>
3838

39+
<com.simplecityapps.shuttle.ui.common.view.SnowfallView
40+
android:id="@+id/snowfallView"
41+
android:layout_width="match_parent"
42+
android:layout_height="match_parent" />
43+
3944
<com.simplecityapps.shuttle.ui.common.view.KeylineView
4045
android:layout_width="match_parent"
4146
android:layout_height="match_parent"

androidApp/main/app/src/main/java/com/simplecityapps/shuttle/ui/MainActivity.kt

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ import android.provider.MediaStore
88
import androidx.appcompat.app.AppCompatActivity
99
import androidx.core.content.ContextCompat
1010
import androidx.navigation.fragment.NavHostFragment
11+
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
1112
import com.simplecityapps.playback.PlaybackService
1213
import com.simplecityapps.shuttle.R
14+
import com.simplecityapps.shuttle.di.AppCoroutineScope
1315
import com.simplecityapps.shuttle.persistence.GeneralPreferenceManager
16+
import com.simplecityapps.shuttle.ui.common.view.SnowfallView
1417
import com.simplecityapps.trial.BillingManager
1518
import dagger.hilt.android.AndroidEntryPoint
19+
import kotlinx.coroutines.CoroutineScope
20+
import kotlinx.coroutines.launch
21+
import kotlinx.coroutines.tasks.await
22+
import kotlinx.coroutines.withTimeout
1623
import javax.inject.Inject
1724

1825
@AndroidEntryPoint
@@ -28,6 +35,15 @@ class MainActivity :
2835
@Inject
2936
lateinit var billingManager: BillingManager
3037

38+
@Inject
39+
lateinit var remoteConfig: FirebaseRemoteConfig
40+
41+
@Inject
42+
@AppCoroutineScope
43+
lateinit var scope: CoroutineScope
44+
45+
lateinit var snowfallView: SnowfallView
46+
3147
// Lifecycle
3248

3349
override fun onCreate(savedInstanceState: Bundle?) {
@@ -54,6 +70,15 @@ class MainActivity :
5470
handleSearchQuery(intent)
5571

5672
billingManager.queryPurchases()
73+
74+
snowfallView = findViewById(R.id.snowfallView)
75+
76+
scope.launch {
77+
withTimeout(5000) {
78+
remoteConfig.fetchAndActivate().await()
79+
}
80+
snowfallView.setForecast(remoteConfig.getDouble("snow_forecast"))
81+
}
5782
}
5883

5984
override fun onResume() {
@@ -78,14 +103,12 @@ class MainActivity :
78103
if (intent?.action == MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH) {
79104
ContextCompat.startForegroundService(
80105
this,
81-
(
82-
Intent(this, PlaybackService::class.java).apply {
83-
action = PlaybackService.ACTION_SEARCH
84-
intent.extras?.let { extras ->
85-
putExtras(extras)
86-
}
106+
Intent(this, PlaybackService::class.java).apply {
107+
action = PlaybackService.ACTION_SEARCH
108+
intent.extras?.let { extras ->
109+
putExtras(extras)
87110
}
88-
)
111+
}
89112
)
90113
}
91114
}

androidApp/main/app/src/main/java/com/simplecityapps/shuttle/ui/common/view/SnowfallView.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import kotlin.math.roundToInt
1515

1616
class SnowfallView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
1717

18+
fun setForecast(forecast: Double) {
19+
if (random.nextDouble() <= forecast) {
20+
letItSnow()
21+
}
22+
}
23+
1824
/** Used to paint each snowflake */
1925
private val snowPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
2026
color = Color.WHITE
@@ -70,14 +76,6 @@ class SnowfallView(context: Context?, attrs: AttributeSet?) : View(context, attr
7076
}
7177
}
7278

73-
override fun onAttachedToWindow() {
74-
super.onAttachedToWindow()
75-
76-
if (lerp(0f, 1f, random.nextFloat()) <= LUCKY) {
77-
letItSnow()
78-
}
79-
}
80-
8179
override fun onDetachedFromWindow() {
8280
clear()
8381
super.onDetachedFromWindow()
@@ -137,9 +135,6 @@ class SnowfallView(context: Context?, attrs: AttributeSet?) : View(context, attr
137135

138136
companion object {
139137

140-
/** Forecast a <= 5% chance of snowing */
141-
private const val LUCKY = 0.05f
142-
143138
/** The total number of snowflakes to generate */
144139
private const val TOTAL_FLAKES = 200
145140

androidApp/main/app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
app:defaultNavHost="true" />
1515

1616
<com.simplecityapps.shuttle.ui.common.view.SnowfallView
17+
android:id="@+id/snowfallView"
1718
android:layout_width="match_parent"
1819
android:layout_height="match_parent" />
1920

androidApp/main/app/src/main/res/values-es-rES/strings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,12 @@
2020
<string name="title_now_playing">Reproduciendo ahora</string>
2121
<!-- Shown at the top of the 'search' screen-->
2222
<string name="title_search_hint">Buscar música</string>
23+
<!-- Shown for alpha/beta testers, in a dialog on the main screen -->
24+
<string name="crash_reporting_nag_text">Considere ativar los informes de fallos. Esto ayuda a diagnosticar y corregir problemas de manera más eficiente.</string>
25+
<!-- Button shown in dialog to enable crash reporting-->
26+
<string name="dialog_button_enable">Activar</string>
27+
<!-- Shown once the user enables crash reporting via the 'please consider enabling crash reporting' dialog-->
28+
<string name="toast_crash_reporting_enabled">Informes de fallos activado</string>
29+
<string name="pref_navigation_title">Navegación</string>
30+
<string name="pref_show_home_on_launch_title">Mostrar Inicio al iniciar</string>
2331
</resources>

androidApp/main/app/src/main/res/values-es-rES/strings_common.xml

Lines changed: 18 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,48 @@
77
<!-- Shown when an unknown error occurs -->
88
<string name="error_unknown">Ocurrió un error desconocido</string>
99
<!-- Shown when items (an album, artist or song) are added to the queue -->
10-
<string name="queue_item_added"><xliff:g example="Lateralus" id="item_name">{item_name}</xliff:g>
11-
agregado a la cola</string>
10+
<string name="queue_item_added"><xliff:g example="Lateralus" id="item_name">{item_name}</xliff:g> agregado a la cola</string>
1211
<!-- Shown when songs are added to the queue -->
1312
<plurals name="queue_songs_added">
14-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
15-
agregada a la cola</item>
16-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
17-
canciones agregadas a la cola</item>
13+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> canción agregada a la cola</item>
14+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> canciones agregadas a la cola</item>
1815
</plurals>
1916
<!-- Shown when albums are added to the queue -->
2017
<plurals name="queue_albums_added">
21-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
22-
álbum agregado a la cola</item>
23-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
24-
álbumes agregados a la cola</item>
18+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> álbum agregado a la cola</item>
19+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> álbumes agregados a la cola</item>
2520
</plurals>
2621
<!-- Shown when artists are added to the queue -->
2722
<plurals name="queue_artists_added">
28-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
29-
artista agregado a la cola.</item>
30-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
31-
artistas agregados a la cola.</item>
23+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> artista agregado a la cola</item>
24+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> artistas agregados a la cola</item>
3225
</plurals>
3326
<!-- Shown when current playback queue is added to a playlist -->
34-
<string name="playlist_queue_added">Cola agregada a
35-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></string>
27+
<string name="playlist_queue_added">Cola agregada a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></string>
3628
<!-- Shown when songs are added to a playlist -->
3729
<plurals name="playlist_songs_added">
38-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
39-
canción agregada a
40-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
41-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
42-
canciones agregadas a
43-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
30+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> canción agregada a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
31+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> canciones agregadas a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
4432
</plurals>
4533
<!-- Shown when albums are added to a playlist -->
4634
<plurals name="playlist_albums_added">
47-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
48-
álbum agregado a
49-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
50-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
51-
álbumes agregados a
52-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
35+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> álbum agregado a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
36+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> álbumes agregados a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
5337
</plurals>
5438
<!-- Shown when artists are added to a playlist -->
5539
<plurals name="playlist_artists_added">
56-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
57-
artista agregado a
58-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
59-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
60-
artistas agregados a
61-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
40+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> artista agregado a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
41+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> artistas agregados a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
6242
</plurals>
6343
<!-- Shown when genres are added to a playlist -->
6444
<plurals name="playlist_genres_added">
65-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
66-
género agregado a
67-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
68-
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g>
69-
géneros agregados a
70-
<xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
45+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> género agregado a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
46+
<item quantity="other"><xliff:g example="30" id="count">{count}</xliff:g> géneros agregados a <xliff:g example="Favourites" id="playlist_name">{playlist_name}</xliff:g></item>
7147
</plurals>
7248
<!-- Shown when a song fails to be deleted -->
7349
<string name="delete_song_failed">No se pudo eliminar la canción</string>
7450
<!-- The disc number for this album-->
75-
<string name="disc_number">Disco
76-
<xliff:g example="1" id="disc_number">{disc_number}</xliff:g></string>
51+
<string name="disc_number">Disco <xliff:g example="1" id="disc_number">{disc_number}</xliff:g></string>
7752
<!-- Shown when the songs list finishes loading, and there are no songs-->
7853
<string name="song_list_empty">Sin canciones</string>
7954
<!-- Shown when the albums list finishes loading, and there are no songs-->
@@ -99,7 +74,7 @@
9974
<!-- Button to skip to the previous track-->
10075
<string name="button_skip_previous">Saltar anterior</string>
10176
<!-- Button to shuffle songs-->
102-
<string name="button_content_description_shuffle">Shuffle</string>
77+
<string name="button_content_description_shuffle">Aleatorio</string>
10378
<!-- Button to shuffle songs using 'album shuffle' mode (shuffles albums, but plays songs in track order)-->
10479
<string name="button_album_shuffle">Álbum aleatorio</string>
10580
<!-- 'Loading' text. Shown on various screens as their content is loading-->

androidApp/main/app/src/main/res/values-es-rES/strings_dialog.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,15 @@
1313
<!-- Shown in the 'exclude' dialog (move the selected songs to the list of 'excluded' songs) (another word for 'blacklist') -->
1414
<string name="dialog_exclude_title">Excluir</string>
1515
<!-- Shown when songs are about to be added to the list of songs to be excluded (blacklisted) -->
16-
<string name="dialog_exclude_message">\"
17-
<xliff:g example="Lateralus" id="item">{item}</xliff:g>
18-
\" se ocultará de tu biblioteca.\n\nPuedes ver las canciones excluidas en la configuración.</string>
16+
<string name="dialog_exclude_message">\"<xliff:g example="Lateralus" id="item">{item}</xliff:g>\" se ocultará de tu biblioteca.\n\nPuedes ver las canciones excluidas en la configuración.</string>
1917
<!-- Button to add the selected songs to the list of 'excluded' (blacklisted) songs -->
2018
<string name="dialog_exclude_button">Excluir</string>
2119
<!-- Shown when viewing the list of 'excluded' (blacklisted) songs, and it's empty-->
2220
<string name="dialog_exclude_list_empty">La lista de excluidas está vacía</string>
2321
<!-- Dialog title shown when attempting to delete a song -->
2422
<string name="dialog_delete_title">Eliminar</string>
2523
<!-- Dialog warning message to indicate the song will be permanently deleted -->
26-
<string name="dialog_delete_message">\"
27-
<xliff:g example="Lateralus" id="item">{item}</xliff:g>
28-
\" se eliminará de forma permanente</string>
24+
<string name="dialog_delete_message">\"<xliff:g example="Lateralus" id="item">{item}</xliff:g>\" se eliminará de forma permanente</string>
2925
<!-- Dialog button to confirm deletion of the selected song(s)-->
3026
<string name="dialog_delete_button">Eliminar</string>
3127
</resources>

androidApp/main/app/src/main/res/values-es-rES/strings_home.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<!-- Title for list of albums released this year -->
1212
<string name="home_title_this_year">Este año</string>
1313
<!-- Description for list of albums released this year -->
14+
<string name="home_description_this_year">Álbumes lanzados en <xliff:g example="2005" id="year">{year}</xliff:g></string>
1415
<!-- Title for list of artists which haven't been played for a while-->
1516
<string name="home_title_something_different">Algo diferente</string>
1617
<!-- Description for list of artists which haven't been played for a while-->
@@ -22,5 +23,5 @@
2223
<!-- Button to show list of favourite songs-->
2324
<string name="btn_favorite">Favoritos</string>
2425
<!-- Button to shuffle all songs -->
25-
<string name="btn_shuffle">Shuffle</string>
26+
<string name="btn_shuffle">Aleatorio</string>
2627
</resources>

androidApp/main/app/src/main/res/values-es-rES/strings_library.xml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,15 @@
55
<!-- Title for the list of albums -->
66
<string name="albums">Álbumes</string>
77
<plurals name="albumsPlural">
8-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
9-
álbum</item>
10-
<item quantity="other"><xliff:g example="5" id="count">{count}</xliff:g>
11-
álbumes</item>
8+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> álbum</item>
9+
<item quantity="other"><xliff:g example="5" id="count">{count}</xliff:g> álbumes</item>
1210
</plurals>
1311
<!-- Title for the list of songs -->
1412
<string name="songs">Canciones</string>
1513
<!-- The number of songs for an album/playlist/genre -->
1614
<plurals name="songsPlural">
17-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
18-
canción</item>
19-
<item quantity="other"><xliff:g example="12" id="count">{count}</xliff:g>
20-
canciones</item>
15+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> canción</item>
16+
<item quantity="other"><xliff:g example="12" id="count">{count}</xliff:g> canciones</item>
2117
</plurals>
2218
<!-- Title for the list of genres -->
2319
<string name="genres">Géneros</string>
@@ -27,10 +23,9 @@
2723
<string name="library_scan_in_progress">Buscando en tu biblioteca</string>
2824
<!-- Shown to indicate the number of tracks/albums/artists which have been selected, in multi-selection mode-->
2925
<plurals name="multi_select_items_selected">
30-
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g>
31-
seleccionado(s)</item>
32-
<item quantity="other"><xliff:g example="3" id="count">{count}</xliff:g>
33-
seleccionado(s)</item>
26+
<item quantity="one"><xliff:g example="1" id="count">{count}</xliff:g> seleccionado(s)</item>
27+
<item quantity="other"><xliff:g example="3" id="count">{count}</xliff:g> seleccionado(s)</item>
3428
</plurals>
3529
<!-- Shown on the library screen, if the user has manually deselected all the library tabs in appearance settings-->
30+
<string name="library_tabs_empty">No hay pestañas de biblioteca visibles</string>
3631
</resources>

0 commit comments

Comments
 (0)