Skip to content

Commit

Permalink
Merge pull request #3 from NicosNicolaou16/updates_and_my_library
Browse files Browse the repository at this point in the history
Updates and my library
  • Loading branch information
NicosNicolaou16 authored Aug 16, 2024
2 parents 099379b + 60ee165 commit 721ff21
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ R8 enabled <br />
# Examples
<p align="left">
<a title="simulator_image"><img src="examples/Screenshot_20240511_012335.png" height="500" width="200"></a>
<a title="simulator_image"><img src="examples/Screenshot_20240511_012348.png" height="500" width="200"></a>
<a title="simulator_image"><img src="examples/Screenshot_20240511_012400.png" height="500" width="200"></a>
<a title="simulator_image"><img src="examples/example_gif.gif" height="500" width="200"></a>
<a title="simulator_image"><img src="examples/Screenshot_20240816_221338.png" height="500" width="200"></a>
<a title="simulator_image"><img src="examples/Screenshot_20240816_221449.png" height="500" width="200"></a>
<a title="simulator_image"><img src="examples/example_gif1.gif" height="500" width="200"></a>
</p>

# Versioning
Target SDK version: 34 <br />
Minimum SDK version: 27 <br />
Kotlin version: 2.0.0 <br />
Gradle version: 8.5.1 <br />
Kotlin version: 2.0.10 <br />
Gradle version: 8.5.2 <br />

# Feeds/Urls/End Point (parsing some data from the response)
## (Links References for Ends Points)
Expand All @@ -44,3 +44,4 @@ https://github.com/PokeAPI/sprites (GitHub) <br />
https://fvilarino.medium.com/shared-element-transitions-in-jetpack-compose-8f553078101e <br />
https://getstream.io/blog/shared-element-compose/ <br />
https://medium.com/androiddevelopers/navigation-compose-meet-type-safety-e081fb3cf2f8 <br />
https://dribbble.com/shots/6540871-Pokedex-App# - Get some UI - not completely use it (CHECK THE LINK FOR THE DESIGN) <br />
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ android {

dependencies {

// My Library - https://github.com/NicosNicolaou16/PercentagesWithAnimationCompose
implementation(libs.percentages.with.animation.compose)
//Architecture
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.swipe.refresh.layout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.nicos.pokedex_compose.compose
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
Expand All @@ -23,7 +24,7 @@ class MainActivity : ComponentActivity() {
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Navigation()
Navigation({ enableEdgeToEdge() })
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
package com.nicos.pokedex_compose.compose.generic_compose_views

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.width
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.nicos.pokedex_compose.R
import com.nicos.pokedex_compose.ui.theme.GreenLight

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CustomToolbar(title: Int) {
fun CustomToolbar(title: Int, backButton: (() -> Unit)? = null) {
CenterAlignedTopAppBar(
title = {
Text(
Expand All @@ -26,6 +36,19 @@ fun CustomToolbar(title: Int) {
)
)
},
navigationIcon = {
if (backButton != null)
Image(
painter = painterResource(id = R.drawable.baseline_arrow_back_24),
contentDescription = null,
colorFilter = ColorFilter.tint(color = Color.White),
contentScale = ContentScale.Inside,
modifier = Modifier
.clickable { backButton() }
.fillMaxHeight()
.width(width = 50.dp)
)
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
containerColor = GreenLight
)
Expand All @@ -34,7 +57,7 @@ fun CustomToolbar(title: Int) {

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CustomToolbar(title: String) {
fun CustomToolbar(title: String, color: Color = GreenLight, backButton: (() -> Unit)? = null) {
CenterAlignedTopAppBar(
title = {
Text(
Expand All @@ -46,8 +69,21 @@ fun CustomToolbar(title: String) {
)
)
},
navigationIcon = {
if (backButton != null)
Image(
painter = painterResource(id = R.drawable.baseline_arrow_back_24),
contentDescription = null,
colorFilter = ColorFilter.tint(color = Color.White),
contentScale = ContentScale.Inside,
modifier = Modifier
.clickable { backButton() }
.fillMaxHeight()
.width(width = 50.dp)
)
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
containerColor = GreenLight
containerColor = color
)
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nicos.pokedex_compose.compose.navigation

import androidx.activity.SystemBarStyle
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.runtime.Composable
Expand All @@ -16,7 +17,7 @@ import com.nicos.pokedex_compose.utils.screen_routes.PokemonList

@OptIn(ExperimentalSharedTransitionApi::class)
@Composable
fun Navigation() {
fun Navigation(changeSystemBarStyle: (SystemBarStyle) -> Unit) {
val navController = rememberNavController()
SharedTransitionLayout {
NavHost(
Expand All @@ -43,7 +44,11 @@ fun Navigation() {
url = pokemonDetailsScreen.url.decodeStringUrl(),
imageUrl = pokemonDetailsScreen.imageUrl.decodeStringUrl(),
name = pokemonDetailsScreen.name,
changeSystemBarStyle = changeSystemBarStyle,
animatedVisibilityScope = this@composable,
backButton = {
navController.popBackStack()
}
)
}
}
Expand Down
Loading

0 comments on commit 721ff21

Please sign in to comment.