Skip to content

Commit

Permalink
style: ktlint 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
ki960213 committed Aug 4, 2023
1 parent 8b490b0 commit 52c7e90
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment
import com.emmsale.R
import com.emmsale.presentation.utils.extension.dp


class FilterTag : AppCompatTextView {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class IconTextButton : AppCompatButton {
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
initIcon(context)
updateActivationView(context)
updateActivationView()
}

private fun initIcon(context: Context) {
Expand All @@ -77,7 +77,7 @@ class IconTextButton : AppCompatButton {
}
}

private fun updateActivationView(context: Context) {
private fun updateActivationView() {
when (isActive) {
true -> {
setTextColor(activeTextColor)
Expand All @@ -97,4 +97,3 @@ class IconTextButton : AppCompatButton {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ class ChildCommentsViewModel(
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ class ChildCommentViewHolder(
return ChildCommentViewHolder(binding, onCommentDelete)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class ChildCommentsAdapter(
oldItem: CommentUiState,
newItem: CommentUiState,
): Boolean = oldItem == newItem

}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ data class ChildCommentsScreenUiState(
)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ data class CommentUiState(
isDeleted = comment.deleted
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ class CommentsFragment : BaseFragment<FragmentCommentsBinding>() {
return fragment
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,6 @@ class CommentsViewModel(
}
}

fun updateComment(commentId: Long, content: String, eventId: Long) {
changeLoadingUiState()
viewModelScope.launch {
when (commentRepository.updateComment(commentId, content)) {
is ApiError -> changeErrorUiState("댓글 수정에 실패했습니다.")
is ApiException -> changeErrorUiState("댓글 수정에 실패했습니다.")
is ApiSuccess -> fetchComments(eventId)
}
}
}

fun deleteComment(commentId: Long, eventId: Long) {
changeLoadingUiState()
viewModelScope.launch {
Expand Down Expand Up @@ -124,4 +113,4 @@ class CommentsViewModel(
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ class CommentViewHolder(
return CommentViewHolder(binding, onChildCommentsView, onCommentDelete)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CommentsAdapter(
oldItem: CommentUiState,
newItem: CommentUiState,
): Boolean = oldItem == newItem

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ class ConferenceViewModel(
) {
viewModelScope.launch {
_events.value = EventsUiState.Loading
when (val eventsResult = conferenceRepository.getConferences(
category = EventCategory.CONFERENCE,
year = year,
month = month,
status = status,
tag = tag,
)) {
is ApiSuccess -> _events.value =
EventsUiState.Success(eventsResult.data.map(ConferencesUiState::from))
when (
val eventsResult = conferenceRepository.getConferences(
category = EventCategory.CONFERENCE,
year = year,
month = month,
status = status,
tag = tag,
)
) {
is ApiSuccess ->
_events.value =
EventsUiState.Success(eventsResult.data.map(ConferencesUiState::from))

is ApiError -> _events.value = EventsUiState.Error
is ApiException -> _events.value = EventsUiState.Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class ConferenceFilterViewModel(
val filterDate = ConferenceFilterDateUiState(startDate.year, startDate.monthValue)

if ((_eventFilters.value as? ConferenceFiltersUiState.Success)?.selectedEndDate?.let {
val endDate = LocalDate.of(it.year, it.month, 1)
startDate.isAfter(endDate)
} == true) {
val endDate = LocalDate.of(it.year, it.month, 1)
startDate.isAfter(endDate)
} == true) {
_eventFilters.postValue(
(_eventFilters.value as? ConferenceFiltersUiState.Success)?.copy(
selectedStartDate = filterDate,
Expand All @@ -128,9 +128,9 @@ class ConferenceFilterViewModel(

fun updateEndDate(endDate: LocalDate) {
if ((_eventFilters.value as? ConferenceFiltersUiState.Success)?.selectedStartDate?.let {
val startDate = LocalDate.of(it.year, it.month, 1)
endDate.isBefore(startDate) || (endDate.year == startDate.year && endDate.monthValue == startDate.monthValue)
} == true) {
val startDate = LocalDate.of(it.year, it.month, 1)
endDate.isBefore(startDate) || (endDate.year == startDate.year && endDate.monthValue == startDate.monthValue)
} == true) {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ package com.emmsale.presentation.ui.notificationBox
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.util.Log
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.emmsale.databinding.ActivityNotificationBoxBinding
import com.emmsale.presentation.ui.notificationBox.recyclerview.body.NotificationBodyClickListener
import com.emmsale.presentation.ui.notificationBox.recyclerview.header.NotificationBoxHeaderAdapter
import com.emmsale.presentation.ui.notificationBox.recyclerview.header.NotificationHeaderClickListener

class NotificationBoxActivity : AppCompatActivity(), NotificationHeaderClickListener,
class NotificationBoxActivity :
AppCompatActivity(),
NotificationHeaderClickListener,
NotificationBodyClickListener {
private val viewModel: NotificationBoxViewModel by viewModels { NotificationBoxViewModel.factory }
private val binding: ActivityNotificationBoxBinding by lazy {
Expand Down Expand Up @@ -53,8 +56,7 @@ class NotificationBoxActivity : AppCompatActivity(), NotificationHeaderClickList
}

private fun navigateToNotificationDetail(notificationId: Long, otherUid: Long) {
// TODO: 상대방 uid를 바탕으로, Notification 상세 화면 조회
// TODO: 다이얼로그로 띄우기
Log.d("NotificationBoxActivity", "$notificationId, $otherUid")
}

override fun onAccept(notificationId: Long) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ class NotificationBoxViewModel(
}

fun toggleExpand(eventId: Long) {
_notifications.postValue(_notifications.value?.copy(
notifications = _notifications.value?.notifications?.map { header ->
when (header.eventId == eventId) {
true -> header.copy(isExpanded = !header.isExpanded)
false -> header
}
} ?: emptyList()
))
_notifications.postValue(
_notifications.value?.copy(
notifications = _notifications.value?.notifications?.map { header ->
when (header.eventId == eventId) {
true -> header.copy(isExpanded = !header.isExpanded)
false -> header
}
} ?: emptyList()
)
)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ class NotificationBoxHeaderAdapter(
holder.bind(getItem(position))
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class SettingFragment : BaseFragment<FragmentSettingBinding>() {
companion object {
const val TAG = "TAG_SETTING"
}
}
}

0 comments on commit 52c7e90

Please sign in to comment.