Skip to content

Commit

Permalink
Formatted some file and fix some minor comment misspelling
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Tomassi <[email protected]>
  • Loading branch information
JanTomassi committed Jun 12, 2023
1 parent bf29881 commit e17a979
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import android.content.Context
import it.unitn.disi.lpsmt.g03.mangacheck.utils.xml.LibraryEntry
import java.io.File

class ManageFiles(private val context: Context){
class ManageFiles(private val context: Context) {

/**
* Create library folder to contains chapter associated with that library
* @param [library] LibraryEntry to associate with a directory
*/
fun createLibraryFolder(library: LibraryEntry){
fun createLibraryFolder(library: LibraryEntry) {
val libraryDir = File(context.filesDir, library.id.toString())
if(!libraryDir.isDirectory){
if (!libraryDir.isDirectory) {
libraryDir.mkdir()
}
}
Expand All @@ -21,19 +21,19 @@ class ManageFiles(private val context: Context){
* Delete the files associated ith a library
* @param [library] entry associated with folder to delete
*/
fun deleteLibraryFolder(library: LibraryEntry){
fun deleteLibraryFolder(library: LibraryEntry) {
val libraryDir = File(context.filesDir, library.id.toString())
if (libraryDir.isDirectory){
if (libraryDir.isDirectory) {
libraryDir.deleteRecursively()
}
}

/**
* Create cache folder for cover images
*/
fun createImageCacheFolder(){
fun createImageCacheFolder() {
val imageCache = File(context.cacheDir, "image")
if(!imageCache.isDirectory){
if (!imageCache.isDirectory) {
imageCache.mkdir()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ class QueryResult {
}
var indexOfFormattedResponse = 0
for (index in listOfValues.indices step 2) {
formattedResponse[indexOfFormattedResponse][0] =
listOfValues[index] //id
formattedResponse[indexOfFormattedResponse][0] = listOfValues[index] //id
formattedResponse[indexOfFormattedResponse][1] =
listOfValues[index + 1].removePrefix(" ").removeSurrounding("\'")
.removeSurrounding("\"") //name
listOfValues[index + 1].removePrefix(" ").removeSurrounding("\'").removeSurrounding("\"") //name
indexOfFormattedResponse += 1
}
return formattedResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ServerRequest(private val context: Context, private val mangaID: Int?) {
return descriptionToReturn
}

// Prepare a delicious Toast for you
/**Prepare a delicious Toast for you*/
private fun toaster(msg: String) {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.io.File
class ImageManager {

/**
* Verify the cache hit ot miss, if is a miss make the image request
* Verify the cache hit or miss, where there is a miss make the image request
*/
fun retrieveImage(context: Context, id: Int): Bitmap? {
val imageFile = File(context.cacheDir, "image/$id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package it.unitn.disi.lpsmt.g03.mangacheck.utils.xml

/**
* The basic XML entry.
*
* It contains all the data that can be useful to manipulate a chapter.
*/
data class ChapterEntry(val num: Int, val title: String)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package it.unitn.disi.lpsmt.g03.mangacheck.utils.xml

/**
* The basic XML entry.
*
* It contains all the data that can be useful to manipulate a library.
*/
data class LibraryEntry(val title: String?, val id: Int)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package it.unitn.disi.lpsmt.g03.mangacheck.utils.xml

/**
* The basic XML entry.
*
* It contains all the data that can be useful to manipulate a comic.
*/

data class MangaEntry(var list: String, val title: String?, val id: Int, val description : String?)
data class MangaEntry(var list: String, val title: String?, val id: Int, val description: String?)
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ package it.unitn.disi.lpsmt.g03.mangacheck.utils.xml
/**
* Interface for the various implementation of the Encoder
*/
interface XMLEncoder<T>{
interface XMLEncoder<T> {

fun addEntry(entry : T)
/**
* Add an entry to the class dependent xml file
*/
fun addEntry(entry: T)

fun removeEntry(entry : T)
/**
* Remove an entry to the class dependent xml file
*/
fun removeEntry(entry: T)

fun modifyEntry(entry : T, fieldName : String, newValue: String)
/**
* Modify an entry to the class dependent xml file
*/
fun modifyEntry(entry: T, fieldName: String, newValue: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ package it.unitn.disi.lpsmt.g03.mangacheck.utils.xml
* Interface for the various implementation of the Parser
*/
interface XMLParser<T> {
/**
* Parse the class dependent xml file
*/
fun parse(): MutableList<T>

/**
* Check if [entry] is already in the xml
*/
fun alreadyInList(entry: T): Boolean
}

0 comments on commit e17a979

Please sign in to comment.