fix-ups for Non-Mac system

This commit is contained in:
shabinder 2021-05-08 23:20:49 +05:30
parent 1776b67306
commit 789818474e
11 changed files with 110 additions and 93 deletions

View File

@ -29,7 +29,6 @@ allprojects {
maven(url = "https://dl.bintray.com/ekito/koin")
maven(url = "https://kotlin.bintray.com/kotlinx/")
maven(url = "https://dl.bintray.com/icerockdev/moko")
// maven(url = "https://kotlin.bintray.com/kotlin-js-wrappers/")
maven(url = "https://dl.bintray.com/kotlin/kotlin-js-wrappers")
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

View File

@ -18,52 +18,16 @@
package com.shabinder.common.uikit
import androidx.compose.animation.Crossfade
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import com.shabinder.common.database.R
import com.shabinder.common.di.Picture
import com.shabinder.common.di.dispatcherIO
import com.shabinder.common.models.methods
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.withContext
@Composable
actual fun ImageLoad(
link: String,
loader: suspend (String) -> Picture,
desc: String,
modifier: Modifier,
// placeholder: ImageVector
) {
var pic by remember(link) { mutableStateOf<ImageBitmap?>(null) }
LaunchedEffect(link) {
withContext(dispatcherIO) {
pic = loader(link).image
}
}
Crossfade(pic) {
if (it == null) {
Image(PlaceHolderImage(), desc, modifier, contentScale = ContentScale.Crop)
} else Image(it, desc, modifier, contentScale = ContentScale.Crop)
}
}
actual fun montserratFont() = FontFamily(
Font(R.font.montserrat_light, FontWeight.Light),

View File

@ -0,0 +1,35 @@
package com.shabinder.common.uikit
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.Image
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.layout.ContentScale
import com.shabinder.common.di.Picture
import com.shabinder.common.di.dispatcherIO
import kotlinx.coroutines.withContext
@Composable
actual fun ImageLoad(
link: String,
loader: suspend (String) -> Picture,
desc: String,
modifier: Modifier,
// placeholder: ImageVector
) {
var pic by remember(link) { mutableStateOf<ImageBitmap?>(null) }
LaunchedEffect(link) {
withContext(dispatcherIO) {
pic = loader(link).image
}
}
Crossfade(pic) {
if (it == null) {
Image(PlaceHolderImage(), desc, modifier, contentScale = ContentScale.Crop)
} else Image(it, desc, modifier, contentScale = ContentScale.Crop)
}
}

View File

@ -22,15 +22,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import com.shabinder.common.di.Picture
@Composable
expect fun ImageLoad(
link: String,
loader: suspend (String) -> Picture,
desc: String = "Album Art",
modifier: Modifier = Modifier,
// placeholder:Painter = PlaceHolderImage()
)
@Composable
expect fun DownloadImageTick()

View File

@ -0,0 +1,14 @@
package com.shabinder.common.uikit
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.shabinder.common.di.Picture
@Composable
expect fun ImageLoad(
link: String,
loader: suspend (String) -> Picture,
desc: String = "Album Art",
modifier: Modifier = Modifier,
// placeholder:Painter = PlaceHolderImage()
)

View File

@ -424,14 +424,14 @@ fun HistoryColumn(
modifier = Modifier.padding(top = 8.dp).fillMaxSize()
)
VerticalScrollbar(
/*VerticalScrollbar(
modifier = Modifier.padding(end = 2.dp).align(Alignment.CenterEnd).fillMaxHeight(),
adapter = rememberScrollbarAdapter(
scrollState = listState,
itemCount = itemList.size,
averageItemSize = 70.dp
)
)
)*/
}
}
}

View File

@ -39,26 +39,6 @@ import com.shabinder.common.di.dispatcherIO
import com.shabinder.common.models.methods
import kotlinx.coroutines.withContext
@Composable
actual fun ImageLoad(
link: String,
loader: suspend (String) -> Picture,
desc: String,
modifier: Modifier,
// placeholder: ImageVector
) {
var pic by remember(link) { mutableStateOf<ImageBitmap?>(null) }
LaunchedEffect(link) {
withContext(dispatcherIO) {
pic = loader(link).image
}
}
Crossfade(pic) {
if (it == null) Image(PlaceHolderImage(), desc, modifier, contentScale = ContentScale.Crop) else Image(it, desc, modifier, contentScale = ContentScale.Crop)
}
}
@Composable
actual fun DownloadImageTick() {
Image(

View File

@ -0,0 +1,32 @@
package com.shabinder.common.uikit
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.Image
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.layout.ContentScale
import com.shabinder.common.di.Picture
import com.shabinder.common.di.dispatcherIO
import kotlinx.coroutines.withContext
@Composable
actual fun ImageLoad(
link: String,
loader: suspend (String) -> Picture,
desc: String,
modifier: Modifier,
// placeholder: ImageVector
) {
var pic by remember(link) { mutableStateOf<ImageBitmap?>(null) }
LaunchedEffect(link) {
withContext(dispatcherIO) {
pic = loader(link).image
}
}
Crossfade(pic) {
if (it == null) Image(PlaceHolderImage(), desc, modifier, contentScale = ContentScale.Crop) else Image(it, desc, modifier, contentScale = ContentScale.Crop)
}
}

View File

@ -42,7 +42,7 @@ interface Actions {
}
private fun stubActions() = object :Actions {
private fun stubActions(): Actions = object :Actions {
override val platformActions = StubPlatformActions
override fun showPopUpMessage(string: String, long: Boolean) {}
override fun setDownloadDirectoryAction() {}

View File

@ -68,7 +68,7 @@ kotlin {
}
}
}
if(HostOS.isMac){
/*Required to Export `packForXcode`*/
sourceSets {
named("iosMain") {
@ -84,9 +84,11 @@ kotlin {
}
}
}
}
}
val packForXcode by tasks.creating(Sync::class) {
if(HostOS.isMac){
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val targetName = "ios"
@ -97,4 +99,5 @@ val packForXcode by tasks.creating(Sync::class) {
val targetDir = File(buildDir, "xcode-frameworks")
from(framework.outputDirectory)
into(targetDir)
}
}

View File

@ -47,7 +47,6 @@ import java.awt.Desktop
import java.net.URI
import javax.swing.JFileChooser
import javax.swing.JFileChooser.APPROVE_OPTION
import javax.swing.JFileChooser.CANCEL_OPTION
private val koin = initKoin(enableNetworkLogs = true).koin
private lateinit var showToast: (String)->Unit