From d734c82bf9632756d89851f715a091402923adc4 Mon Sep 17 00:00:00 2001 From: shabinder Date: Tue, 29 Dec 2020 14:25:27 +0530 Subject: [PATCH] About- Supported Apps --- .../com/shabinder/spotiflyer/home/Home.kt | 68 +++++++++++++++++-- app/src/main/res/drawable/ic_error.xml | 32 +++++++++ app/src/main/res/drawable/ic_gaana.xml | 16 +++++ app/src/main/res/drawable/ic_github.xml | 22 ++++++ app/src/main/res/drawable/ic_heart.xml | 25 +++++++ app/src/main/res/drawable/ic_history.xml | 51 ++++++++++++++ app/src/main/res/drawable/ic_instagram.xml | 51 ++++++++++++++ app/src/main/res/drawable/ic_linkedin.xml | 34 ++++++++++ app/src/main/res/drawable/ic_mug.xml | 30 ++++++++ .../main/res/drawable/ic_musicplaceholder.xml | 29 ++++++++ .../main/res/drawable/ic_refreshgradient.xml | 32 +++++++++ app/src/main/res/drawable/ic_share_open.xml | 23 +++++++ .../main/res/drawable/ic_song_placeholder.xml | 22 ++++++ app/src/main/res/drawable/ic_spotify_logo.xml | 21 ++++++ app/src/main/res/drawable/ic_tick.xml | 31 +++++++++ app/src/main/res/drawable/ic_youtube.xml | 7 ++ app/src/main/res/values/strings.xml | 1 + 17 files changed, 488 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/drawable/ic_error.xml create mode 100644 app/src/main/res/drawable/ic_gaana.xml create mode 100644 app/src/main/res/drawable/ic_github.xml create mode 100644 app/src/main/res/drawable/ic_heart.xml create mode 100644 app/src/main/res/drawable/ic_history.xml create mode 100644 app/src/main/res/drawable/ic_instagram.xml create mode 100644 app/src/main/res/drawable/ic_linkedin.xml create mode 100644 app/src/main/res/drawable/ic_mug.xml create mode 100644 app/src/main/res/drawable/ic_musicplaceholder.xml create mode 100644 app/src/main/res/drawable/ic_refreshgradient.xml create mode 100644 app/src/main/res/drawable/ic_share_open.xml create mode 100644 app/src/main/res/drawable/ic_song_placeholder.xml create mode 100644 app/src/main/res/drawable/ic_spotify_logo.xml create mode 100644 app/src/main/res/drawable/ic_tick.xml create mode 100644 app/src/main/res/drawable/ic_youtube.xml diff --git a/app/src/main/java/com/shabinder/spotiflyer/home/Home.kt b/app/src/main/java/com/shabinder/spotiflyer/home/Home.kt index c36604d8..3ed69822 100644 --- a/app/src/main/java/com/shabinder/spotiflyer/home/Home.kt +++ b/app/src/main/java/com/shabinder/spotiflyer/home/Home.kt @@ -1,6 +1,7 @@ package com.shabinder.spotiflyer.home import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.* @@ -9,6 +10,10 @@ import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.* import androidx.compose.material.TabDefaults.tabIndicatorOffset import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.History +import androidx.compose.material.icons.outlined.Info +import androidx.compose.material.icons.rounded.History +import androidx.compose.material.icons.rounded.Info import androidx.compose.material.icons.rounded.InsertLink import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState @@ -18,7 +23,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.imageResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp @@ -34,11 +41,18 @@ fun Home(modifier: Modifier = Modifier) { Column(modifier = modifier) { - AuthenticationBanner(viewModel,modifier) - SearchBar(viewModel,modifier) - + val link by viewModel.link.collectAsState() val selectedCategory by viewModel.selectedCategory.collectAsState() + AuthenticationBanner(viewModel,modifier) + + SearchBar( + link, + viewModel::updateLink, + modifier + ) + + HomeTabBar( selectedCategory, HomeCategory.values(), @@ -46,9 +60,43 @@ fun Home(modifier: Modifier = Modifier) { modifier ) + when(selectedCategory){ + HomeCategory.About -> AboutColumn(viewModel,modifier) + HomeCategory.History -> HistoryColumn() + } + } } + +@Composable +fun AboutColumn(viewModel: HomeViewModel, modifier: Modifier) { + Card( + modifier = modifier.padding(8.dp).fillMaxWidth(), + border = BorderStroke(1.dp,Color.Gray) + ) { + Column(modifier.padding(8.dp)) { + Text( + text = stringResource(R.string.supported_platform), + style = SpotiFlyerTypography.body1 + ) + Spacer(modifier = Modifier.padding(top = 8.dp)) + Row(horizontalArrangement = Arrangement.Center,modifier = modifier.fillMaxWidth()) { + Icon(imageVector = vectorResource(id = R.drawable.ic_spotify_logo ),tint = Color.Unspecified) + Spacer(modifier = modifier.padding(start = 24.dp)) + Icon(imageVector = vectorResource(id = R.drawable.ic_gaana ),tint = Color.Unspecified) + Spacer(modifier = modifier.padding(start = 24.dp)) + Icon(imageVector = vectorResource(id = R.drawable.ic_youtube),tint = Color.Unspecified) + } + } + } +} + +@Composable +fun HistoryColumn() { + //TODO("Not yet implemented") +} + @Composable fun AuthenticationBanner(viewModel: HomeViewModel, modifier: Modifier) { val authenticationStatus by viewModel.isAuthenticating.collectAsState() @@ -89,6 +137,12 @@ fun HomeTabBar( }, style = MaterialTheme.typography.body2 ) + }, + icon = { + when (category) { + HomeCategory.About -> Icon(Icons.Outlined.Info) + HomeCategory.History -> Icon(Icons.Outlined.History) + } } ) } @@ -97,10 +151,10 @@ fun HomeTabBar( @Composable fun SearchBar( - viewModel: HomeViewModel, + link:String, + updateLink:(s:String) -> Unit, modifier: Modifier = Modifier ){ - val link by viewModel.link.collectAsState() Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -112,7 +166,7 @@ fun SearchBar( }, label = {Text(text = "Paste Link Here...",color = Color.LightGray)}, value = link, - onValueChange = { viewModel.updateLink(it) }, + onValueChange = { updateLink(it) }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri), modifier = Modifier.padding(12.dp).fillMaxWidth() @@ -121,7 +175,7 @@ fun SearchBar( RoundedCornerShape(30.dp) ), backgroundColor = Color.Black, - textStyle = AmbientTextStyle.current.merge(TextStyle(fontSize = 20.sp)), + textStyle = AmbientTextStyle.current.merge(TextStyle(fontSize = 20.sp,color = Color.White)), shape = RoundedCornerShape(size = 30.dp), activeColor = Color.Transparent, inactiveColor = Color.Transparent diff --git a/app/src/main/res/drawable/ic_error.xml b/app/src/main/res/drawable/ic_error.xml new file mode 100644 index 00000000..09d82627 --- /dev/null +++ b/app/src/main/res/drawable/ic_error.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_gaana.xml b/app/src/main/res/drawable/ic_gaana.xml new file mode 100644 index 00000000..b38f15ea --- /dev/null +++ b/app/src/main/res/drawable/ic_gaana.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml new file mode 100644 index 00000000..d8771012 --- /dev/null +++ b/app/src/main/res/drawable/ic_github.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_heart.xml b/app/src/main/res/drawable/ic_heart.xml new file mode 100644 index 00000000..c94771eb --- /dev/null +++ b/app/src/main/res/drawable/ic_heart.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_history.xml b/app/src/main/res/drawable/ic_history.xml new file mode 100644 index 00000000..c0898932 --- /dev/null +++ b/app/src/main/res/drawable/ic_history.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_instagram.xml b/app/src/main/res/drawable/ic_instagram.xml new file mode 100644 index 00000000..b99f87ce --- /dev/null +++ b/app/src/main/res/drawable/ic_instagram.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_linkedin.xml b/app/src/main/res/drawable/ic_linkedin.xml new file mode 100644 index 00000000..306000f7 --- /dev/null +++ b/app/src/main/res/drawable/ic_linkedin.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_mug.xml b/app/src/main/res/drawable/ic_mug.xml new file mode 100644 index 00000000..7fe934f1 --- /dev/null +++ b/app/src/main/res/drawable/ic_mug.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_musicplaceholder.xml b/app/src/main/res/drawable/ic_musicplaceholder.xml new file mode 100644 index 00000000..2df6af15 --- /dev/null +++ b/app/src/main/res/drawable/ic_musicplaceholder.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_refreshgradient.xml b/app/src/main/res/drawable/ic_refreshgradient.xml new file mode 100644 index 00000000..7db55bf7 --- /dev/null +++ b/app/src/main/res/drawable/ic_refreshgradient.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_share_open.xml b/app/src/main/res/drawable/ic_share_open.xml new file mode 100644 index 00000000..3f029571 --- /dev/null +++ b/app/src/main/res/drawable/ic_share_open.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_song_placeholder.xml b/app/src/main/res/drawable/ic_song_placeholder.xml new file mode 100644 index 00000000..b27653de --- /dev/null +++ b/app/src/main/res/drawable/ic_song_placeholder.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_spotify_logo.xml b/app/src/main/res/drawable/ic_spotify_logo.xml new file mode 100644 index 00000000..7100aaca --- /dev/null +++ b/app/src/main/res/drawable/ic_spotify_logo.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_tick.xml b/app/src/main/res/drawable/ic_tick.xml new file mode 100644 index 00000000..7afa2d22 --- /dev/null +++ b/app/src/main/res/drawable/ic_tick.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_youtube.xml b/app/src/main/res/drawable/ic_youtube.xml new file mode 100644 index 00000000..a0c7176d --- /dev/null +++ b/app/src/main/res/drawable/ic_youtube.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bc78f2e4..2db2c904 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,4 +2,5 @@ SpotiFlyer About History + Supported Platforms \ No newline at end of file