Skip to main content
Version: 5.4

How to use Catalog

As we said on the previous page, there are two ways to use the catalog :

  • Basic implementation : an all-in-one component that embeds the navigation and all needed other components
  • Custom implementation : were you can handle navigation by yourself and link components that you need

Basic implementation

For this implementation you will need CatalogJourney component, it's an all-in-one component merging all the available feature of the catalog. It includes a direct link to recipe collections.

XML usage

Add CatalogJourney into your view

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_catalog"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ai.mealz.sdk.components.catalogJourney.CatalogJourney
android:id="@+id/catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

In order to access direclty to a collection you should pass collection's id and title as parametter durring your navigation to catalogFragment

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_catalog"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ai.mealz.sdk.components.catalogJourney.CatalogJourney
android:id="@+id/catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

Compose implementation

fun MyPage(){
Column {
CatalogJourney.View()
}
}

If you pass as input at least an id of recipe collection CatalogJourney will directly open this collection. You can pass a title and a subtitle as well

 NavHost( modifier = Modifier.padding(padding),
navController = navController,
startDestination = "home") {
composable("home") {
Box {
Home()
}
}
composable("catalog/{id}&{title}") {
CatalogJourney.View(
it.arguments?.getString("id") ?: "",
it.arguments?.getString("title") ?: ""
)
}
}

Get recipe collection data

info

You can find the whole list of collections and their ids on Mealz Partners

You can get all Catalog home page's collection list with :

Mealz.catalog.getCatalogCategories { listOfCat : List<CatalogCategory> ->
// Do stuff here
println(listOfCat.map { "${it.id} ${it.title}" })
}

Custom implementation

info

Incoming documentation