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 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<User>

@ -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")
}

@ -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)

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

@ -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,

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

Loading…
Cancel
Save