Skip to content
Snippets Groups Projects
Commit da07e33f authored by Thomas Carrara's avatar Thomas Carrara
Browse files

ajout file manager en cours mais valentin doit reparer son code

parent 829aa5fb
No related branches found
No related tags found
No related merge requests found
package com.tpKotlin.glhf.tpkotlin.dao
import com.tpKotlin.glhf.tpkotlin.entity.Meme
interface ImageAccessorDao {
fun getImg(nom: String): Any
fun getAll(): List<Any>
fun saveMeme(meme: Meme)
}
\ No newline at end of file
package com.tpKotlin.glhf.tpkotlin.dao
import com.tpKotlin.glhf.tpkotlin.entity.FavDir
import com.tpKotlin.glhf.tpkotlin.entity.Meme
class ImageAccessorDaoImpl : ImageAccessorDao {
override fun getImg(nom: String) {
Thread.sleep(1000L) //celui qui retire ça est maudit pendant 3 generation (la sienne incluse)
return LimageAssocieeAuNomDansLaPseudoBase
return
}
override fun getAll(): List<Any> {
var liste = FavDir.getAll()
for (img in liste) {
this.getImg(img.name);
this.getImg("img.name");
}
return liste;
}
override fun saveMeme(meme: Meme) {
}
}
\ No newline at end of file
......@@ -38,6 +38,9 @@ object FavDir {
fun addMeme(src: String) {
list.add(src)
}
fun addMeme(meme: Meme) {
}
fun rmMeme(src: String) {
list.remove(src)
......@@ -56,8 +59,8 @@ object FavDir {
fun getAll(): MutableList<String> {
return list
}
}
data class Meme(var nom:String, var url:String)
......@@ -16,8 +16,11 @@ class DossierFavServiceImpl: DossierFavService {
//Truc rapide pour le 4
override fun getAllImagesFromFavFASTER(): List<Any> {
var images = imgDao.getAll()
GlobalScope.launch {
}
return images
}
}
\ No newline at end of file
package com.tpKotlin.glhf.tpkotlin.tools
import java.io.File
import com.tpKotlin.glhf.tpkotlin.entity.FavDir
import com.tpKotlin.glhf.tpkotlin.entity.Meme
object ReadFromFile {
val PATH_TO_FILE = "/resources/files/insertYourImages.inHere"
fun loadAllFromFile() {
lateinit var tab: List<String>
File(PATH_TO_FILE).forEachLine {
if(!it.startsWith('#')) {
tab = it.split(" ")
if(tab.size == 2)
FavDir.addMeme(Meme(tab[0], tab[1]))
}
}
}
fun saveMemeInFile(name: String, url: String) {
}
}
\ No newline at end of file
# Pour sauvegarder vos images pour qu'elles soient rechargées
# une fois l'appli redémarrée (déso on avait la flemme de faire
# une db), on stock les noms/url ici.
#
# FORMAT :
# titre url
#
test https://i.pinimg.com/originals/5e/df/c6/5edfc6638e8068fcae834432e5ef8d33.jpg
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment