Skip to content

vmaks/weather-android

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this repository for?

  • This is weather android app which uses worldweatheronline.com as data provider
  • v1.0.0

How do I get set up?

  • ./gradlew clean build
  • and don't forget to setup your sdk.dir (via local.properties or direct specification)

Design concepts

The whole design of my app is based on Dependency Injections and EventBus concepts. I wanted to split all classes out from each other onto independent components.

Interaction with weather web-service is based on fetching forecast by latitude and longitude. I use shared preferences as a cache for forecast responses and update this cache in two cases:

  1. user refreshed the list manually by pull-to-refresh action on the list of data
  2. time of response is expired (it's 24 hours) and in the next scrolling action - application will try to fetch new data for this location

Dependencies

I used a lot of 3rd libraries and the main reason why I did it, just to speed up development process.

  • rxjava - don't like to hassle with AsyncTask
  • retrofit - quick bootstrap of any http webservice stub
  • ormlite - quick bootstrap for database
  • otto - eventbus
  • dagger2 - DI
  • com.etsy.android.grid - Staggered GridView for weather dashboard
  • timber - very customizable logger for android

Which design patterns I used

DI, EventBus, Observer, Builder

Applications consists of two screens:

  1. main screen with weather dashboard
  2. settings activity where the user can specify Temperature Units (Celcius or Fahrenheit)
  3. and Debug activity to show how to override eventbus

Small clarification: To refresh weathers list - just pull down (I used SwipeRefreshLayout from support library)

Unit-testing

To run & debug unit-tests in IDE you need to use Android Studio 1.4

About

Example how to use dagger2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%