diff --git a/app/src/androidTest/java/com/example/app/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/app/ExampleInstrumentedTest.kt
deleted file mode 100644
index beddd92..0000000
--- a/app/src/androidTest/java/com/example/app/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.example.app
-
-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("com.example.app", appContext.packageName)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3d94ad0..278200b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,13 +7,12 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
+ android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Project"
tools:targetApi="31">
-
@@ -23,12 +22,14 @@
+
+
adapter.updateList(list)
}
diff --git a/app/src/main/java/com/example/projectfigma/Activity/RecomendationActivity.kt b/app/src/main/java/com/example/projectfigma/Activity/RecomendationActivity.kt
new file mode 100644
index 0000000..4bc6000
--- /dev/null
+++ b/app/src/main/java/com/example/projectfigma/Activity/RecomendationActivity.kt
@@ -0,0 +1,28 @@
+package com.example.projectfigma.Activity
+
+import android.os.Bundle
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import com.example.projectfigma.Fragments.BottomPanelFragment
+import com.example.projectfigma.R
+import com.example.projectfigma.Util.StatusBar
+import com.example.projectfigma.databinding.ActivityAdvertisingPageBinding
+import com.example.projectfigma.databinding.ActivityRecomendationBinding
+
+class RecomendationActivity : AppCompatActivity() {
+ private lateinit var binding: ActivityRecomendationBinding
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ binding = ActivityRecomendationBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ StatusBar.hideStatusBar(window)
+
+ supportFragmentManager.beginTransaction()
+ .replace(R.id.buttonPanel, BottomPanelFragment())
+ .commit()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/projectfigma/Adapters/MainBestSellerAdapter.kt b/app/src/main/java/com/example/projectfigma/Adapters/MainBestSellerAdapter.kt
new file mode 100644
index 0000000..379d2da
--- /dev/null
+++ b/app/src/main/java/com/example/projectfigma/Adapters/MainBestSellerAdapter.kt
@@ -0,0 +1,52 @@
+package com.example.projectfigma.Adapters
+
+import android.net.Uri
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.example.projectfigma.Entites.Dishes
+import com.example.projectfigma.R
+
+class MainBestSellerAdapter (private var dishes: List) :
+ RecyclerView.Adapter() {
+
+ inner class DishViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val image: ImageView = itemView.findViewById(R.id.dishImage)
+ val title: TextView = itemView.findViewById(R.id.dishTitle)
+ val description: TextView = itemView.findViewById(R.id.dishDescription)
+ val price: TextView = itemView.findViewById(R.id.dishPrice)
+ val rating: TextView = itemView.findViewById(R.id.tvRating)
+ val category: ImageView = itemView.findViewById(R.id.iconCategory)
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DishViewHolder {
+ val view = LayoutInflater.from(parent.context).inflate(R.layout.item_dish_best_seller, parent, false)
+ return DishViewHolder(view)
+ }
+
+ override fun onBindViewHolder(holder: DishViewHolder, position: Int) {
+ val dish = dishes[position]
+
+ // Используем Glide для загрузки изображения
+ Glide.with(holder.itemView.context)
+ .load(Uri.parse(dish.imageUri))
+ .into(holder.image)
+
+ holder.category.setImageResource(dish.category.iconRes)
+ holder.title.text = dish.name
+ holder.description.text = dish.description
+ holder.price.text = "$${dish.price}"
+ holder.rating.text = "${dish.rating}"
+ }
+
+ override fun getItemCount(): Int = dishes.size
+
+ fun updateData(newList: List) {
+ dishes = newList
+ notifyDataSetChanged()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/projectfigma/Adapters/MainRecommendAdapter.kt b/app/src/main/java/com/example/projectfigma/Adapters/MainRecommendAdapter.kt
new file mode 100644
index 0000000..1510d8f
--- /dev/null
+++ b/app/src/main/java/com/example/projectfigma/Adapters/MainRecommendAdapter.kt
@@ -0,0 +1,50 @@
+package com.example.projectfigma.Adapters
+
+import android.net.Uri
+import android.view.View
+import android.view.ViewGroup
+import android.view.LayoutInflater
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.bumptech.glide.Glide
+import com.example.projectfigma.Entites.Dishes
+import com.example.projectfigma.R
+
+class MainRecommendAdapter(
+ private var dishes: List
+) : RecyclerView.Adapter() {
+
+ inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
+ val imgFood: ImageView = view.findViewById(R.id.imgFood)
+ val imgCategory: ImageView = view.findViewById(R.id.imgCategory)
+ val tvTitle: TextView = view.findViewById(R.id.tvTitle)
+ val tvDesc: TextView = view.findViewById(R.id.tvDesc)
+ val tvPrice: TextView = view.findViewById(R.id.tvPrice)
+ val tvRating: TextView = view.findViewById(R.id.tvRating)
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val v = LayoutInflater.from(parent.context)
+ .inflate(R.layout.item_main_recomend, parent, false)
+ return ViewHolder(v)
+ }
+
+ override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+ val dish = dishes[position]
+
+ Glide.with(holder.itemView.context)
+ .load(Uri.parse(dish.imageUri))
+ .into(holder.imgFood)
+ holder.imgCategory.setImageResource(dish.category.iconRes)
+ holder.tvTitle.text = dish.name
+ holder.tvDesc.text = dish.description
+ holder.tvPrice.text = "$" + dish.price.toString()
+ holder.tvRating.text = dish.rating.toString()
+ }
+
+ override fun getItemCount(): Int = dishes.size
+ fun updateData(newItems: List) {
+ dishes = newItems
+ }
+}
diff --git a/app/src/main/java/com/example/projectfigma/Adapters/MenuAdapter.kt b/app/src/main/java/com/example/projectfigma/Adapters/MenuAdapter.kt
deleted file mode 100644
index a64f73e..0000000
--- a/app/src/main/java/com/example/projectfigma/Adapters/MenuAdapter.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.example.projectfigma.Adapters
-
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageView
-import android.widget.TextView
-import androidx.recyclerview.widget.RecyclerView
-import com.bumptech.glide.Glide
-import com.example.projectfigma.Entites.Dishes
-import com.example.projectfigma.R
-
-class MenuAdapter(
- private val items: MutableList,
- private val onItemClick: (Dishes) -> Unit
-) : RecyclerView.Adapter() {
-
- inner class VH(view: View) : RecyclerView.ViewHolder(view) {
- val imgDish: ImageView = view.findViewById(R.id.imgDish)
- val tvName: TextView = view.findViewById(R.id.tvName)
- val tvDesc: TextView = view.findViewById(R.id.tvDesc)
- val tvRating: TextView = view.findViewById(R.id.tvRating)
- val tvPrice: TextView = view.findViewById(R.id.tvPrice)
- val tvTag: TextView = view.findViewById(R.id.tvTag)
- }
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
- val v = LayoutInflater.from(parent.context)
- .inflate(R.layout.item_menu, parent, false)
- return VH(v)
- }
-
- override fun onBindViewHolder(h: VH, pos: Int) {
- val dish = items[pos]
- h.tvName.text = dish.name
- h.tvDesc.text = dish.description
- h.tvRating.text = String.format("%.1f", dish.rating)
- h.tvPrice.text = "$%.2f".format(dish.price)
- h.tvTag.text = "${dish.category.toString().length * 2} × ${pos + 1}" // если category — строка
-
- Glide.with(h.itemView.context)
- .load(dish.imageUri)
- .into(h.imgDish)
-
- h.itemView.setOnClickListener { onItemClick(dish) }
- }
-
- override fun getItemCount() = items.size
-
- fun updateList(newList: List) {
- items.clear()
- items.addAll(newList)
- notifyDataSetChanged()
- }
-}
diff --git a/app/src/main/java/com/example/projectfigma/DAO/DishesDao.kt b/app/src/main/java/com/example/projectfigma/DAO/DishesDao.kt
index f56768e..ee99af3 100644
--- a/app/src/main/java/com/example/projectfigma/DAO/DishesDao.kt
+++ b/app/src/main/java/com/example/projectfigma/DAO/DishesDao.kt
@@ -40,17 +40,4 @@ interface DishesDao {
@Update
suspend fun update(item: Dishes)
-
- //Сортировка по популярности (например, по рейтингу)
- @Query("SELECT * FROM dishes ORDER BY rating DESC")
- fun getSortedByRating(): LiveData>
-
- //Сортировка по цене (возрастание)
- @Query("SELECT * FROM dishes ORDER BY price ASC")
- fun getSortedByPriceAsc(): LiveData>
-
- //Сортировка по цене (убывание)
- @Query("SELECT * FROM dishes ORDER BY price DESC")
- fun getSortedByPriceDesc(): LiveData>
-
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/projectfigma/DataBase/DataBase.kt b/app/src/main/java/com/example/projectfigma/DataBase/DataBase.kt
index cf15fbd..76dc8d9 100644
--- a/app/src/main/java/com/example/projectfigma/DataBase/DataBase.kt
+++ b/app/src/main/java/com/example/projectfigma/DataBase/DataBase.kt
@@ -129,7 +129,67 @@ abstract class DataBase : RoomDatabase() {
name = "Роллы",
description = "Роллы",
category = DishCategory.VEGAN
- )
+ ),
+ Dishes(
+ imageUri = "android.resource://$packageName/${R.drawable.into_best_seller1}",
+ price = 15.0,
+ isBestSeller = true,
+ isRecommend = false,
+ rating = 5.0,
+ name = "Солнечная брускетта",
+ description = "Солнечная брускетта",
+ category = DishCategory.SNACKS
+ ),
+ Dishes(
+ imageUri = "android.resource://$packageName/${R.drawable.into_best_seller2}",
+ price = 12.0,
+ isBestSeller = true,
+ isRecommend = false,
+ rating = 4.5,
+ name = "Изысканные шашлыки на гриле",
+ description = "Изысканные шашлыки на гриле",
+ category = DishCategory.SNACKS
+ ),
+ Dishes(
+ imageUri = "android.resource://$packageName/${R.drawable.into_best_seller3}",
+ price = 15.0,
+ isBestSeller = true,
+ isRecommend = false,
+ rating = 4.0,
+ name = "Тако с барбекю",
+ description = "Тако с барбекю",
+ category = DishCategory.MEAL
+ ),
+ Dishes(
+ imageUri = "android.resource://$packageName/${R.drawable.into_best_seller4}",
+ price = 12.0,
+ isBestSeller = true,
+ isRecommend = false,
+ rating = 3.5,
+ name = "Лазанья из брокколи",
+ description = "Лазанья из брокколи",
+ category = DishCategory.VEGAN
+ ),
+ Dishes(
+ imageUri = "android.resource://$packageName/${R.drawable.into_best_seller5}",
+ price = 15.0,
+ isBestSeller = true,
+ isRecommend = false,
+ rating = 3.0,
+ name = "Снежный кофе",
+ description = "Снежный кофе",
+ category = DishCategory.DRINKS
+ ),
+ Dishes(
+ imageUri = "android.resource://$packageName/${R.drawable.into_best_seller6}",
+ price = 12.0,
+ isBestSeller = true,
+ isRecommend = false,
+ rating = 4.0,
+ name = "Клубничный чизкейк",
+ description = "Клубничный чизкейк",
+ category = DishCategory.DESERT
+ ),
)
fun getDb(context: Context): DataBase {
diff --git a/app/src/main/java/com/example/projectfigma/Entites/Dishes.kt b/app/src/main/java/com/example/projectfigma/Entites/Dishes.kt
index c4edbb5..cee6616 100644
--- a/app/src/main/java/com/example/projectfigma/Entites/Dishes.kt
+++ b/app/src/main/java/com/example/projectfigma/Entites/Dishes.kt
@@ -12,7 +12,7 @@ data class Dishes(
val rating: Double,
val isRecommend: Boolean,
val isBestSeller: Boolean,
- val name : String,
- val description : String,
+ val name: String,
+ val description: String,
val category: DishCategory
)
\ No newline at end of file
diff --git a/app/src/main/java/com/example/projectfigma/Enums/SortType.kt b/app/src/main/java/com/example/projectfigma/Enums/SortType.kt
deleted file mode 100644
index 24aa6e5..0000000
--- a/app/src/main/java/com/example/projectfigma/Enums/SortType.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.example.projectfigma.Enums
-
-enum class SortType {
- POPULAR, PRICE, RATING
-}
diff --git a/app/src/main/java/com/example/projectfigma/Fragments/BestSeller.kt b/app/src/main/java/com/example/projectfigma/Fragments/BestSeller.kt
index a951294..e4d19ee 100644
--- a/app/src/main/java/com/example/projectfigma/Fragments/BestSeller.kt
+++ b/app/src/main/java/com/example/projectfigma/Fragments/BestSeller.kt
@@ -1,10 +1,15 @@
package com.example.projectfigma.Fragments
+import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.TextView
+import com.example.projectfigma.Activity.AdverstsingPageActivity
+import com.example.projectfigma.Activity.BestSellerActivity
+import com.example.projectfigma.Activity.RegActivity
import com.example.projectfigma.R
import com.example.projectfigma.databinding.FragmentBestSellerBinding
import com.example.projectfigma.databinding.FragmentDividingLineBinding
@@ -12,7 +17,7 @@ import com.example.projectfigma.databinding.FragmentDividingLineBinding
class BestSeller : Fragment() {
private var _binding: FragmentBestSellerBinding? = null
- private val binding get() = _binding!!
+ private val binding get() = _binding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -24,6 +29,13 @@ class BestSeller : Fragment() {
savedInstanceState: Bundle?
): View {
_binding = FragmentBestSellerBinding.inflate(inflater, container, false)
- return binding.root
+
+ binding?.tvViewAll?.setOnClickListener{
+ val intent = Intent(requireContext(), BestSellerActivity::class.java)
+ startActivity(intent)
+ requireActivity().finish()
+ }
+
+ return binding!!.root
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/projectfigma/Fragments/MainBestSeller.kt b/app/src/main/java/com/example/projectfigma/Fragments/MainBestSeller.kt
new file mode 100644
index 0000000..132688b
--- /dev/null
+++ b/app/src/main/java/com/example/projectfigma/Fragments/MainBestSeller.kt
@@ -0,0 +1,41 @@
+package com.example.projectfigma.Fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.example.projectfigma.Adapters.MainBestSellerAdapter
+import com.example.projectfigma.DAO.DishesDao
+import com.example.projectfigma.DataBase.DataBase
+import com.example.projectfigma.Entites.Dishes
+import com.example.projectfigma.R
+
+class MainBestSeller : Fragment(R.layout.fragment_main_best_seller) {
+
+ private lateinit var recyclerView: RecyclerView
+ private lateinit var adapter: MainBestSellerAdapter
+ private lateinit var database: DataBase
+ private lateinit var dishesDao: DishesDao
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ recyclerView = view.findViewById(R.id.popularRecyclerView)
+ recyclerView.layoutManager = GridLayoutManager(context, 2)
+
+ database = DataBase.getDb(requireContext())
+ dishesDao = database.getDishesDao()
+
+ dishesDao.getBestSellers().observe(viewLifecycleOwner) { dishList ->
+ adapter = MainBestSellerAdapter(dishList)
+ recyclerView.adapter = adapter
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/projectfigma/Fragments/MenuFragment.kt b/app/src/main/java/com/example/projectfigma/Fragments/MenuFragment.kt
deleted file mode 100644
index 6ba91f3..0000000
--- a/app/src/main/java/com/example/projectfigma/Fragments/MenuFragment.kt
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.example.projectfigma.Fragments
-
-import android.content.Intent
-import android.os.Bundle
-import android.view.View
-import android.widget.TextView
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.lifecycleScope
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import com.example.projectfigma.Activity.FoodDetailActivity
-import com.example.projectfigma.Adapters.MenuAdapter
-import com.example.projectfigma.DataBase.DataBase
-import com.example.projectfigma.Entites.Dishes
-import com.example.projectfigma.Enums.SortType
-import com.example.projectfigma.R
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
-
-class MenuFragment : Fragment(R.layout.activity_food_detail) {
-
- private lateinit var adapter: MenuAdapter
- private lateinit var db: com.example.projectfigma.DAO.DishesDao
- private var currentSort: SortType = SortType.POPULAR
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
-
- adapter = MenuAdapter(mutableListOf()) { dish ->
- val intent = Intent(requireContext(), FoodDetailActivity::class.java)
- intent.putExtra("dish_id", dish.id)
- startActivity(intent)
- }
-
- val rv = view.findViewById(R.id.rvMenu)
- rv.layoutManager = LinearLayoutManager(requireContext())
- rv.adapter = adapter
-
- db = DataBase.getDb(requireContext()).getDishesDao()
-
- view.findViewById(R.id.tvSort).setOnClickListener {
- toggleSort()
- loadData()
- }
-
- loadData()
- }
-
- private fun toggleSort() {
- currentSort = when (currentSort) {
- SortType.POPULAR -> SortType.PRICE
- SortType.PRICE -> SortType.RATING
- SortType.RATING -> SortType.POPULAR
- }
- }
-
- private fun loadData() {
- lifecycleScope.launch {
- val dishes = withContext(Dispatchers.IO) {
- when (currentSort) {
- SortType.POPULAR -> db.getAllSortedByPopularityеба()
- SortType.PRICE -> db.getAllSortedByPrice()
- SortType.RATING -> db.getAllSortedByRating()
- }
- }
- adapter.updateList(dishes)
- }
- }
-}
diff --git a/app/src/main/java/com/example/projectfigma/Fragments/RecomandationFragment.kt b/app/src/main/java/com/example/projectfigma/Fragments/RecomandationFragment.kt
new file mode 100644
index 0000000..23ad5c4
--- /dev/null
+++ b/app/src/main/java/com/example/projectfigma/Fragments/RecomandationFragment.kt
@@ -0,0 +1,39 @@
+package com.example.projectfigma.Fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.View
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.example.projectfigma.Adapters.MainBestSellerAdapter
+import com.example.projectfigma.Adapters.MainRecommendAdapter
+import com.example.projectfigma.DAO.DishesDao
+import com.example.projectfigma.DataBase.DataBase
+import com.example.projectfigma.R
+class RecomandationFragment : Fragment(R.layout.fragment_recomandation_fragemnt) {
+
+ private lateinit var dataBase: DataBase
+ private lateinit var dishesDao: DishesDao
+
+ // Создаём адаптер сразу с пустым списком
+ private val adapter by lazy { MainRecommendAdapter(emptyList()) }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ val rv = view.findViewById(R.id.popularRecyclerView)
+ rv.layoutManager = GridLayoutManager(requireContext(), 2)
+ rv.adapter = adapter // устанавливаем адаптер сразу
+
+ dataBase = DataBase.getDb(requireContext())
+ dishesDao = dataBase.getDishesDao()
+
+ // Наблюдаем за списком рекомендаций
+ dishesDao.getRecommend().observe(viewLifecycleOwner) { dishList ->
+ // Если MainRecommendAdapter у вас наследник ListAdapter:
+ // adapter.submitList(dishList)
+ // Иначе:
+ adapter.updateData(dishList)
+ adapter.notifyDataSetChanged()
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/projectfigma/Fragments/Recommend.kt b/app/src/main/java/com/example/projectfigma/Fragments/Recommend.kt
index efe1762..f42fcc3 100644
--- a/app/src/main/java/com/example/projectfigma/Fragments/Recommend.kt
+++ b/app/src/main/java/com/example/projectfigma/Fragments/Recommend.kt
@@ -1,13 +1,17 @@
package com.example.projectfigma.Fragments
+import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.TextView
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
+import com.example.projectfigma.Activity.BestSellerActivity
+import com.example.projectfigma.Activity.RecomendationActivity
import com.example.projectfigma.Adapters.RecommendAdapter
import com.example.projectfigma.DataBase.DataBase
import com.example.projectfigma.R
@@ -16,22 +20,27 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class Recommend : Fragment(R.layout.fragment_recommend) {
+
private val db by lazy { DataBase.getDb(requireContext()) }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val rv = view.findViewById(R.id.rvRecommend)
+ val textRecomend = view.findViewById(R.id.tvHeader)
rv.layoutManager = GridLayoutManager(requireContext(), 2)
+ textRecomend.setOnClickListener(){
+ val intent = Intent(requireContext(), RecomendationActivity::class.java)
+ startActivity(intent)
+ requireActivity().finish()
+ }
+
viewLifecycleOwner.lifecycleScope.launch {
- // 1. Получаем пользователя в IO
val sessionEmail = db.getSessionDao().getSession()?.userEmail.orEmpty()
val user = withContext(Dispatchers.IO) {
db.getUserDao().getUserByEmail(sessionEmail)
}
- // 2. Теперь наблюдаем LiveData рекомендаций
- // и каждый раз создаём новый адаптер с реальным списком
withContext(Dispatchers.Main) {
db.getDishesDao()
.getRecommend()
diff --git a/app/src/main/res/drawable/bg_chip_orange.xml b/app/src/main/res/drawable/bg_chip_orange.xml
deleted file mode 100644
index aa4fd7e..0000000
--- a/app/src/main/res/drawable/bg_chip_orange.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/drawable/edittext_bg.xml b/app/src/main/res/drawable/edittext_bg.xml
deleted file mode 100644
index f12b258..0000000
--- a/app/src/main/res/drawable/edittext_bg.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/drawable/ic_back.png b/app/src/main/res/drawable/ic_back.png
deleted file mode 100644
index 82421d6..0000000
Binary files a/app/src/main/res/drawable/ic_back.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_badge_new.png b/app/src/main/res/drawable/ic_badge_new.png
new file mode 100644
index 0000000..cb51f02
Binary files /dev/null and b/app/src/main/res/drawable/ic_badge_new.png differ
diff --git a/app/src/main/res/drawable/ic_bag.png b/app/src/main/res/drawable/ic_bag.png
deleted file mode 100644
index 410049b..0000000
Binary files a/app/src/main/res/drawable/ic_bag.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_cart_for_best.png b/app/src/main/res/drawable/ic_cart_for_best.png
new file mode 100644
index 0000000..03f03c2
Binary files /dev/null and b/app/src/main/res/drawable/ic_cart_for_best.png differ
diff --git a/app/src/main/res/drawable/ic_cart_white.png b/app/src/main/res/drawable/ic_cart_white.png
deleted file mode 100644
index e87a3e3..0000000
Binary files a/app/src/main/res/drawable/ic_cart_white.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_facebook.png b/app/src/main/res/drawable/ic_facebook.png
deleted file mode 100644
index f9bb464..0000000
Binary files a/app/src/main/res/drawable/ic_facebook.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_filter.png b/app/src/main/res/drawable/ic_filter.png
deleted file mode 100644
index 5671779..0000000
Binary files a/app/src/main/res/drawable/ic_filter.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_fingerprint.png b/app/src/main/res/drawable/ic_fingerprint.png
deleted file mode 100644
index f61ca52..0000000
Binary files a/app/src/main/res/drawable/ic_fingerprint.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_google.png b/app/src/main/res/drawable/ic_google.png
deleted file mode 100644
index c4ef449..0000000
Binary files a/app/src/main/res/drawable/ic_google.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_heart_logo.png b/app/src/main/res/drawable/ic_heart_logo.png
deleted file mode 100644
index c63f9aa..0000000
Binary files a/app/src/main/res/drawable/ic_heart_logo.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_search.png b/app/src/main/res/drawable/ic_search.png
deleted file mode 100644
index afa91a3..0000000
Binary files a/app/src/main/res/drawable/ic_search.png and /dev/null differ
diff --git a/app/src/main/res/drawable/image_rounded_bg.xml b/app/src/main/res/drawable/image_rounded_bg.xml
deleted file mode 100644
index 0332648..0000000
--- a/app/src/main/res/drawable/image_rounded_bg.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/into_best_seller1.png b/app/src/main/res/drawable/into_best_seller1.png
new file mode 100644
index 0000000..d310b39
Binary files /dev/null and b/app/src/main/res/drawable/into_best_seller1.png differ
diff --git a/app/src/main/res/drawable/into_best_seller2.png b/app/src/main/res/drawable/into_best_seller2.png
new file mode 100644
index 0000000..e2b68ed
Binary files /dev/null and b/app/src/main/res/drawable/into_best_seller2.png differ
diff --git a/app/src/main/res/drawable/into_best_seller3.png b/app/src/main/res/drawable/into_best_seller3.png
new file mode 100644
index 0000000..c1e7a11
Binary files /dev/null and b/app/src/main/res/drawable/into_best_seller3.png differ
diff --git a/app/src/main/res/drawable/into_best_seller4.png b/app/src/main/res/drawable/into_best_seller4.png
new file mode 100644
index 0000000..54e8634
Binary files /dev/null and b/app/src/main/res/drawable/into_best_seller4.png differ
diff --git a/app/src/main/res/drawable/into_best_seller5.png b/app/src/main/res/drawable/into_best_seller5.png
new file mode 100644
index 0000000..0acf1bc
Binary files /dev/null and b/app/src/main/res/drawable/into_best_seller5.png differ
diff --git a/app/src/main/res/drawable/into_best_seller6.png b/app/src/main/res/drawable/into_best_seller6.png
new file mode 100644
index 0000000..c4e5938
Binary files /dev/null and b/app/src/main/res/drawable/into_best_seller6.png differ
diff --git a/app/src/main/res/drawable/rating_bg.xml b/app/src/main/res/drawable/rating_bg.xml
deleted file mode 100644
index 51e958e..0000000
--- a/app/src/main/res/drawable/rating_bg.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/rounded_corners.xml b/app/src/main/res/drawable/rounded_corners.xml
new file mode 100644
index 0000000..151f366
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_corners.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/rounded_input_bg.xml b/app/src/main/res/drawable/rounded_input_bg.xml
deleted file mode 100644
index c1d2d9a..0000000
--- a/app/src/main/res/drawable/rounded_input_bg.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/drawable/snacks_1.png b/app/src/main/res/drawable/snacks_1.png
deleted file mode 100644
index ad948d2..0000000
Binary files a/app/src/main/res/drawable/snacks_1.png and /dev/null differ
diff --git a/app/src/main/res/drawable/yellow.png b/app/src/main/res/drawable/yellow.png
deleted file mode 100644
index 2d5d0f2..0000000
Binary files a/app/src/main/res/drawable/yellow.png and /dev/null differ
diff --git a/app/src/main/res/layout/activity_best_seller.xml b/app/src/main/res/layout/activity_best_seller.xml
new file mode 100644
index 0000000..3bf586e
--- /dev/null
+++ b/app/src/main/res/layout/activity_best_seller.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_food_detail.xml b/app/src/main/res/layout/activity_food_detail.xml
deleted file mode 100644
index 0d325ea..0000000
--- a/app/src/main/res/layout/activity_food_detail.xml
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml
index afd1818..7c1ebb4 100644
--- a/app/src/main/res/layout/activity_home.xml
+++ b/app/src/main/res/layout/activity_home.xml
@@ -87,6 +87,9 @@
+
+
+
+ app:layout_constraintTop_toBottomOf="@+id/constraintLayout"
+ app:layout_constraintVertical_bias="0.666">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_recomendation.xml b/app/src/main/res/layout/activity_recomendation.xml
new file mode 100644
index 0000000..483e269
--- /dev/null
+++ b/app/src/main/res/layout/activity_recomendation.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_signup.xml b/app/src/main/res/layout/activity_signup.xml
deleted file mode 100644
index beb7281..0000000
--- a/app/src/main/res/layout/activity_signup.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/fragment_main_best_seller.xml b/app/src/main/res/layout/fragment_main_best_seller.xml
new file mode 100644
index 0000000..dc800e2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_main_best_seller.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_recomandation_fragemnt.xml b/app/src/main/res/layout/fragment_recomandation_fragemnt.xml
new file mode 100644
index 0000000..d8b1d4d
--- /dev/null
+++ b/app/src/main/res/layout/fragment_recomandation_fragemnt.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
diff --git a/app/src/main/res/layout/item_dish_best_seller.xml b/app/src/main/res/layout/item_dish_best_seller.xml
new file mode 100644
index 0000000..79d7f3c
--- /dev/null
+++ b/app/src/main/res/layout/item_dish_best_seller.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/item_food.xml b/app/src/main/res/layout/item_food.xml
index e5ea760..29d627e 100644
--- a/app/src/main/res/layout/item_food.xml
+++ b/app/src/main/res/layout/item_food.xml
@@ -39,11 +39,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5.0"
- android:textColor="@android:color/white"
+ android:textColor="@android:color/black"
android:textSize="12sp"
android:layout_marginStart="4dp"/>
diff --git a/app/src/main/res/layout/item_food_card.xml b/app/src/main/res/layout/item_food_card.xml
deleted file mode 100644
index a6d0e6b..0000000
--- a/app/src/main/res/layout/item_food_card.xml
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/item_main_recomend.xml b/app/src/main/res/layout/item_main_recomend.xml
new file mode 100644
index 0000000..e51529d
--- /dev/null
+++ b/app/src/main/res/layout/item_main_recomend.xml
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/item_menu.xml b/app/src/main/res/layout/item_menu.xml
deleted file mode 100644
index bbb75c9..0000000
--- a/app/src/main/res/layout/item_menu.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/item_new_recomend.xml b/app/src/main/res/layout/item_new_recomend.xml
new file mode 100644
index 0000000..5982d36
--- /dev/null
+++ b/app/src/main/res/layout/item_new_recomend.xml
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 1eb1848..8ee1ec4 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -17,4 +17,34 @@
- @drawable/indicator_selected
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 685f141..0bc321c 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,14 +1,20 @@
-
\ No newline at end of file
+
diff --git a/app/src/test/java/com/example/app/ExampleUnitTest.kt b/app/src/test/java/com/example/app/ExampleUnitTest.kt
deleted file mode 100644
index 21f881a..0000000
--- a/app/src/test/java/com/example/app/ExampleUnitTest.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.example.app
-
-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)
- }
-}
\ No newline at end of file