feat(notification): 알림 리스트에 인라인 배너를 추가한다
This commit is contained in:
@@ -8,6 +8,9 @@ import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.yandex.mobile.ads.banner.BannerAdSize
|
||||
import com.yandex.mobile.ads.common.AdRequest
|
||||
import kr.co.vividnext.sodalive.BuildConfig
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
@@ -16,6 +19,7 @@ import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.home.HomeContentThemeAdapter
|
||||
import kr.co.vividnext.sodalive.settings.notification.NotificationReceiveSettingsActivity
|
||||
import org.koin.android.ext.android.inject
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class PushNotificationListActivity : BaseActivity<ActivityPushNotificationListBinding>(
|
||||
ActivityPushNotificationListBinding::inflate
|
||||
@@ -43,9 +47,36 @@ class PushNotificationListActivity : BaseActivity<ActivityPushNotificationListBi
|
||||
}
|
||||
|
||||
setupCategoryList()
|
||||
setupInlineBanner()
|
||||
setupNotificationList()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
binding.yandexInlineBannerView.destroy()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun setupInlineBanner() {
|
||||
binding.yandexInlineBannerView.post {
|
||||
val density = resources.displayMetrics.density
|
||||
val adWidthPixels = binding.yandexInlineBannerView.width.takeIf { it > 0 } ?: screenWidth
|
||||
val adWidthDp = (adWidthPixels / density).roundToInt()
|
||||
val maxAdHeightDp = 90
|
||||
|
||||
binding.yandexInlineBannerView.apply {
|
||||
setAdUnitId(BuildConfig.YANDEX_INLINE_BANNER_PUSH_NOTIFICATION_LIST_AD_UNIT_ID)
|
||||
setAdSize(
|
||||
BannerAdSize.inlineSize(
|
||||
this@PushNotificationListActivity,
|
||||
adWidthDp,
|
||||
maxAdHeightDp
|
||||
)
|
||||
)
|
||||
loadAd(AdRequest.Builder().build())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupCategoryList() {
|
||||
categoryAdapter = HomeContentThemeAdapter("") { selectedCategory ->
|
||||
viewModel.selectCategory(selectedCategory)
|
||||
|
||||
@@ -49,6 +49,14 @@
|
||||
android:clipToPadding="false"
|
||||
android:paddingHorizontal="13.3dp" />
|
||||
|
||||
<com.yandex.mobile.ads.banner.BannerAdView
|
||||
android:id="@+id/yandex_inline_banner_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="13.3dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxHeight="90dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
|
||||
Reference in New Issue
Block a user