Skip to content

Commit c175a4e

Browse files
Migrated category module from Java to Kotlin (#6016)
* Rename .java to .kt * Rebased category PR * Resolved conflicts --------- Co-authored-by: Nicolas Raoul <[email protected]>
1 parent 3030a6f commit c175a4e

22 files changed

+939
-1021
lines changed

app/src/main/java/fr/free/nrw/commons/category/CategoriesModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ class CategoriesModel
7878

7979
// Newly used category...
8080
if (category == null) {
81-
category = Category(null, item.name, item.description, item.thumbnail, Date(), 0)
81+
category = Category(
82+
null, item.name,
83+
item.description,
84+
item.thumbnail,
85+
Date(),
86+
0
87+
)
8288
}
8389
category.incTimesUsed()
8490
categoryDao.save(category)

app/src/main/java/fr/free/nrw/commons/category/Category.java

Lines changed: 0 additions & 115 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package fr.free.nrw.commons.category
2+
3+
import android.net.Uri
4+
import java.util.Date
5+
6+
data class Category(
7+
var contentUri: Uri? = null,
8+
val name: String? = null,
9+
val description: String? = null,
10+
val thumbnail: String? = null,
11+
val lastUsed: Date? = null,
12+
var timesUsed: Int = 0
13+
) {
14+
fun incTimesUsed() {
15+
timesUsed++
16+
}
17+
}

app/src/main/java/fr/free/nrw/commons/category/CategoryClickedListener.java

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package fr.free.nrw.commons.category
2+
3+
interface CategoryClickedListener {
4+
fun categoryClicked(item: CategoryItem)
5+
}

app/src/main/java/fr/free/nrw/commons/category/CategoryContentProvider.java

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)