Menu

Home

hPa

XSLT template of restaurant has to transform source data into form which jidelak understands. Here is example of final transformed result:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jidelak>
    <config>
        <restaurant version="1.0">
            <id>city-restaurant-id</id>
            <name>My restaurant name</name>
            <phone>Phone of restaurant: +420...</phone>
            <web>URL of restaurant (http://...)</web>
            <city>City where restaurant resides</city>
            <country>Country where restaurant resides</country>
            <address>Address (street, number) where restaurant resides</address>
            <zip>Zip of location where restaurant resides</zip>
            <!-- Next is source of data we use to build daily menu -->
            <source dateFormat="d.M.yyyy" encoding="utf8" firstDayOfWeek="Po" locale="cs_CZ" time="absolute"
                    url="http://www.avion58.cz/"/>
            <!-- Follows opening hours -->
            <open>
                <term description="denní menu" from="11:00" to="15:00"/>
                <term day-of-week="Po" from="08:00" to="00:00"/>
                <term day-of-week="Út" from="08:00" to="00:00"/>
                <term day-of-week="St" from="08:00" to="00:00"/>
                <term day-of-week="Čt" from="08:00" to="00:00"/>
                <term day-of-week="Pá" from="08:00" to="01:00"/>
                <term day-of-week="So" from="10:00" to="01:00"/>
                <term day-of-week="Ne" from="11:00" to="23:00"/>
            </open>

            <!-- When time in source is set to "absolute", ref-time is ignored and in time is real date.
When time in source is set to "relative", in ref-time is base date and in time is number of days after ref-time-->
            <menu>
<!-- dish has to be one of breakfast, snack, starter, soup, dinner, trimmings, dessert, lunch, supper, menu, drink, wine". -->
<!-- category can be everything. You can use numbers as start of category to force sort order of meals of this category. Some substrings of categories are used for highlighting meals. -->
                <meal category="10-normal" dish="soup" order="1" ref-time="23.6.2015" time="23.6.2015">
                    <title>Name of meal</title>
                    <description>Description of meal</description>
                    <price>Price of meal</price>
                </meal>
                <meal category="10-normal" dish="dinner" order="1" ref-time="23.6.2015" time="23.6.2015">
                    <title>Name of meal</title>
                    <description>Description of meal</description>
                    <price>Price of meal</price>
                </meal>
                <meal category="20-salad" dish="dinner" order="1" ref-time="23.6.2015" time="23.6.2015">
                    <title>Name of meal</title>
                    <description>Description of meal</description>
                    <price>Price of meal</price>
                </meal>

            </menu>
        </restaurant>
    </config>
</jidelak>

Category coloring code sniplet:

if (cat.matches(".*vegetar.*")) {
    color = getResources()
            .getColor(R.color.vegeterian_meal);
} else if (cat.matches(".*salad.*")) {
    color = getResources().getColor(R.color.cold_meal);
} else if (cat.matches(".*pasta.*")) {
    color = getResources().getColor(R.color.pasta_meal);
} else if (cat.matches(".*live.*")) {
    color = getResources().getColor(R.color.live_meal);
} else if (cat.matches(".*fried.*")) {
    color = getResources().getColor(R.color.fried_meal);
} else if (cat.matches(".*fish.*")) {
    color = getResources().getColor(R.color.fish_meal);
} else if (cat.matches(".*(caffee|tee).*")) {
    color = getResources()
            .getColor(R.color.warm_drink_meal);
} else if (cat.matches(".*coctail.*")) {
    color = getResources().getColor(R.color.coctail_meal);
} else if (cat.matches(".*juice.*")) {
    color = getResources().getColor(R.color.juice_meal);
} else if (cat.matches(".*red-wine.*")) {
    color = getResources().getColor(R.color.red_wine_meal);
} else if (cat.matches(".*beer.*")) {
    color = getResources().getColor(R.color.beer_meal);
} else if (cat.matches(".*white-wine.*")) {
    color = getResources()
            .getColor(R.color.white_wine_meal);
} else if (cat.matches(".*rose-wine.*")) {
    color = getResources().getColor(R.color.rose_wine_meal);
} else if (cat.matches(".*(ladies|child|half).*")) {
    color = getResources().getColor(R.color.half_meal);
} else if (cat.matches(".*(steak|superior).*")) {
    color = getResources().getColor(R.color.steak_meal);
}