Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/src/main/java/com/example/myfoodproject/EntryFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class EntryFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding?.btnRamen?.setOnClickListener{
findNavController().navigate(R.id.action_entryFragment_to_ramenFragment)
}
binding?.btnSushi?.setOnClickListener{
findNavController().navigate(R.id.action_entryFragment_to_sushiFragment)
}
binding?.btnTonkatsu?.setOnClickListener{
findNavController().navigate(R.id.action_entryFragment_to_tonkatsuFragement)
}


}
}
3 changes: 3 additions & 0 deletions app/src/main/java/com/example/myfoodproject/InfoFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class InfoFragment : Fragment() {
binding?.btnRenickname?.setOnClickListener {
findNavController().navigate(R.id.action_infoFragment_to_newnickFragment)
}
binding?.btnWreview?.setOnClickListener {
findNavController().navigate(R.id.action_infoFragment_to_personalReviewFragment)
}
binding?.btnLogout?.setOnClickListener {
viewModel.logout()
findNavController().navigate(R.id.action_infoFragment_to_loginFragment)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.myfoodproject

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.LinearLayoutManager
import com.example.myfoodproject.databinding.FragmentPersonalreviewBinding

class PersonalReviewFragment : Fragment() {
val reviews = arrayOf(
Review("너무 맛있게 잘 먹었습니다! 인테리어도 깔끔하고 다음에 또 올께요~ 메뉴가 다양해서 좋았습니다! 다른 분들도 여기 오는 거 추천합니다~"
,4.0, "23.11.13"),
)

var binding: FragmentPersonalreviewBinding? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentPersonalreviewBinding.inflate(inflater)

binding?.recReviews?.layoutManager = LinearLayoutManager(context)
binding?.recReviews?.adapter = ReviewsAdapter(reviews)


return binding?.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

}

override fun onDestroy() {
super.onDestroy()
binding = null
}
}
44 changes: 44 additions & 0 deletions app/src/main/java/com/example/myfoodproject/RamenFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.example.myfoodproject

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.LinearLayoutManager
import com.example.myfoodproject.databinding.FragmentRamenBinding

class RamenFragment : Fragment() {

val restaurants = arrayOf(
Restaurant("라멘의 신", 4.9, 1254),
Restaurant("최고 라멘", 4.5, 841),
)


var binding: FragmentRamenBinding? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentRamenBinding.inflate(inflater)

binding?.recRestaurants?.layoutManager = LinearLayoutManager(context)
binding?.recRestaurants?.adapter = RestaurantsAdapter(restaurants)


return binding?.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)



}

override fun onDestroy() {
super.onDestroy()
binding = null
}
}

8 changes: 8 additions & 0 deletions app/src/main/java/com/example/myfoodproject/Restaurant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.myfoodproject

data class Restaurant(val name: String,
val rate: Double,
val review: Int){

}

33 changes: 33 additions & 0 deletions app/src/main/java/com/example/myfoodproject/RestaurantsAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.myfoodproject

import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.example.myfoodproject.databinding.ListRestaurantsBinding
class RestaurantsAdapter(val restaurants: Array<Restaurant>)
: RecyclerView.Adapter<RestaurantsAdapter.Holder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
val binding = ListRestaurantsBinding.inflate(LayoutInflater.from(parent.context))
return Holder(binding)
}

override fun onBindViewHolder(holder: Holder, position: Int) {
holder.bind(restaurants[position])
}
override fun getItemCount() = restaurants.size

class Holder(private val binding: ListRestaurantsBinding): RecyclerView.ViewHolder(binding.root){
fun bind(restaurant: Restaurant){
binding.imageView4.setImageResource(R.drawable.star)
binding.txtName.text = restaurant.name
binding.txtRate.text = restaurant.rate.toString()
binding.txtReview.text = restaurant.review.toString()

binding.root.setOnClickListener{
Toast.makeText(binding.root.context, " ${restaurant.name} 리뷰 목록에 접속하셨습니다.",
Toast.LENGTH_SHORT).show()
}
}
}
}
6 changes: 6 additions & 0 deletions app/src/main/java/com/example/myfoodproject/Review.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.myfoodproject

data class Review(val comment: String,
val grade: Double,
val date: String) {
}
28 changes: 28 additions & 0 deletions app/src/main/java/com/example/myfoodproject/ReviewsAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.example.myfoodproject

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.myfoodproject.databinding.ListReviewsBinding
class ReviewsAdapter(val reviews: Array<Review>): RecyclerView.Adapter<ReviewsAdapter.Holder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReviewsAdapter.Holder {
val binding = ListReviewsBinding.inflate(LayoutInflater.from(parent.context))
return ReviewsAdapter.Holder(binding)
}

override fun onBindViewHolder(holder: Holder, position: Int) {
holder.bind(reviews[position])
}

override fun getItemCount() = reviews.size

class Holder(private val binding: ListReviewsBinding): RecyclerView.ViewHolder(binding.root){
fun bind(review: Review){
binding.imageView2.setImageResource(R.drawable.noodle)
binding.imageView3.setImageResource(R.drawable.star)
binding.txtComment.text = review.comment
binding.txtGrade.text = review.grade.toString()
binding.txtDate.text = review.date.toString()
}
}
}
41 changes: 41 additions & 0 deletions app/src/main/java/com/example/myfoodproject/SushiFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.example.myfoodproject

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.LinearLayoutManager
import com.example.myfoodproject.databinding.FragmentSushiBinding

class SushiFragment : Fragment() {

val restaurants = arrayOf(
Restaurant("스시 월드", 4.2, 566),
Restaurant("장인 스시", 4.7, 1024),
)

var binding: FragmentSushiBinding? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentSushiBinding.inflate(inflater)

binding?.recRestaurants?.layoutManager = LinearLayoutManager(context)
binding?.recRestaurants?.adapter = RestaurantsAdapter(restaurants)


return binding?.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

}

override fun onDestroy() {
super.onDestroy()
binding = null
}
}

41 changes: 41 additions & 0 deletions app/src/main/java/com/example/myfoodproject/TonkatsuFragement.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.example.myfoodproject

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.LinearLayoutManager
import com.example.myfoodproject.databinding.FragmentTonkatsuBinding

class TonkatsuFragement : Fragment() {

val restaurants = arrayOf(
Restaurant("맛있는 돈카츠", 4.1, 497),
Restaurant("돈카츠 천국", 4.4, 774),
)

var binding: FragmentTonkatsuBinding? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentTonkatsuBinding.inflate(inflater)

binding?.recRestaurants?.layoutManager = LinearLayoutManager(context)
binding?.recRestaurants?.adapter = RestaurantsAdapter(restaurants)


return binding?.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

}

override fun onDestroy() {
super.onDestroy()
binding = null
}
}

Binary file added app/src/main/res/drawable/noodle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ramen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/sushi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/tonkatsu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 19 additions & 1 deletion app/src/main/res/layout/fragment_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="행복해"
android:text="일식맛집에 오신 것을 환영합니다."
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
Expand All @@ -32,6 +32,24 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">

<Button
android:id="@+id/btn_ramen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="라멘" />

<Button
android:id="@+id/btn_sushi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="스시" />

<Button
android:id="@+id/btn_tonkatsu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="돈카츠" />

<Button
android:id="@+id/btn_info"
android:layout_width="wrap_content"
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/layout/fragment_personalreview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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=".PersonalReviewFragment">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_reviews"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
18 changes: 18 additions & 0 deletions app/src/main/res/layout/fragment_ramen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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=".RamenFragment">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_restaurants"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
18 changes: 18 additions & 0 deletions app/src/main/res/layout/fragment_sushi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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=".SushiFragment">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_restaurants"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
18 changes: 18 additions & 0 deletions app/src/main/res/layout/fragment_tonkatsu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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=".TonkatsuFragement">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_restaurants"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Loading