feat(settings): 알림 수신 설정에 인라인 배너를 추가한다
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.Constants
|
||||
@@ -18,6 +21,7 @@ import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.following.FollowingCreatorAdapter
|
||||
import org.koin.android.ext.android.inject
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class NotificationReceiveSettingsActivity : BaseActivity<ActivityNotificationReceiveSettingsBinding>(
|
||||
ActivityNotificationReceiveSettingsBinding::inflate
|
||||
@@ -53,6 +57,33 @@ class NotificationReceiveSettingsActivity : BaseActivity<ActivityNotificationRec
|
||||
binding.ivMessage.setOnClickListener { viewModel.toggleMessage() }
|
||||
|
||||
setupFollowingChannels()
|
||||
setupInlineBanner()
|
||||
}
|
||||
|
||||
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_NOTIFICATION_RECEIVE_SETTINGS_AD_UNIT_ID)
|
||||
setAdSize(
|
||||
BannerAdSize.inlineSize(
|
||||
this@NotificationReceiveSettingsActivity,
|
||||
adWidthDp,
|
||||
maxAdHeightDp
|
||||
)
|
||||
)
|
||||
loadAd(AdRequest.Builder().build())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupFollowingChannels() {
|
||||
|
||||
@@ -133,6 +133,14 @@
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<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="26.7dp"
|
||||
android:maxHeight="90dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user