Code Monkey home page Code Monkey logo

sharedviewmodelbasicsample's Introduction

#Cupcake Application

개요

Jetpack.ViewModel를 공유 viewModel 형태로 사용하는 심플앱이다.

OrderViewModel - SharedViewModel

개요

변수

  • quantity: 주문하려는 컵 케이크의 수량
  • flavor: 주문하려는 컵 케이크의 종류
  • dateOptions: 주문 가능한 날짜 목록
  • date: 주문하려는 날짜
  • price: 주문 가격

함수

  • setQuantity(): 주문하려는 컵 케이크의 수량을 설정한다. (call updatePrice())
  • setFlavor(): 주문하려는 컵 케이크의 종류를 설정한다.
  • setDate(): 주문하려는 날짜를 설정한다.
  • hasNoFlavorSet(): 선택 된 컵 케이크의 종류가 있는지 검사한다.
  • resetOrder(): quantity, flavor, date, price 값들을 초기화한다.
  • updatePrice(): 가격 정보를 업데이트한다.
  • getPickupOptions(): 선택 가능한 날짜를 Date형식으로 변경한다.

사용

App Flow

StartFragment

  • setQuantity(): 1, 6 그리고 12 중에 선택한다.
  • setFlavor(): FlavorFragment에서 종류를 선택할 때, 기본값으로 Vanilla를 선택되어 있도록 Vanilla로 설정한다.

FlavorFragment

  • resetOrder(): 주문 취소 시, 주문 관련된 정보를 초기화한다.
  • setFalvor(): 주문할 컵 케이크 종류를 선택한다.
  • flavor: RadioButton.checked 상태값을 바인딩한다.
  • price: 가격 정보를 바인딩한다.

PickupFragment

  • resetOrder(): 주문 취소 시, 주문 관련된 정보를 초기화한다.
  • setDate(): 주문할 날짜를 선택한다.
  • dateOptions: RadioButton.checked 상태값을 바인딩한다.
  • price: 가격 정보를 바인딩한다.

SummaryFragment

  • qauntity: 수량 정보를 바인딩한다.
  • flavor: 종류 정보를 바인딩한다.
  • date: 주문 날짜 정보를 바인딩한다.
  • price: 가격 정보를 바인딩한다.

sharedviewmodelbasicsample's People

Contributors

juhyeoklee97 avatar

Watchers

 avatar

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.