diff --git a/app/build.gradle b/app/build.gradle index 76f8f52..b016ded 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,7 +44,7 @@ dependencies { //viewpager2 추가 implementation "androidx.viewpager2:viewpager2:1.1.0-beta01" - + implementation 'com.github.bumptech.glide:glide:4.12.0' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.3.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8378303..bdfdeea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.SoptSocar"> + diff --git a/app/src/main/java/kr/ac/smu/cs/soptsocar/CarInfoData.kt b/app/src/main/java/kr/ac/smu/cs/soptsocar/CarInfoData.kt new file mode 100644 index 0000000..84ec223 --- /dev/null +++ b/app/src/main/java/kr/ac/smu/cs/soptsocar/CarInfoData.kt @@ -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, +) diff --git a/app/src/main/java/kr/ac/smu/cs/soptsocar/FilterCarAdapter.kt b/app/src/main/java/kr/ac/smu/cs/soptsocar/FilterCarAdapter.kt new file mode 100644 index 0000000..5270f6c --- /dev/null +++ b/app/src/main/java/kr/ac/smu/cs/soptsocar/FilterCarAdapter.kt @@ -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() { + + val filterList = mutableListOf() + + 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) + + } + + } + + } + diff --git a/app/src/main/java/kr/ac/smu/cs/soptsocar/FilterInfoData.kt b/app/src/main/java/kr/ac/smu/cs/soptsocar/FilterInfoData.kt new file mode 100644 index 0000000..80c0784 --- /dev/null +++ b/app/src/main/java/kr/ac/smu/cs/soptsocar/FilterInfoData.kt @@ -0,0 +1,6 @@ +package kr.ac.smu.cs.soptsocar + +data class FilterInfoData( + val filterImage : Int + +) diff --git a/app/src/main/java/kr/ac/smu/cs/soptsocar/MainActivity.kt b/app/src/main/java/kr/ac/smu/cs/soptsocar/MainActivity.kt index 7896258..82f8f30 100644 --- a/app/src/main/java/kr/ac/smu/cs/soptsocar/MainActivity.kt +++ b/app/src/main/java/kr/ac/smu/cs/soptsocar/MainActivity.kt @@ -1,5 +1,6 @@ package kr.ac.smu.cs.soptsocar +import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.viewpager2.widget.ViewPager2 @@ -14,6 +15,7 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) binding= ActivityMainBinding.inflate(layoutInflater) + initViewPagerAdapter() initBottomNavigation() setContentView(binding.root) diff --git a/app/src/main/java/kr/ac/smu/cs/soptsocar/ReservationCar.kt b/app/src/main/java/kr/ac/smu/cs/soptsocar/ReservationCar.kt new file mode 100644 index 0000000..5e3884a --- /dev/null +++ b/app/src/main/java/kr/ac/smu/cs/soptsocar/ReservationCar.kt @@ -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() + + 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() +} + +} \ No newline at end of file diff --git a/app/src/main/java/kr/ac/smu/cs/soptsocar/ReserveCarAdapter.kt b/app/src/main/java/kr/ac/smu/cs/soptsocar/ReserveCarAdapter.kt new file mode 100644 index 0000000..178da50 --- /dev/null +++ b/app/src/main/java/kr/ac/smu/cs/soptsocar/ReserveCarAdapter.kt @@ -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() { + + val carList = mutableListOf() + + 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 + } + + } + + } diff --git a/app/src/main/res/drawable-hdpi/ic_back.png b/app/src/main/res/drawable-hdpi/ic_back.png new file mode 100644 index 0000000..902f034 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_back.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_default_heart_ios.png b/app/src/main/res/drawable-hdpi/ic_default_heart_ios.png new file mode 100644 index 0000000..9113a99 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_default_heart_ios.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_filter.png b/app/src/main/res/drawable-hdpi/ic_filter.png new file mode 100644 index 0000000..2dcb4cf Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_filter.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_filterprice.png b/app/src/main/res/drawable-hdpi/ic_filterprice.png new file mode 100644 index 0000000..cb61355 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_filterprice.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_model.png b/app/src/main/res/drawable-hdpi/ic_model.png new file mode 100644 index 0000000..0fed166 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_model.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_popularity.png b/app/src/main/res/drawable-hdpi/ic_popularity.png new file mode 100644 index 0000000..42ef0e5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_popularity.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_region.png b/app/src/main/res/drawable-hdpi/ic_region.png new file mode 100644 index 0000000..6ff0e2b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_region.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_rentalperiod.png b/app/src/main/res/drawable-hdpi/ic_rentalperiod.png new file mode 100644 index 0000000..2f37927 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_rentalperiod.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_back.png b/app/src/main/res/drawable-mdpi/ic_back.png new file mode 100644 index 0000000..900baaa Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_back.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_default_heart_ios.png b/app/src/main/res/drawable-mdpi/ic_default_heart_ios.png new file mode 100644 index 0000000..b8ef237 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_default_heart_ios.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_filter.png b/app/src/main/res/drawable-mdpi/ic_filter.png new file mode 100644 index 0000000..45c24a4 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_filter.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_filterprice.png b/app/src/main/res/drawable-mdpi/ic_filterprice.png new file mode 100644 index 0000000..571836f Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_filterprice.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_model.png b/app/src/main/res/drawable-mdpi/ic_model.png new file mode 100644 index 0000000..6e50311 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_model.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_popularity.png b/app/src/main/res/drawable-mdpi/ic_popularity.png new file mode 100644 index 0000000..fbfe63e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_popularity.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_region.png b/app/src/main/res/drawable-mdpi/ic_region.png new file mode 100644 index 0000000..4751694 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_region.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_rentalperiod.png b/app/src/main/res/drawable-mdpi/ic_rentalperiod.png new file mode 100644 index 0000000..fa4c646 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_rentalperiod.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_back.png b/app/src/main/res/drawable-xhdpi/ic_back.png new file mode 100644 index 0000000..e620888 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_back.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_default_heart_ios.png b/app/src/main/res/drawable-xhdpi/ic_default_heart_ios.png new file mode 100644 index 0000000..abebb32 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_default_heart_ios.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_filter.png b/app/src/main/res/drawable-xhdpi/ic_filter.png new file mode 100644 index 0000000..81493e9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_filter.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_filterprice.png b/app/src/main/res/drawable-xhdpi/ic_filterprice.png new file mode 100644 index 0000000..036983e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_filterprice.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_model.png b/app/src/main/res/drawable-xhdpi/ic_model.png new file mode 100644 index 0000000..4f0fc2f Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_model.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_popularity.png b/app/src/main/res/drawable-xhdpi/ic_popularity.png new file mode 100644 index 0000000..84d28f2 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_popularity.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_region.png b/app/src/main/res/drawable-xhdpi/ic_region.png new file mode 100644 index 0000000..42475db Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_region.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_rentalperiod.png b/app/src/main/res/drawable-xhdpi/ic_rentalperiod.png new file mode 100644 index 0000000..5fbcf8e Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_rentalperiod.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_back.png b/app/src/main/res/drawable-xxhdpi/ic_back.png new file mode 100644 index 0000000..3b94dd8 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_back.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_default_heart_ios.png b/app/src/main/res/drawable-xxhdpi/ic_default_heart_ios.png new file mode 100644 index 0000000..ef07658 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_default_heart_ios.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_filter.png b/app/src/main/res/drawable-xxhdpi/ic_filter.png new file mode 100644 index 0000000..23ba641 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_filter.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_filterprice.png b/app/src/main/res/drawable-xxhdpi/ic_filterprice.png new file mode 100644 index 0000000..edd3a5d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_filterprice.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_model.png b/app/src/main/res/drawable-xxhdpi/ic_model.png new file mode 100644 index 0000000..d1283fc Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_model.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_popularity.png b/app/src/main/res/drawable-xxhdpi/ic_popularity.png new file mode 100644 index 0000000..c4ae60d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_popularity.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_region.png b/app/src/main/res/drawable-xxhdpi/ic_region.png new file mode 100644 index 0000000..568a6af Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_region.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_rentalperiod.png b/app/src/main/res/drawable-xxhdpi/ic_rentalperiod.png new file mode 100644 index 0000000..e2759ac Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_rentalperiod.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_back.png b/app/src/main/res/drawable-xxxhdpi/ic_back.png new file mode 100644 index 0000000..9700804 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_back.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_default_heart_ios.png b/app/src/main/res/drawable-xxxhdpi/ic_default_heart_ios.png new file mode 100644 index 0000000..d188e37 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_default_heart_ios.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_filter.png b/app/src/main/res/drawable-xxxhdpi/ic_filter.png new file mode 100644 index 0000000..3e1e458 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_filter.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_filterprice.png b/app/src/main/res/drawable-xxxhdpi/ic_filterprice.png new file mode 100644 index 0000000..1ab5880 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_filterprice.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_model.png b/app/src/main/res/drawable-xxxhdpi/ic_model.png new file mode 100644 index 0000000..14b474e Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_model.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_popularity.png b/app/src/main/res/drawable-xxxhdpi/ic_popularity.png new file mode 100644 index 0000000..a6d7d07 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_popularity.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_region.png b/app/src/main/res/drawable-xxxhdpi/ic_region.png new file mode 100644 index 0000000..6013519 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_region.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_rentalperiod.png b/app/src/main/res/drawable-xxxhdpi/ic_rentalperiod.png new file mode 100644 index 0000000..2bc5a1c Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_rentalperiod.png differ diff --git a/app/src/main/res/drawable/layout_background.xml b/app/src/main/res/drawable/layout_background.xml new file mode 100644 index 0000000..9b1c045 --- /dev/null +++ b/app/src/main/res/drawable/layout_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2e9e24b..93ee5a4 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -14,6 +14,15 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"/> +