diff --git a/android/app/build.gradle b/android/app/build.gradle index 36b950867d..5ad382c0ab 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -375,44 +375,44 @@ android { } dependencies { - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.1' - implementation 'androidx.activity:activity-compose:1.9.0' - implementation platform('androidx.compose:compose-bom:2024.05.00') - implementation 'androidx.compose.ui:ui' - implementation 'androidx.compose.ui:ui-graphics' - implementation 'androidx.compose.ui:ui-tooling-preview' - implementation 'androidx.compose.material3:material3' - androidTestImplementation platform('androidx.compose:compose-bom:2024.05.00') - androidTestImplementation 'androidx.compose.ui:ui-test-junit4' - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7' + implementation 'androidx.activity:activity-compose:1.9.3' + implementation platform('androidx.compose:compose-bom:2024.12.01') + implementation 'androidx.compose.ui:ui' + implementation 'androidx.compose.ui:ui-graphics' + implementation 'androidx.compose.ui:ui-tooling-preview' + implementation 'androidx.compose.material3:material3' + androidTestImplementation platform('androidx.compose:compose-bom:2024.12.01') + androidTestImplementation 'androidx.compose.ui:ui-test-junit4' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' - debugImplementation 'androidx.compose.ui:ui-tooling' - debugImplementation 'androidx.compose.ui:ui-test-manifest' + debugImplementation 'androidx.compose.ui:ui-tooling' + debugImplementation 'androidx.compose.ui:ui-test-manifest' - // hilt - def hilt = '2.51.1' - implementation "com.google.dagger:hilt-android:$hilt" - kapt "com.google.dagger:hilt-compiler:$hilt" - kapt "androidx.hilt:hilt-compiler:1.2.0" - implementation 'androidx.hilt:hilt-navigation-compose:1.2.0' + // hilt + def hilt = '2.51.1' + implementation "com.google.dagger:hilt-android:$hilt" + kapt "com.google.dagger:hilt-compiler:$hilt" + kapt "androidx.hilt:hilt-compiler:1.2.0" + implementation 'androidx.hilt:hilt-navigation-compose:1.2.0' - // navigation - implementation "androidx.navigation:navigation-compose:2.8.0-beta03" + // navigation + implementation 'androidx.navigation:navigation-compose:2.8.5' - implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3" - // countries - implementation 'com.hbb20:ccp:2.7.3' - // webview - implementation "androidx.webkit:webkit:1.11.0" - // compress - implementation 'id.zelory:compressor:3.0.1' + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3" + // countries + implementation 'com.hbb20:ccp:2.7.3' + // webview + implementation "androidx.webkit:webkit:1.11.0" + // compress + implementation 'id.zelory:compressor:3.0.1' //Background processing def coroutines = '1.8.1' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines" // Coroutine Lifecycle Scopes - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7' // region Network // Retrofit @@ -423,7 +423,7 @@ dependencies { implementation "com.squareup.okhttp3:okhttp:$okhttp" implementation "com.squareup.okhttp3:logging-interceptor:$okhttp" implementation 'com.google.code.gson:gson:2.11.0' - def coil_version = '2.6.0' + def coil_version = '2.7.0' implementation("io.coil-kt:coil-compose:$coil_version") implementation("io.coil-kt:coil-svg:$coil_version") // endregion diff --git a/android/app/src/main/java/app/organicmaps/downloader/OnmapDownloader.java b/android/app/src/main/java/app/organicmaps/downloader/OnmapDownloader.java index f4debf1926..83185a40af 100644 --- a/android/app/src/main/java/app/organicmaps/downloader/OnmapDownloader.java +++ b/android/app/src/main/java/app/organicmaps/downloader/OnmapDownloader.java @@ -7,7 +7,6 @@ import android.location.Location; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.Button; @@ -15,22 +14,22 @@ import android.widget.TextView; import android.widget.Toast; import androidx.annotation.Nullable; - import androidx.core.view.ViewCompat; + +import java.util.List; +import java.util.Objects; + import app.organicmaps.MwmActivity; import app.organicmaps.R; import app.organicmaps.location.LocationHelper; import app.organicmaps.routing.RoutingController; -import app.organicmaps.widget.WheelProgressView; import app.organicmaps.util.Config; import app.organicmaps.util.ConnectionState; import app.organicmaps.util.StringUtils; import app.organicmaps.util.UiUtils; +import app.organicmaps.widget.WheelProgressView; import app.tourism.MainActivity; -import java.util.List; -import java.util.Objects; - public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener { private static boolean sAutodownloadLocked; @@ -90,13 +89,14 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener private void navigationToMainActivityHandling() { Handler handler = new Handler(Looper.getMainLooper()); Runnable delayedAction = () -> { - if(mCurrentCountry.present && !alreadyNavigating) { - alreadyNavigating = true; - mActivity.removeScreenBlock(); - Intent intent = new Intent(mActivity, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(mActivity, intent, null); - alreadyNavigating = true; + if(mCurrentCountry != null) { + if(mCurrentCountry.present && !alreadyNavigating) { + alreadyNavigating = true; + mActivity.removeScreenBlock(); + Intent intent = new Intent(mActivity, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(mActivity, intent, null); + } } }; handler.postDelayed(delayedAction, 1000); diff --git a/android/app/src/main/java/app/tourism/data/db/dao/PlacesDao.kt b/android/app/src/main/java/app/tourism/data/db/dao/PlacesDao.kt index c8e00c9832..80c59494ae 100644 --- a/android/app/src/main/java/app/tourism/data/db/dao/PlacesDao.kt +++ b/android/app/src/main/java/app/tourism/data/db/dao/PlacesDao.kt @@ -30,7 +30,7 @@ interface PlacesDao { fun getTopPlacesByCategoryId(categoryId: Long): Flow> @Query("SELECT * FROM places WHERE id = :placeId") - fun getPlaceById(placeId: Long): Flow + fun getPlaceById(placeId: Long): Flow @Query("SELECT * FROM places WHERE isFavorite = 1 AND UPPER(name) LIKE UPPER(:q)") fun getFavoritePlacesFlow(q: String = ""): Flow> diff --git a/android/app/src/main/java/app/tourism/data/repositories/PlacesRepository.kt b/android/app/src/main/java/app/tourism/data/repositories/PlacesRepository.kt index 21c18049e6..fb4474e59d 100644 --- a/android/app/src/main/java/app/tourism/data/repositories/PlacesRepository.kt +++ b/android/app/src/main/java/app/tourism/data/repositories/PlacesRepository.kt @@ -165,10 +165,12 @@ class PlacesRepository( } fun getPlaceById(id: Long): Flow> = channelFlow { - placesDao.getPlaceById(id) - .collectLatest { placeEntity -> + placesDao.getPlaceById(id).collectLatest { placeEntity -> + if(placeEntity != null) send(Resource.Success(placeEntity.toPlaceFull())) - } + else + send(Resource.Error(message = "Не найдено")) + } } fun getFavorites(q: String): Flow>> = channelFlow { diff --git a/android/app/src/main/java/app/tourism/ui/screens/auth/sign_in/SignInScreen.kt b/android/app/src/main/java/app/tourism/ui/screens/auth/sign_in/SignInScreen.kt index 1a37768d5a..2175d8018d 100644 --- a/android/app/src/main/java/app/tourism/ui/screens/auth/sign_in/SignInScreen.kt +++ b/android/app/src/main/java/app/tourism/ui/screens/auth/sign_in/SignInScreen.kt @@ -123,7 +123,7 @@ fun SignInScreen( ), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), ) - VerticalSpace(height = 32.dp) + VerticalSpace(height = 16.dp) PasswordEditText( value = password, onValueChange = { vm.setPassword(it) }, @@ -131,7 +131,7 @@ fun SignInScreen( keyboardActions = KeyboardActions(onDone = { onSignInComplete() }), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), ) - VerticalSpace(height = 48.dp) + VerticalSpace(height = 32.dp) PrimaryButton( modifier = Modifier.fillMaxWidth(), label = stringResource(id = R.string.sign_in), diff --git a/android/app/src/main/java/app/tourism/ui/screens/auth/sign_up/SignUpScreen.kt b/android/app/src/main/java/app/tourism/ui/screens/auth/sign_up/SignUpScreen.kt index f54ad802c7..3c4f4c489e 100644 --- a/android/app/src/main/java/app/tourism/ui/screens/auth/sign_up/SignUpScreen.kt +++ b/android/app/src/main/java/app/tourism/ui/screens/auth/sign_up/SignUpScreen.kt @@ -9,8 +9,10 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -39,7 +41,6 @@ import app.tourism.ui.common.VerticalSpace import app.tourism.ui.common.buttons.PrimaryButton import app.tourism.ui.common.nav.BackButton import app.tourism.ui.common.textfields.AuthEditText -import app.tourism.ui.screens.auth.navigateToMainActivity import app.tourism.ui.theme.TextStyles import app.tourism.ui.utils.showToast import app.tourism.utils.openUrlInBrowser @@ -65,7 +66,7 @@ fun SignUpScreen( ObserveAsEvents(flow = vm.uiEventsChannelFlow) { event -> when (event) { - is UiEvent.NavigateToMainActivity -> navigateToMainActivity(context) + is UiEvent.NavigateToMainActivity -> onSignUpComplete() is UiEvent.ShowToast -> context.showToast(event.message) } } @@ -80,22 +81,25 @@ fun SignUpScreen( contentDescription = null ) - Box(Modifier.padding(Constants.SCREEN_PADDING)) { - BackButton( - modifier = Modifier.align(Alignment.TopStart), - onBackClick = onBackClick, - tint = Color.White - ) - } - Column( Modifier .fillMaxWidth() + .verticalScroll(rememberScrollState()) .align(alignment = Alignment.TopCenter) ) { - VerticalSpace(height = 48.dp) - Box(Modifier.padding(Constants.SCREEN_PADDING) - .drawDarkContainerBehind()) { + Box(modifier = Modifier.padding(16.dp)) { + BackButton( + onBackClick = onBackClick, + tint = Color.White + ) + } + VerticalSpace(height = 16.dp) + + Box( + Modifier + .padding(Constants.SCREEN_PADDING) + .drawDarkContainerBehind() + ) { Column( Modifier.padding(36.dp) ) { @@ -134,7 +138,6 @@ fun SignUpScreen( color = Color.White, thickness = 1.dp ) - VerticalSpace(height = 16.dp) AuthEditText( value = email ?: "", onValueChange = { vm.setEmail(it) }, @@ -146,7 +149,6 @@ fun SignUpScreen( ), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), ) - VerticalSpace(height = 16.dp) PasswordEditText( value = password ?: "", onValueChange = { vm.setPassword(it) }, @@ -158,7 +160,6 @@ fun SignUpScreen( ), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next), ) - VerticalSpace(height = 16.dp) PasswordEditText( value = confirmPassword ?: "", onValueChange = { vm.setConfirmPassword(it) }, diff --git a/android/app/src/main/java/app/tourism/ui/screens/main/MainNavigation.kt b/android/app/src/main/java/app/tourism/ui/screens/main/MainNavigation.kt index 282ab0121a..59671770cc 100644 --- a/android/app/src/main/java/app/tourism/ui/screens/main/MainNavigation.kt +++ b/android/app/src/main/java/app/tourism/ui/screens/main/MainNavigation.kt @@ -71,7 +71,9 @@ fun MainNavigation(rootNavController: NavHostController, themeVM: ThemeViewModel rootNavController.navigate(FullscreenImageViewer(selectedImage, imageUrls)) } val onSearchClick: (q: String) -> Unit = { q -> - rootNavController.navigate(Search(query = q)) + if (q.isNotEmpty()) { + rootNavController.navigate(Search(query = q)) + } } val onMapClick = { navigateToMap(context) } val onBackClick: () -> Unit = { rootNavController.navigateUp() } diff --git a/android/app/src/main/res/values-ru/strings.xml b/android/app/src/main/res/values-ru/strings.xml index c0f684678d..433cf3a5ad 100644 --- a/android/app/src/main/res/values-ru/strings.xml +++ b/android/app/src/main/res/values-ru/strings.xml @@ -2222,7 +2222,7 @@ Пароли не схожи Неправильный формат имейла Сохранено - Мне нраится😄 + Отзыв успешно отправлен Отзыв успешно удален Удалить отзыв Вы уверены что хотите удалить это? diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index eea2c0c743..bc7130384c 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -2270,7 +2270,7 @@ Are you sure you wanna delete this? Deleting… Please, wait, data being downloaded - Пусто + Empty Review will be published when you are online Review was successfully published Failed to publish review\n