diff --git a/app/src/main/java/com/mrsep/musicrecognizer/glue/library/mapper/UserPreferencesMapper.kt b/app/src/main/java/com/mrsep/musicrecognizer/glue/library/mapper/UserPreferencesMapper.kt
index 1b544c13..b74540e7 100644
--- a/app/src/main/java/com/mrsep/musicrecognizer/glue/library/mapper/UserPreferencesMapper.kt
+++ b/app/src/main/java/com/mrsep/musicrecognizer/glue/library/mapper/UserPreferencesMapper.kt
@@ -14,7 +14,7 @@ class UserPreferencesMapper @Inject constructor(
override fun map(input: UserPreferencesDo): UserPreferences {
return UserPreferences(
trackFilter = trackFilterMapper.map(input.trackFilter),
- useGridForLibrary = input.useGridForLibrary
+ useColumnForLibrary = input.useColumnForLibrary
)
}
diff --git a/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/adapter/AdapterPreferencesRepository.kt b/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/adapter/AdapterPreferencesRepository.kt
index 417947a3..2d1407f9 100644
--- a/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/adapter/AdapterPreferencesRepository.kt
+++ b/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/adapter/AdapterPreferencesRepository.kt
@@ -69,8 +69,8 @@ class AdapterPreferencesRepository @Inject constructor(
)
}
- override suspend fun setUseGridForLibrary(value: Boolean) {
- preferencesRepositoryDo.setUseGridForLibrary(value)
+ override suspend fun setUseColumnForLibrary(value: Boolean) {
+ preferencesRepositoryDo.setUseColumnForLibrary(value)
}
override suspend fun setThemeMode(value: ThemeMode) {
diff --git a/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/mapper/PreferencesMapper.kt b/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/mapper/PreferencesMapper.kt
index 7bce09ab..4b778032 100644
--- a/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/mapper/PreferencesMapper.kt
+++ b/app/src/main/java/com/mrsep/musicrecognizer/glue/preferences/mapper/PreferencesMapper.kt
@@ -29,7 +29,7 @@ class PreferencesMapper @Inject constructor(
requiredServices = requiredServicesMapper.map(input.requiredServices),
fallbackPolicy = fallbackPolicyMapper.map(input.fallbackPolicy),
hapticFeedback = hapticFeedbackMapper.map(input.hapticFeedback),
- useGridForLibrary = input.useGridForLibrary,
+ useColumnForLibrary = input.useColumnForLibrary,
themeMode = themeModeMapper.map(input.themeMode),
usePureBlackForDarkTheme = input.usePureBlackForDarkTheme
)
diff --git a/core/strings/src/main/res/values-ru/strings.xml b/core/strings/src/main/res/values-ru/strings.xml
index 501c5b96..cd5e8063 100644
--- a/core/strings/src/main/res/values-ru/strings.xml
+++ b/core/strings/src/main/res/values-ru/strings.xml
@@ -132,7 +132,8 @@
Исп. черный фон
Ссылки на музыкальные сервисы
Выберите музыкальные сервисы, для которых вы хотите видеть веб-ссылки (если доступны):
- Использовать сетку для библиотеки
+ Библиотека в виде сетки
+ Библиотека в виде списка
Вибрация
Вибрация
Настройте вибрацию для конкретных действий в приложении:
diff --git a/core/strings/src/main/res/values/strings.xml b/core/strings/src/main/res/values/strings.xml
index c7187f25..9195d494 100644
--- a/core/strings/src/main/res/values/strings.xml
+++ b/core/strings/src/main/res/values/strings.xml
@@ -143,6 +143,7 @@
Music service links
Choose the music services for which you would like to see web links (if available):
Use grid layout for library
+ Use list layout for library
Vibration feedback
Vibration feedback
Configure vibration feedback for certain in-app actions:
diff --git a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryDo.kt b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryDo.kt
index e057effd..ac52c3ca 100644
--- a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryDo.kt
+++ b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryDo.kt
@@ -17,7 +17,7 @@ interface PreferencesRepositoryDo {
suspend fun setLyricsFontStyle(value: UserPreferencesDo.LyricsFontStyleDo)
suspend fun setTrackFilter(value: UserPreferencesDo.TrackFilterDo)
suspend fun setHapticFeedback(value: UserPreferencesDo.HapticFeedbackDo)
- suspend fun setUseGridForLibrary(value: Boolean)
+ suspend fun setUseColumnForLibrary(value: Boolean)
suspend fun setThemeMode(value: ThemeModeDo)
suspend fun setUsePureBlackForDarkTheme(value: Boolean)
diff --git a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryImpl.kt b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryImpl.kt
index 5c289fad..bf988431 100644
--- a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryImpl.kt
+++ b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/PreferencesRepositoryImpl.kt
@@ -90,8 +90,8 @@ class PreferencesRepositoryImpl @Inject constructor(
}
}
- override suspend fun setUseGridForLibrary(value: Boolean) {
- safeWriter { setUseGridForLibrary(value) }
+ override suspend fun setUseColumnForLibrary(value: Boolean) {
+ safeWriter { setUseColumnForLibrary(value) }
}
override suspend fun setThemeMode(value: ThemeModeDo) {
diff --git a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesDo.kt b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesDo.kt
index b3d5fa98..ee2dca81 100644
--- a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesDo.kt
+++ b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesDo.kt
@@ -12,7 +12,7 @@ data class UserPreferencesDo(
val lyricsFontStyle: LyricsFontStyleDo,
val trackFilter: TrackFilterDo,
val hapticFeedback: HapticFeedbackDo,
- val useGridForLibrary: Boolean,
+ val useColumnForLibrary: Boolean,
val themeMode: ThemeModeDo,
val usePureBlackForDarkTheme: Boolean,
) {
diff --git a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesProtoSerializer.kt b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesProtoSerializer.kt
index 5bd8eec4..2bce1450 100644
--- a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesProtoSerializer.kt
+++ b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/UserPreferencesProtoSerializer.kt
@@ -27,7 +27,7 @@ object UserPreferencesProtoSerializer : Serializer {
.setOnboardingCompleted(false)
.setDynamicColorsEnabled(true)
.setArtworkBasedThemeEnabled(false)
- .setUseGridForLibrary(true)
+ .setUseColumnForLibrary(false)
.setNotificationServiceEnabled(false)
.setDeveloperModeEnabled(true)
.setFallbackPolicy(
diff --git a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/mappers/UserPreferencesDoMapper.kt b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/mappers/UserPreferencesDoMapper.kt
index 727fea22..fe680278 100644
--- a/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/mappers/UserPreferencesDoMapper.kt
+++ b/data/src/main/java/com/mrsep/musicrecognizer/data/preferences/mappers/UserPreferencesDoMapper.kt
@@ -30,7 +30,7 @@ class UserPreferencesDoMapper @Inject constructor(
.setLyricsFontStyle(lyricsFontStyleMapper.reverseMap(input.lyricsFontStyle))
.setTrackFilter(trackFilterMapper.reverseMap(input.trackFilter))
.setHapticFeedback(hapticFeedbackMapper.reverseMap(input.hapticFeedback))
- .setUseGridForLibrary(input.useGridForLibrary)
+ .setUseColumnForLibrary(input.useColumnForLibrary)
.setThemeMode(themeModeMapper.reverseMap(input.themeMode))
.setUsePureBlackForDarkTheme(input.usePureBlackForDarkTheme)
.build()
@@ -49,7 +49,7 @@ class UserPreferencesDoMapper @Inject constructor(
lyricsFontStyle = lyricsFontStyleMapper.map(input.lyricsFontStyle),
trackFilter = trackFilterMapper.map(input.trackFilter),
hapticFeedback = hapticFeedbackMapper.map(input.hapticFeedback),
- useGridForLibrary = input.useGridForLibrary,
+ useColumnForLibrary = input.useColumnForLibrary,
themeMode = themeModeMapper.map(input.themeMode),
usePureBlackForDarkTheme = input.usePureBlackForDarkTheme
)
diff --git a/data/src/main/proto/user_preferences_proto.proto b/data/src/main/proto/user_preferences_proto.proto
index 0a2a99ad..27fc243f 100644
--- a/data/src/main/proto/user_preferences_proto.proto
+++ b/data/src/main/proto/user_preferences_proto.proto
@@ -89,7 +89,7 @@ message UserPreferencesProto {
}
HapticFeedbackProto haptic_feedback = 31;
- bool use_grid_for_library = 32;
+ bool use_column_for_library = 32;
enum ThemeModeProto {
FOLLOW_SYSTEM = 0;
diff --git a/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/domain/model/UserPreferences.kt b/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/domain/model/UserPreferences.kt
index 33afbda2..17b83f69 100644
--- a/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/domain/model/UserPreferences.kt
+++ b/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/domain/model/UserPreferences.kt
@@ -2,5 +2,5 @@ package com.mrsep.musicrecognizer.feature.library.domain.model
data class UserPreferences(
val trackFilter: TrackFilter,
- val useGridForLibrary: Boolean
+ val useColumnForLibrary: Boolean
)
\ No newline at end of file
diff --git a/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryScreen.kt b/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryScreen.kt
index 74c31add..c2058c5b 100644
--- a/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryScreen.kt
+++ b/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryScreen.kt
@@ -86,12 +86,12 @@ internal fun LibraryScreen(
)
var newFilterApplied by rememberSaveable { mutableStateOf(false) }
- if (uiState.useGridLayout) {
- val lazyGridState = rememberLazyGridState()
- TrackLazyGrid(
+ if (uiState.useColumnLayout) {
+ val lazyListState = rememberLazyListState()
+ TrackLazyColumn(
trackList = uiState.trackList,
onTrackClick = onTrackClick,
- lazyGridState = lazyGridState,
+ lazyListState = lazyListState,
multiSelectionState = multiSelectionState,
modifier = Modifier.nestedScroll(
topBarBehaviour.nestedScrollConnection
@@ -99,16 +99,16 @@ internal fun LibraryScreen(
)
LaunchedEffect(uiState.trackFilter) {
if (newFilterApplied) {
- lazyGridState.animateScrollToItem(0)
+ lazyListState.animateScrollToItem(0)
newFilterApplied = false
}
}
} else {
- val lazyListState = rememberLazyListState()
- TrackLazyColumn(
+ val lazyGridState = rememberLazyGridState()
+ TrackLazyGrid(
trackList = uiState.trackList,
onTrackClick = onTrackClick,
- lazyListState = lazyListState,
+ lazyGridState = lazyGridState,
multiSelectionState = multiSelectionState,
modifier = Modifier.nestedScroll(
topBarBehaviour.nestedScrollConnection
@@ -116,7 +116,7 @@ internal fun LibraryScreen(
)
LaunchedEffect(uiState.trackFilter) {
if (newFilterApplied) {
- lazyListState.animateScrollToItem(0)
+ lazyGridState.animateScrollToItem(0)
newFilterApplied = false
}
}
diff --git a/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryViewModel.kt b/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryViewModel.kt
index e5e0b39b..fba7f0b2 100644
--- a/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryViewModel.kt
+++ b/feature/library/src/main/java/com/mrsep/musicrecognizer/feature/library/presentation/library/LibraryViewModel.kt
@@ -32,7 +32,7 @@ internal class LibraryViewModel @Inject constructor(
LibraryUiState.Success(
trackList = trackList.map { track -> track.toUi() }.toImmutableList(),
trackFilter = preferences.trackFilter,
- useGridLayout = preferences.useGridForLibrary
+ useColumnLayout = preferences.useColumnForLibrary
)
}
}
@@ -66,7 +66,7 @@ internal sealed class LibraryUiState {
data class Success(
val trackList: ImmutableList,
val trackFilter: TrackFilter,
- val useGridLayout: Boolean
+ val useColumnLayout: Boolean
) : LibraryUiState()
}
diff --git a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/PreferencesRepository.kt b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/PreferencesRepository.kt
index 896ffdda..fea60eba 100644
--- a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/PreferencesRepository.kt
+++ b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/PreferencesRepository.kt
@@ -15,7 +15,7 @@ interface PreferencesRepository {
suspend fun setRequiredServices(requiredServices: UserPreferences.RequiredServices)
suspend fun setFallbackPolicy(fallbackPolicy: UserPreferences.FallbackPolicy)
suspend fun setHapticFeedback(hapticFeedback: UserPreferences.HapticFeedback)
- suspend fun setUseGridForLibrary(value: Boolean)
+ suspend fun setUseColumnForLibrary(value: Boolean)
suspend fun setThemeMode(value: ThemeMode)
suspend fun setUsePureBlackForDarkTheme(value: Boolean)
diff --git a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/UserPreferences.kt b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/UserPreferences.kt
index a8fe2f09..79610ec1 100644
--- a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/UserPreferences.kt
+++ b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/domain/UserPreferences.kt
@@ -10,7 +10,7 @@ data class UserPreferences(
val developerModeEnabled: Boolean,
val fallbackPolicy: FallbackPolicy,
val hapticFeedback: HapticFeedback,
- val useGridForLibrary: Boolean,
+ val useColumnForLibrary: Boolean,
val themeMode: ThemeMode,
val usePureBlackForDarkTheme: Boolean,
) {
diff --git a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesScreen.kt b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesScreen.kt
index 5549d47c..4dbb1c31 100644
--- a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesScreen.kt
+++ b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesScreen.kt
@@ -148,9 +148,9 @@ internal fun PreferencesScreen(
)
}
PreferenceSwitchItem(
- title = stringResource(StringsR.string.use_grid_for_library),
- onCheckedChange = { viewModel.setUseGridForLibrary(it) },
- checked = uiState.preferences.useGridForLibrary,
+ title = stringResource(StringsR.string.use_list_for_library),
+ onCheckedChange = { viewModel.setUseColumnForLibrary(it) },
+ checked = uiState.preferences.useColumnForLibrary,
modifier = Modifier.padding(top = 12.dp)
)
}
diff --git a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesViewModel.kt b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesViewModel.kt
index bc243df1..f5569bc1 100644
--- a/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesViewModel.kt
+++ b/feature/preferences/src/main/java/com/mrsep/musicrecognizer/feature/preferences/presentation/PreferencesViewModel.kt
@@ -67,9 +67,9 @@ internal class PreferencesViewModel @Inject constructor(
}
}
- fun setUseGridForLibrary(value: Boolean) {
+ fun setUseColumnForLibrary(value: Boolean) {
viewModelScope.launch {
- preferencesRepository.setUseGridForLibrary(value)
+ preferencesRepository.setUseColumnForLibrary(value)
}
}