Skip to content

Commit

Permalink
[AN] 놀이터 태블릿 화면 대응 (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpcks0509 authored Oct 24, 2024
1 parent 20173f3 commit bce8cec
Show file tree
Hide file tree
Showing 4 changed files with 473 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.happy.friendogly.presentation.ui.playground.util

import android.content.res.Resources
import android.util.TypedValue
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageButton
Expand All @@ -22,9 +20,6 @@ import kotlinx.datetime.LocalDate
import kotlinx.datetime.toJavaLocalDate
import java.time.Period

private const val MARGIN_BOTTOM_DEFAULT = 26
private const val MARGIN_BOTTOM_PLAYING = 106

@BindingAdapter("petAge")
fun TextView.bindPetAge(petBirthDate: LocalDate?) {
if (petBirthDate != null) {
Expand Down Expand Up @@ -147,22 +142,16 @@ fun TextView.bindRegisterPlaygroundBtnClickable(uiState: PlaygroundUiState?) {

@BindingAdapter("btnMargin")
fun View.bindBtnMargin(playStatus: PlayStatus?) {
fun Int.dp(): Int {
val metrics = Resources.getSystem().displayMetrics
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), metrics)
.toInt()
}

val marginBottom =
if (playStatus != PlayStatus.NO_PLAYGROUND) {
MARGIN_BOTTOM_PLAYING
resources.getDimension(R.dimen.location_btn_margin_bottom_playing)
} else {
MARGIN_BOTTOM_DEFAULT
resources.getDimension(R.dimen.location_btn_margin_bottom_default)
}

val layoutParams = this.layoutParams as ConstraintLayout.LayoutParams
layoutParams.apply {
bottomMargin = marginBottom.dp()
bottomMargin = marginBottom.toInt()
}

this.layoutParams = layoutParams
Expand Down
Loading

0 comments on commit bce8cec

Please sign in to comment.