-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Playlist Detail Shared Module, added API integration
- Loading branch information
1 parent
c7a65ee
commit e3e6ba6
Showing
67 changed files
with
814 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
app/src/main/java/com/spotify/app/kmp/ui/SpotifyRootView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package com.spotify.app.kmp.ui | ||
|
||
import androidx.compose.animation.AnimatedContentTransitionScope | ||
import androidx.compose.animation.core.tween | ||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.rememberNavController | ||
import androidx.navigation.navArgument | ||
import com.spotify.app.feature_homepage.shared.ui.HomePageViewModel | ||
import com.spotify.app.feature_homepage.ui.HomePageComposable | ||
import com.spotify.app.feature_playlist_detail.shared.ui.PlaylistDetailViewModel | ||
import com.spotify.app.feature_playlist_detail.ui.PlaylistDetailComposable | ||
import com.spotify.app.kmp.navigation.Screen | ||
import org.koin.androidx.compose.koinViewModel | ||
|
||
private const val ANIMATION_DURATION = 500 | ||
private const val PLAYLIST_ID = "PLAYLIST_ID" | ||
|
||
@Composable | ||
fun SpotifyRootView() { | ||
|
||
val navController = rememberNavController() | ||
|
||
NavHost(navController = navController, startDestination = Screen.HomePage.route) { | ||
|
||
composable( | ||
route = Screen.HomePage.route, | ||
enterTransition = { | ||
slideIntoContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Left, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
}, | ||
exitTransition = { | ||
slideOutOfContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Left, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
}, | ||
popEnterTransition = { | ||
slideIntoContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Right, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
}, | ||
popExitTransition = { | ||
slideOutOfContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Right, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
} | ||
) { | ||
val viewModel = koinViewModel<HomePageViewModel>() | ||
HomePageComposable( | ||
viewModel = viewModel, | ||
onPlaylistClick = { playlistId -> | ||
navController.navigate( | ||
Screen.PlaylistDetail.withArgs(playlistId) | ||
) | ||
} | ||
) | ||
} | ||
|
||
composable( | ||
route = Screen.PlaylistDetail.route + "/{$PLAYLIST_ID}", | ||
arguments = listOf( | ||
navArgument(PLAYLIST_ID) { | ||
type = NavType.StringType | ||
nullable = false | ||
}, | ||
), | ||
enterTransition = { | ||
slideIntoContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Left, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
}, | ||
exitTransition = { | ||
slideOutOfContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Left, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
}, | ||
popEnterTransition = { | ||
slideIntoContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Right, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
}, | ||
popExitTransition = { | ||
slideOutOfContainer( | ||
towards = AnimatedContentTransitionScope.SlideDirection.Right, | ||
animationSpec = tween(ANIMATION_DURATION) | ||
) | ||
} | ||
) { entry -> | ||
val playlistId = entry.arguments?.getString(PLAYLIST_ID)!! | ||
val viewModel = koinViewModel<PlaylistDetailViewModel>() | ||
PlaylistDetailComposable( | ||
playlistId = playlistId, | ||
viewModel = viewModel | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed | ||
plugins { | ||
alias(libs.plugins.com.android.library) | ||
alias(libs.plugins.org.jetbrains.kotlin.android) | ||
} | ||
|
||
android { | ||
namespace = "com.spotify.app.feature_playlist_detail" | ||
compileSdk = libs.versions.compileSdkVersion.get().toInt() | ||
|
||
defaultConfig { | ||
minSdk = libs.versions.minSdkVersion.get().toInt() | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = libs.versions.jvmTargetVersion.get() | ||
freeCompilerArgs += listOf( | ||
"-P", | ||
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true" | ||
) | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get() | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
// Shared Feature Playlist Detail Module | ||
implementation(project(":shared:feature-playlist-detail")) | ||
|
||
// Coil (Image Loading) | ||
implementation(libs.coil) | ||
|
||
// Core Ktx | ||
implementation(libs.core.ktx) | ||
|
||
// Lifecycle Ktx | ||
implementation(libs.lifecycle.runtime.ktx) | ||
|
||
// Koin | ||
implementation(libs.koin) | ||
implementation(libs.koin.android) | ||
|
||
//Compose | ||
implementation(libs.activity.compose) | ||
implementation(platform(libs.compose.bom)) | ||
implementation(libs.ui) | ||
implementation(libs.ui.graphics) | ||
implementation(libs.ui.tooling.preview) | ||
implementation(libs.material3) | ||
|
||
// Testing | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.test.ext.junit) | ||
androidTestImplementation(libs.espresso.core) | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http:https://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
...l/src/androidTest/java/com/spotify/app/feature_playlist_detail/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.spotify.app.feature_playlist_detail | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http:https://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.spotify.app.feature_playlist_detail.test", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
Oops, something went wrong.