error remains in building.(Compose is in alpha stage)

This commit is contained in:
shabinder 2021-02-09 01:35:40 +05:30
parent 6d4a33e9ad
commit 14eeee195f
24 changed files with 140 additions and 102 deletions

View File

@ -1,9 +1,9 @@
import org.jetbrains.compose.compose import org.jetbrains.compose.compose
plugins { plugins {
id("org.jetbrains.compose")
id("com.android.application") id("com.android.application")
kotlin("android") kotlin("android")
id("org.jetbrains.compose")
} }
group = "com.shabinder" group = "com.shabinder"
@ -46,6 +46,25 @@ android {
exclude(group = "androidx.compose.ui") exclude(group = "androidx.compose.ui")
} }
} }
// Remove After upgrading dependency
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group.contains("org.jetbrains.compose")) {
useVersion("0.3.0-build146")
because("wait for decompose to upgrade too")
}
}
}
buildFeatures {
compose = true
}
packagingOptions {
exclude("META-INF/*")
}
composeOptions {
kotlinCompilerVersion = Versions.kotlinVersion
//kotlinCompilerExtensionVersion = Versions.compose
}
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = "1.8"
useIR = true useIR = true
@ -54,18 +73,20 @@ android {
dependencies { dependencies {
implementation(compose.material) implementation(compose.material)
implementation(compose.materialIconsExtended) implementation(compose.materialIconsExtended)
implementation(project(":common:database")) implementation(project(":common:database"))
implementation(project(":common:compose-ui")) implementation(project(":common:compose-ui"))
implementation(project(":common:dependency-injection")) implementation(project(":common:dependency-injection"))
implementation(project(":common:data-models")) implementation(project(":common:data-models"))
implementation(Androidx.appCompat) implementation(Androidx.appCompat)
/*
implementation(Androidx.coroutines) implementation(Androidx.coroutines)
implementation(Androidx.core) implementation(Androidx.core)
implementation(Androidx.palette) implementation(Androidx.palette)
//implementation(JetBrains.Compose.materialIcon) */
//Compose-Navigation //Compose-Navigation
implementation(Androidx.composeNavigation) //implementation(Androidx.composeNavigation)
implementation(Koin.android) implementation(Koin.android)
implementation(Koin.androidViewModel) implementation(Koin.androidViewModel)
@ -73,6 +94,7 @@ dependencies {
//DECOMPOSE //DECOMPOSE
implementation(Decompose.decompose) implementation(Decompose.decompose)
implementation(Decompose.extensionsCompose) implementation(Decompose.extensionsCompose)
/*
//Lifecycle //Lifecycle
Versions.androidLifecycle.let{ Versions.androidLifecycle.let{
@ -87,6 +109,7 @@ dependencies {
implementation("dev.chrisbanes.accompanist:accompanist-coil:$it") implementation("dev.chrisbanes.accompanist:accompanist-coil:$it")
implementation("dev.chrisbanes.accompanist:accompanist-insets:$it") implementation("dev.chrisbanes.accompanist:accompanist-insets:$it")
} }
*/
Extras.Android.apply { Extras.Android.apply {
implementation(appUpdator) implementation(appUpdator)
@ -112,7 +135,8 @@ dependencies {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString() jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check", freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies","-Xallow-unstable-dependencies",
"-Xskip-prerelease-check",
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi" "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi"
) )
} }

View File

@ -2,8 +2,8 @@ package com.shabinder.android
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.compose.ui.platform.setContent
import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.ComponentContext
import androidx.compose.ui.platform.setContent
import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent import com.arkivanov.decompose.extensions.compose.jetbrains.rootComponent
import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory
import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory

View File

@ -12,14 +12,11 @@ allprojects {
maven(url = "https://kotlin.bintray.com/kotlinx/") maven(url = "https://kotlin.bintray.com/kotlinx/")
maven(url = "https://kotlin.bintray.com/kotlin-js-wrappers/") maven(url = "https://kotlin.bintray.com/kotlin-js-wrappers/")
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
flatDir {
dirs("fuzzywuzzy")
}
} }
} }
buildscript { buildscript {
dependencies { dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") classpath(JetBrains.Kotlin.gradlePlugin)
} }
} }

View File

@ -5,7 +5,6 @@ plugins {
group = "com.shabinder" group = "com.shabinder"
version = "2.1" version = "2.1"
buildscript{ buildscript{
repositories { repositories {
// TODO: remove after new build is published // TODO: remove after new build is published
@ -17,12 +16,11 @@ buildscript{
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:4.0.2") classpath("com.android.tools.build:gradle:4.0.1")
classpath(JetBrains.Compose.gradlePlugin) classpath(JetBrains.Compose.gradlePlugin)
classpath(JetBrains.Kotlin.gradlePlugin) classpath(JetBrains.Kotlin.gradlePlugin)
} }
} }
repositories { repositories {
maven(url = "https://jitpack.io") maven(url = "https://jitpack.io")
jcenter() jcenter()
@ -32,7 +30,7 @@ repositories {
} }
dependencies { dependencies {
implementation("com.android.tools.build:gradle:4.0.2") implementation("com.android.tools.build:gradle:4.0.1")
implementation(JetBrains.Compose.gradlePlugin) implementation(JetBrains.Compose.gradlePlugin)
implementation(JetBrains.Kotlin.gradlePlugin) implementation(JetBrains.Kotlin.gradlePlugin)
implementation(JetBrains.Kotlin.serialization) implementation(JetBrains.Kotlin.serialization)

View File

@ -2,14 +2,14 @@
object Versions { object Versions {
const val versionName = "2.2" const val versionName = "2.2"
const val kotlinVersion = "1.4.30" const val kotlinVersion = "1.4.21-2"
const val coroutinesVersion = "1.4.2" const val coroutinesVersion = "1.4.2"
const val composeVersion = "1.0.0-alpha11" const val compose = "1.0.0-alpha11"
const val coilVersion = "0.4.1" const val coilVersion = "0.4.1"
//DI //DI
const val kodein = "7.2.0" const val kodein = "7.2.0"
const val koin = "3.0.1-alpha-1" const val koin = "3.0.0-alpha-4"
//Logger //Logger
const val kermit = "0.1.8" const val kermit = "0.1.8"
@ -46,6 +46,16 @@ object Androidx{
const val junit = "androidx.test.ext:junit:1.1.2" const val junit = "androidx.test.ext:junit:1.1.2"
const val expresso = "androidx.test.espresso:espresso-core:3.3.0" const val expresso = "androidx.test.espresso:espresso-core:3.3.0"
object Compose{
const val materialIcon = "androidx.compose.material:material-icons-extended:${Versions.compose}"
const val ui = "androidx.compose.ui:ui:${Versions.compose}"
const val uiGraphics = "androidx.compose.ui:ui-graphics:${Versions.compose}"
const val uiTooling = "androidx.compose.ui:ui-tooling:${Versions.compose}"
const val foundationLayout = "androidx.compose.foundation:foundation-layout:${Versions.compose}"
const val material = "androidx.compose.material:material:${Versions.compose}"
const val runtimeLiveData = "androidx.compose.runtime:runtime-livedata:${Versions.compose}"
}
} }
object JetBrains { object JetBrains {
object Kotlin { object Kotlin {
@ -58,9 +68,8 @@ object JetBrains {
object Compose { object Compose {
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
private const val VERSION = "0.3.0-build149" private const val VERSION = "0.3.0-build146"
const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
const val materialIcon = "androidx.compose.material:material-icons-extended:${Versions.composeVersion}"
} }
} }
object Decompose { object Decompose {

View File

@ -1,5 +1,3 @@
//import gradle.kotlin.dsl.accessors._2e8a70bdda5e56ec477a6ff432ddf9d7.android
plugins { plugins {
id("com.android.library") id("com.android.library")
} }
@ -12,10 +10,10 @@ android {
targetSdkVersion(Versions.targetSdkVersion) targetSdkVersion(Versions.targetSdkVersion)
} }
composeOptions { /*composeOptions {
kotlinCompilerExtensionVersion = Versions.composeVersion kotlinCompilerExtensionVersion = Versions.compose
kotlinCompilerVersion = Versions.kotlinVersion kotlinCompilerVersion = Versions.kotlinVersion
} }*/
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8

View File

@ -3,22 +3,21 @@ import org.jetbrains.compose.compose
plugins { plugins {
id("multiplatform-compose-setup") id("multiplatform-compose-setup")
id("android-setup") id("android-setup")
id("kotlin-parcelize")
} }
kotlin { kotlin {
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation(compose.materialIconsExtended) //implementation(compose.materialIconsExtended)
implementation("org.jetbrains.compose.material:material-icons-extended:0.3.0-build150")
implementation(project(":common:dependency-injection")) implementation(project(":common:dependency-injection"))
implementation(project(":common:data-models")) implementation(project(":common:data-models"))
implementation(project(":common:database")) implementation(project(":common:database"))
//implementation(MVIKotlin.rx)
implementation(SqlDelight.coroutineExtensions) implementation(SqlDelight.coroutineExtensions)
implementation(MVIKotlin.coroutines) implementation(MVIKotlin.coroutines)
implementation(MVIKotlin.mvikotlin) implementation(MVIKotlin.mvikotlin)
//implementation(MVIKotlin.mvikotlinExtensionsReaktive)
//implementation(Badoo.Reaktive.reaktive)
implementation(Decompose.decompose) implementation(Decompose.decompose)
implementation(Decompose.extensionsCompose) implementation(Decompose.extensionsCompose)
@ -34,7 +33,9 @@ kotlin {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions { kotlinOptions {
freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check", useIR = true
freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies",
"-Xallow-unstable-dependencies","-Xskip-prerelease-check",
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable" "-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable"
) )

View File

@ -3,30 +3,29 @@ package com.shabinder.common.ui
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.vectorResource import androidx.compose.ui.res.vectorResource
@Composable @Composable
actual fun DownloadImageTick(modifier: Modifier){ actual fun DownloadImageTick(){
Image( Image(
vectorResource(R.drawable.ic_tick), painterResource(R.drawable.ic_tick),
"Download Done", "Download Done"
modifier
) )
} }
@Composable @Composable
actual fun DownloadImageError(modifier: Modifier){ actual fun DownloadImageError(){
Image( Image(
vectorResource(R.drawable.ic_error), painterResource(R.drawable.ic_error),
"Error! Cant Download this track", "Error! Cant Download this track"
modifier
) )
} }
@Composable @Composable
actual fun DownloadImageArrow(modifier: Modifier){ actual fun DownloadImageArrow(modifier: Modifier){
Image( Image(
vectorResource(R.drawable.ic_arrow), painterResource(R.drawable.ic_arrow),
"Start Download", "Start Download",
modifier modifier
) )

View File

@ -150,7 +150,7 @@ fun DownloadAllButton(onClick: () -> Unit, modifier: Modifier = Modifier) {
ExtendedFloatingActionButton( ExtendedFloatingActionButton(
text = { Text("Download All") }, text = { Text("Download All") },
onClick = onClick, onClick = onClick,
icon = { Icon(imageVector = DownloadAllImage(),"Download All Button",tint = Color.Black) }, icon = { Icon(imageVector = DownloadAllImage(),"Download All Button",tint = Color(0xFF000000)) },
backgroundColor = colorAccent, backgroundColor = colorAccent,
modifier = modifier modifier = modifier
) )

View File

@ -11,7 +11,7 @@ import androidx.compose.material.Icon
import androidx.compose.material.TabRowDefaults.tabIndicatorOffset import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.DateRange import androidx.compose.material.icons.outlined.History
import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.rounded.* import androidx.compose.material.icons.rounded.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -21,7 +21,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -98,7 +97,7 @@ fun HomeTabBar(
icon = { icon = {
when (category) { when (category) {
HomeCategory.About -> Icon(Icons.Outlined.Info,"Info Tab") HomeCategory.About -> Icon(Icons.Outlined.Info,"Info Tab")
HomeCategory.History -> Icon(Icons.Outlined.DateRange,"History Tab") HomeCategory.History -> Icon(Icons.Outlined.History,"History Tab")
} }
} }
) )
@ -121,21 +120,21 @@ fun SearchPanel(
value = link, value = link,
onValueChange = updateLink , onValueChange = updateLink ,
leadingIcon = { leadingIcon = {
Icon(Icons.Rounded.AddLink,"Link Text Box",tint = Color.LightGray) Icon(Icons.Rounded.AddLink,"Link Text Box",tint = Color(0xFFCCCCCC))//LightGray
}, },
label = { Text(text = "Paste Link Here...",color = Color.LightGray) }, label = { Text(text = "Paste Link Here...",color = Color(0xFFCCCCCC)) },
singleLine = true, singleLine = true,
textStyle = LocalTextStyle.current.merge(TextStyle(fontSize = 18.sp,color = Color.White)), //textStyle = LocalTextStyle.current.merge(TextStyle(fontSize = 18.sp,color = Color.White)),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
modifier = modifier.padding(12.dp).fillMaxWidth() modifier = modifier.padding(12.dp).fillMaxWidth()
.border( .border(
BorderStroke(2.dp, Brush.horizontalGradient(listOf(colorPrimary, colorAccent))), BorderStroke(2.dp, Brush.horizontalGradient(listOf(colorPrimary, colorAccent))),
RoundedCornerShape(30.dp) RoundedCornerShape(30.dp)
), ),
backgroundColor = Color.Black, backgroundColor = Color(0xFF000000),
shape = RoundedCornerShape(size = 30.dp), shape = RoundedCornerShape(size = 30.dp),
activeColor = Color.Transparent, activeColor = transparent,
inactiveColor = Color.Transparent, inactiveColor = transparent,
) )
OutlinedButton( OutlinedButton(
modifier = Modifier.padding(12.dp).wrapContentWidth(), modifier = Modifier.padding(12.dp).wrapContentWidth(),
@ -156,10 +155,10 @@ fun SearchPanel(
@Composable @Composable
fun AboutColumn(modifier: Modifier = Modifier) { fun AboutColumn(modifier: Modifier = Modifier) {
//TODO Make Scrollable //TODO Make Scrollable
Column(modifier.fillMaxSize()) { Column(modifier.fillMaxSize().verticalScroll(rememberScrollState())) {
Card( Card(
modifier = modifier.fillMaxWidth(), modifier = modifier.fillMaxWidth(),
border = BorderStroke(1.dp,Color.Gray) border = BorderStroke(1.dp,Color(0xFF888888))//Gray
) { ) {
Column(modifier.padding(12.dp)) { Column(modifier.padding(12.dp)) {
Text( Text(
@ -172,28 +171,28 @@ fun AboutColumn(modifier: Modifier = Modifier) {
Icon( Icon(
imageVector = SpotifyLogo(), imageVector = SpotifyLogo(),
"Open Spotify", "Open Spotify",
tint = Color.Unspecified, tint = unspecifiedColor,
modifier = Modifier.clickable( modifier = Modifier.clickable(
onClick = { openPlatform("com.spotify.music","http://open.spotify.com") }) onClick = { openPlatform("com.spotify.music","http://open.spotify.com") })
) )
Spacer(modifier = modifier.padding(start = 16.dp)) Spacer(modifier = modifier.padding(start = 16.dp))
Icon(imageVector = GaanaLogo(), Icon(imageVector = GaanaLogo(),
"Open Gaana", "Open Gaana",
tint = Color.Unspecified, tint = unspecifiedColor,
modifier = Modifier.clickable( modifier = Modifier.clickable(
onClick = { openPlatform("com.gaana","http://gaana.com") }) onClick = { openPlatform("com.gaana","http://gaana.com") })
) )
Spacer(modifier = modifier.padding(start = 16.dp)) Spacer(modifier = modifier.padding(start = 16.dp))
Icon(imageVector = YoutubeLogo(), Icon(imageVector = YoutubeLogo(),
"Open Youtube", "Open Youtube",
tint = Color.Unspecified, tint = unspecifiedColor,
modifier = Modifier.clickable( modifier = Modifier.clickable(
onClick = { openPlatform("com.google.android.youtube","http://m.youtube.com") }) onClick = { openPlatform("com.google.android.youtube","http://m.youtube.com") })
) )
Spacer(modifier = modifier.padding(start = 12.dp)) Spacer(modifier = modifier.padding(start = 12.dp))
Icon(imageVector = YoutubeMusicLogo(), Icon(imageVector = YoutubeMusicLogo(),
"Open Youtube Music", "Open Youtube Music",
tint = Color.Unspecified, tint = unspecifiedColor,
modifier = Modifier.clickable( modifier = Modifier.clickable(
onClick = { openPlatform("com.google.android.apps.youtube.music","https://music.youtube.com/") }) onClick = { openPlatform("com.google.android.apps.youtube.music","https://music.youtube.com/") })
) )
@ -203,7 +202,7 @@ fun AboutColumn(modifier: Modifier = Modifier) {
Spacer(modifier = Modifier.padding(top = 8.dp)) Spacer(modifier = Modifier.padding(top = 8.dp))
Card( Card(
modifier = modifier.fillMaxWidth(), modifier = modifier.fillMaxWidth(),
border = BorderStroke(1.dp,Color.Gray) border = BorderStroke(1.dp,Color(0xFF888888))//Gray
) { ) {
Column(modifier.padding(12.dp)) { Column(modifier.padding(12.dp)) {
Text( Text(
@ -217,7 +216,7 @@ fun AboutColumn(modifier: Modifier = Modifier) {
onClick = { openPlatform("","http://github.com/Shabinder/SpotiFlyer") }) onClick = { openPlatform("","http://github.com/Shabinder/SpotiFlyer") })
.padding(vertical = 6.dp) .padding(vertical = 6.dp)
) { ) {
Icon(imageVector = GithubLogo(),"Open Project Repo",tint = Color.LightGray) Icon(imageVector = GithubLogo(),"Open Project Repo",tint = Color(0xFFCCCCCC))
Spacer(modifier = Modifier.padding(start = 16.dp)) Spacer(modifier = Modifier.padding(start = 16.dp))
Column { Column {
Text( Text(

View File

@ -11,7 +11,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.arkivanov.decompose.extensions.compose.jetbrains.Children import com.arkivanov.decompose.extensions.compose.jetbrains.Children
import com.shabinder.common.ui.utils.verticalGradientScrim
import com.shabinder.common.list.SpotiFlyerListContent import com.shabinder.common.list.SpotiFlyerListContent
import com.shabinder.common.main.SpotiFlyerMainContent import com.shabinder.common.main.SpotiFlyerMainContent
import com.shabinder.common.root.SpotiFlyerRoot.Child import com.shabinder.common.root.SpotiFlyerRoot.Child
@ -20,14 +19,15 @@ import com.shabinder.common.ui.appNameStyle
@Composable @Composable
fun SpotiFlyerRootContent(component: SpotiFlyerRoot) { fun SpotiFlyerRootContent(component: SpotiFlyerRoot) {
val appBarColor = MaterialTheme.colors.surface.copy(alpha = 0.65f) val appBarColor = MaterialTheme.colors.surface
Column( Column(
modifier = Modifier.fillMaxSize().verticalGradientScrim( modifier = Modifier.fillMaxSize()
//color = sharedViewModel.gradientColor.copy(alpha = 0.38f), /*.verticalGradientScrim(
color = sharedViewModel.gradientColor.copy(alpha = 0.38f),
color = appBarColor.copy(alpha = 0.38f), color = appBarColor.copy(alpha = 0.38f),
startYPercentage = 0.29f, startYPercentage = 0.29f,
endYPercentage = 0f, endYPercentage = 0f,
) )*/
) { ) {
AppBar( AppBar(
backgroundColor = appBarColor, backgroundColor = appBarColor,
@ -56,6 +56,7 @@ fun AppBar(
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Image( Image(
imageVector = SpotiFlyerLogo(), imageVector = SpotiFlyerLogo(),
"SpotiFlyer Logo",
Modifier.preferredSize(32.dp) Modifier.preferredSize(32.dp)
) )
Spacer(Modifier.padding(horizontal = 4.dp)) Spacer(Modifier.padding(horizontal = 4.dp))

View File

@ -33,7 +33,7 @@ internal class SpotiFlyerRootImpl(
private fun createChild(configuration: Configuration, componentContext: ComponentContext): Child = private fun createChild(configuration: Configuration, componentContext: ComponentContext): Child =
when (configuration) { when (configuration) {
is Configuration.Main -> Child.Main(spotiFlyerMain(componentContext)) is Configuration.Main -> Child.Main(spotiFlyerMain(componentContext))
is Configuration.Edit -> Child.List(spotiFlyerList(componentContext, link = configuration.link)) is Configuration.List -> Child.List(spotiFlyerList(componentContext, link = configuration.link))
} }
private fun spotiFlyerMain(componentContext: ComponentContext): SpotiFlyerMain = private fun spotiFlyerMain(componentContext: ComponentContext): SpotiFlyerMain =
@ -60,7 +60,7 @@ internal class SpotiFlyerRootImpl(
private fun onMainOutput(output: SpotiFlyerMain.Output): Unit = private fun onMainOutput(output: SpotiFlyerMain.Output): Unit =
when (output) { when (output) {
is SpotiFlyerMain.Output.Search -> router.push(Configuration.Edit(link = output.link)) is SpotiFlyerMain.Output.Search -> router.push(Configuration.List(link = output.link))
} }
private fun onListOutput(output: SpotiFlyerList.Output): Unit = private fun onListOutput(output: SpotiFlyerList.Output): Unit =
@ -73,6 +73,6 @@ internal class SpotiFlyerRootImpl(
object Main : Configuration() object Main : Configuration()
@Parcelize @Parcelize
data class Edit(val link: String) : Configuration() data class List(val link: String) : Configuration()
} }
} }

View File

@ -20,6 +20,10 @@ import androidx.compose.material.Colors
import androidx.compose.material.darkColors import androidx.compose.material.darkColors
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.colorspace.ColorSpaces
import androidx.compose.ui.graphics.colorspace.Illuminant
import androidx.compose.ui.graphics.colorspace.Rgb
import androidx.compose.ui.graphics.colorspace.TransferParameters
import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.graphics.compositeOver
val colorPrimary = Color(0xFFFC5C7D) val colorPrimary = Color(0xFFFC5C7D)
@ -29,26 +33,31 @@ val colorRedError = Color(0xFFFF9494)
val colorSuccessGreen = Color(0xFF59C351) val colorSuccessGreen = Color(0xFF59C351)
val darkBackgroundColor = Color(0xFF000000) val darkBackgroundColor = Color(0xFF000000)
val colorOffWhite = Color(0xFFE7E7E7) val colorOffWhite = Color(0xFFE7E7E7)
val transparent = Color(0x00000000)
val unspecifiedColor =Color(0f, 0f, 0f, 0f)
val black = Color(0xFF000000)
val lightGray = Color(0xFFCCCCCC)
val SpotiFlyerColors = darkColors( val SpotiFlyerColors = darkColors(
primary = colorPrimary, primary = colorPrimary,
onPrimary = Color.Black, onPrimary = black,
primaryVariant = colorPrimaryDark, primaryVariant = colorPrimaryDark,
secondary = colorAccent, secondary = colorAccent,
onSecondary = Color.Black, onSecondary = black,
error = colorRedError, error = colorRedError,
onError = Color.Black, onError = black,
surface = darkBackgroundColor, surface = darkBackgroundColor,
background = darkBackgroundColor, background = darkBackgroundColor,
onSurface = Color.LightGray, onSurface = lightGray,
onBackground = Color.LightGray onBackground = lightGray
) )
/** /**
* Return the fully opaque color that results from compositing [onSurface] atop [surface] with the * Return the fully opaque color that results from compositing [onSurface] atop [surface] with the
* given [alpha]. Useful for situations where semi-transparent colors are undesirable. * given [alpha]. Useful for situations where semi-transparent colors are undesirable.
*/ */
/*
@Composable @Composable
fun Colors.compositedOnSurface(alpha: Float): Color { fun Colors.compositedOnSurface(alpha: Float): Color {
return onSurface.copy(alpha = alpha).compositeOver(surface) return onSurface.copy(alpha = alpha).compositeOver(surface)
} }*/

View File

@ -2,13 +2,6 @@ package com.shabinder.common.ui
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.font.font
import androidx.compose.ui.text.font.fontFamily
import androidx.compose.ui.unit.Dp
import com.shabinder.common.Picture import com.shabinder.common.Picture
@Composable @Composable

View File

@ -5,7 +5,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
@Composable @Composable
expect fun DownloadImageTick(modifier: Modifier = Modifier) expect fun DownloadImageTick()
@Composable @Composable
expect fun DownloadAllImage():ImageVector expect fun DownloadAllImage():ImageVector
@ -32,7 +32,7 @@ expect fun GithubLogo():ImageVector
expect fun HeartIcon():ImageVector expect fun HeartIcon():ImageVector
@Composable @Composable
expect fun DownloadImageError(modifier: Modifier = Modifier) expect fun DownloadImageError()
@Composable @Composable
expect fun DownloadImageArrow(modifier: Modifier = Modifier) expect fun DownloadImageArrow(modifier: Modifier)

View File

@ -44,7 +44,7 @@ fun Splash(modifier: Modifier = Modifier, onTimeout: () -> Unit) {
delay(SplashWaitTime) delay(SplashWaitTime)
currentOnTimeout() currentOnTimeout()
} }
Image(imageVector = SpotiFlyerLogo()) Image(imageVector = SpotiFlyerLogo(),"SpotiFlyer Logo")
MadeInIndia(Modifier.align(Alignment.BottomCenter)) MadeInIndia(Modifier.align(Alignment.BottomCenter))
} }
} }
@ -67,7 +67,7 @@ fun MadeInIndia(
fontSize = 22.sp fontSize = 22.sp
) )
Spacer(modifier = Modifier.padding(start = 4.dp)) Spacer(modifier = Modifier.padding(start = 4.dp))
Icon(HeartIcon(),tint = Color.Unspecified) Icon(HeartIcon(),"Love",tint = unspecifiedColor)
Spacer(modifier = Modifier.padding(start = 4.dp)) Spacer(modifier = Modifier.padding(start = 4.dp))
Text( Text(
text = " in India", text = " in India",

View File

@ -21,6 +21,7 @@ import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.graphics.luminance import androidx.compose.ui.graphics.luminance
import kotlin.math.max import kotlin.math.max
import kotlin.math.min import kotlin.math.min
/*
fun Color.contrastAgainst(background: Color): Float { fun Color.contrastAgainst(background: Color): Float {
val fg = if (alpha < 1f) compositeOver(background) else this val fg = if (alpha < 1f) compositeOver(background) else this
@ -30,3 +31,4 @@ fun Color.contrastAgainst(background: Color): Float {
return max(fgLuminance, bgLuminance) / min(fgLuminance, bgLuminance) return max(fgLuminance, bgLuminance) / min(fgLuminance, bgLuminance)
} }
*/

View File

@ -38,6 +38,7 @@ import kotlin.math.pow
* @param numStops The number of color stops to draw in the gradient. Higher numbers result in * @param numStops The number of color stops to draw in the gradient. Higher numbers result in
* the higher visual quality at the cost of draw performance. Defaults to `16`. * the higher visual quality at the cost of draw performance. Defaults to `16`.
*/ */
/*
fun Modifier.verticalGradientScrim( fun Modifier.verticalGradientScrim(
color: Color, color: Color,
//@FloatRange(from = 0.0, to = 1.0) //@FloatRange(from = 0.0, to = 1.0)
@ -79,3 +80,4 @@ fun Modifier.verticalGradientScrim(
drawRect(brush = brush) drawRect(brush = brush)
} }
} }
*/

View File

@ -7,18 +7,18 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorXmlResource import androidx.compose.ui.res.vectorXmlResource
@Composable @Composable
actual fun DownloadImageTick(modifier: Modifier){ actual fun DownloadImageTick(){
Image( Image(
vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_tick.xml"), vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_tick.xml"),
modifier "Downloaded"
) )
} }
@Composable @Composable
actual fun DownloadImageError(modifier: Modifier){ actual fun DownloadImageError(){
Image( Image(
vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_error.xml"), vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_error.xml"),
modifier "Can't Download"
) )
} }
@ -26,6 +26,7 @@ actual fun DownloadImageError(modifier: Modifier){
actual fun DownloadImageArrow(modifier: Modifier){ actual fun DownloadImageArrow(modifier: Modifier){
Image( Image(
vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_arrow.xml"), vectorXmlResource("common/compose-ui/src/main/res/drawable/ic_arrow.xml"),
"Download",
modifier modifier
) )
} }

View File

@ -13,3 +13,15 @@ kotlin {
} }
} }
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
useIR = true
freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies",
"-Xallow-unstable-dependencies","-Xskip-prerelease-check",
"-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true",
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable"
)
}
}

View File

@ -14,7 +14,7 @@ final pathSeparator = System.properties["path.separator"]
kotlin { kotlin {
jvm() jvm()
js() { /*js() {
[compileKotlinJs, compileTestKotlinJs].each { configuration -> [compileKotlinJs, compileTestKotlinJs].each { configuration ->
configuration.kotlinOptions { configuration.kotlinOptions {
moduleKind = 'umd' moduleKind = 'umd'
@ -22,7 +22,7 @@ kotlin {
metaInfo = true metaInfo = true
} }
} }
} }*/
/* /*
wasm32("wasm") wasm32("wasm")
@ -63,7 +63,7 @@ kotlin {
implementation 'junit:junit:4.12' implementation 'junit:junit:4.12'
} }
} }
jsMain { /*jsMain {
kotlin.srcDir('src/jsMain/kotlin') kotlin.srcDir('src/jsMain/kotlin')
dependencies { dependencies {
implementation kotlin("stdlib-js") implementation kotlin("stdlib-js")
@ -82,7 +82,7 @@ kotlin {
implementation kotlin("test-js") implementation kotlin("test-js")
implementation kotlin("stdlib-js") implementation kotlin("stdlib-js")
} }
} }*/
/*nativeMain { /*nativeMain {
kotlin.srcDir('src/nativeMain/kotlin') kotlin.srcDir('src/nativeMain/kotlin')
}*/ }*/
@ -97,8 +97,8 @@ kotlin {
} }
//Workaround to copy kotlin libraries so they are visible during testing //Workaround to copy kotlin libraries so they are visible during testing
def jsLibDir = "$compileKotlinJs.destinationDir/lib" //def jsLibDir = "$compileKotlinJs.destinationDir/lib"
def jsTestLibDir = "$compileTestKotlinJs.destinationDir/lib" //def jsTestLibDir = "$compileTestKotlinJs.destinationDir/lib"
//uncomment below to test JS. This conflicts with iOS config //uncomment below to test JS. This conflicts with iOS config
/* /*
@ -130,6 +130,7 @@ jsTestClasses.dependsOn copyJsTestDependencies
/*
node { node {
version = nodeVersion version = nodeVersion
download = true download = true
@ -192,4 +193,5 @@ publishing {
artifactId = artifactId.replace(project.name, 'fuzzywuzzy-kotlin') artifactId = artifactId.replace(project.name, 'fuzzywuzzy-kotlin')
} }
} }
*/

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.8-rc-4-bin.zip distributionUrl=https://services.gradle.org/distributions/gradle-6.8-bin.zip

0
gradlew vendored Normal file → Executable file
View File

View File

@ -1,12 +1,3 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven(url = "https://jitpack.io")
}
}
rootProject.name = "spotiflyer" rootProject.name = "spotiflyer"
enableFeaturePreview("GRADLE_METADATA") enableFeaturePreview("GRADLE_METADATA")