diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 34cca4b..3d216a5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,7 +25,7 @@ android { buildTypes { release { - isMinifyEnabled = false + isMinifyEnabled = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 774a4dd..1d9bc75 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,20 +9,23 @@ android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" - android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.SearchFlight" tools:targetApi="31"> + android:theme="@style/Theme.SplashScreen"> + + \ No newline at end of file diff --git a/app/src/main/java/com/nabilbdev/searchflight/SplashActivity.kt b/app/src/main/java/com/nabilbdev/searchflight/SplashActivity.kt new file mode 100644 index 0000000..98be2ae --- /dev/null +++ b/app/src/main/java/com/nabilbdev/searchflight/SplashActivity.kt @@ -0,0 +1,60 @@ +package com.nabilbdev.searchflight + +import android.annotation.SuppressLint +import android.content.Intent +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.animation.core.Animatable +import androidx.compose.animation.core.tween +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.aspectRatio +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.res.painterResource +import com.nabilbdev.searchflight.ui.theme.SearchFlightTheme +import kotlinx.coroutines.delay + +@SuppressLint("CustomSplashScreen") +class SplashActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + SearchFlightTheme { + SplashScreen() + } + } + } + + @Composable + private fun SplashScreen() { + val alpha = remember { Animatable(0f) } + + LaunchedEffect(key1 = true) { + alpha.animateTo(1f, animationSpec = tween(1500)) + delay(2000) + startActivity(Intent(this@SplashActivity, MainActivity::class.java)) + } + + Box( + modifier = Modifier + .fillMaxSize(), + contentAlignment = Alignment.Center + ) { + Image( + modifier = Modifier + .aspectRatio(3f / 2f) + .alpha(alpha.value), + painter = painterResource(id = R.drawable.app_logo), + contentDescription = null + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/nabilbdev/searchflight/ui/components/FavoriteRouteTicket.kt b/app/src/main/java/com/nabilbdev/searchflight/ui/components/FavoriteRouteTicket.kt index 9d1adc8..0c74017 100644 --- a/app/src/main/java/com/nabilbdev/searchflight/ui/components/FavoriteRouteTicket.kt +++ b/app/src/main/java/com/nabilbdev/searchflight/ui/components/FavoriteRouteTicket.kt @@ -6,9 +6,11 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.nabilbdev.searchflight.data.local.entity.Airport import com.nabilbdev.searchflight.ui.screens.route.CompactAirportSelection @@ -17,6 +19,7 @@ import com.nabilbdev.searchflight.ui.screens.search.utils.AIRPORT_DEFAULT @Composable fun FavoriteRouteTicket( modifier: Modifier = Modifier, + containerColor: Color = MaterialTheme.colorScheme.surfaceContainer, fromAirport: Airport = AIRPORT_DEFAULT, toAirport: Airport = AIRPORT_DEFAULT ) { @@ -26,7 +29,9 @@ fun FavoriteRouteTicket( .padding(24.dp), shape = CardDefaults.elevatedShape, elevation = CardDefaults.elevatedCardElevation(), - colors = CardDefaults.elevatedCardColors(), + colors = CardDefaults.cardColors( + containerColor = containerColor + ), ) { CustomCurvedFlightPath { Row( diff --git a/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteScreen.kt b/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteScreen.kt index 3f4d873..52388ae 100644 --- a/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteScreen.kt +++ b/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteScreen.kt @@ -86,6 +86,11 @@ fun FavoriteScreen( FavoriteRouteTicket( fromAirport = favoriteRouteItem.first, toAirport = favoriteRouteItem.second, + containerColor = + if (viewModel.isCurrentlyDragging && viewModel.isOverDropItem) + Color.Red.copy(.65f) + else + MaterialTheme.colorScheme.surfaceContainer, modifier = Modifier .width(325.dp) ) @@ -131,6 +136,7 @@ fun BinDropItem( } } if (isInBound) { + viewModel.onDropItem() BinIconDropItem(iconColor = Color.Red) } else { BinIconDropItem(iconColor = Color.DarkGray) diff --git a/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteViewModel.kt b/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteViewModel.kt index 0c6f568..16db702 100644 --- a/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteViewModel.kt +++ b/app/src/main/java/com/nabilbdev/searchflight/ui/screens/favorite/FavoriteViewModel.kt @@ -32,11 +32,14 @@ class FavoriteViewModel( private val _favoriteAirports = MutableStateFlow>>(emptyList()) private val _deletedOrNoFavoriteStatusMessage = MutableStateFlow(null) - private val _favoriteStatus = MutableStateFlow(FavoriteStatus.NONE) + private val _favoriteStatus = MutableStateFlow(FavoriteStatus.NONE) var isCurrentlyDragging by mutableStateOf(false) private set + var isOverDropItem by mutableStateOf(false) + private set + val favoriteUiState: StateFlow = combine( _favoriteAirports, _deletedOrNoFavoriteStatusMessage, _favoriteStatus ) { favoriteAirports, deletedOrNoFavoriteStatusMessage, favoriteStatus -> @@ -121,10 +124,12 @@ class FavoriteViewModel( fun startDragging() { isCurrentlyDragging = true + isOverDropItem = false } fun stopDragging() { isCurrentlyDragging = false + isOverDropItem = false } fun clearFavoriteStatusAndMessage() { @@ -132,6 +137,10 @@ class FavoriteViewModel( _favoriteStatus.value = FavoriteStatus.NONE } + fun onDropItem() { + isOverDropItem = true + } + companion object { private const val TIMEOUT_MILLIS = 5_000L } diff --git a/app/src/main/java/com/nabilbdev/searchflight/ui/theme/Theme.kt b/app/src/main/java/com/nabilbdev/searchflight/ui/theme/Theme.kt index c4f2126..c0ddafb 100644 --- a/app/src/main/java/com/nabilbdev/searchflight/ui/theme/Theme.kt +++ b/app/src/main/java/com/nabilbdev/searchflight/ui/theme/Theme.kt @@ -9,7 +9,12 @@ import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat private val DarkColorScheme = darkColorScheme( primary = Purple80, @@ -50,6 +55,15 @@ fun SearchFlightTheme( else -> LightColorScheme } + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val window = (view.context as Activity).window + window.statusBarColor = Color.Transparent.toArgb() + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme + } + } + MaterialTheme( colorScheme = colorScheme, typography = Typography, diff --git a/app/src/main/res/drawable/app_bg.png b/app/src/main/res/drawable/app_bg.png new file mode 100644 index 0000000..9f7ad83 Binary files /dev/null and b/app/src/main/res/drawable/app_bg.png differ diff --git a/app/src/main/res/drawable/app_logo.xml b/app/src/main/res/drawable/app_logo.xml new file mode 100644 index 0000000..fe31569 --- /dev/null +++ b/app/src/main/res/drawable/app_logo.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 6f3b755..345888d 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,6 +1,6 @@ - - - + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 6f3b755..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..5560b13 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_background.png b/app/src/main/res/mipmap-hdpi/ic_launcher_background.png new file mode 100644 index 0000000..e47efde Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..b35e47d Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png b/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..45a845f Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..db7dfd0 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_background.png b/app/src/main/res/mipmap-mdpi/ic_launcher_background.png new file mode 100644 index 0000000..5f51fd4 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..2388ce6 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png b/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..f6633d5 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..cc0751c Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png new file mode 100644 index 0000000..67cddcf Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..d5a97d8 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..640dbb3 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..543b0a6 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png new file mode 100644 index 0000000..e786c4d Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..0ee99fa Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..90643cf Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..15cab47 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png new file mode 100644 index 0000000..6c7a967 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..c0cd210 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png new file mode 100644 index 0000000..7dcfb30 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127..0023fb1 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,5 +1,6 @@ + #FFFF9800 #FFBB86FC #FF6200EE #FF3700B3 diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index a0b4c07..fb2c29c 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -2,4 +2,9 @@ \ No newline at end of file