mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 09:04:32 +01:00
Added Res. & Image Load Crash Fix
This commit is contained in:
parent
f9120a1fb4
commit
9d892507c6
@ -1,3 +1,5 @@
|
||||
@file:Suppress("FunctionName")
|
||||
|
||||
package com.shabinder.common.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
@ -34,6 +36,9 @@ actual fun DownloadImageArrow(modifier: Modifier){
|
||||
@Composable
|
||||
actual fun DownloadAllImage() = vectorResource(R.drawable.ic_download_arrow)
|
||||
|
||||
@Composable
|
||||
actual fun ShareImage() = vectorResource(R.drawable.ic_share_open)
|
||||
|
||||
@Composable
|
||||
actual fun PlaceHolderImage() = vectorResource(R.drawable.music)
|
||||
|
@ -3,6 +3,9 @@ package com.shabinder.common.ui
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import com.shabinder.common.database.appContext
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
||||
actual val dispatcherIO = Dispatchers.IO
|
||||
|
||||
@Composable
|
||||
actual fun Toast(
|
@ -21,6 +21,7 @@ import com.shabinder.common.ui.*
|
||||
import com.shabinder.common.ui.SpotiFlyerTypography
|
||||
import com.shabinder.common.ui.colorAccent
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
@ -67,7 +68,7 @@ fun TrackCard(
|
||||
Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) {
|
||||
var pic by mutableStateOf<ImageBitmap?>(null)
|
||||
val scope = rememberCoroutineScope()
|
||||
scope.launch {
|
||||
scope.launch(Dispatchers.Unconfined) {
|
||||
pic = loadImage(track.albumArtURL)
|
||||
}
|
||||
ImageLoad(
|
||||
@ -127,7 +128,7 @@ fun CoverImage(
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
var pic by mutableStateOf<ImageBitmap?>(null)
|
||||
scope.launch {
|
||||
scope.launch(Dispatchers.Unconfined) {
|
||||
pic = loadImage(coverURL)
|
||||
}
|
||||
ImageLoad(
|
||||
|
@ -348,7 +348,7 @@ fun DownloadRecordItem(
|
||||
}
|
||||
}
|
||||
Image(
|
||||
imageVector = Icons.Rounded.Share,
|
||||
imageVector = ShareImage(),
|
||||
"Research",
|
||||
modifier = Modifier.clickable(onClick = {
|
||||
//if(!isOnline(ctx)) showDialog("Check Your Internet Connection") else
|
||||
|
@ -14,7 +14,6 @@ import com.shabinder.common.main.SpotiFlyerMain
|
||||
import com.shabinder.common.root.SpotiFlyerRoot
|
||||
import com.shabinder.common.root.SpotiFlyerRoot.Child
|
||||
import com.shabinder.common.root.SpotiFlyerRoot.Dependencies
|
||||
import com.shabinder.common.ui.showPopUpMessage
|
||||
import com.shabinder.common.utils.Consumer
|
||||
|
||||
internal class SpotiFlyerRootImpl(
|
||||
@ -57,12 +56,10 @@ internal class SpotiFlyerRootImpl(
|
||||
}
|
||||
)
|
||||
|
||||
private fun onMainOutput(output: SpotiFlyerMain.Output){
|
||||
showPopUpMessage("Button Pressed")
|
||||
private fun onMainOutput(output: SpotiFlyerMain.Output) =
|
||||
when (output) {
|
||||
is SpotiFlyerMain.Output.Search -> router.push(Configuration.List(link = output.link))
|
||||
}
|
||||
}
|
||||
|
||||
private fun onListOutput(output: SpotiFlyerList.Output): Unit =
|
||||
when (output) {
|
||||
|
@ -1,3 +1,7 @@
|
||||
package com.shabinder.common.ui
|
||||
|
||||
expect fun showPopUpMessage(text: String)
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
|
||||
expect fun showPopUpMessage(text: String)
|
||||
|
||||
expect val dispatcherIO: CoroutineDispatcher
|
||||
|
@ -1,3 +1,4 @@
|
||||
@file:Suppress("FunctionName")
|
||||
package com.shabinder.common.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
@ -17,6 +18,9 @@ expect fun DownloadImageTick()
|
||||
@Composable
|
||||
expect fun DownloadAllImage():ImageVector
|
||||
|
||||
@Composable
|
||||
expect fun ShareImage():ImageVector
|
||||
|
||||
@Composable
|
||||
expect fun PlaceHolderImage():ImageVector
|
||||
|
@ -1,11 +0,0 @@
|
||||
package com.shabinder.common.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.res.vectorXmlResource
|
||||
import com.shabinder.common.di.Picture
|
||||
import java.awt.image.BufferedImage
|
||||
import java.io.ByteArrayOutputStream
|
||||
import javax.imageio.ImageIO
|
@ -0,0 +1,64 @@
|
||||
@file:Suppress("FunctionName")
|
||||
package com.shabinder.common.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.vectorXmlResource
|
||||
|
||||
@Composable
|
||||
actual fun DownloadImageTick(){
|
||||
Image(
|
||||
vectorXmlResource("drawable/ic_tick.xml"),
|
||||
"Downloaded"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DownloadImageError(){
|
||||
Image(
|
||||
vectorXmlResource("drawable/ic_error.xml"),
|
||||
"Can't Download"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DownloadImageArrow(modifier: Modifier){
|
||||
Image(
|
||||
vectorXmlResource("drawable/ic_arrow.xml"),
|
||||
"Download",
|
||||
modifier
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DownloadAllImage():ImageVector = vectorXmlResource("drawable/ic_download_arrow.xml")
|
||||
|
||||
@Composable
|
||||
actual fun ShareImage():ImageVector = vectorXmlResource("drawable/ic_share_open.xml")
|
||||
|
||||
@Composable
|
||||
actual fun PlaceHolderImage():ImageVector = vectorXmlResource("drawable/music.xml")
|
||||
|
||||
|
||||
@Composable
|
||||
actual fun SpotiFlyerLogo():ImageVector = vectorXmlResource("drawable/ic_spotiflyer_logo.xml")
|
||||
|
||||
@Composable
|
||||
actual fun HeartIcon():ImageVector = vectorXmlResource("drawable/ic_heart.xml")
|
||||
|
||||
@Composable
|
||||
actual fun SpotifyLogo():ImageVector = vectorXmlResource("drawable/ic_spotify_logo.xml")
|
||||
|
||||
@Composable
|
||||
actual fun YoutubeLogo():ImageVector = vectorXmlResource("drawable/ic_youtube.xml")
|
||||
|
||||
@Composable
|
||||
actual fun GaanaLogo():ImageVector = vectorXmlResource("drawable/ic_gaana.xml")
|
||||
|
||||
@Composable
|
||||
actual fun YoutubeMusicLogo():ImageVector = vectorXmlResource("drawable/ic_youtube_music_logo.xml")
|
||||
|
||||
@Composable
|
||||
actual fun GithubLogo():ImageVector = vectorXmlResource("drawable/ic_github.xml")
|
@ -15,10 +15,13 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
actual val dispatcherIO = Dispatchers.IO
|
||||
|
||||
private val message: MutableState<String> = mutableStateOf("")
|
||||
private val state: MutableState<Boolean> = mutableStateOf(false)
|
||||
|
@ -1,60 +0,0 @@
|
||||
package com.shabinder.common.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.vectorXmlResource
|
||||
|
||||
@Composable
|
||||
actual fun DownloadImageTick(){
|
||||
Image(
|
||||
vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_tick.xml"),
|
||||
"Downloaded"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DownloadImageError(){
|
||||
Image(
|
||||
vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_error.xml"),
|
||||
"Can't Download"
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DownloadImageArrow(modifier: Modifier){
|
||||
Image(
|
||||
vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_arrow.xml"),
|
||||
"Download",
|
||||
modifier
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun DownloadAllImage():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_download_arrow.xml")
|
||||
|
||||
@Composable
|
||||
actual fun PlaceHolderImage():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/music.xml")
|
||||
|
||||
|
||||
@Composable
|
||||
actual fun SpotiFlyerLogo():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_spotiflyer_logo.xml")
|
||||
|
||||
@Composable
|
||||
actual fun HeartIcon():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_heart.xml")
|
||||
|
||||
@Composable
|
||||
actual fun SpotifyLogo():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_spotify_logo.xml")
|
||||
|
||||
@Composable
|
||||
actual fun YoutubeLogo():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_youtube.xml")
|
||||
|
||||
@Composable
|
||||
actual fun GaanaLogo():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_gaana.xml")
|
||||
|
||||
@Composable
|
||||
actual fun YoutubeMusicLogo():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_youtube_music_logo.xml")
|
||||
|
||||
@Composable
|
||||
actual fun GithubLogo():ImageVector = vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_github.xml")
|
@ -7,6 +7,7 @@ import com.shabinder.common.models.TrackDetails
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.*
|
||||
import io.ktor.http.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlin.math.roundToInt
|
||||
|
Loading…
Reference in New Issue
Block a user