ajout des methode(pas encore implementer) nécésaire pour la fin de la page quote

pull/48/head
kevin.modejar 1 month ago
parent d554b87ab8
commit afd5ca2a99

@ -9,7 +9,9 @@ interface IServices {
fun EditEmail(email : String, index : Int) fun EditEmail(email : String, index : Int)
fun EditPasswd(passwd : String, index : Int) fun EditPasswd(passwd : String, index : Int)
fun EditImage(imageURL : 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 CreateUser(username : String, email : String, passwd : String, services : IServices) : Boolean
fun getFavorite(username: String) fun getFavorite(username: String)
fun getAllUsers(): List<User> fun getAllUsers(): List<User>

@ -22,6 +22,18 @@ class ServicesAPI : IServices {
TODO("Not yet implemented") 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 { override fun CreateUser(username: String, email: String, passwd: String, services: IServices) : Boolean {
TODO("Not yet implemented") TODO("Not yet implemented")
} }

@ -45,6 +45,19 @@ class ServicesStub : IServices {
TODO("Not yet implemented") 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 { override fun CreateUser(username: String, email: String, passwd: String, services : IServices) : Boolean {
val date =dateDuJour() val date =dateDuJour()
val passwordhash = hashPassword(passwd) val passwordhash = hashPassword(passwd)

@ -146,7 +146,7 @@ fun ButtonIconPainterInt(img : Painter, name : String, nav : (Int)->Unit,index:
Icon(img, Icon(img,
contentDescription = name, contentDescription = name,
modifier = Modifier modifier = Modifier
.fillMaxSize() .size(50.dp)
) )
} }
} }

@ -108,9 +108,11 @@ fun QuotePage(
// --/!\-- a modifier --/!\-- // --/!\-- a modifier --/!\--
// isFavorite = service.isFavorite(id) // isFavorite = service.isFavorite(id)
// -------------------------- // --------------------------
true, false,
userId = index,
id = quoteId, id = quoteId,
context = context context = context,
service = service
) )
QuoteText( QuoteText(
text = '"' + quote.content + '"' text = '"' + quote.content + '"'
@ -154,14 +156,11 @@ fun QuotePage(
) { ) {
Box(modifier = Modifier.fillMaxWidth().background(gradienBox).fillMaxSize()){ Box(modifier = Modifier.fillMaxWidth().background(gradienBox).fillMaxSize()){
Column { Column {
AddComment(index) AddComment(index, service)
LstComment(service.getComment(quoteId)) LstComment(service.getComment(quoteId))
} }
} }
} }
if(isCommentVisible){
}
} }
} }
@ -190,7 +189,7 @@ fun ImageQuote(imageUrl : String){
} }
@Composable @Composable
fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Context, service: IServices){
Row(modifier = Modifier Row(modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
) { ) {
@ -233,7 +232,7 @@ fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){
if(isFavorite){ if(isFavorite){
IconButton( IconButton(
onClick = { }, //sup fav onClick = { service.SupFav(userId = userId, QuoteId = id)}, //sup fav
modifier = Modifier.padding(start = 20.dp) modifier = Modifier.padding(start = 20.dp)
){ ){
Icon( Icon(
@ -246,7 +245,7 @@ fun FunctionalIcon(isFavorite: Boolean, id : Int, context : Context){
} }
else{ else{
IconButton( IconButton(
onClick = { }, //add fav onClick = { service.AddFav(userId = userId, QuoteId = id)}, //add fav
modifier = Modifier.padding(start = 50.dp) modifier = Modifier.padding(start = 50.dp)
){ ){
Icon( Icon(
@ -300,9 +299,9 @@ fun LikeInfo(likes : Int){
} }
@Composable @Composable
fun AddComment(userId : Int){ fun AddComment(userId : Int, service: IServices){
var text by remember { mutableStateOf("") } var text by remember { mutableStateOf("") }
Row{ Row(modifier = Modifier.padding(bottom = 15.dp, top = 15.dp)){
IconButton( IconButton(
onClick = { isCommentVisible = !isCommentVisible}, onClick = { isCommentVisible = !isCommentVisible},
){ ){
@ -325,7 +324,7 @@ fun AddComment(userId : Int){
.width(300.dp) .width(300.dp)
) )
IconButton( IconButton(
onClick = { }, //send comment onClick = { service.AddComment(text)}, //send comment
){ ){
Icon( Icon(
Icons.AutoMirrored.Filled.Send, Icons.AutoMirrored.Filled.Send,

@ -8,9 +8,9 @@
<string name="charac">Character</string> <string name="charac">Character</string>
<string name="source">Source</string> <string name="source">Source</string>
<string name="share">Share</string> <string name="share">Share</string>
<string name="comment">comment</string> <string name="comment">Comment</string>
<string name="favorite">favorite</string> <string name="favorite">Favorite</string>
<string name="like">likes</string> <string name="like">Likes</string>
<string name="profilePict">Profile picture</string> <string name="profilePict">Profile picture</string>
<string name="send">Send</string> <string name="send">Send</string>

Loading…
Cancel
Save