Исправлена работа лайков и ссылок на профиль исполнителя.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package it.hamy.muza.ui.components
|
package it.hamy.muza.ui.components
|
||||||
|
|
||||||
import android.util.Log
|
import android.os.CountDownTimer
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -11,6 +10,7 @@ import com.yandex.mobile.ads.banner.BannerAdSize
|
|||||||
import com.yandex.mobile.ads.banner.BannerAdView
|
import com.yandex.mobile.ads.banner.BannerAdView
|
||||||
import com.yandex.mobile.ads.common.AdRequest
|
import com.yandex.mobile.ads.common.AdRequest
|
||||||
import com.yandex.mobile.ads.common.AdRequestError
|
import com.yandex.mobile.ads.common.AdRequestError
|
||||||
|
import com.yandex.mobile.ads.common.AdTheme
|
||||||
import com.yandex.mobile.ads.common.ImpressionData
|
import com.yandex.mobile.ads.common.ImpressionData
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -24,17 +24,35 @@ fun YandexAdsBanner(id: String) {
|
|||||||
/**
|
/**
|
||||||
* Размер блока рекламы
|
* Размер блока рекламы
|
||||||
*/
|
*/
|
||||||
setAdSize(BannerAdSize.inlineSize(context, 140, 60))
|
setAdSize(BannerAdSize.inlineSize(context, 110, 110))
|
||||||
/**
|
/**
|
||||||
* Билдер запроса
|
* Билдер запроса
|
||||||
*/
|
*/
|
||||||
val adRequest = AdRequest.Builder().build()
|
val adRequest = AdRequest.Builder()
|
||||||
|
.setPreferredTheme(AdTheme.DARK)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
|
||||||
|
val timer = object : CountDownTimer(4000, 1000) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
// Здесь можно выполнить действия, которые нужно сделать каждую секунду
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
// Здесь вызывается метод loadAd(adRequest) после истечения таймера
|
||||||
|
loadAd(adRequest)
|
||||||
|
// Здесь можно повторить таймер, чтобы он всегда повторялся
|
||||||
|
//start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Слушатель экшнов
|
* Слушатель экшнов
|
||||||
*/
|
*/
|
||||||
setBannerAdEventListener(object : BannerAdEventListener {
|
setBannerAdEventListener(object : BannerAdEventListener {
|
||||||
override fun onAdLoaded() {
|
override fun onAdLoaded() {
|
||||||
|
// Запускаем таймер
|
||||||
|
timer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAdFailedToLoad(p0: AdRequestError) {
|
override fun onAdFailedToLoad(p0: AdRequestError) {
|
||||||
@@ -52,7 +70,7 @@ fun YandexAdsBanner(id: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onReturnedToApplication() {
|
override fun onReturnedToApplication() {
|
||||||
|
loadAd(adRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onImpression(p0: ImpressionData?) {
|
override fun onImpression(p0: ImpressionData?) {
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package it.hamy.muza.ui.components
|
||||||
|
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
|
import com.yandex.mobile.ads.banner.BannerAdEventListener
|
||||||
|
import com.yandex.mobile.ads.banner.BannerAdSize
|
||||||
|
import com.yandex.mobile.ads.banner.BannerAdView
|
||||||
|
import com.yandex.mobile.ads.common.AdRequest
|
||||||
|
import com.yandex.mobile.ads.common.AdRequestError
|
||||||
|
import com.yandex.mobile.ads.common.AdTheme
|
||||||
|
import com.yandex.mobile.ads.common.ImpressionData
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun YandexAdsBannerQuickPicksCenter(id: String) {
|
||||||
|
AndroidView(modifier = Modifier.fillMaxSize(), factory = { context ->
|
||||||
|
BannerAdView(context).apply {
|
||||||
|
/**
|
||||||
|
* ID блока рекламы
|
||||||
|
*/
|
||||||
|
setAdUnitId(id)
|
||||||
|
/**
|
||||||
|
* Размер блока рекламы
|
||||||
|
*/
|
||||||
|
setAdSize(BannerAdSize.inlineSize(context, 260, 60))
|
||||||
|
/**
|
||||||
|
* Билдер запроса
|
||||||
|
*/
|
||||||
|
val adRequest = AdRequest.Builder()
|
||||||
|
.setPreferredTheme(AdTheme.DARK)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
|
||||||
|
val timer = object : CountDownTimer(4000, 1000) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
// Здесь можно выполнить действия, которые нужно сделать каждую секунду
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
// Здесь вызывается метод loadAd(adRequest) после истечения таймера
|
||||||
|
loadAd(adRequest)
|
||||||
|
// Здесь можно повторить таймер, чтобы он всегда повторялся
|
||||||
|
//start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Слушатель экшнов
|
||||||
|
*/
|
||||||
|
setBannerAdEventListener(object : BannerAdEventListener {
|
||||||
|
override fun onAdLoaded() {
|
||||||
|
// Запускаем таймер
|
||||||
|
timer.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdFailedToLoad(p0: AdRequestError) {
|
||||||
|
/**
|
||||||
|
* Тут дебажим ошибки
|
||||||
|
*/
|
||||||
|
loadAd(adRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLeftApplication() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReturnedToApplication() {
|
||||||
|
loadAd(adRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onImpression(p0: ImpressionData?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Запуск баннера
|
||||||
|
*/
|
||||||
|
loadAd(adRequest)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -23,8 +23,6 @@ import androidx.compose.foundation.lazy.grid.GridItemSpan
|
|||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
|
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -174,6 +172,10 @@ fun HomePlaylists(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
item(key = "favorites") {
|
item(key = "favorites") {
|
||||||
PlaylistItem(
|
PlaylistItem(
|
||||||
icon = R.drawable.heart,
|
icon = R.drawable.heart,
|
||||||
@@ -213,18 +215,23 @@ fun HomePlaylists(
|
|||||||
.animateItemPlacement()
|
.animateItemPlacement()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(start = 14.dp, end = 10.dp, top = 30.dp)
|
.padding(start = 14.dp, end = 10.dp, top = 20.dp)
|
||||||
.align(Alignment.CenterHorizontally),
|
.align(Alignment.CenterHorizontally),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
YandexAdsBanner(id = "R-M-5961316-1")
|
YandexAdsBanner(id = "R-M-5961316-1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
FloatingActionsContainerWithScrollToTop(
|
FloatingActionsContainerWithScrollToTop(
|
||||||
lazyGridState = lazyGridState,
|
lazyGridState = lazyGridState,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.compose.foundation.background
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
|
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -35,6 +36,7 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -51,6 +53,7 @@ import it.hamy.muza.models.Song
|
|||||||
import it.hamy.muza.query
|
import it.hamy.muza.query
|
||||||
import it.hamy.muza.ui.components.LocalMenuState
|
import it.hamy.muza.ui.components.LocalMenuState
|
||||||
import it.hamy.muza.ui.components.ShimmerHost
|
import it.hamy.muza.ui.components.ShimmerHost
|
||||||
|
import it.hamy.muza.ui.components.YandexAdsBannerQuickPicksCenter
|
||||||
import it.hamy.muza.ui.components.themed.FloatingActionsContainerWithScrollToTop
|
import it.hamy.muza.ui.components.themed.FloatingActionsContainerWithScrollToTop
|
||||||
import it.hamy.muza.ui.components.themed.Header
|
import it.hamy.muza.ui.components.themed.Header
|
||||||
import it.hamy.muza.ui.components.themed.NonQueuedMediaItemMenu
|
import it.hamy.muza.ui.components.themed.NonQueuedMediaItemMenu
|
||||||
@@ -246,6 +249,16 @@ fun QuickPicks(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(start = 0.dp, end = 0.dp, top = 15.dp)
|
||||||
|
.align(Alignment.CenterHorizontally),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
YandexAdsBannerQuickPicksCenter(id = "R-M-5961316-5")
|
||||||
|
}
|
||||||
|
|
||||||
related.albums?.let { albums ->
|
related.albums?.let { albums ->
|
||||||
BasicText(
|
BasicText(
|
||||||
text = "Похожие альбомы",
|
text = "Похожие альбомы",
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ fun Controls(
|
|||||||
|
|
||||||
var artistsInfo: List<Info>? by remember { mutableStateOf(null) }
|
var artistsInfo: List<Info>? by remember { mutableStateOf(null) }
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit, mediaId) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
if (artistsInfo == null) artistsInfo = Database.songArtistInfo(mediaId)
|
if (artistsInfo == null) artistsInfo = Database.songArtistInfo(mediaId)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user