Skip to content

Commit

Permalink
Feat : Add a WeekWeatherAdapter tukcomCD2024#102
Browse files Browse the repository at this point in the history
File : subdivide the sub-files of the folder and organize them into folders
  • Loading branch information
ksh-g001 committed Jul 12, 2024
1 parent 6a89bbe commit 3724165
Show file tree
Hide file tree
Showing 90 changed files with 436 additions and 254 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.booking.airplane

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.project.how.R
import com.project.how.data_class.dto.GetOneWayFlightOffersResponseElement
import com.project.how.data_class.dto.booking.airplane.GetOneWayFlightOffersResponseElement
import com.project.how.databinding.OneWayAirplaneListItemBinding
import java.text.NumberFormat
import java.time.LocalDateTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.booking.airplane

import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.booking.airplane

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.project.how.R
import com.project.how.data_class.dto.GetFlightOffersResponseElement
import com.project.how.data_class.dto.booking.airplane.GetFlightOffersResponseElement
import com.project.how.databinding.RoundTripAirplaneListItemBinding
import java.text.NumberFormat
import java.time.LocalDateTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.booking.hotel

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.project.how.BuildConfig
import com.project.how.R
import com.project.how.data_class.recyclerview.RecentHotel
import com.project.how.databinding.RecentHotelItemBinding

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.schedule

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -8,13 +9,14 @@ import com.project.how.R
import com.project.how.data_class.recyclerview.AiDaysSchedule
import com.project.how.databinding.AiDaysScheduleItemBinding

class AiDaysScheduleAdapter(data: List<AiDaysSchedule>)
class AiDaysScheduleAdapter(private val context: Context, data: List<AiDaysSchedule>)
: RecyclerView.Adapter<AiDaysScheduleAdapter.ViewHolder>(){
private var dailySchedule = data

inner class ViewHolder(val binding: AiDaysScheduleItemBinding) : RecyclerView.ViewHolder(binding.root){
fun bind(data : AiDaysSchedule, position: Int){
binding.scheduleTitle.text = data.places
binding.budget.text = context.getString(R.string.budget, data.budget.toString())
when (position) {
0 -> binding.topDottedLine.visibility = View.GONE
dailySchedule.lastIndex -> binding.bottomDottedLine.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.schedule

import android.content.Context
import android.util.Log
Expand Down Expand Up @@ -35,6 +35,7 @@ class AiScheduleAdapter(private val context: Context, data : List<AiSchedule>, p
inner class ViewHolder(val binding : AiScheduleItemBinding) : RecyclerView.ViewHolder(binding.root){
fun bind(data : AiSchedule, position: Int){
binding.title.text = data.title
binding.budget.text = context.getString(R.string.total_budget, data.budget.toString())
binding.places.text = getPlacesText(data.places)
Glide.with(binding.root)
.load(data.image)
Expand All @@ -47,7 +48,7 @@ class AiScheduleAdapter(private val context: Context, data : List<AiSchedule>, p

binding.daysTitle.text = context.getString(R.string.days_title, (1).toString(), getDaysTitle(data, 0))

val adapter = AiDaysScheduleAdapter(data.dailySchedule[selectedDay])
val adapter = AiDaysScheduleAdapter(context, data.dailySchedule[selectedDay])
binding.daySchedules.adapter = adapter

binding.drawer.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.schedule

import android.content.Context
import android.util.Log
Expand All @@ -7,11 +7,10 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.google.android.gms.maps.model.LatLng
import com.project.how.BuildConfig
import com.project.how.R
import com.project.how.data_class.dto.GetScheduleListResponse
import com.project.how.data_class.dto.GetScheduleListResponseElement
import com.project.how.data_class.dto.schedule.GetScheduleListResponse
import com.project.how.data_class.dto.schedule.GetScheduleListResponseElement
import com.project.how.databinding.CalendarListItemBinding
import java.text.NumberFormat
import java.util.Locale
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.schedule

import android.content.Context
import android.view.LayoutInflater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.schedule

import android.content.Context
import android.util.Log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.project.how.adapter.recyclerview
package com.project.how.adapter.recyclerview.schedule

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.project.how.BuildConfig
import com.project.how.data_class.dto.GetLatestSchedulesResponse
import com.project.how.data_class.dto.GetLatestSchedulesResponseElement
import com.project.how.data_class.dto.schedule.GetLatestSchedulesResponse
import com.project.how.data_class.dto.schedule.GetLatestSchedulesResponseElement
import com.project.how.databinding.RecentAddedCalendarsItemBinding

class RecentAddedCalendarsAdapter(data : GetLatestSchedulesResponse, private val onItemClickListener: OnItemClickListener) : RecyclerView.Adapter<RecentAddedCalendarsAdapter.ViewHolder>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.project.how.adapter.recyclerview.weather

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.project.how.R
import com.project.how.data_class.dto.weather.GetWeeklyWeathersResponseElement
import com.project.how.databinding.WeekWeatherItemBinding

class WeekWeatherAdapter(private val data : List<GetWeeklyWeathersResponseElement>)
: RecyclerView.Adapter<WeekWeatherAdapter.ViewHolder>() {

inner class ViewHolder(val binding: WeekWeatherItemBinding) : RecyclerView.ViewHolder(binding.root){
fun bind(data: GetWeeklyWeathersResponseElement){
binding.week.text = data.date
binding.temp.text = data.temp
Glide.with(binding.root)
.load(data.iconUrl)
.error(R.drawable.icon_question)
.into(binding.image)
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder = ViewHolder(
WeekWeatherItemBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)

override fun getItemViewType(position: Int): Int = position
override fun getItemCount(): Int = data.size

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val data = data[position]
holder.bind(data)
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

import com.google.gson.annotations.SerializedName
import java.io.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

import java.io.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

typealias GetLikeFlightResponse = List<GetLikeFlightResponseElement>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

typealias LikeFlight = List<LikeFlightElement>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.booking.airplane

typealias LikeOneWayFlight = List<LikeOneWayFlightElement>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.country

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.country

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.member

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.member

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.member
import com.google.gson.annotations.SerializedName

data class LoginRequest (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.member

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

data class GetFastestSchedulesResponse(
val id: Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

typealias GetLatestSchedulesResponse = List<GetLatestSchedulesResponseElement>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.how.data_class.dto
package com.project.how.data_class.dto.schedule

import com.google.gson.annotations.SerializedName

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.project.how.data_class.dto.weather

import com.google.gson.annotations.SerializedName

data class GetWeathersRequest(
@SerializedName("country")
val country : String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.project.how.data_class.dto.weather

import com.google.gson.annotations.SerializedName

typealias GetWeeklyWeathersResponse = ArrayList<GetWeeklyWeathersResponseElement>

data class GetWeeklyWeathersResponseElement (
@SerializedName("date")
val date: String,
@SerializedName("temp")
val temp: String,
@SerializedName("iconUrl")
val iconUrl: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data class AiScheduleList(
data class AiSchedule(
val title: String,
val country: String,
val budget : Long = 0,
val places: List<String>,
val image: String,
val startDate: String,
Expand All @@ -19,6 +20,7 @@ data class AiSchedule(
data class AiDaysSchedule(
val type : Int,
val todo: String,
val budget : Long,
val places: String,
val lat : Double,
val lng : Double
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package com.project.how.model
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.project.how.data_class.dto.GetFlightOffersResponse
import com.project.how.data_class.dto.GetLikeFlightResponse
import com.project.how.data_class.dto.GetOneWayFlightOffersResponse
import com.project.how.data_class.dto.booking.airplane.GetFlightOffersResponse
import com.project.how.data_class.dto.booking.airplane.GetLikeFlightResponse
import com.project.how.data_class.dto.booking.airplane.GetOneWayFlightOffersResponse
import com.project.how.data_class.roomdb.RecentAirplane
import com.project.how.roomdb.dao.RecentAirplaneDao
import java.util.LinkedList
import javax.inject.Inject
import javax.inject.Singleton

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.project.how.R
import com.project.how.adapter.recyclerview.AiDaysScheduleAdapter
import com.project.how.data_class.dto.GetFastestSchedulesResponse
import com.project.how.data_class.dto.GetLatestSchedulesResponse
import com.project.how.adapter.recyclerview.schedule.AiDaysScheduleAdapter
import com.project.how.data_class.dto.schedule.GetFastestSchedulesResponse
import com.project.how.data_class.dto.schedule.GetLatestSchedulesResponse
import com.project.how.data_class.recyclerview.AiDaysSchedule
import com.project.how.data_class.recyclerview.AiSchedule
import com.project.how.data_class.recyclerview.DaysSchedule
import com.project.how.data_class.recyclerview.Schedule
import com.project.how.data_class.dto.GetScheduleListResponse
import com.project.how.data_class.dto.ScheduleDetail
import com.project.how.data_class.dto.schedule.GetScheduleListResponse
import com.project.how.data_class.dto.schedule.ScheduleDetail
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import java.time.LocalDate
Expand Down
Loading

0 comments on commit 3724165

Please sign in to comment.