diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index ce03c14..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-SpotifyCompose
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index fb7f4a8..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/droidbaza.xml b/.idea/copyright/droidbaza.xml
deleted file mode 100644
index f7706d7..0000000
--- a/.idea/copyright/droidbaza.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index f262cee..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 526b4c2..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 2842237..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index f9f6ed7..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/model/Category.kt b/app/src/main/java/com/droidbaza/spotifycompose/model/Category.kt
index 30e3589..8f7454f 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/model/Category.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/model/Category.kt
@@ -34,6 +34,9 @@ data class Category(
companion object {
val Default = Category(0, subtitle = "empty subtitle")
}
+}
- fun authors(): List = data.map { it.title ?: "" }
+// written with solid principles(open-closed)
+fun Category.authors(): List {
+ return data.map { it.title ?: "" }
}
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPersonsScreen.kt b/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPersonsScreen.kt
index 2ac9f2f..6c05b81 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPersonsScreen.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPersonsScreen.kt
@@ -39,11 +39,11 @@ import com.droidbaza.spotifycompose.components.CardColumn
import com.droidbaza.spotifycompose.components.SearchBar
import com.droidbaza.spotifycompose.components.TextTitle
import com.droidbaza.spotifycompose.repository.DataProvider
-import com.droidbaza.spotifycompose.tools.Ext
import com.droidbaza.spotifycompose.tools.Ext.color
import com.droidbaza.spotifycompose.tools.Ext.gradient
import com.droidbaza.spotifycompose.tools.Ext.offsetY
import com.droidbaza.spotifycompose.tools.Ext.round
+import com.droidbaza.spotifycompose.tools.GradientTypeVertical
import com.droidbaza.spotifycompose.tools.Sizes
import com.droidbaza.spotifycompose.ui.theme.Primary30
@@ -98,7 +98,7 @@ fun AddPersonsScreen() {
.align(Alignment.BottomCenter)
.gradient(
listOf(Color.Transparent, Primary30),
- Ext.GradientType.VERTICAL
+ GradientTypeVertical()
)
) {
Text(
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPodcastsScreen.kt b/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPodcastsScreen.kt
index d71c471..d915f33 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPodcastsScreen.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/screens/AddPodcastsScreen.kt
@@ -39,12 +39,12 @@ import com.droidbaza.spotifycompose.components.CardColumn
import com.droidbaza.spotifycompose.components.SearchBar
import com.droidbaza.spotifycompose.components.TextTitle
import com.droidbaza.spotifycompose.repository.DataProvider
-import com.droidbaza.spotifycompose.tools.Ext
import com.droidbaza.spotifycompose.tools.Ext.color
import com.droidbaza.spotifycompose.tools.Ext.gradient
import com.droidbaza.spotifycompose.tools.Ext.offsetY
import com.droidbaza.spotifycompose.tools.Ext.clickableResize
import com.droidbaza.spotifycompose.tools.Ext.round
+import com.droidbaza.spotifycompose.tools.GradientTypeVertical
import com.droidbaza.spotifycompose.tools.Sizes
import com.droidbaza.spotifycompose.ui.theme.Primary30
@@ -100,7 +100,7 @@ fun AddPodcastsScreen() {
.align(Alignment.BottomCenter)
.gradient(
listOf(Color.Transparent, Primary30),
- Ext.GradientType.VERTICAL
+ GradientTypeVertical()
)
) {
Text(
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/screens/MainScreen.kt b/app/src/main/java/com/droidbaza/spotifycompose/screens/MainScreen.kt
index e8dec15..e4c5b26 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/screens/MainScreen.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/screens/MainScreen.kt
@@ -29,7 +29,6 @@ import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
-import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
@@ -41,9 +40,9 @@ import com.droidbaza.spotifycompose.navigation.NavigationContainer
import com.droidbaza.spotifycompose.navigation.Screen
import com.droidbaza.spotifycompose.navigation.Router
import com.droidbaza.spotifycompose.navigation.RouterImpl
-import com.droidbaza.spotifycompose.tools.Ext
import com.droidbaza.spotifycompose.tools.Ext.clickableResize
import com.droidbaza.spotifycompose.tools.Ext.gradient
+import com.droidbaza.spotifycompose.tools.GradientTypeVertical
@ExperimentalFoundationApi
@ExperimentalAnimationApi
@@ -69,7 +68,7 @@ fun MainScreen(finish: () -> Unit) {
modifier = Modifier
.gradient(
listOf(Color.Transparent, Color.Black),
- Ext.GradientType.VERTICAL
+ GradientTypeVertical()
)
.padding(top = 20.dp)
) {
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/screens/PlayerFullScreen.kt b/app/src/main/java/com/droidbaza/spotifycompose/screens/PlayerFullScreen.kt
index 9fdd1c2..702a605 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/screens/PlayerFullScreen.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/screens/PlayerFullScreen.kt
@@ -40,9 +40,9 @@ import androidx.compose.ui.unit.sp
import com.droidbaza.spotifycompose.R
import com.droidbaza.spotifycompose.components.*
import com.droidbaza.spotifycompose.components.core.TopBar
-import com.droidbaza.spotifycompose.tools.Ext
import com.droidbaza.spotifycompose.tools.Ext.gradient
import com.droidbaza.spotifycompose.tools.Ext.round
+import com.droidbaza.spotifycompose.tools.GradientTypeVertical
import com.droidbaza.spotifycompose.tools.Sizes.MEDIUM
const val DEFAULT_DESCRIPTION =
@@ -58,7 +58,7 @@ fun PlayerFullScreen() {
.verticalScroll(scrollState)
.gradient(
listOf(Color.Red, Color.Transparent, Color.Transparent),
- Ext.GradientType.VERTICAL
+ GradientTypeVertical()
)
) {
TopBar(
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/screens/PremiumSreen.kt b/app/src/main/java/com/droidbaza/spotifycompose/screens/PremiumSreen.kt
index 09a5134..8ace853 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/screens/PremiumSreen.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/screens/PremiumSreen.kt
@@ -42,11 +42,11 @@ import com.droidbaza.spotifycompose.R
import com.droidbaza.spotifycompose.components.ImageCrop
import com.droidbaza.spotifycompose.components.PremiumCard
import com.droidbaza.spotifycompose.components.TextTitle
-import com.droidbaza.spotifycompose.tools.Ext
import com.droidbaza.spotifycompose.tools.Ext.color
import com.droidbaza.spotifycompose.tools.Ext.gradient
import com.droidbaza.spotifycompose.tools.Ext.offsetY
import com.droidbaza.spotifycompose.tools.Ext.round
+import com.droidbaza.spotifycompose.tools.GradientTypeVertical
import com.droidbaza.spotifycompose.ui.theme.Primary
@@ -83,7 +83,7 @@ fun PremiumScreen(paddingValues: PaddingValues = PaddingValues()) {
Column(
Modifier.gradient(
listOf(Color.Transparent, Primary),
- Ext.GradientType.VERTICAL
+ GradientTypeVertical()
)
) {
Surface(
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/tools/Ext.kt b/app/src/main/java/com/droidbaza/spotifycompose/tools/Ext.kt
index ff0c0fd..a07f4ba 100644
--- a/app/src/main/java/com/droidbaza/spotifycompose/tools/Ext.kt
+++ b/app/src/main/java/com/droidbaza/spotifycompose/tools/Ext.kt
@@ -35,7 +35,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.scale
-import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalDensity
@@ -67,34 +66,12 @@ object Ext {
return 1
}
- enum class GradientType {
- HORIZONTAL, VERTICAL, LINEAR, RADIAL, SWEEP
- }
-
-
+ // written with solid principles(open-closed)
fun Modifier.gradient(
colors: List,
- gradientType: GradientType = GradientType.LINEAR
+ typeProperty: GradientTypeProperty = GradientTypeLinear()
): Modifier {
- return this.background(
- brush = when (gradientType) {
- GradientType.HORIZONTAL -> {
- Brush.horizontalGradient(colors = colors)
- }
- GradientType.VERTICAL -> {
- Brush.verticalGradient(colors = colors)
- }
- GradientType.LINEAR -> {
- Brush.linearGradient(colors = colors)
- }
- GradientType.RADIAL -> {
- Brush.radialGradient(colors = colors)
- }
- GradientType.SWEEP -> {
- Brush.sweepGradient(colors = colors)
- }
- }
- )
+ return this.background(brush = typeProperty.getGradientType(colors = colors))
}
fun Modifier.round(
diff --git a/app/src/main/java/com/droidbaza/spotifycompose/tools/GradientTypeProperty.kt b/app/src/main/java/com/droidbaza/spotifycompose/tools/GradientTypeProperty.kt
new file mode 100644
index 0000000..5f8251a
--- /dev/null
+++ b/app/src/main/java/com/droidbaza/spotifycompose/tools/GradientTypeProperty.kt
@@ -0,0 +1,50 @@
+/*
+ * Created by droidbaza on 29.12.2021
+ *
+ * Copyright (c) 2021 . All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.droidbaza.spotifycompose.tools
+
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+
+/**
+ * Created by tfakioglu on 29.December.2021
+ */
+interface GradientTypeProperty {
+ fun getGradientType(colors: List): Brush
+}
+
+class GradientTypeHorizontal(): GradientTypeProperty {
+ override fun getGradientType(colors: List): Brush = Brush.horizontalGradient(colors = colors)
+}
+
+class GradientTypeVertical(): GradientTypeProperty {
+ override fun getGradientType(colors: List): Brush = Brush.verticalGradient(colors = colors)
+}
+
+class GradientTypeLinear(): GradientTypeProperty {
+ override fun getGradientType(colors: List): Brush = Brush.linearGradient(colors = colors)
+}
+
+class GradientTypeRadial(): GradientTypeProperty {
+ override fun getGradientType(colors: List): Brush = Brush.radialGradient(colors = colors)
+}
+
+class GradientTypeSweep(): GradientTypeProperty {
+ override fun getGradientType(colors: List): Brush = Brush.sweepGradient(colors = colors)
+}
\ No newline at end of file