IanTDuncan / MealTime

Project for CSC 480
0 stars 0 forks source link

MVP - Updated Allergy Optons for MealGeneration.XML #164

Closed BeepDroid closed 3 months ago

BeepDroid commented 3 months ago

MVP - Updated Allergy Optons for MealGeneration.XML


Description:


Work towards getting the meal generation results, which are returning from the API without problem, to show up on the app as intended. This small update to the generational options of the XML is just to better reflect the new API options to ensure we're getting the full use out of it.

Steps to Reproduce:


  1. Replace the daily and weekly checkboxes with radio buttons to avoid users choosing both at once.
  2. Add in a few radio buttons for dietary plans.
  3. Add in two more options for allergies.

Expected vs. Actual Behavior:


  1. Better interaction with API.
  2. Reflects the options provided a lot better for the user.

Code Snippets:



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- Back button to go back a page -->
    <Button
        android:id="@+id/backButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_marginStart="25dp"
        android:layout_marginTop="25dp"
        android:text="Back" />

    <!-- Radio group for time frame selection -->
    <RadioGroup
        android:id="@+id/weekOptions"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_below="@id/backButton"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="25dp">

        <!-- Toggles for breakfast meals -->
        <RadioButton
            android:id="@+id/weekdaySwitch"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="day" />

        <!-- Toggles for full week meals -->
        <RadioButton
            android:id="@+id/fullWeekSwitch"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="week" />
    </RadioGroup>

    <!-- Generate meal button -->
    <Button
        android:id="@+id/generateMealButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginEnd="151dp"
        android:layout_marginBottom="30dp"
        android:text="Generate a meal!" />

    <!-- Scrollview containing all options to narrow down meal generation -->
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/weekOptions"
        android:layout_above="@+id/generateMealButton"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="20dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <!-- Informs what category is next -->
            <TextView
                android:id="@+id/allergiesView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Allergies"
                android:textSize="35sp" />

            <!-- dairy allergy option -->
            <CheckBox
                android:id="@+id/dairyAllergy"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:text="Dairy" />

            <!-- Egg allergy option -->
            <CheckBox
                android:id="@+id/eggAllergy"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:text="Eggs" />

            <!-- nut allergy option -->
            <CheckBox
                android:id="@+id/nutAllergy"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:text="Nuts" />

            <!-- wheat allergy option -->
            <CheckBox
                android:id="@+id/wheatAllergy"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:text="Wheat" />

            <!-- Soy allergy option -->
            <CheckBox
                android:id="@+id/soyAllergy"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:text="Soy" />

            <!-- Fish allergy option -->
            <CheckBox
                android:id="@+id/fishAllergy"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:text="Fish" />

            <!-- Informs what category is next -->
            <TextView
                android:id="@+id/dietSeparator"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Dietary Restrictions"
                android:textSize="35sp" />

            <!-- Radio group for diet selection -->
            <RadioGroup
                android:id="@+id/dietRadioGroup"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Vegan option for diets -->
                <RadioButton
                    android:id="@+id/vegan"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Vegan" />

                <!-- Gluten-Free option for diets -->
                <RadioButton
                    android:id="@+id/glutenFree"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Gluten-Free" />

                <!-- Ketogenic option for diets -->
                <RadioButton
                    android:id="@+id/ketogenic"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Ketogenic" />

                <!-- Vegetarian option for diets -->
                <RadioButton
                    android:id="@+id/vegetarian"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Vegetarian" />

                <!-- Lacto-Vegetarian option for diets -->
                <RadioButton
                    android:id="@+id/lactoVegetarian"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Lacto-Vegetarian" />

                <!-- Ovo-Vegetarian option for diets -->
                <RadioButton
                    android:id="@+id/ovoVegetarian"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Ovo-Vegetarian" />

                <!-- Pescetarian option for diets -->
                <RadioButton
                    android:id="@+id/pescetarian"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Pescetarian" />

                <!-- Paleo option for diets -->
                <RadioButton
                    android:id="@+id/paleo"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Paleo" />

                <!-- Primal option for diets -->
                <RadioButton
                    android:id="@+id/primal"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Primal" />

                <!-- Low FODMAP option for diets -->
                <RadioButton
                    android:id="@+id/lowFodmap"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Low FODMAP" />

                <!-- Whole30 option for diets -->
                <RadioButton
                    android:id="@+id/whole30"
                    android:layout_width="wrap_content"
                    android:layout_height="48dp"
                    android:text="Whole30" />
            </RadioGroup>

            <!-- Informing what the next category is-->
            <TextView
                android:id="@+id/calorieAmount"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Target Calories"
                android:textSize="25sp" />

            <!-- Highest amount of calories you want in one meal-->
            <EditText
                android:id="@+id/lowRange"
                android:layout_width="303dp"
                android:layout_height="wrap_content"
                android:ems="10"
                android:hint="Calories Per Day"
                android:inputType="number" />

        </LinearLayout>
    </ScrollView>

</RelativeLayout>

Environment Details:


Android Studio, Windows OS.

Current Status:


Completed