Compare commits
No commits in common. "98706890682ddc1d21c850139eae59e1d39fa091" and "d54e5c179ad95930db61e0fec6339d0238c53b54" have entirely different histories.
9870689068
...
d54e5c179a
@ -38,10 +38,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".RegisterActivity"
|
android:name=".RegisterActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".CreateDishActivity" />
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -1,25 +0,0 @@
|
|||||||
package tech.mercantec.easyeat
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.appcompat.widget.Toolbar
|
|
||||||
|
|
||||||
class CreateDishActivity : AppCompatActivity() {
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_create_dish_form)
|
|
||||||
|
|
||||||
// Setup the Toolbar as ActionBar
|
|
||||||
val toolbar: Toolbar = findViewById(R.id.toolbar)
|
|
||||||
setSupportActionBar(toolbar)
|
|
||||||
|
|
||||||
// Enable the Up button
|
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the Up button click
|
|
||||||
override fun onSupportNavigateUp(): Boolean {
|
|
||||||
onBackPressedDispatcher.onBackPressed()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package tech.mercantec.easyeat
|
package tech.mercantec.easyeat
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
@ -8,7 +7,6 @@ import androidx.navigation.findNavController
|
|||||||
import androidx.navigation.ui.AppBarConfiguration
|
import androidx.navigation.ui.AppBarConfiguration
|
||||||
import androidx.navigation.ui.setupActionBarWithNavController
|
import androidx.navigation.ui.setupActionBarWithNavController
|
||||||
import androidx.navigation.ui.setupWithNavController
|
import androidx.navigation.ui.setupWithNavController
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
import tech.mercantec.easyeat.databinding.ActivityMainBinding
|
import tech.mercantec.easyeat.databinding.ActivityMainBinding
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
@ -31,33 +29,5 @@ class MainActivity : AppCompatActivity() {
|
|||||||
)
|
)
|
||||||
setupActionBarWithNavController(navController, appBarConfiguration)
|
setupActionBarWithNavController(navController, appBarConfiguration)
|
||||||
navView.setupWithNavController(navController)
|
navView.setupWithNavController(navController)
|
||||||
|
|
||||||
val listView: ListView = findViewById(R.id.dishesList)
|
|
||||||
val listItems = arrayOf(
|
|
||||||
Dish("Spaghetti Bolognese", "Beef", 70.5),
|
|
||||||
Dish("Margherita Pizza", "Cheese", 60.0),
|
|
||||||
Dish("Chicken Curry", "Chicken", 80.2),
|
|
||||||
Dish("Vegetable Stir Fry", "Mixed Vegetables", 50.5),
|
|
||||||
Dish("Sushi", "Fish", 100.0),
|
|
||||||
Dish("Beef Tacos", "Beef", 60.8),
|
|
||||||
Dish("Lentil Soup", "Lentils", 40.5),
|
|
||||||
Dish("Pasta Alfredo", "Cream", 60.9),
|
|
||||||
Dish("Caesar Salad", "Chicken", 50.8),
|
|
||||||
Dish("Falafel Wrap", "Chickpeas", 50.2)
|
|
||||||
)
|
|
||||||
|
|
||||||
val listAdapter = DishAdapter(this, listItems)
|
|
||||||
listView.adapter = listAdapter
|
|
||||||
|
|
||||||
listView.setOnItemClickListener { parent, view, position, id ->
|
|
||||||
val selectedItem = parent.getItemAtPosition(position) as Dish
|
|
||||||
Toast.makeText(this, "you selected $selectedItem.name that costs ${selectedItem.expense} kr.", Toast.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
findViewById<FloatingActionButton>(R.id.add_dish).setOnClickListener {
|
|
||||||
val intent = Intent(this, CreateDishActivity::class.java)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:title="Create Dish"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/create_dish_heading"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textSize="24sp" />
|
|
||||||
|
|
||||||
<include
|
|
||||||
layout="@layout/activity_create_dish_ingredient_row" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/addIngredientButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Add Ingredient"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="16dp"/>
|
|
||||||
</LinearLayout>
|
|
@ -1,80 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp">
|
|
||||||
|
|
||||||
<!-- Ingredient Field -->
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="2dp"
|
|
||||||
android:text="@string/ingredient_label" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="58dp"
|
|
||||||
android:hint="Ingredient name" />
|
|
||||||
|
|
||||||
<!-- Row: Amount + Measurement -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:layout_marginTop="8dp">
|
|
||||||
|
|
||||||
<!-- Amount field (fixed width) -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="174dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/amount_label" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="173dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:hint="0" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- Measurement field (fill rest) -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_marginStart="8dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/measurement_label" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/spinner"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="48dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- Remove Button (fixed width) -->
|
|
||||||
<Button
|
|
||||||
android:id="@+id/removeButton"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:text="-"
|
|
||||||
android:textSize="20dp"
|
|
||||||
android:backgroundTint="@color/red"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
@ -2,38 +2,9 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:paddingTop="?attr/actionBarSize">
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
||||||
android:id="@+id/add_dish"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:contentDescription="@string/add_label"
|
|
||||||
app:srcCompat="@android:drawable/ic_input_add"
|
|
||||||
app:backgroundTint="@color/cyan"
|
|
||||||
app:tint="@android:color/white"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Navigation Fragment -->
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/dishesList"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_bias="1.0">
|
|
||||||
|
|
||||||
</ListView>
|
|
||||||
|
|
||||||
<!-- Navigation Fragment -->
|
<!-- Navigation Fragment -->
|
||||||
<fragment
|
<fragment
|
||||||
@ -42,10 +13,10 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:defaultNavHost="true"
|
app:defaultNavHost="true"
|
||||||
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:navGraph="@navigation/mobile_navigation" />
|
app:navGraph="@navigation/mobile_navigation" />
|
||||||
|
|
||||||
<!-- Bottom Navigation -->
|
<!-- Bottom Navigation -->
|
||||||
@ -55,8 +26,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/windowBackground"
|
android:background="?android:attr/windowBackground"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:menu="@menu/bottom_nav_menu" />
|
app:menu="@menu/bottom_nav_menu" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@ -6,5 +6,4 @@
|
|||||||
<color name="dark_gray">#FF757575</color>
|
<color name="dark_gray">#FF757575</color>
|
||||||
<color name="black">#FF242424</color>
|
<color name="black">#FF242424</color>
|
||||||
<color name="white">#FFF9F9F9</color>
|
<color name="white">#FFF9F9F9</color>
|
||||||
<color name="red">#D62D2D </color>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -17,10 +17,4 @@
|
|||||||
<string name="confirm_password_label">Confirm password</string>
|
<string name="confirm_password_label">Confirm password</string>
|
||||||
<string name="password_hint">••••••••</string>
|
<string name="password_hint">••••••••</string>
|
||||||
<string name="back_label">Back</string>
|
<string name="back_label">Back</string>
|
||||||
<string name="create_dish_heading">Create Dish</string>
|
|
||||||
<string name="ingredient_label">Ingredient</string>
|
|
||||||
<string name="measurement_label">Measurement</string>
|
|
||||||
<string name="amount_label">Amount</string>
|
|
||||||
<string name="add_label">Add</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user