Skip to content

Commit

Permalink
Migrated category module from Java to Kotlin (commons-app#6016)
Browse files Browse the repository at this point in the history
* Rename .java to .kt

* Rebased category PR

* Resolved conflicts

---------

Co-authored-by: Nicolas Raoul <[email protected]>
  • Loading branch information
Saifuddin53 and nicolas-raoul authored Dec 11, 2024
1 parent 3030a6f commit c175a4e
Show file tree
Hide file tree
Showing 22 changed files with 939 additions and 1,021 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ class CategoriesModel

// Newly used category...
if (category == null) {
category = Category(null, item.name, item.description, item.thumbnail, Date(), 0)
category = Category(
null, item.name,
item.description,
item.thumbnail,
Date(),
0
)
}
category.incTimesUsed()
categoryDao.save(category)
Expand Down
115 changes: 0 additions & 115 deletions app/src/main/java/fr/free/nrw/commons/category/Category.java

This file was deleted.

17 changes: 17 additions & 0 deletions app/src/main/java/fr/free/nrw/commons/category/Category.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package fr.free.nrw.commons.category

import android.net.Uri
import java.util.Date

data class Category(
var contentUri: Uri? = null,
val name: String? = null,
val description: String? = null,
val thumbnail: String? = null,
val lastUsed: Date? = null,
var timesUsed: Int = 0
) {
fun incTimesUsed() {
timesUsed++
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package fr.free.nrw.commons.category

interface CategoryClickedListener {
fun categoryClicked(item: CategoryItem)
}

This file was deleted.

Loading

0 comments on commit c175a4e

Please sign in to comment.