Skip to content

Commit

Permalink
Extract :map, split up :data and :model (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob authored Dec 20, 2023
1 parent 1361691 commit 8ad797a
Show file tree
Hide file tree
Showing 183 changed files with 538 additions and 228 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
run: |
curl --silent --show-error --location --remote-name \
https://github.com/TWiStErRob/net.twisterrob.travel/releases/download/v1.0.0/LULDLRRiverTramCable.zip
mkdir -p temp/feed15/LULDLRRiverTramCable
unzip LULDLRRiverTramCable.zip 'tfl_*-*-_-y05-*.xml' -d temp/feed15/LULDLRRiverTramCable
mkdir -p data/feed15/LULDLRRiverTramCable
unzip LULDLRRiverTramCable.zip 'tfl_*-*-_-y05-*.xml' -d data/feed15/LULDLRRiverTramCable
- name: "Build project."
working-directory: .
Expand Down
5 changes: 4 additions & 1 deletion android/app/full/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ android.defaultConfig.version {
dependencies {
implementation(projects.android.component.android)
implementation(projects.android.component.data)
implementation(projects.android.component.map)
implementation(projects.android.component.theme)
implementation(projects.android.feature.range)
implementation(projects.common.feed.feeds)
implementation(projects.common.feed.facilities)
implementation(projects.common.feed.trackernet)
implementation("net.twisterrob.lib:twister-lib-android-monolith")
implementation("net.twisterrob.lib:twister-lib-android-basics")
implementation("net.twisterrob.lib:twister-lib-android-slf4j")
Expand All @@ -20,7 +24,6 @@ dependencies {
implementation("net.twisterrob.lib:twister-lib-android-about")
implementation("net.twisterrob.lib:twister-lib-android-settings")

implementation(libs.gms.maps)
implementation(libs.jsr305)
implementation(libs.androidx.swiperefreshlayout)
}
4 changes: 2 additions & 2 deletions android/app/full/src/debug/res/values/overrides.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>

<string name="app_name">!Better London Travel</string>
<!-- Debug 3A:01:32:8E:53:38:57:08:8F:6C:0D:2D:2F:9C:1C:0E:5A:35:96:44;net.twisterrob.blt.debug -->
<string name="gms_key_geo">AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA</string>

</resources>
7 changes: 0 additions & 7 deletions android/app/full/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
android:theme="@style/AppTheme.Default"
>

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/gms_key_geo" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<provider
android:name="net.twisterrob.blt.android.ui.StationSuggestProvider"
android:authorities="${applicationId}.suggest_station"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public App() {

@Override public void onCreate() {
super.onCreate();
Stringers.register(StringerRepo.INSTANCE);
RangeStringers.register(StringerRepo.INSTANCE);
m_static = new AndroidDBStaticData(db());
}

Expand Down
4 changes: 0 additions & 4 deletions android/app/full/src/release/res/values/overrides.xml

This file was deleted.

3 changes: 0 additions & 3 deletions android/app/range/src/debug/res/values/overrides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

<string name="app_name">!Tube Range Map</string>

<!-- Debug 3A:01:32:8E:53:38:57:08:8F:6C:0D:2D:2F:9C:1C:0E:5A:35:96:44;net.twisterrob.blt.range.debug -->
<string name="gms_key_geo">AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA</string>

</resources>
7 changes: 0 additions & 7 deletions android/app/range/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
android:theme="@style/AppTheme.Default"
>

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/gms_key_geo" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity
android:name="net.twisterrob.blt.android.ui.activity.StandaloneRangeMapActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import net.twisterrob.android.app.BaseApp;
import net.twisterrob.android.log.AndroidLoggerFactory;
import net.twisterrob.android.utils.tostring.stringers.detailed.Stringers;
import net.twisterrob.android.utils.tostring.stringers.detailed.RangeStringers;
import net.twisterrob.blt.android.BuildConfig;
import net.twisterrob.blt.android.Injector;
import net.twisterrob.blt.android.data.AndroidDBStaticData;
Expand All @@ -24,7 +24,7 @@ public class App extends BaseApp implements Injector.Provider {

@Override public void onCreate() {
super.onCreate();
Stringers.register(StringerRepo.INSTANCE);
RangeStringers.register(StringerRepo.INSTANCE);
this.injector = createInjector(this);
}

Expand Down
9 changes: 6 additions & 3 deletions android/component/data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@ plugins {
id("net.twisterrob.travel.android-library")
}

configurations.create("database")

dependencies {
api(projects.common.model)
api(projects.common.data.static)
implementation("net.twisterrob.lib:twister-lib-android-monolith")
implementation("net.twisterrob.lib:twister-lib-android-basics")
implementation("net.twisterrob.lib:twister-lib-android-slf4j")
database(projects.common.data.postcodes) { targetConfiguration = "output" }
database(projects.common.data.network) { targetConfiguration = "output" }
}

// TODO this is hacky, replace with proper publishing things after :common:data is split up.
abstract class GenerateDatabase extends Copy {

@Internal("An intermediate property to satisfy AGP, tracked in destination.")
abstract DirectoryProperty getOutput()
}

def generateDataBase = tasks.register("generateDataBase", GenerateDatabase.class) {
dependsOn(":common:data:runNetwork", ":common:data:runPostCode")
from(new File(project(":common:data").projectDir, "output")) {
from(configurations.database) {
include("*.data.*.sql")
}
into(output)
Expand Down
12 changes: 12 additions & 0 deletions android/component/map/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id("net.twisterrob.travel.android-library")
}

dependencies {
implementation(projects.common.maptiler)
api(libs.gms.maps)
implementation(libs.slf4j.api)
implementation(libs.androidx.fragment)
implementation("net.twisterrob.lib:twister-lib-android-stringers")
implementation("net.twisterrob.lib:twister-lib-stringer")
}
7 changes: 7 additions & 0 deletions android/component/map/src/debug/res/values/keys.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>

<!-- Debug 3A:01:32:8E:53:38:57:08:8F:6C:0D:2D:2F:9C:1C:0E:5A:35:96:44;net.twisterrob.blt.debug -->
<!-- Debug 3A:01:32:8E:53:38:57:08:8F:6C:0D:2D:2F:9C:1C:0E:5A:35:96:44;net.twisterrob.blt.range.debug -->
<string name="gms_key_geo">AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA</string>

</resources>
17 changes: 17 additions & 0 deletions android/component/map/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
>

<application>

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/gms_key_geo" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package net.twisterrob.android.utils.tostring.stringers.detailed;

import javax.annotation.Nonnull;

import com.google.android.gms.maps.model.LatLngBounds;

import androidx.annotation.NonNull;

import net.twisterrob.java.utils.tostring.*;

public class LatLngBoundsStringer extends Stringer<LatLngBounds> {
@Override public String getType(LatLngBounds object) {
return "LatLngBounds";
}
@Override public void toString(@Nonnull ToStringAppender append, LatLngBounds bounds) {
@Override public void toString(@NonNull ToStringAppender append, LatLngBounds bounds) {
append.complexProperty("SW", bounds.southwest);
append.complexProperty("NE", bounds.northeast);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package net.twisterrob.android.utils.tostring.stringers.detailed;

import javax.annotation.Nonnull;

import com.google.android.gms.maps.model.LatLng;

import androidx.annotation.NonNull;

import net.twisterrob.java.utils.tostring.*;

public class LatLngStringer extends Stringer<LatLng> {
@Override public String getType(LatLng object) {
return "LatLng";
}
@Override public void toString(@Nonnull ToStringAppender append, LatLng latlng) {
@Override public void toString(@NonNull ToStringAppender append, LatLng latlng) {
append.formattedProperty(null, null, "%f,%f", latlng.latitude, latlng.longitude);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import com.google.android.gms.common.api.Status;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.libraries.places.api.model.Place;

import net.twisterrob.java.utils.tostring.StringerRepo;

public class Stringers {
public class MapStringers {

public static void register(StringerRepo repo) {
repo.register(Status.class, new StatusStringer());
repo.register(Place.class, new PlaceStringer());
repo.register(LatLng.class, new LatLngStringer());
repo.register(LatLngBounds.class, new LatLngBoundsStringer());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package net.twisterrob.android.utils.tostring.stringers.detailed;

import javax.annotation.Nonnull;

import android.annotation.SuppressLint;

import com.google.android.gms.common.api.Status;

import androidx.annotation.NonNull;

import net.twisterrob.java.utils.tostring.*;

public class StatusStringer extends Stringer<Status> {
@SuppressLint("VisibleForTests")
@Override public void toString(@Nonnull ToStringAppender append, Status status) {
@Override public void toString(@NonNull ToStringAppender append, Status status) {
append.rawProperty("code", status.getStatusCode());
append.rawProperty("message", status.getStatusMessage());
append.booleanProperty(status.isSuccess(), "success");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import androidx.core.util.Pools;
import android.text.TextPaint;

import com.bumptech.glide.util.Util;
import com.google.android.gms.maps.model.Tile;

public abstract class GeneratedGeoTileProvider extends GeoTileProvider {
Expand All @@ -31,7 +30,7 @@ protected GeneratedGeoTileProvider(int tileSize) {
+ "drawing a {}x{} Bitmap ({} bytes) compressed into {} bytes "
+ "took {} ms (create = {} ms, draw = {} ms, compress = {} ms)",
x, y, zoom,
bitmap.getWidth(), bitmap.getHeight(), Util.getBitmapByteSize(bitmap), tile.data.length,
bitmap.getWidth(), bitmap.getHeight(), bitmap.getAllocationByteCount(), tile.data.length,
converted - begin, created - begin, drawn - created, converted - drawn);
return tile;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources>

<!-- Release F6:35:98:18:C9:2F:99:F9:60:F3:74:EA:CA:73:45:93:24:F6:E2:60;net.twisterrob.blt -->
<!-- Release F6:35:98:18:C9:2F:99:F9:60:F3:74:EA:CA:73:45:93:24:F6:E2:60;net.twisterrob.blt.range -->
<string name="gms_key_geo">AIzaSyB6qc9WlSDbaNGO-c-mnu8ajlq3jroh2E4</string>

Expand Down
2 changes: 1 addition & 1 deletion android/feature/range/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
dependencies {
implementation(projects.android.component.android)
implementation(projects.android.component.data)
implementation(projects.android.component.map)
implementation(projects.android.component.theme)

api("net.twisterrob.lib:twister-lib-android-monolith") // api because AppCompatActivity.
Expand All @@ -17,7 +18,6 @@ dependencies {
implementation("net.twisterrob.lib:twister-lib-android-settings")

implementation(projects.common.model)
implementation(libs.gms.maps)
implementation(libs.gms.places)
implementation(libs.jsr305)
implementation(libs.glide)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.twisterrob.android.utils.tostring.stringers.detailed;

import com.google.android.libraries.places.api.model.Place;

import net.twisterrob.java.utils.tostring.StringerRepo;

public class RangeStringers {

public static void register(StringerRepo repo) {
MapStringers.register(repo);
repo.register(Place.class, new PlaceStringer());
}
}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ idea {
file(".gradle"),
file("build"),
file(".idea"),
file("data"),
file("temp"),
]
}
Expand Down
Loading

0 comments on commit 8ad797a

Please sign in to comment.