Git Product home page Git Product logo

taiwanairquality's Introduction

串接政府公開 API,呈現空污資料

  • threshold 設定為 20 資料會分布的比較平均。

Data

  • Fetch with Retrofit and Gson converter
  • 資料會在 MainViewModel init 時抓取一次,保存在 in-memory 的 DB 內
  • 透過 room 的協助產生 LiveData 建立 observer pattern

UI

MainFragment

  • 透過 Concat Adapter 將上下兩種相接。上方在 ViewHolder 內再建立一 RecyclerView 放置橫向 items
  • records 由 DB 取出後透過 switchMap 方法轉為上下各自需要的 data list
  • Layout 的需求透過 Constraint Layout 的特性達成

SearchFragment

  • 用 EditText 的 onTextChange 監聽輸入資料,透過 switchMap 來處理字串的比對,並替換 sql query 取得 LiveData。當 input 改變時也立刻改變結果。

taiwanairquality's People

Contributors

mch-aoitek avatar mingchun-hsu avatar

Watchers

James Cloos avatar mch avatar

taiwanairquality's Issues

java.lang.NumberFormatException: For input string: ""

2022-01-03 15:30:13.079 9842-9842/com.mch.ubiquiti E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mch.ubiquiti, PID: 9842
java.lang.NumberFormatException: For input string: ""
at java.lang.Integer.parseInt(Integer.java:627)
at java.lang.Integer.parseInt(Integer.java:650)
at com.mch.ubiquiti.ui.MainViewModel$1.invokeSuspend(MainViewModel.kt:20)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

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.