Skip to content

Commit

Permalink
refactor: Migrate cryptoapp in a Gradle module.
Browse files Browse the repository at this point in the history
- Create :components:charts module to host all
generic charts compose components.
- Move more compose components into :theme module.
- Create :demos:cryptoapp module for crypto app.

Issue Gurupreet#61
  • Loading branch information
GerardPaligot committed Jun 4, 2021
1 parent b2ddec7 commit c09df29
Show file tree
Hide file tree
Showing 62 changed files with 355 additions and 248 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ dependencies {
implementation(project(":data"))
implementation(project(":theme"))
implementation(project(":demos:instagram"))
implementation(project(":demos:cryptoapp"))
implementation(project(":components:charts"))

debugImplementation("org.jetbrains.kotlin:kotlin-reflect:${Dependencies.kotlin}")

Expand Down
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@
android:name="com.guru.composecookbook.ui.demoapps.moviesappmvi.ui.home.MoviesHomeActivity"
android:label="@string/title_activity_movies_home"
android:theme="@style/Theme.ComposeCookBook.NoActionBar" />
<activity
android:name="com.guru.composecookbook.ui.demoapps.cryptoappmvvm.ui.detail.CryptoDetailActivity"
android:label="@string/title_activity_crypto_detail"
android:theme="@style/Theme.ComposeCookBook.NoActionBar" />
<activity
android:name="com.guru.composecookbook.ui.demoapps.cryptoappmvvm.ui.home.CryptoHomeActivity"
android:label="@string/title_activity_crypto_home"
android:theme="@style/Theme.ComposeCookBook.NoActionBar" />
<activity
android:name=".ui.demoapps.spotify.details.SpotifyDetailActivity"
android:label="@string/title_activity_spotify_detail"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTag
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.guru.composecookbook.cryptoapp.ui.home.CryptoHomeActivity
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.ui.demoapps.cryptoappmvvm.ui.home.CryptoHomeActivity
import com.guru.composecookbook.ui.demoapps.datingapp.DatingHomeActivity
import com.guru.composecookbook.ui.demoapps.moviesappmvi.ui.home.MoviesHomeActivity
import com.guru.composecookbook.ui.demoapps.spotify.SpotifyActivity
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import com.guru.composecookbook.theme.purple
import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.spotify.data.Album
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.utils.verticalGradientBackground
import com.guru.composecookbook.theme.modifiers.verticalGradientBackground
import kotlin.random.Random

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.guru.composecookbook.ui.animation.FloatMultiStateAnimationCircleCanva
import com.guru.composecookbook.ui.demoapps.datingapp.components.DraggableCard
import com.guru.composecookbook.ui.demoapps.spotify.data.Album
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.utils.verticalGradientBackground
import com.guru.composecookbook.theme.modifiers.verticalGradientBackground
import kotlin.random.Random

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.moviesappmvi.data.models.Movie
import com.guru.composecookbook.ui.demoapps.spotify.generateDominantColorState
import com.guru.composecookbook.ui.templates.profile.InterestTag
import com.guru.composecookbook.ui.utils.verticalGradientBackground
import com.guru.composecookbook.theme.modifiers.verticalGradientBackground


class MovieDetailActivity : ComponentActivity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.guru.composecookbook.ui.demoapps.moviesappmvi.ui.MoviesLaneItem
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground

@Composable
fun MovieTrendingScreen(moviesHomeInteractionEvents: (MoviesHomeInteractionEvents) -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.spotify.generateDominantColorState
import com.guru.composecookbook.ui.home.carousel.Pager
import com.guru.composecookbook.ui.home.carousel.PagerState
import com.guru.composecookbook.ui.utils.verticalGradientBackground
import com.guru.composecookbook.theme.modifiers.verticalGradientBackground

@Composable
fun MovieHomeScreen(moviesHomeInteractionEvents: (MoviesHomeInteractionEvents) -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.google.accompanist.coil.rememberCoilPainter
import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.moviesappmvi.data.models.Movie
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground


@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.room.TypeConverter

class ListTypeConverter {
companion object {

@TypeConverter
@JvmStatic
fun gettingListFromString(genreIds: String?): List<Int>? {
Expand Down Expand Up @@ -37,39 +36,5 @@ class ListTypeConverter {

return genreIds
}

@TypeConverter
@JvmStatic
fun gettingFloatListFromString(genreIds: String?): List<Float>? {
val list = arrayListOf<Float>()

val array =
genreIds?.split(",".toRegex())?.dropLastWhile { it.isEmpty() }?.toTypedArray()
if (array.isNullOrEmpty()) {
return null
}
for (s in array) {
if (!s.isEmpty()) {
list.add(s.toFloat())
}
}
return list
}

@TypeConverter
@JvmStatic
fun writingStringFromFloatList(list: List<Float>?): String? {
var genreIds = ""
if (genreIds.isEmpty()) {
return null
} else {
for (i in list!!) {
genreIds += ",$i"
}
}

return genreIds
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.unit.dp
import com.guru.composecookbook.theme.ComposeCookBookTheme
import com.guru.composecookbook.theme.graySurface
import com.guru.composecookbook.ui.templates.components.ColorPicker
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground

@ExperimentalAnimationApi
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.spotify.data.Album
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.demoapps.spotify.details.SpotifyDetailActivity
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground

@Composable
fun SpotifyHomeGridItem(album: Album) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.guru.composecookbook.theme.graySurface
import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.utils.VerticalGrid
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground

@Composable
fun SpotifyHome() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.guru.composecookbook.ui.demoapps.spotify.data.Album
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.demoapps.spotify.details.SpotifyDetailActivity
import com.guru.composecookbook.ui.utils.StaggeredVerticalGrid
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground
import kotlin.random.Random

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import androidx.compose.ui.unit.sp
import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.utils.VerticalGrid
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground

@Composable
fun SpotifySearchScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.spotify.data.Album
import com.guru.composecookbook.ui.demoapps.spotify.data.SpotifyDataProvider
import com.guru.composecookbook.ui.demoapps.spotify.generateDominantColorState
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.ui.utils.verticalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.verticalGradientBackground

@Composable
fun SpotifyDetailScreen(album: Album) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.constraintlayout.compose.ChainStyle
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.ui.demoapps.cryptoappmvvm.ui.home.components.MyWalletCard
import com.guru.composecookbook.cryptoapp.ui.home.components.MyWalletCard
import com.guru.composecookbook.ui.demoapps.gmail.home.GmailListItem
import com.guru.composecookbook.ui.demoapps.youtube.YoutubeListItem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.activity.compose.setContent
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.runtime.Composable
import com.guru.composecookbook.charts.Charts
import com.guru.composecookbook.theme.ComposeCookBookTheme
import com.guru.composecookbook.ui.templates.logins.LoginOnboarding
import com.guru.composecookbook.ui.templates.onboardings.OnBoardingScreen1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import androidx.compose.ui.unit.sp
import com.guru.composecookbook.R
import com.guru.composecookbook.theme.gradientBluePurple
import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.utils.horizontalGradientBackground
import com.guru.composecookbook.theme.modifiers.horizontalGradientBackground

private val initialimageFloat = 170f
private val name = "Gurupreet Singh"
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
<string name="spotify_nav_search">Search</string>
<string name="spotify_nav_library">Your Library</string>
<string name="title_activity_spotify_detail">SpotifyDetail</string>
<string name="title_activity_crypto_home">CryptoHome</string>
<string name="title_activity_crypto_detail">CryptoDetail</string>
<string name="title_activity_movies_home">MovieHome</string>
<string name="title_activity_movie_detail">MovieDetail</string>

Expand Down
1 change: 1 addition & 0 deletions components/charts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
35 changes: 35 additions & 0 deletions components/charts/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugins {
id("com.android.library")
id("kotlin-android")
}

android {
compileSdk = Configuration.compileSdk

defaultConfig {
minSdk = Configuration.minSdk
targetSdk = Configuration.compileSdk
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = Dependencies.compose
}
}

dependencies {
implementation(project(":theme"))

implementation("androidx.compose.ui:ui:${Dependencies.compose}")
implementation("androidx.compose.material:material:${Dependencies.compose}")
implementation("androidx.compose.ui:ui-tooling:${Dependencies.compose}")
}
5 changes: 5 additions & 0 deletions components/charts/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guru.composecookbook.charts">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.guru.composecookbook.ui.templates
package com.guru.composecookbook.charts

import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
Expand Down
1 change: 1 addition & 0 deletions demos/cryptoapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading

0 comments on commit c09df29

Please sign in to comment.