Merge branch 'master' of git.reim.ar:ReiMerc/easyeat
This commit is contained in:
commit
3cbf52f8b2
@ -1,24 +0,0 @@
|
||||
package tech.mercantec.easyeat
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("tech.mercantec.easyeat", appContext.packageName)
|
||||
}
|
||||
}
|
@ -38,6 +38,10 @@
|
||||
<activity
|
||||
android:name=".RegisterActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".CreateDishActivity" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,25 @@
|
||||
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,13 +1,8 @@
|
||||
package tech.mercantec.easyeat
|
||||
|
||||
import android.graphics.Color
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.BaseAdapter
|
||||
import android.widget.ListView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -15,9 +10,10 @@ import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.setupActionBarWithNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import tech.mercantec.easyeat.databinding.ActivityMainBinding
|
||||
import tech.mercantec.easyeat.ui.home.DishAdapter
|
||||
import tech.mercantec.easyeat.ui.home.models.Dish
|
||||
import tech.mercantec.easyeat.models.Dish
|
||||
import tech.mercantec.easyeat.ui.dishes.DishAdapter
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
@ -34,32 +30,17 @@ class MainActivity : AppCompatActivity() {
|
||||
val navController = findNavController(R.id.nav_host_fragment_activity_main)
|
||||
val appBarConfiguration = AppBarConfiguration(
|
||||
setOf(
|
||||
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications
|
||||
R.id.navigation_dishes, R.id.navigation_shopping_list, R.id.navigation_notifications
|
||||
)
|
||||
)
|
||||
setupActionBarWithNavController(navController, appBarConfiguration)
|
||||
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,3 +1,3 @@
|
||||
package tech.mercantec.easyeat.ui.home.models
|
||||
package tech.mercantec.easyeat.models
|
||||
|
||||
public data class Dish(val name: String, val mainIngredient: String, val expense: Double)
|
@ -1,42 +0,0 @@
|
||||
package tech.mercantec.easyeat.ui.dashboard
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import tech.mercantec.easyeat.databinding.FragmentDashboardBinding
|
||||
|
||||
class DashboardFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentDashboardBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val dashboardViewModel =
|
||||
ViewModelProvider(this).get(DashboardViewModel::class.java)
|
||||
|
||||
_binding = FragmentDashboardBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
val textView: TextView = binding.textDashboard
|
||||
dashboardViewModel.text.observe(viewLifecycleOwner) {
|
||||
textView.text = it
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package tech.mercantec.easyeat.ui.dashboard
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class DashboardViewModel : ViewModel() {
|
||||
|
||||
private val _text = MutableLiveData<String>().apply {
|
||||
value = "This is dashboard Fragment"
|
||||
}
|
||||
val text: LiveData<String> = _text
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package tech.mercantec.easyeat.ui.home
|
||||
package tech.mercantec.easyeat.ui.dishes
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
@ -7,7 +7,7 @@ import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.TextView
|
||||
import tech.mercantec.easyeat.R
|
||||
import tech.mercantec.easyeat.ui.home.models.Dish
|
||||
import tech.mercantec.easyeat.models.Dish
|
||||
|
||||
class DishAdapter(context: Context, dishes: Array<Dish>) :
|
||||
ArrayAdapter<Dish>(context, 0, dishes) {
|
@ -0,0 +1,57 @@
|
||||
package tech.mercantec.easyeat.ui.dishes
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import tech.mercantec.easyeat.databinding.FragmentDishesBinding
|
||||
import tech.mercantec.easyeat.models.Dish
|
||||
|
||||
class DishesFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentDishesBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentDishesBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
context?.let { context ->
|
||||
binding.dishesList.setOnItemClickListener { parent, view, position, id ->
|
||||
val selectedItem = parent.getItemAtPosition(position) as Dish
|
||||
Toast.makeText(context, "you selected $selectedItem.name that costs ${selectedItem.expense} kr.", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
binding.dishesList.adapter = DishAdapter(context, listItems)
|
||||
}
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package tech.mercantec.easyeat.ui.home
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class HomeViewModel : ViewModel() {
|
||||
|
||||
private val _text = MutableLiveData<String>().apply {
|
||||
value = "This is home Fragment"
|
||||
}
|
||||
val text: LiveData<String> = _text
|
||||
}
|
@ -1,17 +1,15 @@
|
||||
package tech.mercantec.easyeat.ui.home
|
||||
package tech.mercantec.easyeat.ui.shopping_list
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import tech.mercantec.easyeat.databinding.FragmentHomeBinding
|
||||
import tech.mercantec.easyeat.databinding.FragmentShoppingListBinding
|
||||
|
||||
class HomeFragment : Fragment() {
|
||||
class ShoppingListFragment : Fragment() {
|
||||
|
||||
private var _binding: FragmentHomeBinding? = null
|
||||
private var _binding: FragmentShoppingListBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
@ -22,16 +20,9 @@ class HomeFragment : Fragment() {
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val homeViewModel =
|
||||
ViewModelProvider(this).get(HomeViewModel::class.java)
|
||||
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
_binding = FragmentShoppingListBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
val textView: TextView = binding.textHome
|
||||
homeViewModel.text.observe(viewLifecycleOwner) {
|
||||
textView.text = it
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
|
||||
</vector>
|
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
|
||||
</vector>
|
11
app/app/src/main/res/drawable/ic_list_alt_black_24px.xml
Normal file
11
app/app/src/main/res/drawable/ic_list_alt_black_24px.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:autoMirrored="true">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M320,680Q337,680 348.5,668.5Q360,657 360,640Q360,623 348.5,611.5Q337,600 320,600Q303,600 291.5,611.5Q280,623 280,640Q280,657 291.5,668.5Q303,680 320,680ZM320,520Q337,520 348.5,508.5Q360,497 360,480Q360,463 348.5,451.5Q337,440 320,440Q303,440 291.5,451.5Q280,463 280,480Q280,497 291.5,508.5Q303,520 320,520ZM320,360Q337,360 348.5,348.5Q360,337 360,320Q360,303 348.5,291.5Q337,280 320,280Q303,280 291.5,291.5Q280,303 280,320Q280,337 291.5,348.5Q303,360 320,360ZM440,680L680,680L680,600L440,600L440,680ZM440,520L680,520L680,440L440,440L440,520ZM440,360L680,360L680,280L440,280L440,360ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200Z"/>
|
||||
</vector>
|
10
app/app/src/main/res/drawable/ic_restaurant_black_24px.xml
Normal file
10
app/app/src/main/res/drawable/ic_restaurant_black_24px.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M280,880L280,514Q229,500 194.5,458Q160,416 160,360L160,80L240,80L240,360L280,360L280,80L360,80L360,360L400,360L400,80L480,80L480,360Q480,416 445.5,458Q411,500 360,514L360,880L280,880ZM680,880L680,560L560,560L560,280Q560,197 618.5,138.5Q677,80 760,80L760,880L680,880Z"/>
|
||||
</vector>
|
34
app/app/src/main/res/layout/activity_create_dish_form.xml
Normal file
34
app/app/src/main/res/layout/activity_create_dish_form.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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>
|
@ -0,0 +1,80 @@
|
||||
<?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>
|
||||
|
||||
|
@ -1,34 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="?attr/actionBarSize">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/dishesList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
<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" />
|
||||
|
||||
|
||||
</ListView>
|
||||
<!-- Navigation Fragment -->
|
||||
<fragment
|
||||
android:id="@+id/nav_host_fragment_activity_main"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/mobile_navigation" />
|
||||
|
||||
<!-- Bottom Navigation -->
|
||||
@ -38,8 +40,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/windowBackground"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:menu="@menu/bottom_nav_menu" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.dashboard.DashboardFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_dashboard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
12
app/app/src/main/res/layout/fragment_dishes.xml
Normal file
12
app/app/src/main/res/layout/fragment_dishes.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ListView
|
||||
android:id="@+id/dishes_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
/>
|
||||
</FrameLayout>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.home.HomeFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
9
app/app/src/main/res/layout/fragment_shopping_list.xml
Normal file
9
app/app/src/main/res/layout/fragment_shopping_list.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.shopping_list.ShoppingListFragment">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -2,14 +2,14 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/ic_home_black_24dp"
|
||||
android:id="@+id/navigation_dishes"
|
||||
android:icon="@drawable/ic_restaurant_black_24px"
|
||||
android:title="@string/title_your_dishes" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_dashboard"
|
||||
android:icon="@drawable/ic_dashboard_black_24dp"
|
||||
android:title="@string/title_dashboard" />
|
||||
android:id="@+id/navigation_shopping_list"
|
||||
android:icon="@drawable/ic_list_alt_black_24px"
|
||||
android:title="@string/title_shopping_list" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_notifications"
|
||||
|
@ -3,19 +3,19 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/mobile_navigation"
|
||||
app:startDestination="@+id/navigation_home">
|
||||
app:startDestination="@+id/navigation_dishes">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_home"
|
||||
android:name="tech.mercantec.easyeat.ui.home.HomeFragment"
|
||||
android:id="@+id/navigation_dishes"
|
||||
android:name="tech.mercantec.easyeat.ui.dishes.DishesFragment"
|
||||
android:label="@string/title_your_dishes"
|
||||
tools:layout="@layout/fragment_home" />
|
||||
tools:layout="@layout/fragment_dishes" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_dashboard"
|
||||
android:name="tech.mercantec.easyeat.ui.dashboard.DashboardFragment"
|
||||
android:label="@string/title_dashboard"
|
||||
tools:layout="@layout/fragment_dashboard" />
|
||||
android:id="@+id/navigation_shopping_list"
|
||||
android:name="tech.mercantec.easyeat.ui.shopping_list.ShoppingListFragment"
|
||||
android:label="@string/title_shopping_list"
|
||||
tools:layout="@layout/fragment_shopping_list" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_notifications"
|
||||
|
@ -6,4 +6,5 @@
|
||||
<color name="dark_gray">#FF757575</color>
|
||||
<color name="black">#FF242424</color>
|
||||
<color name="white">#FFF9F9F9</color>
|
||||
<color name="red">#D62D2D </color>
|
||||
</resources>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<string name="app_name">EasyEat</string>
|
||||
<string name="title_activity_main">MainActivity</string>
|
||||
<string name="title_your_dishes">Your Dishes</string>
|
||||
<string name="title_dashboard">Dashboard</string>
|
||||
<string name="title_shopping_list">Shopping list</string>
|
||||
<string name="title_notifications">Notifications</string>
|
||||
<string name="welcome_heading">Welcome to <font color="#0099BA">EasyEat</font></string>
|
||||
<string name="login_label">Login</string>
|
||||
@ -17,4 +17,10 @@
|
||||
<string name="confirm_password_label">Confirm password</string>
|
||||
<string name="password_hint">••••••••</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>
|
||||
|
@ -1,17 +0,0 @@
|
||||
package tech.mercantec.easyeat
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user