FloodMonitoring


Source link: https://github.com/fiskurgit/FloodMonitoring

FloodMonitoring

Android library for the gov.uk Flood Monitoring API: http://environment.data.gov.uk/flood-monitoring/doc/reference

The Flood Monitoring API is RESTful and follows HATEOAS, this means where the Android library requires a url you can use the id of an object: getId()

A couple of apps using this library:
Flood Alerts: https://play.google.com/store/apps/details?id=eu.fiskur.floodmonitor
River Levels: https://play.google.com/store/apps/details?id=eu.fiskur.riverlevels

The library uses RxJava, example usage:

FloodMonitoring.getInstance().getThreeDayForecast()  .observeOn(AndroidSchedulers.mainThread())  .subscribeOn(Schedulers.newThread())  .subscribe(new Observer<ThreeDayForecast>() {

@Override

public void onCompleted() {

}

 @Override

public void onError(Throwable e) {

 //...

}

 @Override

public void onNext(ThreeDayForecast threeDayForecast) {

 outputForecast(threeDayForecast);

}
  
}
);

#Dependency

Add jitpack.io to your root build.gradle, eg:

allprojects {

  repositories {

jcenter()

maven {
 url "https://jitpack.io" 
}

  
}
 
}

then add the dependency to your project build.gradle:

dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.github.fiskurgit:FloodMonitoring:1.5' 
}

You can find the latest version in the releases tab above: https://github.com/fiskurgit/FloodMonitoring/releases

More options at jitpack.io: https://jitpack.io/#fiskurgit/FloodMonitoring

#Licence

Full licence here: https://github.com/fiskurgit/FloodMonitoring/blob/master/LICENSE.md

In short:

The MIT License is a permissive license that is short and to the point. It lets people do anything they want with your code as long as they provide attribution back to you and don’t hold you liable.

#Logging

You can turn on logging to see the network response:

FloodMonitoring.getInstance().logOutput(true);

Then register a log listener:

FloodApiLogger.getInstance().setApiLogListener(new FloodApiLogger.ApiLogListener() {

  @Override
  public void apiLog(String message) {

Log.d(TAG, message);

  
}
 
}
);

#3 Day Forecast

getThreeDayForecast() returns a general overview of the forecast for England and Wales over the next 3 days. A small image of the UK marked with forecast warnings can be fetched using getDayImageBytes(int day) (with 1, 2, or 3) this returns a Retrofit ResponseBody containing the image bytes, a convenience method in the utils class helps populate an ImageView: FloodUtils.loadImage(responseBody, imageView). Alternatively get the image URLs for use with Picasso or similar: getDayImageUrl(int day).

#Flood Warnings

getAllWarnings() returns List<FloodWarning> of all current alerts (including any that have been removed in the last 24 hours, use getSeverityLevel() to build your UI).

getAreaWarnings(double latitude, double longitude, int distance) returns List<FloodWarning> of any flood alerts in the area.

getFloodAreaFromUrl(String url) returns the FloodArea including latitude and longitude for plotting warning locations on a map.

#Water Level Stations

getAreaStations(double latitude, double longitude, int distance) returns List<StationOverview> containing some detail, but you should use the id to fetch the full StationDetail object: getStation(String url).

getReadings(String url, int count) gets the last count Reading objects, normally taken at 15 minute intervals that you can use to create graphs, you can also use getReadingsToday(String url) and getReadingsDays(String url, int days) which will ge the last x days worth of readings (although the API docs state data is held for a month it only seems to return up to two weeks worth of readings).

##Code Coverage

Resources

shapeletter is a simple view that displays a letter within circle or rectangle much like the gmail app.

ExVidPlayer is simple library that abstracts ExoPlayer.

Features:

  • Gesture controls.
  • Brightness controls with one single touch vertical scroll.
  • Volume controls with multitouch vertical scroll.
  • Forward on left swipe.
  • Reverse on right swipe.
  • Player controls

Data binding library for Android which is:

  • Lightweight
  • Doing one thing and doing it well
  • Easily extendable
  • Fully covered with unit tests
  • Working great with Jack, Retrolambda or Kotlin

A small String Template Library for Android and Java without any Dependencies.

Storing Credentials securely on a Device is a must. To make that possible we have combined the Android Keystore for generating Cryptographic keys, and storing them securely and using those keys we encrypt the credentials and save them in the SharedPreferences.

hiddenshot is a simple library to take a screenshot programmatically on demand. Screenshot is saved in the picture folder on the device. You may also share a screenshot programmatically.

  • Share a screenshot as image or image with text.
  • Take continuous screenshots periodically.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes