diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt index 8598128..d2d317a 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/IServices.kt @@ -9,7 +9,9 @@ interface IServices { fun EditEmail(email : String, index : Int) fun EditPasswd(passwd : String, index : Int) fun EditImage(imageURL : String, index : Int) - + fun AddFav(userId: Int, QuoteId : Int) + fun SupFav(userId: Int, QuoteId : Int) + fun AddComment(content : String) fun CreateUser(username : String, email : String, passwd : String, services : IServices) : Boolean fun getFavorite(username: String) fun getAllUsers(): List diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt index 5f85555..9aee3ba 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesAPI.kt @@ -22,6 +22,18 @@ class ServicesAPI : IServices { TODO("Not yet implemented") } + override fun AddFav(userId: Int, QuoteId: Int) { + TODO("Not yet implemented") + } + + override fun SupFav(userId: Int, QuoteId: Int) { + TODO("Not yet implemented") + } + + override fun AddComment(content: String) { + TODO("Not yet implemented") + } + override fun CreateUser(username: String, email: String, passwd: String, services: IServices) : Boolean { TODO("Not yet implemented") } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt index 354b228..b51c15f 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/services/ServicesStub.kt @@ -45,6 +45,19 @@ class ServicesStub : IServices { TODO("Not yet implemented") } + override fun AddFav(userId: Int, QuoteId: Int) { + TODO("Not yet implemented") + } + + override fun SupFav(userId: Int, QuoteId: Int) { + TODO("Not yet implemented") + } + + override fun AddComment(content: String) { + TODO("Not yet implemented") + //comments.add(Comment(content = content,)) + } + override fun CreateUser(username: String, email: String, passwd: String, services : IServices) : Boolean { val date =dateDuJour() val passwordhash = hashPassword(passwd) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt index 8d89f41..391bb36 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/components/NavBar.kt @@ -146,7 +146,7 @@ fun ButtonIconPainterInt(img : Painter, name : String, nav : (Int)->Unit,index: Icon(img, contentDescription = name, modifier = Modifier - .fillMaxSize() + .size(50.dp) ) } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt index 91448c4..094431b 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt @@ -108,9 +108,11 @@ fun QuotePage( // --/!\-- a modifier --/!\-- // isFavorite = service.isFavorite(id) // -------------------------- - true, + false, + userId = index, id = quoteId, - context = context + context = context, + service = service ) QuoteText( text = '"' + quote.content + '"' @@ -154,14 +156,11 @@ fun QuotePage( ) { Box(modifier = Modifier.fillMaxWidth().background(gradienBox).fillMaxSize()){ Column { - AddComment(index) + AddComment(index, service) LstComment(service.getComment(quoteId)) } } } - if(isCommentVisible){ - - } } } @@ -190,7 +189,7 @@ fun ImageQuote(imageUrl : String){ } @Composable -fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){ +fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Context, service: IServices){ Row(modifier = Modifier .fillMaxWidth() ) { @@ -233,7 +232,7 @@ fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){ if(isFavorite){ IconButton( - onClick = { }, //sup fav + onClick = { service.SupFav(userId = userId, QuoteId = id)}, //sup fav modifier = Modifier.padding(start = 20.dp) ){ Icon( @@ -246,7 +245,7 @@ fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){ } else{ IconButton( - onClick = { }, //add fav + onClick = { service.AddFav(userId = userId, QuoteId = id)}, //add fav modifier = Modifier.padding(start = 50.dp) ){ Icon( @@ -300,9 +299,9 @@ fun LikeInfo(likes : Int){ } @Composable -fun AddComment(userId : Int){ +fun AddComment(userId : Int, service: IServices){ var text by remember { mutableStateOf("") } - Row{ + Row(modifier = Modifier.padding(bottom = 15.dp, top = 15.dp)){ IconButton( onClick = { isCommentVisible = !isCommentVisible}, ){ @@ -325,7 +324,7 @@ fun AddComment(userId : Int){ .width(300.dp) ) IconButton( - onClick = { }, //send comment + onClick = { service.AddComment(text)}, //send comment ){ Icon( Icons.AutoMirrored.Filled.Send, diff --git a/What_The_Fantasy/app/src/main/res/values/strings.xml b/What_The_Fantasy/app/src/main/res/values/strings.xml index dd450d6..f54602e 100644 --- a/What_The_Fantasy/app/src/main/res/values/strings.xml +++ b/What_The_Fantasy/app/src/main/res/values/strings.xml @@ -8,9 +8,9 @@ Character Source Share - comment - favorite - likes + Comment + Favorite + Likes Profile picture Send