Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementa os botões RecycleView e LazyColumn samples #43

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ fun MoviesApp() {
title = { Text(stringResource(id = R.string.app_name)) },
actions = {
topAppBarItems.forEach { screen ->
IconButton(onClick = {
navController.navigate(screen.route)
}) {
IconButton(
onClick = {
navController.navigate(screen.route) {
launchSingleTop = true
}
}
) {
Icon(screen.icon, null)
}
}
Expand Down Expand Up @@ -83,7 +87,6 @@ fun MoviesApp() {
}
composable(Screen.SampleCompose.route) {
showBottomBar.value = false

ListComponents()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package br.com.concrete.composekmmmoviesapp.androidApp

import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent

Expand All @@ -12,9 +11,4 @@ class MainActivity : ComponentActivity() {
MoviesApp()
}
}

override fun onResume() {
super.onResume()
Log.d("APP", "onResume")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import androidx.compose.material.icons.filled.Favorite
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import br.com.concrete.composekmmmoviesapp.androidApp.R
import br.com.concrete.composekmmmoviesapp.androidApp.data.model.Movie
import br.com.concrete.composekmmmoviesapp.androidApp.theme.Yellow
import br.com.concrete.composekmmmoviesapp.androidApp.util.DataSamples
Expand All @@ -23,7 +25,7 @@ fun FavoriteMovieButton(
IconButton(
onClick = { action(movie) },
modifier = Modifier
.size(48.dp)
.size(48.dp),



Expand All @@ -36,8 +38,9 @@ fun FavoriteMovieButton(
}
Icon(
Icons.Filled.Favorite,
contentDescription = null,
tint = tintIcon
contentDescription = stringResource(R.string.icon_description),
tint = tintIcon,

)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ fun FavoritesCard(
Text(
text = movie.releaseYear.toString(),
fontWeight = FontWeight.Black,
style = typography.body1/*TextStyle(fontSize = 17.sp)*/,

style = typography.body1,
color = Color.Black



)
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.medium
Expand Down
1 change: 1 addition & 0 deletions androidApp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<string name="title_tab_favorites">Favorites</string>
<string name="generic_error">An unexpected error ocurred. Please, try again.</string>
<string name="title_compose">compose</string>
<string name="icon_description">Botão de favoritar</string>
</resources>
4 changes: 4 additions & 0 deletions components/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ dependencies {
implementation ("androidx.appcompat:appcompat:1.3.0-beta01")
implementation ("com.google.android.material:material:1.3.0")

//layout imagem
implementation ("com.google.android.material:material:1.3.0")


// Compose
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.ui:ui-tooling:$composeVersion")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/src/debug/res/drawable/deadpool.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/src/debug/res/drawable/thor.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/src/debug/res/drawable/ww.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions components/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.concrete.components">
<application>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="false"
android:supportsRtl="true">
<activity android:name=".recyclerviewlazycolumn.recycleview.RecycleViewPage">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".devexperience.xml.XmlVsCompose"/>
</application>
<application>
<activity
android:name=".TextCompose"
android:exported="true"></activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sealed class AppComposeScreen(
val name: String = "composeHome"
) {
object SampleComposeHome : AppComposeScreen("composeHome")
object RecyclerVsLazy : AppComposeScreen("recyclerV", "RecyclerView vs LazyComponents")
object XmlHome: AppComposeScreen("xmlHome","Xml no compose")
object XmlComposeActivity: AppComposeScreen("xml Activity")
object XmlCompose : AppComposeScreen("xmlCompose", "Compose")
Expand All @@ -17,5 +18,7 @@ sealed class AppComposeScreen(
val listItems = listOf(
AppComposeScreen.ModifiersCompose,
AppComposeScreen.TextHome,
AppComposeScreen.XmlHome
AppComposeScreen.XmlHome,
AppComposeScreen.RecyclerVsLazy
)

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.navigation.compose.navigate
import androidx.navigation.compose.rememberNavController
import br.com.concrete.components.design.Modifiers
import br.com.concrete.components.devexperience.xml.XmlCompose
import br.com.concrete.components.recyclerviewlazycolumn.ListRecyclerViewVSLazyColumn
import br.com.concrete.components.devexperience.xml.XmlVsCompose

@Composable
Expand Down Expand Up @@ -48,10 +49,10 @@ fun ListComponents() {

}
composable(AppComposeScreen.XmlComposeActivity.route) {

context.startActivity(Intent(context, XmlVsCompose()::class.java))


}
composable(AppComposeScreen.RecyclerVsLazy.route) {
ListRecyclerViewVSLazyColumn()
}
composable(AppComposeScreen.ModifiersCompose.route) {
Modifiers()
Expand All @@ -65,7 +66,6 @@ fun ListComponents() {
composable(AppComposeScreen.TextActivity.route) {
context.startActivity(Intent(context, TextCompose()::class.java))
}

}
}
}
Expand Down Expand Up @@ -140,4 +140,4 @@ fun AppComposeHome(navController: NavController) {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package br.com.concrete.components.recyclerviewlazycolumn

import androidx.compose.ui.graphics.vector.ImageVector


sealed class AppComposeRecycleVSLazy(
val route: String,
val icon: ImageVector? = null
) {
object SampleComposeRecycleLazy : AppComposeRecycleVSLazy("composeHome")
object RecyclerPage : AppComposeRecycleVSLazy("recyclerPage")
object LazyPage : AppComposeRecycleVSLazy("lazyPage")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package br.com.concrete.components.recyclerviewlazycolumn

import androidx.compose.material.Text
import androidx.compose.runtime.Composable

@Composable
fun LazyColumnPage() {
Text(text = "pagina da lazycolumn")
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package br.com.concrete.components.recyclerviewlazycolumn

import android.content.Intent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.navigate
import androidx.navigation.compose.rememberNavController
import br.com.concrete.components.recyclerviewlazycolumn.recycleview.RecycleViewPage


@Composable
fun ListRecyclerViewVSLazyColumn() {
val context = LocalContext.current
val navController = rememberNavController()
Column (
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight()
) {
NavHost(navController, startDestination = AppComposeRecycleVSLazy.SampleComposeRecycleLazy.route) {
composable(AppComposeRecycleVSLazy.SampleComposeRecycleLazy.route) {
RecyclerViewVSLazyColumn(navController)
}
composable(AppComposeRecycleVSLazy.RecyclerPage.route) {
context.startActivity(Intent(context,RecycleViewPage()::class.java))

}
composable(AppComposeRecycleVSLazy.LazyPage.route) {
SetLazyColumnList()
}
}
}
}



@Composable
fun RecyclerViewVSLazyColumn(navController: NavController) {
Button(modifier = Modifier.padding(top = 64.dp, start = 124.dp), onClick = {
navController.navigate(AppComposeRecycleVSLazy.RecyclerPage.route) {
popUpTo = navController.graph.startDestination
launchSingleTop = true
}


}) {
Text("RecycleView",textAlign = TextAlign.Center)

}

Button(modifier = Modifier.padding(top = 64.dp, start = 124.dp), onClick = {
navController.navigate(AppComposeRecycleVSLazy.LazyPage.route) {
popUpTo = navController.graph.startDestination
launchSingleTop = true
}


}) {
Text("LazyColumn",textAlign = TextAlign.Center)

}
}
Loading