compose->build149

This commit is contained in:
shabinder 2021-02-08 00:33:55 +05:30
parent 7d7e82b3b7
commit 6d4a33e9ad
5 changed files with 43 additions and 28 deletions

View File

@ -53,6 +53,7 @@ android {
} }
dependencies { dependencies {
implementation(compose.material) implementation(compose.material)
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"))
@ -68,9 +69,11 @@ dependencies {
implementation(Koin.android) implementation(Koin.android)
implementation(Koin.androidViewModel) implementation(Koin.androidViewModel)
//DECOMPOSE //DECOMPOSE
implementation(Decompose.decompose) implementation(Decompose.decompose)
implementation(Decompose.extensionsCompose) implementation(Decompose.extensionsCompose)
//Lifecycle //Lifecycle
Versions.androidLifecycle.let{ Versions.androidLifecycle.let{
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$it") implementation("androidx.lifecycle:lifecycle-runtime-ktx:$it")

View File

@ -2,20 +2,20 @@
object Versions { object Versions {
const val versionName = "2.2" const val versionName = "2.2"
const val kotlinVersion = "1.4.21" const val kotlinVersion = "1.4.30"
const val coroutinesVersion = "1.4.2" const val coroutinesVersion = "1.4.2"
const val composeVersion = "1.0.0-alpha10" const val composeVersion = "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.0-alpha-4" const val koin = "3.0.1-alpha-1"
//Logger //Logger
const val kermit = "0.1.8" const val kermit = "0.1.8"
//Internet //Internet
const val ktor = "1.5.0" const val ktor = "1.5.1"
const val kotlinxSerialization = "1.0.1" const val kotlinxSerialization = "1.0.1"
//Database //Database
@ -41,7 +41,7 @@ object Androidx{
const val appCompat = "androidx.appcompat:appcompat:1.2.0" const val appCompat = "androidx.appcompat:appcompat:1.2.0"
const val core = "androidx.core:core-ktx:1.5.0-beta01" const val core = "androidx.core:core-ktx:1.5.0-beta01"
const val palette = "androidx.palette:palette-ktx:1.0.0" const val palette = "androidx.palette:palette-ktx:1.0.0"
const val composeNavigation = "androidx.navigation:navigation-compose:1.0.0-alpha05" const val composeNavigation = "androidx.navigation:navigation-compose:1.0.0-alpha06"
const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutinesVersion}" const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutinesVersion}"
const val junit = "androidx.test.ext:junit:1.1.2" const val junit = "androidx.test.ext:junit:1.1.2"
@ -58,7 +58,7 @@ object JetBrains {
object Compose { object Compose {
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
private const val VERSION = "0.3.0-build140" private const val VERSION = "0.3.0-build149"
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}" const val materialIcon = "androidx.compose.material:material-icons-extended:${Versions.composeVersion}"
} }

View File

@ -1,3 +1,5 @@
import org.jetbrains.compose.compose
plugins { plugins {
id("multiplatform-compose-setup") id("multiplatform-compose-setup")
id("android-setup") id("android-setup")
@ -7,6 +9,7 @@ kotlin {
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation(compose.materialIconsExtended)
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"))

View File

@ -3,6 +3,7 @@ package com.shabinder.common.list
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
@ -149,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(),tint = Color.Black) }, icon = { Icon(imageVector = DownloadAllImage(),"Download All Button",tint = Color.Black) },
backgroundColor = colorAccent, backgroundColor = colorAccent,
modifier = modifier modifier = modifier
) )

View File

@ -3,19 +3,17 @@ package com.shabinder.common.main
import androidx.compose.foundation.* import androidx.compose.foundation.*
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.material.AmbientTextStyle
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.TabDefaults.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.DateRange
import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.rounded.Edit import androidx.compose.material.icons.rounded.*
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material.icons.rounded.Share
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@ -99,8 +97,8 @@ fun HomeTabBar(
}, },
icon = { icon = {
when (category) { when (category) {
HomeCategory.About -> Icon(Icons.Outlined.Info) HomeCategory.About -> Icon(Icons.Outlined.Info,"Info Tab")
HomeCategory.History -> Icon(Icons.Outlined.DateRange) HomeCategory.History -> Icon(Icons.Outlined.DateRange,"History Tab")
} }
} }
) )
@ -120,24 +118,24 @@ fun SearchPanel(
modifier = modifier.padding(top = 16.dp) modifier = modifier.padding(top = 16.dp)
){ ){
TextField( TextField(
value = link,
onValueChange = updateLink ,
leadingIcon = { leadingIcon = {
Icon(Icons.Rounded.Edit,tint = Color.LightGray) Icon(Icons.Rounded.AddLink,"Link Text Box",tint = Color.LightGray)
}, },
label = { Text(text = "Paste Link Here...",color = Color.LightGray) }, label = { Text(text = "Paste Link Here...",color = Color.LightGray) },
value = link,
onValueChange = { updateLink(it) },
singleLine = true, singleLine = true,
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.Black,
textStyle = AmbientTextStyle.current.merge(TextStyle(fontSize = 18.sp,color = Color.White)),
shape = RoundedCornerShape(size = 30.dp), shape = RoundedCornerShape(size = 30.dp),
activeColor = Color.Transparent, activeColor = Color.Transparent,
inactiveColor = Color.Transparent inactiveColor = Color.Transparent,
) )
OutlinedButton( OutlinedButton(
modifier = Modifier.padding(12.dp).wrapContentWidth(), modifier = Modifier.padding(12.dp).wrapContentWidth(),
@ -157,7 +155,8 @@ fun SearchPanel(
@Composable @Composable
fun AboutColumn(modifier: Modifier = Modifier) { fun AboutColumn(modifier: Modifier = Modifier) {
ScrollableColumn(modifier.fillMaxSize(),contentPadding = PaddingValues(16.dp)) { //TODO Make Scrollable
Column(modifier.fillMaxSize()) {
Card( Card(
modifier = modifier.fillMaxWidth(), modifier = modifier.fillMaxWidth(),
border = BorderStroke(1.dp,Color.Gray) border = BorderStroke(1.dp,Color.Gray)
@ -171,22 +170,30 @@ fun AboutColumn(modifier: Modifier = Modifier) {
Spacer(modifier = Modifier.padding(top = 12.dp)) Spacer(modifier = Modifier.padding(top = 12.dp))
Row(horizontalArrangement = Arrangement.Center,modifier = modifier.fillMaxWidth()) { Row(horizontalArrangement = Arrangement.Center,modifier = modifier.fillMaxWidth()) {
Icon( Icon(
imageVector = SpotifyLogo(), tint = Color.Unspecified, imageVector = SpotifyLogo(),
"Open Spotify",
tint = Color.Unspecified,
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(),tint = Color.Unspecified, Icon(imageVector = GaanaLogo(),
"Open Gaana",
tint = Color.Unspecified,
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(),tint = Color.Unspecified, Icon(imageVector = YoutubeLogo(),
"Open Youtube",
tint = Color.Unspecified,
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(),tint = Color.Unspecified, Icon(imageVector = YoutubeMusicLogo(),
"Open Youtube Music",
tint = Color.Unspecified,
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/") })
) )
@ -210,7 +217,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(),tint = Color.LightGray) Icon(imageVector = GithubLogo(),"Open Project Repo",tint = Color.LightGray)
Spacer(modifier = Modifier.padding(start = 16.dp)) Spacer(modifier = Modifier.padding(start = 16.dp))
Column { Column {
Text( Text(
@ -228,7 +235,7 @@ fun AboutColumn(modifier: Modifier = Modifier) {
.clickable(onClick = { openPlatform("","http://github.com/Shabinder/SpotiFlyer") }), .clickable(onClick = { openPlatform("","http://github.com/Shabinder/SpotiFlyer") }),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Icon(Icons.Rounded.Info.copy(defaultHeight = 32.dp,defaultWidth = 32.dp)) Icon(Icons.Rounded.Flag,"Help Translate",Modifier.preferredSize(32.dp))
Spacer(modifier = Modifier.padding(start = 16.dp)) Spacer(modifier = Modifier.padding(start = 16.dp))
Column { Column {
Text( Text(
@ -337,6 +344,7 @@ fun DownloadRecordItem(
} }
Image( Image(
imageVector = Icons.Rounded.Share, imageVector = Icons.Rounded.Share,
"Share App",
modifier = Modifier.clickable(onClick = { modifier = Modifier.clickable(onClick = {
//if(!isOnline(ctx)) showDialog("Check Your Internet Connection") else //if(!isOnline(ctx)) showDialog("Check Your Internet Connection") else
onItemClicked(item.link) onItemClicked(item.link)
@ -354,6 +362,6 @@ fun HomeCategoryTabIndicator(
Spacer( Spacer(
modifier.padding(horizontal = 24.dp) modifier.padding(horizontal = 24.dp)
.preferredHeight(4.dp) .preferredHeight(4.dp)
.background(color, RoundedCornerShape(topLeftPercent = 100, topRightPercent = 100)) .background(color, RoundedCornerShape(topStartPercent = 100, topEndPercent = 100))
) )
} }