feat(series-genre): 시리즈 장르별 화면에 인라인 배너를 추가한다
This commit is contained in:
@@ -8,7 +8,9 @@ import android.widget.Toast
|
|||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kr.co.vividnext.sodalive.audio_content.series.SeriesListAdapter
|
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.audio_content.series.detail.SeriesDetailActivity
|
import kr.co.vividnext.sodalive.audio_content.series.detail.SeriesDetailActivity
|
||||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||||
import kr.co.vividnext.sodalive.common.Constants
|
import kr.co.vividnext.sodalive.common.Constants
|
||||||
@@ -39,9 +41,36 @@ class SeriesMainByGenreFragment : BaseFragment<FragmentSeriesMainByGenreBinding>
|
|||||||
private fun setupView() {
|
private fun setupView() {
|
||||||
loadingDialog = LoadingDialog(requireActivity(), layoutInflater)
|
loadingDialog = LoadingDialog(requireActivity(), layoutInflater)
|
||||||
setupGenreView()
|
setupGenreView()
|
||||||
|
setupInlineBanner()
|
||||||
setupSeriesView()
|
setupSeriesView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
binding.yandexInlineBannerView.destroy()
|
||||||
|
super.onDestroyView()
|
||||||
|
}
|
||||||
|
|
||||||
|
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_SERIES_MAIN_BY_GENRE_AD_UNIT_ID)
|
||||||
|
setAdSize(
|
||||||
|
BannerAdSize.inlineSize(
|
||||||
|
requireContext(),
|
||||||
|
adWidthDp,
|
||||||
|
maxAdHeightDp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
loadAd(AdRequest.Builder().build())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupGenreView() {
|
private fun setupGenreView() {
|
||||||
genreAdapter = GenreAdapter { genre ->
|
genreAdapter = GenreAdapter { genre ->
|
||||||
seriesAdapter.clear()
|
seriesAdapter.clear()
|
||||||
|
|||||||
@@ -13,11 +13,20 @@
|
|||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingHorizontal="24dp" />
|
android:paddingHorizontal="24dp" />
|
||||||
|
|
||||||
|
<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="24dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:maxHeight="90dp" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_series_by_genre"
|
android:id="@+id/rv_series_by_genre"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:paddingHorizontal="24dp" />
|
android:paddingHorizontal="24dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user