Giter Club home page Giter Club logo

lady-happy-android's Introduction

Hi, I'm Yahor

Inspired with new tools and technologies


Why Android logo
Powered by Why Android? community


Open source projects

๐ŸŽ Projects โญ Stars ๐Ÿ“š Forks ๐Ÿ›Ž Issues ๐Ÿท๏ธ Stack
Lady Happy Stars Forks Issues multi module, custom gradle plugin, dymamic delivery
RadioTok Stars Forks Issues full compose, support android auto
GrodnoRoads Stars Forks Issues maps compose, decompose

My latest posts

  • How to animate BottomSheet content using Jetpack Compose
  • How I made beautiful screenshots for Google Play (Developer experience)
  • Kotlin delegated property for Datastore Preferences library
  • Implement Themed Icons (Android 12+)
  • Where to find me

    Github Medium LinkedIn Gmail Gmail

    egorikftp

    Support:

    egorikftp




    egorikftp

    lady-happy-android's People

    Contributors

    dependabot-preview[bot] avatar egorikftp avatar malligan avatar maximsemashko avatar urbanovichem avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    lady-happy-android's Issues

    26.08.21 Load config from firebase

    26.08.21 Load config from firebase

    
    import com.egoriku.ladyhappy.postcreator.domain.predefined.PredefinedData
    import com.egoriku.ladyhappy.postcreator.domain.usecase.PublishPostUseCase
    import com.egoriku.ladyhappy.postcreator.domain.usecase.UploadImagesUseCase
    import com.egoriku.ladyhappy.postcreator.presentation.state.DialogEvent
    import com.egoriku.ladyhappy.postcreator.presentation.state.Effect
    import com.egoriku.ladyhappy.postcreator.presentation.state.PostState
    import com.egoriku.ladyhappy.postcreator.presentation.state.ScreenState
    import com.egoriku.ladyhappy.postcreator.presentation.state.ScreenState.Uploading.Stage
    import com.google.firebase.Timestamp
    import kotlinx.coroutines.Dispatchers
    import kotlinx.coroutines.flow.MutableSharedFlow
    import kotlinx.coroutines.flow.MutableStateFlow
    import kotlinx.coroutines.flow.asSharedFlow
    import kotlinx.coroutines.flow.asStateFlow
    import kotlinx.coroutines.launch
    import kotlinx.coroutines.withContext
    import java.util.*
    
    const val MAX_IMAGES_SIZE = 10
    
    class PostViewModel(
        application: Application,
        private val uploadImagesUseCase: UploadImagesUseCase,
        private val publishPostUseCase: PublishPostUseCase,
    ) : AndroidViewModel(application) {
    
        private val _uiState = MutableStateFlow<ScreenState>(ScreenState.None)
        val uiState = _uiState.asStateFlow()
    
        private val _postState = MutableStateFlow(PostState())
        val postState = _postState.asStateFlow()
    
        private val _publishButtonAvailability = MutableStateFlow(false)
        val publishButtonAvailability = _publishButtonAvailability.asStateFlow()
    
        private val _dialogEffects = MutableSharedFlow<DialogEvent>()
        val dialogEffects = _dialogEffects.asSharedFlow()
    
        private val _effects = MutableSharedFlow<Effect>()
        val effects = _effects.asSharedFlow()
    
        private val _currentPostState
            get() = _postState.value
    
        private val subCategoryId: Int
            get() = requireNotNull(
                _currentPostState.chooserState
                    .filterIsInstance<ChooserType.SubCategory>()
                    .firstOrNull()
                    ?.categoryId
            )
    
        init {
            viewModelScope.launch {
                _uiState.emit(ScreenState.Loading)
                // TODO: 26.08.21 Load config from firebase
                _uiState.emit(ScreenState.CreatePost)
            }
        }
    
        fun processEffect(effect: Effect) {
            viewModelScope.launch {
                _effects.emit(effect)
            }
        }
    
        fun openDialog(type: ChooserType) {
            val dialogEvent = when (type) {
                is ChooserType.Category -> DialogEvent.Category(
                    data = PredefinedData.getCategoriesNames()
                )
                is ChooserType.SubCategory -> DialogEvent.SubCategory(
                    data = PredefinedData.getSubCategoriesNames(subCategoryId)
                )
                is ChooserType.Color -> DialogEvent.Color
                is ChooserType.CreationDate -> DialogEvent.Date
            }
    
            viewModelScope.launch {
                _dialogEffects.emit(dialogEvent)
            }
        }
    
        fun processImageResult(list: List<Uri>) {
            val images = _currentPostState.imagesSection.images
            val newImages = list.map { ImageItem(uri = it) }
    
            _postState.value = _currentPostState.copy(
                imagesSection = ImageSection(images + newImages)
            )
    
    
    

    1871318460819d14f96bf237fd5a6a6b44598b8e

    Request Dynamic feature access

    Using this issue you can request demo access to the following Dynamic features:

    • Edit info screen

    Icon

    • Publish new data screen

    Icon

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.