lebonprix.apk/java/io/xdrm/lebonprix/model/Category.kt

104 lines
4.7 KiB
Kotlin

package io.xdrm.lebonprix.model
import android.util.Log
import io.xdrm.lebonprix.R
enum class Category(val label: String, val iconId: Int){
// [1] Common
ALL("Toutes les catégories", R.drawable.ic_category_all),
MISC("Autres", R.drawable.ic_category_misc),
// [2] VEHICLES
CARS("Voitures", R.drawable.ic_category_cars),
MOTORCYCLES("Motos", R.drawable.ic_category_moto),
CARAVANS("Caravaning", R.drawable.ic_category_caravan),
UTILITY_VEHICLES("Utilitaires", R.drawable.ic_category_utility_vehicle),
CAR_EQUIPMENT("Equipement auto", R.drawable.ic_category_tools),
MOTORCYCLES_EQUIPMENT("Equipement moto", R.drawable.ic_category_tools),
CARAVAN_EQUIPMENT("Equipement caravaning", R.drawable.ic_category_tools),
YACHTING("Nautisme", R.drawable.ic_category_boat),
YACHTING_EQUIPMENT("Equipement nautisme", R.drawable.ic_category_tools),
// [3] REAL ESTATE
HOUSE_SALES("Ventes immobilières", R.drawable.ic_category_house),
HOUSE("Immobilier neuf", R.drawable.ic_category_house),
LEASING("Locations", R.drawable.ic_category_apartment),
CO_LEASING("Colocations", R.drawable.ic_category_apartment),
OFFICES_SHOPS("Bureaux & Commerces", R.drawable.ic_category_market),
// [4] Holidays
LEASING_GITES("Locations & Gîtes", R.drawable.ic_category_house),
GUESTHOUSE("Chambres d'hôtes", R.drawable.ic_category_house),
CAMPING("Campings", R.drawable.ic_category_camping),
HOTELS("Hotels", R.drawable.ic_category_hotel),
UNUSUAL_LEASING("Hébergements insolites", R.drawable.ic_category_camping),
// [5] Multimedia
COMPUTER_EQUIPMENT("Informatique", R.drawable.ic_category_computer),
GAMES("Consoles & Jeux vidéo", R.drawable.ic_category_game),
VIDEO("Image & Son", R.drawable.ic_category_camera),
PHONES("Téléphonie", R.drawable.ic_category_phone),
// [6] Entertainment
DVD("DVD / Films", R.drawable.ic_category_dvd),
CD("CD / Musique", R.drawable.ic_category_cd),
BOOKS("Livres", R.drawable.ic_category_book),
PETS("Animaux", R.drawable.ic_category_pet),
BIKES("Vélos", R.drawable.ic_category_bike),
HOBBIES("Sports & Hobbies", R.drawable.ic_category_sport),
MUSIC_INSTRUMENTS("Instruments de musique", R.drawable.ic_category_piano),
COLLECTION("Collection", R.drawable.ic_category_collection),
TOYS("Jeux & Jouets", R.drawable.ic_category_toy),
WINE("Vins & Gastronomie", R.drawable.ic_category_wine),
// [7] Professional equipment
FARM_EQUIPMENT("Matériel agricole", R.drawable.ic_category_tractor),
WAREHOUSE_EQUIPMENT("Transport - Manutention", R.drawable.ic_category_warehouse),
CONSTRUCTION("BTP - Chantier gros-oeuvre", R.drawable.ic_category_road),
TOOLS("Outillage - Matériaux 2nd-oeuvre", R.drawable.ic_category_diy),
INDUSTRIAL_EQUIPMENT("Équipements industriels", R.drawable.ic_category_industry),
CATERING("Restauration - Hôtellerie", R.drawable.ic_category_food),
DESK_EQUIPMENT("Fournitures de bureau", R.drawable.ic_category_desk),
SHOP_EQUIPMENT("Commerces & Marchés", R.drawable.ic_category_market),
MEDICAL_EQUIPMENT("Matériel médical", R.drawable.ic_category_pill),
// [8] Services
SERVICES("Prestations de services", R.drawable.ic_category_handshake),
TICKETS("Billetterie", R.drawable.ic_category_ticket),
EVENTS("Evénements", R.drawable.ic_category_event),
CLASSES("Cours particuliers", R.drawable.ic_category_teacher),
CAR_SHARING("Covoiturage", R.drawable.ic_category_car_sharing),
// [9] House
FURNITURE("Ameublement", R.drawable.ic_category_furniture),
ELECTRICAL("Electroménager", R.drawable.ic_category_cooker),
TABLE_ARTS("Arts de la table", R.drawable.ic_category_food),
DECORATION("Décoration", R.drawable.ic_category_decoration),
LAUNDRY("Linge de maison", R.drawable.ic_category_pillow),
DIY("Bricolage", R.drawable.ic_category_diy),
GARDENING("Jardinage", R.drawable.ic_category_gardening),
// [10] Clothes
CLOTHS("Vêtements", R.drawable.ic_category_cloth),
SHOES("Chaussures", R.drawable.ic_category_shoe),
LUGGAGE("Accessoires & Bagagerie", R.drawable.ic_category_bag),
JEWELS("Montres & Bijoux", R.drawable.ic_category_watch),
BABY_EQUIPMENT("Equipement bébé", R.drawable.ic_category_baby),
BABY_CLOTHS("Vêtements bébé", R.drawable.ic_category_baby);
companion object {
fun fromLabel(l: String): Category? {
val lower = l.toLowerCase()
val avail = Category.values()
for (cat in avail) {
if (cat.label.toLowerCase() == lower)
return cat
}
Log.i("DEBUGDEBUG", "unknown label " + lower)
return null
}
}
}