Skip to content

Commit

Permalink
Merge pull request #152 from depromeet/fix/#151-viewfinder-qa-v2
Browse files Browse the repository at this point in the history
[FIX] 시야 찾기 2차 MVP QA V2
  • Loading branch information
Jokwanhee authored Aug 28, 2024
2 parents 0d141b1 + 6f68c69 commit 9ebec76
Show file tree
Hide file tree
Showing 21 changed files with 230 additions and 50 deletions.
2 changes: 1 addition & 1 deletion core/designsystem/src/main/res/raw/lottie_like.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions core/designsystem/src/main/res/values/appearances.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@
<item name="android:textSize">13sp</item>
</style>

<style name="TextAppearance.Spot.Caption01.White" parent="TextAppearance.Spot">
<item name="android:fontFamily">@font/font_pretendard_medium</item>
<item name="android:lineSpacingMultiplier">1.4</item>
<item name="android:lineSpacingExtra">0dp</item>
<item name="android:textSize">13sp</item>
<item name="android:textColor">@color/color_foreground_white</item>
</style>

<style name="TextAppearance.Spot.Caption02" parent="TextAppearance.Spot">
<item name="android:fontFamily">@font/font_pretendard_medium</item>
<item name="android:lineSpacingMultiplier">1.4</item>
Expand Down
8 changes: 4 additions & 4 deletions presentation/src/main/assets/web/stadium.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ var allIds = Array.from(allElements)
.map(el => el.id)
allIds.forEach(id => {
var element = document.getElementById(id);
if (element) {
element.classList.add("unclick");
}
// if (element) {
// element.classList.add("unclick");
// }
})
// ==========================================

Expand Down Expand Up @@ -155,7 +155,7 @@ function removeStyle() {
allIds.forEach(id => {
var element = document.getElementById(id);
if (element) {
element.classList.add("unclick");
element.classList.remove("unclick");
element.classList.remove("unselected");
}
})
Expand Down
5 changes: 5 additions & 0 deletions presentation/src/main/java/com/dpm/presentation/util/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import androidx.core.view.updateLayoutParams
class Utils(
private val context: Context
) {
/**
* 네비게이션 하단 바 높이
*/
val navigationHeight = context.resources.getIdentifier("navigation_bar_height","dimen","android").let { context.resources.getDimensionPixelSize(it) }

fun restartApp(toastMsg: String?) {
val packageManager = context.packageManager
val packageName = context.packageName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.dpm.presentation.viewfinder

import android.content.Intent
import android.graphics.Rect
import android.os.Bundle
import android.view.MotionEvent
import android.view.View
import android.view.View.GONE
import android.view.View.INVISIBLE
Expand Down Expand Up @@ -92,6 +94,19 @@ class StadiumActivity : BaseActivity<ActivityStadiumBinding>({
initObserve()
}

override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
if (behavior.state == BottomSheetBehavior.STATE_EXPANDED) {
if (ev?.action == MotionEvent.ACTION_DOWN) {
val rect = Rect()
binding.clBottomSheet.getGlobalVisibleRect(rect)
if (!rect.contains(ev.rawX.toInt(), ev.rawY.toInt())) {
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
}
}
}
return super.dispatchTouchEvent(ev)
}


private fun initView() {
initStatusBar()
Expand Down Expand Up @@ -206,7 +221,6 @@ class StadiumActivity : BaseActivity<ActivityStadiumBinding>({
object : StadiumSectionRecommendAdapter.OnItemFilterClickListener {
override fun onItemFilterClick(recommend: ResponseStadium.ResponseBlockTags) {
viewModel.updateBlockFilter(recommend)
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
setSectionText(
getString(com.depromeet.presentation.R.string.viewfinder_find_section_description),
R.color.color_foreground_caption
Expand Down Expand Up @@ -320,14 +334,6 @@ class StadiumActivity : BaseActivity<ActivityStadiumBinding>({
}

override fun onSlide(bottomSheet: View, slideOffset: Float) {
binding.btnRefresh.setMargins(
0, 0, 0,
(((binding.clBottomSheet.height / resources.displayMetrics.density) - BOTTOM_SHEET_PEEK_HEIGHT) * slideOffset).dpToPx(
this@StadiumActivity
)
+ BOTTOM_SHEET_PEEK_HEIGHT.dpToPx(this@StadiumActivity)
+ BUTTON_BOTTOM_MARGIN.dpToPx(this@StadiumActivity)
)
binding.clTipContainer.setMargins(
TIP_CONTAINER_HORIZONTAL_MARGIN.dpToPx(this@StadiumActivity),
0,
Expand Down Expand Up @@ -372,6 +378,8 @@ class StadiumActivity : BaseActivity<ActivityStadiumBinding>({

private fun setTipContainerByFilter(description: String, ranges: List<Pair<Int, Int>>) {
setTextZoomDescriptionColorMulti(description, ranges)
binding.tvZoomDescription.setTextAppearance(R.style.TextAppearance_Spot_Caption01_White)
binding.tvZoomDescription.setLineSpacing(0f, 1.3f)
binding.ivPinchZoom.setImageResource(R.drawable.ic_tip)
binding.ivPinchZoom.layoutParams.height = 52.dpToPx(this)
binding.ivPinchZoom.layoutParams.width = 52.dpToPx(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,30 @@ package com.dpm.presentation.viewfinder
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import androidx.activity.viewModels
import androidx.compose.material.MaterialTheme
import androidx.core.os.bundleOf
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import androidx.fragment.app.commit
import androidx.lifecycle.asLiveData
import com.dpm.core.base.BaseActivity
import com.dpm.domain.entity.response.viewfinder.ResponseBlockReview
import com.depromeet.presentation.R
import com.depromeet.presentation.databinding.ActivityStadiumDetailBinding
import com.dpm.designsystem.SpotSnackBar
import com.dpm.designsystem.extension.dpToPx
import com.dpm.domain.preference.SharedPreference
import com.dpm.presentation.extension.getCompatibleParcelableExtra
import com.dpm.presentation.home.HomeActivity
import com.dpm.presentation.scheme.SchemeKey
import com.dpm.presentation.scrap.ScrapActivity
import com.dpm.presentation.util.KakaoUtils
import com.dpm.presentation.util.MixpanelManager
import com.dpm.presentation.util.Utils
import com.dpm.presentation.util.seatFeed
import com.dpm.presentation.util.toEmptyBlock
import com.dpm.presentation.viewfinder.compose.StadiumDetailScreen
Expand Down Expand Up @@ -45,6 +54,9 @@ class StadiumDetailActivity : BaseActivity<ActivityStadiumDetailBinding>({
@Inject
lateinit var sharedPreference: SharedPreference

private lateinit var scrapActiveSnackBar: SpotSnackBar
private lateinit var scrapInActiveSnackBar: SpotSnackBar

private val viewModel: StadiumDetailViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -62,6 +74,7 @@ class StadiumDetailActivity : BaseActivity<ActivityStadiumDetailBinding>({
viewModel.reviewId = reviewId
}
initComposeView()
initSnackBar()
}

private fun initComposeView() {
Expand Down Expand Up @@ -105,6 +118,16 @@ class StadiumDetailActivity : BaseActivity<ActivityStadiumDetailBinding>({
onClickTopImage = { id, index, title ->
startToStadiumDetailPictureFragment(id, index, title, DetailReviewEntryPoint.TOP_REVIEW)
},
onClickLike = { },
onClickScrap = { isScrap ->
if (isScrap) {
scrapActiveSnackBar.dismiss()
scrapInActiveSnackBar.show()
} else {
scrapInActiveSnackBar.dismiss()
scrapActiveSnackBar.show()
}
},
onClickShare = {
sharedPreference.isFirstShare = false
}
Expand Down Expand Up @@ -134,6 +157,26 @@ class StadiumDetailActivity : BaseActivity<ActivityStadiumDetailBinding>({
}
}

private fun initSnackBar() {
val navigationHeight = (Utils(this).navigationHeight / resources.displayMetrics.density).toInt()
scrapActiveSnackBar = SpotSnackBar.make(
view = binding.root.rootView,
message = getString(R.string.viewfinder_snackbar_scrap),
endMessage = getString(R.string.viewfinder_underscore_snackbar_scrap),
marginBottom = navigationHeight,
onClick = {
Intent(this, ScrapActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}.let { startActivity(it) }
})
scrapInActiveSnackBar = SpotSnackBar.make(
view = binding.root.rootView,
message = getString(R.string.viewfinder_inactive_snackbar_scrap),
marginBottom = navigationHeight,
onClick = {}
)
}

private fun getIdExtra(callback: (stadiumId: Int, blockCode: String, reviewId: Int) -> Unit) {
callback(
intent?.getIntExtra(SchemeKey.STADIUM_ID, 0) ?: 0,
Expand All @@ -149,6 +192,8 @@ class StadiumDetailActivity : BaseActivity<ActivityStadiumDetailBinding>({
type: DetailReviewEntryPoint
) {
MixpanelManager.track("viewfinder_check_view")
scrapActiveSnackBar.dismiss()
scrapInActiveSnackBar.dismiss()
val fragment = StadiumDetailPictureFragment.newInstance().apply {
arguments = bundleOf(
REVIEW_ID to id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Snackbar
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
Expand Down Expand Up @@ -54,7 +55,8 @@ class StadiumDetailPictureFragment : BindingFragment<FragmentStadiumDetailPictur
private val utils by lazy {
Utils(requireActivity())
}
private lateinit var snackBar: SpotSnackBar
private lateinit var scrapActiveSnackBar: SpotSnackBar
private lateinit var scrapInActiveSnackBar: SpotSnackBar

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand All @@ -80,7 +82,11 @@ class StadiumDetailPictureFragment : BindingFragment<FragmentStadiumDetailPictur
},
onClickScrap = { isScrap ->
if (isScrap) {
snackBar.show()
scrapActiveSnackBar.dismiss()
scrapInActiveSnackBar.show()
} else {
scrapInActiveSnackBar.dismiss()
scrapActiveSnackBar.show()
}
},
onClickShare = {
Expand Down Expand Up @@ -124,7 +130,7 @@ class StadiumDetailPictureFragment : BindingFragment<FragmentStadiumDetailPictur
}

private fun initSnackBar() {
snackBar = SpotSnackBar.make(
scrapActiveSnackBar = SpotSnackBar.make(
view = binding.root.rootView,
background = com.depromeet.designsystem.R.drawable.rect_body_subtitle_fill_60,
message = getString(R.string.viewfinder_snackbar_scrap),
Expand All @@ -134,6 +140,12 @@ class StadiumDetailPictureFragment : BindingFragment<FragmentStadiumDetailPictur
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}.let { startActivity(it) }
})
scrapInActiveSnackBar = SpotSnackBar.make(
view = binding.root.rootView,
background = com.depromeet.designsystem.R.drawable.rect_body_subtitle_fill_60,
message = getString(R.string.viewfinder_inactive_snackbar_scrap),
onClick = {}
)
}

private fun getReviewExtra(callback: (id: Long, index: Int, title: String, type: String) -> Unit) {
Expand Down Expand Up @@ -181,8 +193,9 @@ class StadiumDetailPictureFragment : BindingFragment<FragmentStadiumDetailPictur
}

override fun onDestroyView() {
snackBar.dismiss()
resetWindowInsets()
scrapActiveSnackBar.dismiss()
scrapInActiveSnackBar.dismiss()
super.onDestroyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fun LikeButton(
shape = RoundedCornerShape(72.dp)
)
.padding(
horizontal = 10.dp,
horizontal = 13.dp,
vertical = 8.dp
)
.noRippleClickable {
Expand All @@ -58,7 +58,7 @@ fun LikeButton(
modifier = Modifier.size(24.dp),
tint = Color.Unspecified
)
Spacer(modifier = Modifier.width(4.dp))
Spacer(modifier = Modifier.width(6.dp))
Text(
text = "너무 도움돼요",
style = SpotTheme.typography.label11,
Expand All @@ -68,7 +68,7 @@ fun LikeButton(
Text(
text = likeCount.toString(),
style = SpotTheme.typography.label09,
color = if (isLike) SpotTheme.colors.actionEnabled else SpotTheme.colors.strokeTertiary
color = if (isLike) SpotTheme.colors.actionEnabled else SpotTheme.colors.foregroundCaption
)
}
}
Expand All @@ -81,4 +81,14 @@ private fun LikeButtonPreview() {
likeCount = 1,
onClick = {}
)
}

@Preview
@Composable
private fun LikeButtonFalsePreview() {
LikeButton(
isLike = false,
likeCount = 1,
onClick = {}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
Expand Down Expand Up @@ -36,9 +37,12 @@ fun ReviewContentBottom(
likeCount = likeCount,
onClick = onClickLike
)
Row {
Row(
verticalAlignment = Alignment.CenterVertically
) {
IconButton(
onClick = onClickScrap
onClick = onClickScrap,
modifier = Modifier.size(40.dp)
) {
Icon(
painter = painterResource(
Expand All @@ -49,7 +53,8 @@ fun ReviewContentBottom(
}
Spacer(modifier = Modifier.width(6.dp))
IconButton(
onClick = onClickShare
onClick = onClickShare,
modifier = Modifier.size(40.dp)
) {
Icon(
painter = painterResource(
Expand Down
Loading

0 comments on commit 9ebec76

Please sign in to comment.