Skip to content

Commit

Permalink
#6 remain_ui/남은 ui : 메인 홈 화면
Browse files Browse the repository at this point in the history
 - activityResultLauncher 선언 방식 임시 변경
  • Loading branch information
likppi10 committed Sep 12, 2022
1 parent 2ba8928 commit fd65284
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/src/main/java/com/ftw/hometerview/ui/main/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ class HomeFragment : Fragment() {
private lateinit var adapter: HomeViewPagerAdapter
private var toolbarLayoutState: ToolbarLayoutState = ToolbarLayoutState.EXPANDING

private val createReviewLauncher: ActivityResultLauncher<Intent> =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
val review = result.data?.getParcelableExtra<ParcelableReview>(CreateReviewActivity.CREATE_REVIEW_RESULT_KEY)
if (review == null) return@registerForActivityResult
viewModel.showBanner.value = false
}
private lateinit var createReviewLauncher: ActivityResultLauncher<Intent>

override fun onCreateView(
inflater: LayoutInflater,
Expand All @@ -72,6 +66,15 @@ class HomeFragment : Fragment() {
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

createReviewLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode != Activity.RESULT_OK) return@registerForActivityResult
val review = result.data?.getParcelableExtra<ParcelableReview>(CreateReviewActivity.CREATE_REVIEW_RESULT_KEY)
if (review == null) return@registerForActivityResult
viewModel.showBanner.value = false
}

setOnOffsetChangedListener()
startInducementBanner()
observeState()
Expand Down Expand Up @@ -178,7 +181,7 @@ class HomeFragment : Fragment() {
addUpdateListener { valueAnimator ->
val value = valueAnimator.animatedValue as? Int ?: 0
binding.inducementEmptyLayout.updateLayoutParams<ViewGroup.LayoutParams> {
height = value
height = value + resources.getDimensionPixelSize(R.dimen.dp_size_24)
}
}

Expand All @@ -191,7 +194,7 @@ class HomeFragment : Fragment() {
)
binding.inducementEmptyLayout.isVisible = false
}
duration = 2000
duration = 1000
}.start()
}

Expand Down

0 comments on commit fd65284

Please sign in to comment.