Skip to content

Resources

roosit edited this page May 9, 2026 · 5 revisions

Plugin resources

Русский

Description of all files in src/main/resources/: what is there, why it is needed, and how to add something new. These resources are packaged into the plugin jar and are available at runtime through ClassLoader.getResourceAsStream(...) (flat paths from the jar root).

Structure

src/main/resources/
├── sql/setup/          → plugin DB migrations
│   └── create.sql
├── strings/            → localization
│   ├── strings.properties        (EN)
│   └── strings_ru.properties     (RU)
├── svg/                → indicator SVG graphics
│   ├── compass.svg
│   └── speedometer/
│       ├── background.svg
│       ├── delimiter.svg
│       ├── arrow.svg, arrow_tail.svg
│       └── numeric_40.svg, numeric_80.svg, numeric_160.svg, numeric_320.svg
└── templates/          → default Mixel templates for source types
    ├── video.vttp, gpx.vttp
    ├── thumbnail-video.vttp, thumbnail-gpx.vttp
    └── README.md

sql/setup/ — plugin DB

The plugin owns its own SQLite DB (see getDbVersion() = 1 in VelitaskPlagin). When the plugin is first installed into a project, the SDK executes create.sql; on later version bumps, it executes upgrade-N.sql (from the current version to the new one).

Current schema (v1):

  • slope_groups — aggregates of slope segments (ascent/descent/flat), calculated in onSourceImported through SlopeDetector. SlopeText, SlopeChart, and SlopeSpeed depend on them.
  • slope_atom_groups — mapping atom_id → group_id (atoms from core sensors_slope_data ↔ groups from slope_groups).

SQL uses placeholders ${table:slope_groups} — at runtime, the plugin-prefixed table name is substituted to avoid collisions with other plugins.

How to add a migration: when changing the schema, bump getDbVersion() (for example 1 → 2), create sql/setup/upgrade-2.sql with SQL ALTER TABLE / CREATE TABLE. The SDK will run the upgrade automatically on projects with the old version.

strings/ — localization

Two files, in standard Java .properties format:

  • strings.properties — English localization (default).
  • strings_ru.properties — Russian localization.

Keys are built by the schema Plugin.Indicator.<name>.<property> — for example Plugin.Indicator.compass.title, Plugin.Indicator.distanceText.tags. This matches the KEY constant inside each indicator.

The plugin loads both locales (see defineAdditionLocales() — it returns ["ru"] in addition to the UI locale). This guarantees that Russian strings are available even when the UI is launched with the English locale.

Encoding — direct UTF-8. Cyrillic is written as regular text, without \uXXXX escapes (see DOCS_GUIDE.md and the project's general rule).

Consistency check: during build, the Gradle task checkLocalization (see build.gradle) compares keys used in code through localized(...) with both files. Any missing key is a release blocker (see RELEASING.md, Step 1).

svg/ — indicator graphics

Indicator raster graphics are made through SVG for scalability. SVG is loaded through SvgProperty with .bind(selector, attr, ColorProperty) — at runtime, the current user colors are substituted into the attributes of SVG elements.

Files:

  • svg/compass.svg — compass. Used by CompassIndicator with binds .body / .ring / .tick / .needle-n / .needle-s to user colors.
  • svg/speedometer/ — five SVG files for the speedometer, used by SpeedometerIndicator:
    • background.svg — round background (bind .ring).
    • delimiter.svg — scale ticks (bind .tick).
    • numeric_40.svg, numeric_80.svg, numeric_160.svg, numeric_320.svg — four variants of scale numbers (bind .number); the indicator selects one of the four by mSpeedScale.
    • arrow.svg — needle (bind .arrow-body for fill and stroke).
    • arrow_tail.svg — tail-sector line (bind .tail for stroke).

CSS class naming convention: selectors .body, .ring, .tick, .needle-*, .arrow-*, .number are stable; indicator binds depend on them. When editing SVG, do not rename classes — otherwise .bind(...) will stop finding elements.

How to add a new SVG:

  1. Put the file in svg/ (or a subfolder if there are several resources).
  2. Declare SvgProperty in the indicator with this path: new SvgProperty("name", "svg/file.svg").
  3. Add .bind(...) for each configurable color — the selector in the SVG must be styled through <style> or be the fill/stroke attribute of an element.

templates/ — default Mixel templates

.vttp files are JSON snapshots of a Mixel composition for typical source types. They are used as the last fallback when the project has no template of its own and there is also nothing in the user's templates folder. Without them, opening a new source would produce an empty Mixel and a "configure the layout" notification.

Files:

File When it is used
video.vttp Default Mixel for a VIDEO source (mp4, mov)
gpx.vttp Default Mixel for a GPX source
thumbnail-video.vttp Thumbnail render for VIDEO in the project browser
thumbnail-gpx.vttp Thumbnail render for GPX in the project browser

File names = SourceType.name().toLowerCase() from the SDK (video, gpx, image, telemiger). To add a default for a new type, put <type>.vttp.

Update workflow:

  1. Launch Velitask and open a representative source.
  2. Configure Mixel: indicators, sizes, positions.
  3. File → Export Template → save .vttp.
  4. Copy the exported file into this folder under the required name.
  5. Rebuild the distribution: cd ../../../../distrib && ./gradlew rebuildStage -Pname=plugin-official && ./gradlew assembleRelease.

.vttp format — full JSON snapshot of Mixel, product of mixel.toJSON(true). Layers reference indicators by UID <plugin-uid>.<indicator-name> (for example com.velitask.plagin.official.geoMap). When loading through mixel.fromJSON(json, true):

  • Indicators not registered in the current PlaginsManager are silently skipped — this lets the template work even if some plugins are not loaded.
  • Properties of type SensorProperty / SourceProperty receive applyDefaultSource(...) automatically — sensor/source IDs are not hardcoded into the template.

Current templates are MVP placeholders with a minimal layout. Most likely they will be rewritten into full ones when leaving beta.

Useful links

Clone this wiki locally