IanTDuncan / MealTime

Project for CSC 480
0 stars 0 forks source link

Addition of functions for meal_activity.xml #124

Closed bdshanks-28 closed 4 months ago

bdshanks-28 commented 4 months ago

Addition of functions for meal_activity.xml

Description:

Addition of the selection process for allergies, diets, meal types to generate. All functions needed for the core app.

Steps to Reproduce:

N/A

Expected vs. Actual Behavior:

N/A

Code Snippets:

N/A

Environment Details:

Built in Android Studio, Windows OS.

For Issue Resolution:

Researching usages of radio buttons, checkboxes, switches, and scrollviews. Best case usages for these things for what we are aiming for design-wise.

For Investigations/Research:

Researching the demo on edaman api page to best use it as an example.

Current Status:

Completed

bdshanks-28 commented 4 months ago

Addition of 'back' button. A switch for lunch, dinner, and breakfast each. A completion button to redirect to meal_result_activity.xml. A scrollview for containing options for allergies. 8 common allergies to check off using checkboxes.

Code Snippet

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

<Switch
    android:id="@+id/breakfastSwitch"
    android:layout_width="wrap_content"
    android:layout_height="48dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginStart="70dp"
    android:layout_marginTop="77dp"
    android:text="Breakfast" />

<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="140dp"
    android:layout_marginBottom="80dp"
    android:text="Generate a meal!" />

<Switch
    android:id="@+id/dinnerSwitch"
    android:layout_width="wrap_content"
    android:layout_height="48dp"
    android:layout_alignParentTop="true"
    android:layout_marginStart="5dp"
    android:layout_marginTop="77dp"
    android:layout_toEndOf="@+id/lunchSwitch"
    android:text="Dinner" />

<Switch
    android:id="@+id/lunchSwitch"
    android:layout_width="wrap_content"
    android:layout_height="48dp"
    android:layout_alignParentTop="true"
    android:layout_marginStart="5dp"
    android:layout_marginTop="77dp"
    android:layout_toEndOf="@+id/breakfastSwitch"
    android:text="Lunch" />

<Button
    android:id="@+id/backButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="25dp"
    android:layout_marginTop="25dp"
    android:text="Back" />

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/generateMealButton"
    android:layout_below="@id/lunchSwitch"
    android:layout_alignParentStart="true"
    android:layout_alignParentEnd="true"
    android:layout_marginEnd="0dp">

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

        <TextView
            android:id="@+id/allergiesView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Allergies"
            android:textSize="35sp" />

        <CheckBox
            android:id="@+id/dairyAllergy"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="Dairy" />

        <CheckBox
            android:id="@+id/eggAllergy"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="Eggs" />

        <CheckBox
            android:id="@+id/nutAllergy"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="Nuts" />

        <CheckBox
            android:id="@+id/wheatAllergy"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="Wheat" />

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

        <CheckBox
            android:id="@+id/fishAllergy"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:text="Fish" />
    </LinearLayout>
</ScrollView>

bdshanks-28 commented 4 months ago

Added attribution:

<ImageView
    android:id="@+id/attribution"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginStart="0dp"
    android:layout_marginLeft="0dp"
    android:layout_marginEnd="0dp"
    android:layout_marginRight="0dp"
    android:layout_marginBottom="3dp"
    android:src="@drawable/edamam_badge_transparent" />

Added 2 diets to choose from or leave unchosen, and a max amount of calories you can input

        <!-- 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" />

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

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

        <!-- Informing what the next category is-->
        <TextView
            android:id="@+id/calorieAmount"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Calorie Range (Highest amount)"
            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="Highest amount of calories you want"
            android:inputType="number" />

Also added comments to make the rest of it more clear in purpose.

bdshanks-28 commented 4 months ago

With this, this issue can be considered complete, I will be closing it now.