Skip to content

Commit

Permalink
Karoo SDK Release 0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
brentnd committed Feb 11, 2021
1 parent 56556ea commit 3cfdd29
Show file tree
Hide file tree
Showing 123 changed files with 2,547 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[Quick Start](https://hammerheadnav.github.io/karoo-sdk/index.html)

[API Documentation](https://hammerheadnav.github.io/karoo-sdk/0.0.6/karoo-sdk/index.html)
[API Documentation](https://hammerheadnav.github.io/karoo-sdk/0.0.7/karoo-sdk/index.html)

[Jitpack Build](https://jitpack.io/#io.hammerhead/karoo-sdk)

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
'compileSdk' : 28,

'kotlin' : '1.3.72',
'libraryVersion': "0.0.6"
'libraryVersion': "0.0.7"
]
repositories {
google()
Expand Down
27 changes: 27 additions & 0 deletions docs/0.0.7/karoo-sdk/alltypes/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: alltypes - karoo-sdk
---

The top-level module that is provided as the Karoo SDK Android library

### All Types

| [io.hammerhead.sdk.v0.datatype.formatter.BuiltInFormatter](../io.hammerhead.sdk.v0.datatype.formatter/-built-in-formatter/index.html) | |
| [io.hammerhead.sdk.v0.datatype.transformer.BuiltInTransformer](../io.hammerhead.sdk.v0.datatype.transformer/-built-in-transformer/index.html) | |
| [io.hammerhead.sdk.v0.datatype.view.BuiltInView](../io.hammerhead.sdk.v0.datatype.view/-built-in-view/index.html) | |
| [io.hammerhead.sdk.v0.datatype.Dependency](../io.hammerhead.sdk.v0.datatype/-dependency/index.html) | Enumeration of possible dependencies for [SdkDataType](../io.hammerhead.sdk.v0.datatype/-sdk-data-type/index.html). |
| [io.hammerhead.sdk.v0.card.FitFileListener](../io.hammerhead.sdk.v0.card/-fit-file-listener/index.html) | Listener interface which is used in [PostRideCard](../io.hammerhead.sdk.v0.card/-post-ride-card/index.html) to access FIT file data as it is decoded. |
| [io.hammerhead.sdk.v0.KeyValueStore](../io.hammerhead.sdk.v0/-key-value-store/index.html) | Simple storage of key/value pairs for use by Karoo SDK modules. This allows modules to store values that need to be persisted across rides and reboots. Additionally, allows access between full APK and Karoo SDK plugins and across plugin instances running within different Karoo apps. |
| [io.hammerhead.sdk.v0.Module](../io.hammerhead.sdk.v0/-module/index.html) | Karoo SDK Module |
| [io.hammerhead.sdk.v0.ModuleFactoryI](../io.hammerhead.sdk.v0/-module-factory-i/index.html) | Interface for factory to build a custom Karoo SDK module. |
| [io.hammerhead.sdk.v0.card.PostRideCard](../io.hammerhead.sdk.v0.card/-post-ride-card/index.html) | Definition of a post-ride card view. |
| [io.hammerhead.sdk.v0.card.RideDetails](../io.hammerhead.sdk.v0.card/-ride-details/index.html) | Deprecated - Details from a recorded ride. |
| [io.hammerhead.sdk.v0.card.RideDetailsI](../io.hammerhead.sdk.v0.card/-ride-details-i/index.html) | Access to details from a recorded ride. |
| [io.hammerhead.sdk.v0.RideLifecycleListener](../io.hammerhead.sdk.v0/-ride-lifecycle-listener/index.html) | Interface which is called for lifecycle events related to ride. |
| [io.hammerhead.sdk.v0.RideState](../io.hammerhead.sdk.v0/-ride-state/index.html) | Enumeration of ride state |
| [io.hammerhead.sdk.v0.SdkContext](../io.hammerhead.sdk.v0/-sdk-context/index.html) | Context wrapper specifically for use within external code (Karoo SDK Module) while running within the Karoo System. This allows use of the originating packages resources within the Karoo System app context. |
| [io.hammerhead.sdk.v0.datatype.SdkDataType](../io.hammerhead.sdk.v0.datatype/-sdk-data-type/index.html) | Definition of an extended data field to add to the Karoo System. |
| [io.hammerhead.sdk.v0.datatype.formatter.SdkFormatter](../io.hammerhead.sdk.v0.datatype.formatter/-sdk-formatter/index.html) | Abstract class to extend the way data field is formatted. |
| [io.hammerhead.sdk.v0.datatype.transformer.SdkTransformer](../io.hammerhead.sdk.v0.datatype.transformer/-sdk-transformer/index.html) | Abstract class to extend the way data field is formatted. |
| [io.hammerhead.sdk.v0.datatype.view.SdkView](../io.hammerhead.sdk.v0.datatype.view/-sdk-view/index.html) | Abstract class to extend the way data fields are displayed in ride. |

20 changes: 20 additions & 0 deletions docs/0.0.7/karoo-sdk/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: karoo-sdk
---

[karoo-sdk](./index.html)

The top-level module that is provided as the Karoo SDK Android library

### Packages

| [io.hammerhead.sdk.v0](io.hammerhead.sdk.v0/index.html) | Versioned namespace for first-release of Karoo SDK. |
| [io.hammerhead.sdk.v0.card](io.hammerhead.sdk.v0.card/index.html) | Package containing definitions showing card views |
| [io.hammerhead.sdk.v0.datatype](io.hammerhead.sdk.v0.datatype/index.html) | Package containing SDK extensions related to data type definitions |
| [io.hammerhead.sdk.v0.datatype.formatter](io.hammerhead.sdk.v0.datatype.formatter/index.html) | Package containing SDK extensions related to formatting data |
| [io.hammerhead.sdk.v0.datatype.transformer](io.hammerhead.sdk.v0.datatype.transformer/index.html) | Package containing SDK extensions related to transforming data streams |
| [io.hammerhead.sdk.v0.datatype.view](io.hammerhead.sdk.v0.datatype.view/index.html) | Package containing SDK extensions related to displaying data in custom views |

### Index

[All Types](alltypes/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: FitFileListener - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [FitFileListener](./index.html)

# FitFileListener

`interface FitFileListener`

Listener interface which is used in [PostRideCard](../-post-ride-card/index.html) to access
FIT file data as it is decoded.

Use with [RideDetailsI.registerFitFileListener](../-ride-details-i/register-fit-file-listener.html) on [PostRideCard](../-post-ride-card/index.html) construction.

### Functions

| [onDescription](on-description.html) | `open fun onDescription(desc: DeveloperFieldDescription): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Called when a [DeveloperFieldDescription](#) is decoded from the FIT file. |
| [onEndDecoding](on-end-decoding.html) | `abstract fun onEndDecoding(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Called when decoding has finished processing all records. No more calls to [onMesg](on-mesg.html) will be made. |
| [onMesg](on-mesg.html) | `abstract fun onMesg(mesg: Mesg): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Called when a [Mesg](#) is decoded from the FIT file. |
| [onMesgDefinition](on-mesg-definition.html) | `open fun onMesgDefinition(mesgDef: MesgDefinition): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Called when a [MesgDefinition](#) is decoded from the FIT file. |
| [onStartDecoding](on-start-decoding.html) | `abstract fun onStartDecoding(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Called when decoding is started. Calls to [onMesg](on-mesg.html) will start. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: FitFileListener.onDescription - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [FitFileListener](index.html) / [onDescription](./on-description.html)

# onDescription

`open fun onDescription(desc: DeveloperFieldDescription): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Called when a [DeveloperFieldDescription](#) is decoded from the FIT file.

**See Also**

[com.garmin.fit.DeveloperFieldDescriptionListener](#)

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: FitFileListener.onEndDecoding - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [FitFileListener](index.html) / [onEndDecoding](./on-end-decoding.html)

# onEndDecoding

`abstract fun onEndDecoding(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Called when decoding has finished processing all records.
No more calls to [onMesg](on-mesg.html) will be made.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: FitFileListener.onMesgDefinition - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [FitFileListener](index.html) / [onMesgDefinition](./on-mesg-definition.html)

# onMesgDefinition

`open fun onMesgDefinition(mesgDef: MesgDefinition): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Called when a [MesgDefinition](#) is decoded from the FIT file.

**See Also**

[com.garmin.fit.MesgDefinitionListener](#)

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: FitFileListener.onMesg - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [FitFileListener](index.html) / [onMesg](./on-mesg.html)

# onMesg

`abstract fun onMesg(mesg: Mesg): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Called when a [Mesg](#) is decoded from the FIT file.

**See Also**

[com.garmin.fit.MesgListener](#)

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: FitFileListener.onStartDecoding - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [FitFileListener](index.html) / [onStartDecoding](./on-start-decoding.html)

# onStartDecoding

`abstract fun onStartDecoding(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Called when decoding is started.
Calls to [onMesg](on-mesg.html) will start.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: PostRideCard.<init> - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [PostRideCard](index.html) / [&lt;init&gt;](./-init-.html)

# &lt;init&gt;

`PostRideCard(context: `[`SdkContext`](../../io.hammerhead.sdk.v0/-sdk-context/index.html)`, rideDetailsI: `[`RideDetailsI`](../-ride-details-i/index.html)`)``PostRideCard(context: `[`SdkContext`](../../io.hammerhead.sdk.v0/-sdk-context/index.html)`, rideDetails: `[`RideDetails`](../-ride-details/index.html)`?)`

Definition of a post-ride card view.

``` kotlin
class RideCard(context: SdkContext, rideDetails: RideDetailsI) : PostRideCard(context, rideDetails), FitFileListener {
private val elevationPoints = mutableListOf<Double>()
private var elevationPointsReady = false
private var view: View? = null

init {
rideDetailsI.registerFitFileListener(this)
}

override fun createView(layoutInflater: LayoutInflater, parent: ViewGroup): View {
val view = layoutInflater.inflate(R.layout.ride_card_view, parent, false)
rideDetailsI.summaryFields[AppValDataType.TYPE_ID]?.let {
view.finalAppVal.text = AppValFormatter().formatValue(it)
}
view.rideName.text = rideDetailsI.name
view.setOnClickListener {
val detail = Intent().setClassName("io.hammerhead.sample", "io.hammerhead.sample.DetailActivity")
context.startActivity(detail)
}
Timber.d("Strava external ID is ${rideDetailsI.externalIds[STRAVA]}")
if (elevationPointsReady) {
view.elevationBackground.setPoints(elevationPoints)
}
this.view = view
return view
}

override fun onMesg(mesg: Mesg) {
if (mesg.num == 20) {
val record = RecordMesg(mesg)
if (record.hasField(RecordMesg.AltitudeFieldNum)) {
elevationPoints.add(record.getField(RecordMesg.AltitudeFieldNum).doubleValue)
}
}
}

override fun onStartDecoding() {
elevationPoints.clear()
elevationPointsReady = false
}

override fun onEndDecoding() {
view?.elevationBackground?.setPoints(elevationPoints)
elevationPointsReady = true
}
}
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: PostRideCard.context - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [PostRideCard](index.html) / [context](./context.html)

# context

`protected val context: `[`SdkContext`](../../io.hammerhead.sdk.v0/-sdk-context/index.html)

SDK context

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: PostRideCard.createView - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [PostRideCard](index.html) / [createView](./create-view.html)

# createView

`protected abstract fun createView(layoutInflater: `[`LayoutInflater`](https://developer.android.com/reference/android/view/LayoutInflater.html)`, parent: `[`ViewGroup`](https://developer.android.com/reference/android/view/ViewGroup.html)`): `[`View`](https://developer.android.com/reference/android/view/View.html)

Called to inflate the layout or manually create the view
required for this card to show the [rideDetailsI](ride-details-i.html).

### Parameters

`layoutInflater` - to be used for calls to [LayoutInflater.inflate](https://developer.android.com/reference/android/view/LayoutInflater.html#inflate(int, android.view.ViewGroup)) to ensure
access to resources from module's containing APK

`parent` - the parent layout of the view being inflated
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: PostRideCard - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [PostRideCard](./index.html)

# PostRideCard

`abstract class PostRideCard`

Definition of a post-ride card view.

``` kotlin
class RideCard(context: SdkContext, rideDetails: RideDetailsI) : PostRideCard(context, rideDetails), FitFileListener {
private val elevationPoints = mutableListOf<Double>()
private var elevationPointsReady = false
private var view: View? = null

init {
rideDetailsI.registerFitFileListener(this)
}

override fun createView(layoutInflater: LayoutInflater, parent: ViewGroup): View {
val view = layoutInflater.inflate(R.layout.ride_card_view, parent, false)
rideDetailsI.summaryFields[AppValDataType.TYPE_ID]?.let {
view.finalAppVal.text = AppValFormatter().formatValue(it)
}
view.rideName.text = rideDetailsI.name
view.setOnClickListener {
val detail = Intent().setClassName("io.hammerhead.sample", "io.hammerhead.sample.DetailActivity")
context.startActivity(detail)
}
Timber.d("Strava external ID is ${rideDetailsI.externalIds[STRAVA]}")
if (elevationPointsReady) {
view.elevationBackground.setPoints(elevationPoints)
}
this.view = view
return view
}

override fun onMesg(mesg: Mesg) {
if (mesg.num == 20) {
val record = RecordMesg(mesg)
if (record.hasField(RecordMesg.AltitudeFieldNum)) {
elevationPoints.add(record.getField(RecordMesg.AltitudeFieldNum).doubleValue)
}
}
}

override fun onStartDecoding() {
elevationPoints.clear()
elevationPointsReady = false
}

override fun onEndDecoding() {
view?.elevationBackground?.setPoints(elevationPoints)
elevationPointsReady = true
}
}
```

### Constructors

| [&lt;init&gt;](-init-.html) | `PostRideCard(context: `[`SdkContext`](../../io.hammerhead.sdk.v0/-sdk-context/index.html)`, rideDetailsI: `[`RideDetailsI`](../-ride-details-i/index.html)`)``PostRideCard(context: `[`SdkContext`](../../io.hammerhead.sdk.v0/-sdk-context/index.html)`, rideDetails: `[`RideDetails`](../-ride-details/index.html)`?)`<br>Definition of a post-ride card view. |

### Properties

| [context](context.html) | `val context: `[`SdkContext`](../../io.hammerhead.sdk.v0/-sdk-context/index.html)<br>SDK context |
| [rideDetails](ride-details.html) | `val ~~rideDetails~~: `[`RideDetails`](../-ride-details/index.html)`?`<br>Deprecated - use [rideDetailsI](ride-details-i.html) |
| [rideDetailsI](ride-details-i.html) | `lateinit var rideDetailsI: `[`RideDetailsI`](../-ride-details-i/index.html) |

### Functions

| [createView](create-view.html) | `abstract fun createView(layoutInflater: `[`LayoutInflater`](https://developer.android.com/reference/android/view/LayoutInflater.html)`, parent: `[`ViewGroup`](https://developer.android.com/reference/android/view/ViewGroup.html)`): `[`View`](https://developer.android.com/reference/android/view/View.html)<br>Called to inflate the layout or manually create the view required for this card to show the [rideDetailsI](ride-details-i.html). |

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: PostRideCard.rideDetailsI - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [PostRideCard](index.html) / [rideDetailsI](./ride-details-i.html)

# rideDetailsI

`protected lateinit var rideDetailsI: `[`RideDetailsI`](../-ride-details-i/index.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: PostRideCard.rideDetails - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [PostRideCard](index.html) / [rideDetails](./ride-details.html)

# rideDetails

`protected val ~~rideDetails~~: `[`RideDetails`](../-ride-details/index.html)`?`
**Deprecated:** legacy member

Deprecated - use [rideDetailsI](ride-details-i.html)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: RideDetailsI.KOMOOT - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [RideDetailsI](index.html) / [KOMOOT](./-k-o-m-o-o-t.html)

# KOMOOT

`@JvmField val KOMOOT: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)

Value representing string key for Komoot in `externalIds`

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: RideDetailsI.RIDE_WITH_GPS - karoo-sdk
---

[karoo-sdk](../../index.html) / [io.hammerhead.sdk.v0.card](../index.html) / [RideDetailsI](index.html) / [RIDE_WITH_GPS](./-r-i-d-e_-w-i-t-h_-g-p-s.html)

# RIDE_WITH_GPS

`@JvmField val RIDE_WITH_GPS: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)

Value representing string key for RideWithGPS in `externalIds`

Loading

0 comments on commit 3cfdd29

Please sign in to comment.