Skip to content

Commit

Permalink
Merge branch 'develop' into mod-plan-date-time-view
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/res/values/strings.xml
  • Loading branch information
jihyunniiii committed Jan 9, 2024
2 parents 45e2ff7 + 814f8f3 commit bb94469
Show file tree
Hide file tree
Showing 47 changed files with 1,779 additions and 76 deletions.
9 changes: 8 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions app/src/main/java/org/sopt/pingle/domain/model/PingleEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.sopt.pingle.domain.model

data class PingleEntity(
val id: Long,
val category: String,
val name: String,
val ownerName: String,
val location: String,
val date: String,
val startAt: String,
val endAt: String,
val maxParticipants: Int,
val curParticipants: Int,
val isParticipating: Boolean,
val chatLink: String
)
14 changes: 14 additions & 0 deletions app/src/main/java/org/sopt/pingle/domain/model/PlanEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.pingle.domain.model

data class PlanEntity(
val category: String,
val name: String,
val startAt: String,
val endAt: String,
val x: Double,
val y: Double,
val address: String,
val location: String,
val maxParticipants: Int,
val chatLink: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.sopt.pingle.domain.model

import androidx.databinding.ObservableBoolean

data class PlanLocationEntity(
val location: String,
val address: String,
val x: Double,
val y: Double,
var isSelected: ObservableBoolean = ObservableBoolean(false)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.sopt.pingle.presentation.mapper

import org.sopt.pingle.presentation.type.CategoryType
import org.sopt.pingle.presentation.ui.main.home.map.MapFragment

fun CategoryType.toMarkerIcon(isSelected: Boolean) =
when (this) {
CategoryType.PLAY -> if (isSelected) MapFragment.OVERLAY_IMAGE_PLAY_BIG else MapFragment.OVERLAY_IMAGE_PLAY_SMALL
CategoryType.STUDY -> if (isSelected) MapFragment.OVERLAY_IMAGE_STUDY_BIG else MapFragment.OVERLAY_IMAGE_STUDY_SMALL
CategoryType.MULTI -> if (isSelected) MapFragment.OVERLAY_IMAGE_MULTI_BIG else MapFragment.OVERLAY_IMAGE_MULTI_SMALL
CategoryType.OTHERS -> if (isSelected) MapFragment.OVERLAY_IMAGE_OTHER_BIG else MapFragment.OVERLAY_IMAGE_OTHER_SMALL
}
32 changes: 21 additions & 11 deletions app/src/main/java/org/sopt/pingle/presentation/mapper/PinMapper.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
package org.sopt.pingle.presentation.mapper

import androidx.databinding.Observable
import com.naver.maps.geometry.LatLng
import com.naver.maps.map.overlay.Marker
import com.naver.maps.map.overlay.OverlayImage
import org.sopt.pingle.R
import org.sopt.pingle.domain.model.PinEntity
import org.sopt.pingle.presentation.model.MarkerModel
import org.sopt.pingle.presentation.type.CategoryType

fun PinEntity.toMarker(): Marker = Marker().apply {
position = LatLng(y, x)
isHideCollidedMarkers = true
icon = OverlayImage.fromResource(
when (category) {
CategoryType.PLAY.toString() -> R.drawable.ic_map_marker_play_small
CategoryType.STUDY.toString() -> R.drawable.ic_map_marker_study_small
CategoryType.MULTI.toString() -> R.drawable.ic_map_marker_multi_small
else -> R.drawable.ic_map_marker_other_small
fun PinEntity.toMarkerModel(): MarkerModel {
val markerModel = MarkerModel(
Marker().apply {
position = LatLng(y, x)
isHideCollidedMarkers = true
icon = CategoryType.fromString(category).toMarkerIcon(false)
}
)

markerModel.isSelected.addOnPropertyChangedCallback(
object :
Observable.OnPropertyChangedCallback() {
override fun onPropertyChanged(sender: Observable?, propertyId: Int) {
with(markerModel.marker) {
icon = CategoryType.fromString(category).toMarkerIcon(markerModel.isSelected.get())
}
}
}
)

return markerModel
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.sopt.pingle.presentation.model

import androidx.databinding.ObservableBoolean
import com.naver.maps.map.overlay.Marker

data class MarkerModel(
val marker: Marker,
var isSelected: ObservableBoolean = ObservableBoolean(false)
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,46 @@ enum class CategoryType(
@ColorRes val activatedOutLinedColor: Int,
@ColorRes val backgroundChipColor: Int,
@ColorRes val backgroundBadgeColor: Int,
@StringRes val categoryNameRes: Int
@StringRes val categoryNameRes: Int,
@StringRes val categoryDescriptionRes: Int
// TODO 해당 부분은 UX, icon 정해지면 추가하기
// @StringRes val categoryDescriptionRes: Int,
// @DrawableRes val categoryIconRes: Int,
) {
PLAY(
textColor = R.color.pingle_green,
activatedOutLinedColor = R.color.pingle_green,
backgroundChipColor = R.color.chip_green,
backgroundBadgeColor = R.color.badge_green,
categoryNameRes = R.string.category_play
categoryNameRes = R.string.category_play,
categoryDescriptionRes = R.string.category_play_detail
),
STUDY(
textColor = R.color.pingle_orange,
activatedOutLinedColor = R.color.pingle_orange,
backgroundChipColor = R.color.chip_orange,
backgroundBadgeColor = R.color.badge_orange,
categoryNameRes = R.string.category_study
categoryNameRes = R.string.category_study,
categoryDescriptionRes = R.string.category_study_detail
),
MULTI(
textColor = R.color.pingle_yellow,
activatedOutLinedColor = R.color.pingle_yellow,
backgroundChipColor = R.color.chip_yellow,
backgroundBadgeColor = R.color.badge_yellow,
categoryNameRes = R.string.category_multi
categoryNameRes = R.string.category_multi,
categoryDescriptionRes = R.string.category_multi_detail
),
OTHER(
OTHERS(
textColor = R.color.g_01,
activatedOutLinedColor = R.color.g_01,
backgroundChipColor = R.color.g_10,
backgroundBadgeColor = R.color.g_07,
categoryNameRes = R.string.category_others
)
categoryNameRes = R.string.category_others,
categoryDescriptionRes = R.string.category_others_detail
);

companion object {
fun fromString(categoryName: String) =
CategoryType.values().first() { it.name == categoryName }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sopt.pingle.presentation.ui.common

import android.content.DialogInterface
import android.os.Bundle
import android.view.View
import org.sopt.pingle.R
Expand All @@ -12,7 +13,8 @@ class AllModalDialogFragment(
private val buttonText: String,
private val textButtonText: String,
private val clickBtn: () -> Unit,
private val clickTextBtn: () -> Unit
private val clickTextBtn: () -> Unit,
private val onDialogClosed: () -> Unit = {}
) : BindingDialogFragment<DialogAllModalBinding>(R.layout.dialog_all_modal) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand All @@ -21,6 +23,11 @@ class AllModalDialogFragment(
addListeners()
}

override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
onDialogClosed()
}

private fun initLayout() {
with(binding) {
tvAllModalTitle.text = title
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.sopt.pingle.presentation.ui.main.home.mainlist

import android.os.Bundle
import android.view.View
import org.sopt.pingle.R
import org.sopt.pingle.databinding.FragmentMainListBinding
import org.sopt.pingle.presentation.ui.main.home.map.MapFragment
import org.sopt.pingle.util.base.BindingFragment
import org.sopt.pingle.util.fragment.navigateToFragment

class MainListFragment : BindingFragment<FragmentMainListBinding>(R.layout.fragment_main_list) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

addListeners()
}

private fun addListeners() {
binding.fabMainListMap.setOnClickListener {
navigateToFragment<MapFragment>()
}
}
}
Loading

0 comments on commit bb94469

Please sign in to comment.