라이브 상세 - 배너 광고 추가
This commit is contained in:
parent
f9401d91c4
commit
6610f13619
|
@ -12,6 +12,7 @@ import android.widget.FrameLayout
|
|||
import android.widget.Toast
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import com.google.android.gms.ads.AdRequest
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kr.co.vividnext.sodalive.R
|
||||
|
@ -58,11 +59,31 @@ class LiveRoomDetailFragment(
|
|||
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
|
||||
bindData()
|
||||
setupAdMob()
|
||||
viewModel.getDetail(roomId) { dismiss() }
|
||||
|
||||
binding.ivClose.setOnClickListener { dismiss() }
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.adView.resume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
binding.adView.pause()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
binding.adView.destroy()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun setupAdMob() {
|
||||
binding.adView.loadAd(AdRequest.Builder().build())
|
||||
}
|
||||
|
||||
private fun bindData() {
|
||||
viewModel.isLoading.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:ads="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -10,6 +11,16 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.gms.ads.AdView
|
||||
android:id="@+id/ad_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
ads:adSize="SMART_BANNER"
|
||||
ads:adUnitId="@string/admob_live_banner_unit_id"
|
||||
ads:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -18,8 +29,8 @@
|
|||
android:paddingHorizontal="16.7dp"
|
||||
android:paddingTop="13.3dp"
|
||||
android:src="@drawable/ic_close_white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
ads:layout_constraintTop_toBottomOf="@+id/ad_view"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue