mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2320 Gallery Installation | Tech | MVVM components (#1009)
This commit is contained in:
parent
c0ee5ef7eb
commit
fa08c1325b
14 changed files with 324 additions and 1 deletions
57
gallery-experience/build.gradle
Normal file
57
gallery-experience/build.gradle
Normal file
|
@ -0,0 +1,57 @@
|
|||
plugins {
|
||||
id "com.android.library"
|
||||
id "kotlin-android"
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
def config = rootProject.extensions.getByName("ext")
|
||||
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion libs.versions.composeKotlinCompilerVersion.get()
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
namespace 'com.anytypeio.anytype.galleryexperience'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':domain')
|
||||
implementation project(':core-ui')
|
||||
implementation project(':analytics')
|
||||
implementation project(':core-models')
|
||||
implementation project(':core-utils')
|
||||
implementation project(':localization')
|
||||
implementation project(':presentation')
|
||||
implementation project(':library-emojifier')
|
||||
|
||||
compileOnly libs.javaxInject
|
||||
|
||||
implementation libs.lifecycleViewModel
|
||||
implementation libs.lifecycleRuntime
|
||||
|
||||
implementation libs.appcompat
|
||||
implementation libs.compose
|
||||
implementation libs.composeFoundation
|
||||
implementation libs.composeToolingPreview
|
||||
implementation libs.composeMaterial3
|
||||
|
||||
implementation libs.coilCompose
|
||||
|
||||
debugImplementation libs.composeTooling
|
||||
|
||||
implementation libs.timber
|
||||
|
||||
testImplementation libs.junit
|
||||
testImplementation libs.kotlinTest
|
||||
}
|
1
gallery-experience/src/main/AndroidManifest.xml
Normal file
1
gallery-experience/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1 @@
|
|||
<manifest />
|
|
@ -0,0 +1,15 @@
|
|||
package com.anytypeio.anytype.gallery_experience.models
|
||||
|
||||
sealed class GalleryInstallationState {
|
||||
object Hidden : GalleryInstallationState()
|
||||
object Loading : GalleryInstallationState()
|
||||
object Success : GalleryInstallationState()
|
||||
}
|
||||
|
||||
sealed class GalleryInstallationNavigation(val route: String) {
|
||||
object Main : GalleryInstallationNavigation("main")
|
||||
object Spaces : GalleryInstallationNavigation("spaces")
|
||||
object Success : GalleryInstallationNavigation("success")
|
||||
object Error : GalleryInstallationNavigation("error")
|
||||
object Dismiss : GalleryInstallationNavigation("")
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.anytypeio.anytype.gallery_experience.screens
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.anytypeio.anytype.gallery_experience.models.GalleryInstallationState
|
||||
|
||||
@Composable
|
||||
fun GalleryInstallationScreen(state: GalleryInstallationState) {
|
||||
}
|
||||
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun GalleryInstallationScreenPreview() {
|
||||
GalleryInstallationScreen(GalleryInstallationState.Success)
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.anytypeio.anytype.gallery_experience.screens
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
||||
@Composable
|
||||
fun GalleryInstallationSpacesScreen() {
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun GallerySpacesScreenPreview() {
|
||||
GalleryInstallationSpacesScreen()
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.anytypeio.anytype.gallery_experience.viewmodel
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.anytypeio.anytype.analytics.base.Analytics
|
||||
import com.anytypeio.anytype.gallery_experience.models.GalleryInstallationNavigation
|
||||
import com.anytypeio.anytype.gallery_experience.models.GalleryInstallationState
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import timber.log.Timber
|
||||
|
||||
class GalleryInstallationViewModel(
|
||||
private val analytics: Analytics,
|
||||
) : ViewModel() {
|
||||
|
||||
val mainState = MutableStateFlow<GalleryInstallationState>(GalleryInstallationState.Hidden)
|
||||
val command = MutableStateFlow<GalleryInstallationNavigation?>(null)
|
||||
|
||||
init {
|
||||
Timber.d("GalleryInstallationViewModel init")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.anytypeio.anytype.gallery_experience.viewmodel
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.anytypeio.anytype.analytics.base.Analytics
|
||||
import javax.inject.Inject
|
||||
|
||||
class GalleryInstallationViewModelFactory@Inject constructor(
|
||||
private val analytics: Analytics,
|
||||
) : ViewModelProvider.Factory {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return GalleryInstallationViewModel(
|
||||
analytics = analytics,
|
||||
) as T
|
||||
}
|
||||
}
|
2
gallery-experience/src/main/res/values/strings.xml
Normal file
2
gallery-experience/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<resources>
|
||||
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue