-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from SOPT-29th-Joint-Seminar-10/subeen
#3 [STYLE] : 차량 예약.xml 및 RecyclerView
- Loading branch information
Showing
53 changed files
with
426 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package kr.ac.smu.cs.soptsocar | ||
|
||
data class CarInfoData( | ||
val car : Int, | ||
val heart: Int, | ||
val name : String, | ||
val price : String, | ||
val sale : String, | ||
val date : String, | ||
val city : String, | ||
) |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/kr/ac/smu/cs/soptsocar/FilterCarAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package kr.ac.smu.cs.soptsocar | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.bumptech.glide.Glide | ||
import kr.ac.smu.cs.soptsocar.databinding.ItemFilterBinding | ||
import kr.ac.smu.cs.soptsocar.databinding.ItemReserveCarListBinding | ||
|
||
class FilterCarAdapter : RecyclerView.Adapter<FilterCarAdapter.FilterCarViewHolder>() { | ||
|
||
val filterList = mutableListOf<FilterInfoData>() | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FilterCarViewHolder { | ||
val binding = ItemFilterBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, false | ||
) | ||
return FilterCarViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: FilterCarViewHolder, position: Int) { | ||
holder.onBind(filterList[position]) | ||
} | ||
|
||
override fun getItemCount(): Int = filterList.size | ||
|
||
class FilterCarViewHolder(private val binding: ItemFilterBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun onBind(data: FilterInfoData) { | ||
// 이미지버튼 | ||
Glide.with(binding.root) | ||
.load(data.filterImage) | ||
.into(binding.imgFilter) | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package kr.ac.smu.cs.soptsocar | ||
|
||
data class FilterInfoData( | ||
val filterImage : Int | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
app/src/main/java/kr/ac/smu/cs/soptsocar/ReservationCar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package kr.ac.smu.cs.soptsocar | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import kr.ac.smu.cs.soptsocar.databinding.ActivityReservationCarBinding | ||
|
||
class ReservationCar : AppCompatActivity() { | ||
|
||
private lateinit var binding: ActivityReservationCarBinding | ||
lateinit var reserveCarAdapter: ReserveCarAdapter | ||
lateinit var filterCarAdapter: FilterCarAdapter | ||
|
||
val data = mutableListOf<CarInfoData>() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding= ActivityReservationCarBinding.inflate(layoutInflater) | ||
|
||
setContentView(binding.root) | ||
|
||
initAdapter() | ||
|
||
//뒤로 가기 버튼 전 화면으로 이동 | ||
binding.back.setOnClickListener { | ||
finish() | ||
} | ||
} | ||
|
||
|
||
|
||
private fun initAdapter(){ | ||
|
||
reserveCarAdapter= ReserveCarAdapter() | ||
filterCarAdapter = FilterCarAdapter() | ||
|
||
binding.rvCar.adapter=reserveCarAdapter | ||
binding.rvFilter.adapter=filterCarAdapter | ||
|
||
val img1 = R.drawable.img_tosan | ||
val img11 = R.drawable.ic_default_heart_ios | ||
|
||
|
||
filterCarAdapter.filterList.addAll( | ||
listOf( | ||
FilterInfoData(R.drawable.ic_filter), | ||
FilterInfoData(R.drawable.ic_rentalperiod), | ||
FilterInfoData(R.drawable.ic_filterprice), | ||
FilterInfoData(R.drawable.ic_model), | ||
FilterInfoData(R.drawable.ic_popularity), | ||
FilterInfoData(R.drawable.ic_region) | ||
|
||
) | ||
) | ||
filterCarAdapter.notifyDataSetChanged() | ||
|
||
reserveCarAdapter.carList.addAll( | ||
listOf( | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천"), | ||
CarInfoData(img1,img11,"투싼(경유)","월 503,000원~","26%","2016~2017", "서울/경기/인천") | ||
) | ||
) | ||
reserveCarAdapter.notifyDataSetChanged() | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/kr/ac/smu/cs/soptsocar/ReserveCarAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package kr.ac.smu.cs.soptsocar | ||
|
||
import android.content.ClipData | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.bumptech.glide.Glide | ||
import kr.ac.smu.cs.soptsocar.databinding.ItemReserveCarListBinding | ||
|
||
class ReserveCarAdapter : RecyclerView.Adapter<ReserveCarAdapter.ReserveCarViewHolder>() { | ||
|
||
val carList = mutableListOf<CarInfoData>() | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReserveCarViewHolder { | ||
val binding = ItemReserveCarListBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, false | ||
) | ||
return ReserveCarViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: ReserveCarViewHolder, position: Int) { | ||
holder.onBind(carList[position]) | ||
} | ||
|
||
override fun getItemCount(): Int = carList.size | ||
|
||
class ReserveCarViewHolder(private val binding: ItemReserveCarListBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun onBind(data: CarInfoData) { | ||
// 사진 불러오기 2개 | ||
Glide.with(binding.root) | ||
.load(data.car) | ||
.into(binding.imgCar) | ||
Glide.with(binding.root) | ||
.load(data.heart) | ||
.into(binding.imgHeart) | ||
binding.txtCarname.text = data.name | ||
binding.txtPrice.text = data.price | ||
binding.txtSale.text = data.sale | ||
binding.txtDate.text = data.date | ||
binding.txtCity.text = data.city | ||
} | ||
|
||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@color/white" /> | ||
<corners android:radius="4dp" /> | ||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?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=".ReservationCar"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/constraintLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="144dp" | ||
android:background="@color/whtie" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<TextView | ||
android:id="@+id/txt_title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="40dp" | ||
android:textColor="#28323c" | ||
android:textSize="16sp" | ||
android:includeFontPadding="false" | ||
app:fontFamily="@font/spoqa_han_sans_neo_medium" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
android:text="차량 예약" /> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/rv_filter" | ||
android:layout_width="match_parent" | ||
android:layout_height="50dp" | ||
android:orientation="horizontal" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/txt_title" | ||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
app:spanCount="1" | ||
tools:listitem="@layout/item_filter"> | ||
<!-- <LinearLayout--> | ||
<!-- android:layout_width="match_parent"--> | ||
<!-- android:layout_height="wrap_content"--> | ||
<!-- android:orientation="vertical" />--> | ||
|
||
</androidx.recyclerview.widget.RecyclerView> | ||
|
||
<ImageButton | ||
android:id="@+id/back" | ||
android:layout_width="24dp" | ||
android:layout_height="24dp" | ||
android:layout_marginTop="40dp" | ||
android:background="@color/white" | ||
app:layout_constraintBottom_toTopOf="@+id/rv_filter" | ||
app:layout_constraintEnd_toStartOf="@+id/txt_title" | ||
app:layout_constraintHorizontal_bias="0.253" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintVertical_bias="0.0" | ||
app:srcCompat="@drawable/ic_back" /> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
|
||
|
||
r<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/rv_car" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
app:layout_constraintBottom_toTopOf="@+id/bnv_main" | ||
android:layout_marginLeft="24dp" | ||
android:layout_marginRight="24dp" | ||
android:layout_marginTop="16dp" | ||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" | ||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" | ||
app:spanCount="2" | ||
tools:itemCount="10" | ||
tools:listitem="@layout/item_reserve_car_list"/> | ||
|
||
|
||
|
||
<com.google.android.material.bottomnavigation.BottomNavigationView | ||
android:id="@+id/bnv_main" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@color/white" | ||
app:menu="@menu/menu" | ||
app:itemIconTint="@color/selector_bottom_navi" | ||
app:itemTextColor="@color/gray_070" | ||
app:layout_constraintBottom_toBottomOf="parent"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?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" | ||
android:background="@color/white" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<ImageButton | ||
android:layout_width="wrap_content" | ||
android:layout_height="0dp" | ||
android:layout_marginLeft="24dp" | ||
app:layout_constraintDimensionRatio="1:1" | ||
android:background="@color/white" | ||
app:srcCompat="@drawable/ic_filterprice" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
android:id="@+id/img_filter"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
Oops, something went wrong.