Skip to content

Commit

Permalink
chore: change xxxUtil.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
HI-JIN2 committed May 14, 2024
1 parent a9a2558 commit b18d33d
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.eatssu.android.R
import com.eatssu.android.ui.main.MainActivity
import com.eatssu.android.util.extension.startActivity
import com.eatssu.android.util.startActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import androidx.lifecycle.lifecycleScope
import com.eatssu.android.base.BaseActivity
import com.eatssu.android.databinding.ActivitySocialLoginBinding
import com.eatssu.android.ui.main.MainActivity
import com.eatssu.android.util.extension.showToast
import com.eatssu.android.util.extension.startActivity
import com.eatssu.android.util.showToast
import com.eatssu.android.util.startActivity
import com.kakao.sdk.common.model.ClientError
import com.kakao.sdk.common.model.ClientErrorCause
import com.kakao.sdk.user.UserApiClient
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/java/com/eatssu/android/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import com.eatssu.android.ui.main.calendar.CalendarAdapter.OnItemListener
import com.eatssu.android.ui.main.calendar.CalendarViewModel
import com.eatssu.android.ui.mypage.MyPageActivity
import com.eatssu.android.ui.mypage.usernamechange.UserNameChangeActivity
import com.eatssu.android.util.CalendarUtils
import com.eatssu.android.util.CalendarUtils.daysInWeekArray
import com.eatssu.android.util.CalendarUtils.monthYearFromDate
import com.eatssu.android.util.extension.showToast
import com.eatssu.android.util.extension.startActivity
import com.eatssu.android.util.CalendarUtil
import com.eatssu.android.util.CalendarUtil.daysInWeekArray
import com.eatssu.android.util.CalendarUtil.monthYearFromDate
import com.eatssu.android.util.showToast
import com.eatssu.android.util.startActivity
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.prolificinteractive.materialcalendarview.*
Expand Down Expand Up @@ -82,7 +82,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
}

initWidgets()
CalendarUtils.selectedDate = LocalDate.now()
CalendarUtil.selectedDate = LocalDate.now()
calendarViewModel.setData(LocalDate.now())
setWeekView()
}
Expand All @@ -95,8 +95,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl

@RequiresApi(Build.VERSION_CODES.O)
private fun setWeekView() {
monthYearText?.setText(CalendarUtils.selectedDate?.let { monthYearFromDate(it) })
val days: ArrayList<LocalDate>? = CalendarUtils.selectedDate?.let { daysInWeekArray(it) }
monthYearText?.setText(CalendarUtil.selectedDate?.let { monthYearFromDate(it) })
val days: ArrayList<LocalDate>? = CalendarUtil.selectedDate?.let { daysInWeekArray(it) }
val calendarAdapter = days?.let { CalendarAdapter(it, this) }
val gridLayoutManager = GridLayoutManager(applicationContext, 7)

Expand All @@ -106,21 +106,21 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl

@RequiresApi(Build.VERSION_CODES.O)
fun previousWeekAction(view: View?) {
CalendarUtils.selectedDate = CalendarUtils.selectedDate.minusWeeks(1)
onItemClick(mainPosition, CalendarUtils.selectedDate)
CalendarUtil.selectedDate = CalendarUtil.selectedDate.minusWeeks(1)
onItemClick(mainPosition, CalendarUtil.selectedDate)
setWeekView()
}

@RequiresApi(Build.VERSION_CODES.O)
fun nextWeekAction(view: View?) {
CalendarUtils.selectedDate = CalendarUtils.selectedDate.plusWeeks(1)
onItemClick(mainPosition, CalendarUtils.selectedDate)
CalendarUtil.selectedDate = CalendarUtil.selectedDate.plusWeeks(1)
onItemClick(mainPosition, CalendarUtil.selectedDate)
setWeekView()
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onItemClick(position: Int, date: LocalDate) {
CalendarUtils.selectedDate = date
CalendarUtil.selectedDate = date
calendarViewModel.setData(date)
mainPosition = position

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.eatssu.android.R
import com.eatssu.android.databinding.ItemCalendarListBinding
import com.eatssu.android.util.CalendarUtils
import com.eatssu.android.util.CalendarUtil
import java.time.LocalDate
import java.time.format.TextStyle
import java.util.*
import java.util.Locale


internal class CalendarAdapter(
Expand Down Expand Up @@ -41,12 +41,21 @@ internal class CalendarAdapter(
holder.dayText.text =
date.dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN).toString()

if (date == CalendarUtils.selectedDate) {
if (date == CalendarUtil.selectedDate) {
holder.parentView.setBackgroundResource(R.drawable.selector_background_blue)
holder.dayOfMonth.setTextColor(ContextCompat.getColor(holder.itemView.context, R.color.selector_calendar_colortext))
holder.dayText.setTextColor(ContextCompat.getColor(holder.itemView.context, R.color.selector_calendar_colortext))
}
else {
holder.dayOfMonth.setTextColor(
ContextCompat.getColor(
holder.itemView.context,
R.color.selector_calendar_colortext
)
)
holder.dayText.setTextColor(
ContextCompat.getColor(
holder.itemView.context,
R.color.selector_calendar_colortext
)
)
} else {
holder.parentView.setBackgroundResource(R.drawable.ic_selector_background_white)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.eatssu.android.data.service.InquiresService
import com.eatssu.android.databinding.ActivityInquireBinding
import com.eatssu.android.util.MySharedPreferences
import com.eatssu.android.util.RetrofitImpl
import com.eatssu.android.util.extension.showToast
import com.eatssu.android.util.showToast
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.activity.viewModels
import androidx.lifecycle.lifecycleScope
import com.eatssu.android.base.BaseActivity
import com.eatssu.android.databinding.ActivityUserNameChangeBinding
import com.eatssu.android.util.extension.showToast
import com.eatssu.android.util.showToast
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.eatssu.android.base.BaseActivity
import com.eatssu.android.databinding.ActivityFixMenuBinding
import com.eatssu.android.util.extension.showToast
import com.eatssu.android.util.showToast
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.eatssu.android.data.service.ReviewService
import com.eatssu.android.databinding.ActivityReviewWriteRateBinding
import com.eatssu.android.util.RetrofitImpl.mRetrofit
import com.eatssu.android.util.RetrofitImpl.retrofit
import com.eatssu.android.util.extension.showToast
import com.eatssu.android.util.showToast
import id.zelory.compressor.Compressor
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.eatssu.android.util.extension
package com.eatssu.android.util

import android.app.Activity
import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.time.LocalDate
import java.time.format.DateTimeFormatter


object CalendarUtils {
object CalendarUtil {
lateinit var selectedDate: LocalDate

@RequiresApi(Build.VERSION_CODES.O)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.eatssu.android.util.extension
package com.eatssu.android.util

import android.content.Context
import android.widget.Toast
Expand Down

0 comments on commit b18d33d

Please sign in to comment.