Code Monkey home page Code Monkey logo

kujaku's Introduction

Kujaku (Peacock) Build Status Download Coverage Status

A mapping and check-in library for Android using MapBox SDK (Version 8.3.3)

IMPORTANT UPDATE

Kujaku library and utils artefacts are no longer available on bintray and any builds using these dependencies will fail. Kindly update to use mavenCentral() repository in your build.gradle and the library version 0.9.0 for a successful build. Kindly create an issue in case you face any problems.

Table of Contents

Setup Instructions

Running Sample App

For instructions on how to run the sample app see these instructions.

How to publish artifacts

You can easily publish a snapshot artefact by creating a tag for the library or util module. Follow the steps below:

To publish the utils module

  1. Update the utils version in this file utils\build.gradle in the format X.Y.Z-SNAPSHOT where X, Y and Z should be replaced with the version numbers of the major vesion, minor version and build versions respectively.
  2. Create a PR with the change and have it merged
  3. Generate a tag with the title utils-vX.Y.X-SNAPSHOT and push it. This will trigger a publish of the artefact snapshot version to Sonatype and Github packages

To publish the library module

  1. Follow the steps above to get the latest version of utils as a dependency in your library snapshot
  2. Update the library version in this file library\build.gradle in the format X.Y.Z-SNAPSHOT where X, Y and Z should be replaced with the version numbers of the major vesion, minor version and build versions respectively.
  3. Create a PR with the change and have it merged
  4. Generate a tag with the title library-vX.Y.X-SNAPSHOT and push it. This will trigger a publish of the artefact snapshot version to Sonatype and Github packages

Due to the sunsetting of JFrog Bintray, Kujaku artefacts/release are no longer available on bintray and all publishing is done to Maven Central. Some of the packages are also published to Github packages.

How to import the library

To import the library:

  1. Add the following snippet to your app module build.gradle
...


allprojects {
    repositories {
        mavenCentral()
    }
}

This adds the bintray repository to your configuration

  1. Add the following snippet to your app module build.gradle
...
android {

... 

dependencies {
    ...
    // Kujaku dependencies
    implementation 'io.ona.kujaku:library:0.9.0'
    ...
}
  1. Initialise the library

This can be done in the Application class

KujakuLibrary.init(this);
  1. Set the Mapbox key

This is required before any use of the library such as offline map downloads or viewing a map

Mapbox.getInstance(context, "ACCESS-TOKEN");

How to use the library

The library offers a view KujakuMapView that provides more functionality than Mapbox.

  • For Mapbox related functionality, go here
  • For setup information and extra features provided by this library go here

Unable to resolve artifact: Missing while running tests

This is encountered when Robolectric has problems downloading the jars it needs for different Android SDK levels. If you keep running into this you can download the JARs locally and point Robolectric to them by doing:

./download-robolectric-deps.sh

License

This software is provided under the Apache 2 license, see the LICENSE file for further details.

Acknowledgements

We’d like to acknowledge The Bill and Melinda Gates Foundation and Qualcomm for supporting us in this work.

kujaku's People

Contributors

craigappl avatar ekigamba avatar eotin avatar githengi avatar jasonrogena avatar kigamba avatar nightcrawler- avatar pld avatar rkareko avatar shubham1g5 avatar vincent-karuri avatar

Stargazers

 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  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

kujaku's Issues

Kujaku in Official Ona Bintray Account

Move Kujaku to Ona's official Bintray account. We can leave the library in Bintray for now (since it's easy to deploy to Bintray) though we should consider moving to a different Maven repository, preferably the same repository OpenSRP modules are in since account verification and signing of packages isn't very rigorous in Bintray.

Related to #13

Decongest MapboxOfflineDownloaderService

As a way of decongesting the MapboxOfflineDownloaderService class, to make it easier to write tests for the code and in anticipation of code reuse, move the logic for the following features out of this class:

  • Android notifications
  • Database actions for tracking tile download tasks

Info Window Click Action

When a info window is clicked when in focus, it should return the focused feature's GeoJSON to the activity that called it.
When the feature on the map is also clicked when it is already in focus, it should also return the focused feature's GeoJSON to the activity that called it.

Add support for Android 8.0 Notification channels

Notifications on Android 8.0 cannot be displayed unless they have a channel.

Download Progress channel

  1. Name -> offline_map_download_progress
  2. Vibration -> Off
  3. Lights -> Off

Download Complete channel

  1. Name -> offline_map_download_complete
  2. Vibration -> On
  3. Vibration Patter -> Default
  4. Lights -> On
  5. Light Color -> Blue

Tasks

  • Move notification operations to another class
  • Create the download progress channel
  • Create the download complete channel
  • Fix tests

Rethink Data Delivery Between SDK and 3rd-party App

Currently, data is moved from the 3rd party app into the library as a GeoJSON data-source. This means that for 3rd party apps (like OpenSRP) that have dynamic data that needs to be sent to the app, the GeoJSON has to generated within the 3rd party app at some point. Works OK now (with small datasets), but might be slow for large datasets.

Test whether generating and importing GeoJSON data-sources is slow. If so, are there other alternatives we could use to deliver the data, while still keeping the library generic (able to handle different data schema types).

Accurately determine if the user's location is out-of-view in the map

Kujaku needs to accurately determine if the user's current location is out-of-view in the MapActivity after the map has centered on the current user location.

Currently, the target icon on the bottom-right turns blue if the user's location is in focus. The user's location has a marker. If the map is scrolled and the user's marker is no longer visible, the target icon does not turn to white.

Decongest MapActivity

As a way of decongesting the MapActivity class, to make it easier to write tests for the code and in anticipation of code reuse, move the logic for the following features out of this class:

  • Location updates
  • The code in the sortData method

Map Activity: Show currently selected point distinctively

How should the Map Activity highlight the currently focused point given that:

  • Currently the point is centred on the map when the point is in focus
  • Centering a point on the map doesn't highlight the point well, especially when there's other points close to the highlighted point.

Downloading Offline Tiles

Add a service for downloading offline tiles for a third party app in anticipation that the app will call the Kujaku map when offline. Bounds should be provided by the third-party app.

Parse 3rd Party App MapBox Style

Add functionality for parsing and rendering MapBox style JSON from the calling app.

  1. Create MapBox Style GeoJSON on the 3rd party app
  2. Pass the GeoJSON Data to Kujaku with the MapBox Style to merge with
  3. Render the final style on the Kujaku MapView

Offline Map Download service: Enable changing of bounds and other properties for an offline map & updating it

  1. Make a call to the service for an offline map download
  2. Delete all pending Offline Map Download tasks with: Similar name & STATUS_NOT_STARTED
  3. Add the Offline Map to the task queue
  4. When every Offline Map download task is complete, check if there are existing Mapbox Offline Maps downloaded with the same map name & delete them. Use the OfflineRegion Id to exclude the just completed download.

Deprecate PARCELABLE_KEY_BOTTOM_RIGHT_BOUND and PARCELABLE_KEY_TOP_LEFT_BOUND

Stop using PARCELABLE_KEY_BOTTOM_RIGHT_BOUND and PARCELABLE_KEY_TOP_LEFT_BOUND to pass map bound configurations to the MapActivity since this can be achieved using a combination of the center and zoom properties in the MapBox style specification.

Will involve:

  • Removing the constants from the Constants class.
  • Removing any reference of the constants in the utils and library modules.
  • Updating the sample module, and opensrp-client-path project constants used there.

Map View should have a target icon to take the user back to their location

  • Position of the target icon on the bottom-right - While the user position is in central focus, the icon will be blue in color
  • The target icon is like the one on Google Maps.
  • When the target icon is clicked it should move the user back to their location
  • Map View should have a marker of the current user location
  • The first time the Map Activity is opened, it should focus on the user's location only if it was not given certain bounds or a target coordinate

Deprecate PARCELABLE_KEY_CAMERA_TARGET_LATLNG

Stop using PARCELABLE_KEY_CAMERA_TARGET_LATLNG for defining the default map centre. Instead rely on the center property defined in the MapBox style specification.

Will involve:

  • Removing the constants from the Constants class.
  • Removing any reference of the constants in the utils and library modules.
  • Updating the sample module
  • Update opensrp-client-path project constants used there.
  • Add helper method for updating the center property in the Mapbox Style

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.