Skip to content

Commit

Permalink
brand features can now be loaded lazily per-country
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Feb 14, 2022
1 parent fcf0740 commit 784f631
Show file tree
Hide file tree
Showing 17 changed files with 359 additions and 175 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Requires Java 8.

## Installation

Add [`de.westnordost:osmfeatures:3.0`](https://mvnrepository.com/artifact/de.westnordost/osmfeatures/3.0/) as a Maven dependency or download the jar from there.
Add [`de.westnordost:osmfeatures:4.0`](https://mvnrepository.com/artifact/de.westnordost/osmfeatures/4.0/) as a Maven dependency or download the jar from there.

For Android, use [`de.westnordost:osmfeatures-android:3.0`](https://mvnrepository.com/artifact/de.westnordost/osmfeatures-android/3.0/).
For Android, use [`de.westnordost:osmfeatures-android:4.0`](https://mvnrepository.com/artifact/de.westnordost/osmfeatures-android/4.0/).

## Usage

Expand Down
8 changes: 4 additions & 4 deletions library-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'signing'
}

version = "3.0"
version = "4.0"
group "de.westnordost"

repositories {
Expand All @@ -15,18 +15,18 @@ repositories {

dependencies {
//api (project(':library')) {
api ('de.westnordost:osmfeatures:3.0') {
api ('de.westnordost:osmfeatures:4.0') {
// it's already included in Android
exclude group: 'org.json', module: 'json'
}
}

android {
compileSdkVersion 29
compileSdkVersion 31

defaultConfig {
minSdkVersion 9
targetSdkVersion 29
targetSdkVersion 31
versionCode 1
versionName project.version
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import android.content.res.AssetManager;

import java.util.Arrays;

public class AndroidFeatureDictionary
{
private AndroidFeatureDictionary() {} // cannot be instantiated
Expand All @@ -16,13 +14,13 @@ public static FeatureDictionary create(AssetManager assetManager, String presets
/** Create a new FeatureDictionary which gets its data from the given directory in the app's
* asset folder. Optionally, the path to the brand presets can be specified. */
public static FeatureDictionary create(AssetManager assetManager, String presetsBasePath, String brandPresetsBasePath) {
FeatureCollection featureCollection =
new IDFeatureCollection(new AssetManagerAccess(assetManager, presetsBasePath));
LocalizedFeatureCollection featureCollection =
new IDLocalizedFeatureCollection(new AssetManagerAccess(assetManager, presetsBasePath));

FeatureCollection brandsFeatureCollection = brandPresetsBasePath != null
? new IDBaseFeatureCollection(new AssetManagerAccess(assetManager, brandPresetsBasePath))
PerCountryFeatureCollection brandsFeatureCollection = brandPresetsBasePath != null
? new IDBrandPresetsFeatureCollection(new AssetManagerAccess(assetManager, brandPresetsBasePath))
: null;

return new FeatureDictionary(Arrays.asList(featureCollection), Arrays.asList(brandsFeatureCollection));
return new FeatureDictionary(featureCollection, brandsFeatureCollection);
}
}
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'signing'
}

version = "3.0"
version = "4.0"
group "de.westnordost"

repositories {
Expand Down
Loading

0 comments on commit 784f631

Please sign in to comment.