diff --git a/.github/workflows/CI-build.yml b/.github/workflows/CI-build.yml index 14892886..31519ef4 100644 --- a/.github/workflows/CI-build.yml +++ b/.github/workflows/CI-build.yml @@ -50,13 +50,14 @@ jobs: --continue --no-build-cache build - :AppEngine:appengineStage + :web:status-history:appengineStage - name: "Upload 'Unit Test Results' artifact." if: success() || failure() uses: actions/upload-artifact@v3 with: name: 'Unit Test Results' + if-no-files-found: error path: ${{ github.workspace }}/**/build/reports/tests/*/ - name: "Upload 'Android Lint Results' artifact." @@ -64,6 +65,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: 'Android Lint Results' + if-no-files-found: error path: ${{ github.workspace }}/**/build/reports/lint-results* - name: "Publish 'Unit Results' check suite." @@ -81,6 +83,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: 'APKs' + if-no-files-found: error path: | ${{ github.workspace }}/**/build/outputs/apk/ ${{ github.workspace }}/**/build/outputs/mapping/ diff --git a/Android/build.gradle b/Android/build.gradle deleted file mode 100644 index 760518bf..00000000 --- a/Android/build.gradle +++ /dev/null @@ -1,106 +0,0 @@ -//name = "Better London Travel Android App" -plugins { - id("net.twisterrob.blt.convention") - id("net.twisterrob.gradle.plugin.android-app") - id("com.android.application") -} - -dependencies { - implementation("net.twisterrob.lib:twister-lib-android-monolith") - implementation("net.twisterrob.lib:twister-lib-android-basics") - implementation("net.twisterrob.lib:twister-lib-android-slf4j") - implementation("net.twisterrob.lib:twister-lib-android-widgets") - implementation("net.twisterrob.lib:twister-lib-android-stringers") - - implementation("net.twisterrob.lib:twister-lib-android-about") - implementation("net.twisterrob.lib:twister-lib-android-color_picker") - implementation("net.twisterrob.lib:twister-lib-android-settings") - - implementation(projects.shared) { - exclude module: "android-polyfill" - } - implementation(libs.gms.maps) - implementation(libs.gms.places) - implementation(libs.jsr305) - implementation(libs.glide) - implementation(libs.androidx.swiperefreshlayout) - - testImplementation(projects.shared.testHelpers) -} - -android { - namespace = "net.twisterrob.blt.android" - compileSdk = 34 - defaultConfig { - minSdk = 21 - targetSdk = 21 - version { - major = 1 - } - } - twisterrob { - decorateBuildConfig = false - } - buildTypes { - release { - minifyEnabled true - shrinkResources true - } - debug { - // twister-lib-android only has release build type - matchingFallbacks = [ "release" ] - } - } - buildFeatures { - buildConfig = true - } - lint { - checkAllWarnings = true - warningsAsErrors = true - checkDependencies = true - lintConfig = rootProject.file("config/lint/lint.xml") - baseline = rootProject.file("config/lint/lint-baseline.xml") - } - flavorDimensions += "app-build" - productFlavors { - full { - // default - applicationId = "net.twisterrob.blt" - dimension("app-build") - } - range { - applicationId = "net.twisterrob.blt.range" - dimension("app-build") - } - } - packagingOptions { - // TODEL https://issuetracker.google.com/issues/312677256 - exclude("META-INF/services/io.grpc.LoadBalancerProvider") - exclude("META-INF/services/io.grpc.NameResolverProvider") - } -} - -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(":Data:runNetwork", ":Data:runPostCode") - from(new File(projects.data.dependencyProject.projectDir, "output")) { - include("*.data.*.sql") - } - into(output) -} -androidComponents { - onVariants(selector().all()) { variant -> - variant.sources.assets.addGeneratedSourceDirectory(generateDataBase, { it.output }) - afterEvaluate { - tasks.named("generate${variant.name.capitalize()}Assets").configure { - // This should be not necessary with addGeneratedSourceDirectory, but without this, it doesn't work. - dependsOn(generateDataBase) - } - } - } -} diff --git a/Android/src/main/java/net/twisterrob/android/map/MapFragment.java b/Android/src/main/java/net/twisterrob/android/map/MapFragment.java deleted file mode 100644 index deea9f96..00000000 --- a/Android/src/main/java/net/twisterrob/android/map/MapFragment.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.twisterrob.android.map; - -import android.content.Context; -import android.os.*; -import android.util.AttributeSet; - -import com.google.android.gms.maps.SupportMapFragment; - -import androidx.annotation.NonNull; - -public class MapFragment extends SupportMapFragment { - @Override public void onInflate(@NonNull Context context, @NonNull AttributeSet attrs, Bundle savedInstanceState) { - StrictMode.ThreadPolicy originalPolicy = StrictMode.allowThreadDiskReads(); - try { - super.onInflate(context, attrs, savedInstanceState); - } finally { - StrictMode.setThreadPolicy(originalPolicy); - } - } -} diff --git a/Android/src/range/AndroidManifest.xml b/Android/src/range/AndroidManifest.xml deleted file mode 100644 index 0f80d8d2..00000000 --- a/Android/src/range/AndroidManifest.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Android/src/range/res/values/overrides.xml b/Android/src/range/res/values/overrides.xml deleted file mode 100644 index 3d2f78a8..00000000 --- a/Android/src/range/res/values/overrides.xml +++ /dev/null @@ -1,3 +0,0 @@ - - @string/launcher__range_map - diff --git a/Android/src/rangeDebug/res/values/overrides.xml b/Android/src/rangeDebug/res/values/overrides.xml deleted file mode 100644 index b1e553da..00000000 --- a/Android/src/rangeDebug/res/values/overrides.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - @string/launcher__range_map - !Tube Range Map - diff --git a/Shared/diff/build.gradle b/Shared/diff/build.gradle deleted file mode 100644 index 83f046b2..00000000 --- a/Shared/diff/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - id("net.twisterrob.blt.convention") - id("org.gradle.java-library") - id("net.twisterrob.gradle.plugin.java") -} - -java { - sourceCompatibility = libs.versions.java.asProvider().get() - targetCompatibility = libs.versions.java.asProvider().get() -} diff --git a/android/app/full/build.gradle b/android/app/full/build.gradle new file mode 100644 index 00000000..cf1952fb --- /dev/null +++ b/android/app/full/build.gradle @@ -0,0 +1,26 @@ +plugins { + id("net.twisterrob.travel.android-app") +} + +android.defaultConfig.applicationId = "net.twisterrob.blt" +android.defaultConfig.version { + major = 1 +} + +dependencies { + implementation(projects.android.component.android) + implementation(projects.android.component.data) + implementation(projects.android.component.theme) + implementation(projects.android.feature.range) + implementation("net.twisterrob.lib:twister-lib-android-monolith") + implementation("net.twisterrob.lib:twister-lib-android-basics") + implementation("net.twisterrob.lib:twister-lib-android-slf4j") + implementation("net.twisterrob.lib:twister-lib-android-stringers") + + 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) +} diff --git a/Android/src/debug/res/values/overrides.xml b/android/app/full/src/debug/res/values/overrides.xml similarity index 100% rename from Android/src/debug/res/values/overrides.xml rename to android/app/full/src/debug/res/values/overrides.xml diff --git a/Android/src/main/AndroidManifest.xml b/android/app/full/src/main/AndroidManifest.xml similarity index 83% rename from Android/src/main/AndroidManifest.xml rename to android/app/full/src/main/AndroidManifest.xml index 413b42b9..309bd039 100644 --- a/Android/src/main/AndroidManifest.xml +++ b/android/app/full/src/main/AndroidManifest.xml @@ -27,14 +27,14 @@ android:value="@integer/google_play_services_version" /> @@ -59,7 +59,7 @@ @@ -69,7 +69,7 @@ @@ -85,7 +85,7 @@ @@ -95,7 +95,7 @@ @@ -105,7 +105,7 @@ @@ -115,7 +115,7 @@ + diff --git a/Android/src/main/assets/local.prop b/android/app/full/src/main/assets/local.prop similarity index 100% rename from Android/src/main/assets/local.prop rename to android/app/full/src/main/assets/local.prop diff --git a/Android/src/main/java/net/twisterrob/android/utils/concurrent/MailSenderAsyncTask.java b/android/app/full/src/main/java/net/twisterrob/android/utils/concurrent/MailSenderAsyncTask.java similarity index 100% rename from Android/src/main/java/net/twisterrob/android/utils/concurrent/MailSenderAsyncTask.java rename to android/app/full/src/main/java/net/twisterrob/android/utils/concurrent/MailSenderAsyncTask.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/App.java b/android/app/full/src/main/java/net/twisterrob/blt/android/App.java similarity index 81% rename from Android/src/main/java/net/twisterrob/blt/android/App.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/App.java index f22007fd..96cc7c65 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/App.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/App.java @@ -5,22 +5,18 @@ import androidx.annotation.NonNull; import android.widget.Toast; -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.android.AndroidConstants; import net.twisterrob.android.app.BaseApp; import net.twisterrob.android.log.AndroidLoggerFactory; import net.twisterrob.android.utils.concurrent.*; import net.twisterrob.android.utils.tostring.stringers.detailed.*; +import net.twisterrob.blt.android.app.full.BuildConfig; import net.twisterrob.blt.android.data.*; import net.twisterrob.blt.android.db.DataBaseHelper; import net.twisterrob.blt.io.feeds.*; import net.twisterrob.java.utils.tostring.StringerRepo; -public class App extends BaseApp { +public class App extends BaseApp implements Injector.Provider { static { AndroidLoggerFactory.addReplacement("^net\\.twisterrob\\.blt\\.android\\.(.+\\.)?", ""); AndroidLoggerFactory.addReplacement("^net\\.twisterrob\\.blt\\.(.+\\.)?", ""); @@ -48,15 +44,12 @@ public App() { @Override public void onCreate() { super.onCreate(); - StringerRepo.INSTANCE.register(Status.class, new StatusStringer()); - StringerRepo.INSTANCE.register(Place.class, new PlaceStringer()); - StringerRepo.INSTANCE.register(LatLng.class, new LatLngStringer()); - StringerRepo.INSTANCE.register(LatLngBounds.class, new LatLngBoundsStringer()); + Stringers.register(StringerRepo.INSTANCE); m_static = new AndroidDBStaticData(db()); } @Override protected Object createDatabase() { - DataBaseHelper db = new DataBaseHelper(this); + DataBaseHelper db = new DataBaseHelper(this, BuildConfig.DEBUG); @SuppressWarnings({"unused", "deprecation"}) // TODO https://github.com/TWiStErRob/net.twisterrob.travel/issues/15 Object task = new BackgroundExecution(new Runnable() { @Override public void run() { @@ -92,4 +85,14 @@ public static void sendMail(String body) { } }.execute(body); } + + @SuppressWarnings("deprecation") + @Override public Injector injector() { + return new net.twisterrob.blt.android.ui.activity.Injector( + new BuildConfigWrapper(), + m_static, + db(), + prefs() + ); + } } diff --git a/android/app/full/src/main/java/net/twisterrob/blt/android/BuildConfigWrapper.java b/android/app/full/src/main/java/net/twisterrob/blt/android/BuildConfigWrapper.java new file mode 100644 index 00000000..8240a973 --- /dev/null +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/BuildConfigWrapper.java @@ -0,0 +1,14 @@ +package net.twisterrob.blt.android; + +import net.twisterrob.blt.android.app.full.BuildConfig; + +public class BuildConfigWrapper implements net.twisterrob.blt.android.BuildConfig { + + @Override public boolean isDebug() { + return BuildConfig.DEBUG; + } + + @Override public String applicationId() { + return BuildConfig.APPLICATION_ID; + } +} diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java b/android/app/full/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/io/feeds/DownloadFeedTask.java b/android/app/full/src/main/java/net/twisterrob/blt/android/io/feeds/DownloadFeedTask.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/io/feeds/DownloadFeedTask.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/io/feeds/DownloadFeedTask.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/DownloadFilesTask.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/DownloadFilesTask.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/ui/DownloadFilesTask.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/DownloadFilesTask.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/ListViewHandler.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/ListViewHandler.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/ui/ListViewHandler.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/ListViewHandler.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/StationSuggestProvider.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/StationSuggestProvider.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/StationSuggestProvider.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/StationSuggestProvider.java index 93e99969..4bafc015 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/StationSuggestProvider.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/StationSuggestProvider.java @@ -11,7 +11,8 @@ import android.provider.BaseColumns; import androidx.annotation.NonNull; -import net.twisterrob.blt.android.*; +import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.app.full.BuildConfig; import net.twisterrob.blt.android.db.model.Station; public class StationSuggestProvider extends ContentProvider { diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/BaseActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/BaseActivity.java similarity index 94% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/BaseActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/BaseActivity.java index df1a2d80..202bf0d8 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/BaseActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/BaseActivity.java @@ -5,7 +5,7 @@ import android.view.*; import android.widget.ListView; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; public abstract class BaseActivity extends AppCompatActivity { @Override public void setContentView(@LayoutRes int layoutResID) { diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/PostCodesActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/PostCodesActivity.java similarity index 97% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/PostCodesActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/PostCodesActivity.java index dbeb0d44..29cfa2be 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/PostCodesActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/PostCodesActivity.java @@ -19,8 +19,8 @@ import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.PolygonOptions; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.data.LocationUtils; import net.twisterrob.blt.android.db.model.AreaHullPoint; import net.twisterrob.java.model.Location; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/PredictionSummaryActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/PredictionSummaryActivity.java similarity index 99% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/PredictionSummaryActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/PredictionSummaryActivity.java index aab5ec1b..bef34f57 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/PredictionSummaryActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/PredictionSummaryActivity.java @@ -16,7 +16,7 @@ import net.twisterrob.android.utils.concurrent.AsyncTaskResult; import net.twisterrob.android.utils.tools.BundleTools; import net.twisterrob.android.utils.tools.IntentTools; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.io.feeds.DownloadFeedTask; import net.twisterrob.blt.android.ui.ListViewHandler; import net.twisterrob.blt.android.ui.adapter.PredictionSummaryAdapter; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationInfoActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationInfoActivity.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationInfoActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationInfoActivity.java index 5b547a3a..48df158c 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationInfoActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationInfoActivity.java @@ -11,8 +11,8 @@ import net.twisterrob.android.utils.concurrent.AsyncTaskResult; import net.twisterrob.android.utils.tools.IntentTools; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.io.feeds.DownloadFeedTask; import net.twisterrob.blt.android.ui.ListViewHandler; import net.twisterrob.blt.android.ui.adapter.PredictionSummaryAdapter; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationListActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationListActivity.java similarity index 95% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationListActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationListActivity.java index f4032c33..b7cdc0d0 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationListActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationListActivity.java @@ -16,8 +16,8 @@ import android.widget.AdapterView.OnItemClickListener; import android.widget.Filter.FilterListener; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.db.model.Station; import net.twisterrob.blt.android.ui.adapter.StationAdapter; @@ -112,7 +112,7 @@ public void onFilterComplete(int count) { protected void populateListData(List stations) { Collections.sort(stations, Station.COMPARATOR_NAME); - m_adapter = new StationAdapter(this, stations); + m_adapter = new StationAdapter(this, stations, App.getInstance().getStaticData()); filter(m_lastFilter); m_list.setAdapter(m_adapter); } diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationMapsActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationMapsActivity.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationMapsActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationMapsActivity.java index 10af67ac..a62c07a8 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StationMapsActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StationMapsActivity.java @@ -17,7 +17,7 @@ import com.google.android.gms.maps.model.MarkerOptions; import net.twisterrob.blt.android.App; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.data.LocationUtils; import net.twisterrob.blt.android.db.model.Station; import net.twisterrob.blt.model.StopType; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StatusActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StatusActivity.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/StatusActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StatusActivity.java index 3e2f6186..eeb67c18 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/StatusActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/StatusActivity.java @@ -11,7 +11,7 @@ import android.widget.AdapterView.OnItemClickListener; import net.twisterrob.android.utils.concurrent.AsyncTaskResult; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.io.feeds.DownloadFeedTask; import net.twisterrob.blt.android.ui.ListViewHandler; import net.twisterrob.blt.android.ui.adapter.StationStatusAdapter; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherAdapter.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherAdapter.java similarity index 95% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherAdapter.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherAdapter.java index a9c7296a..3e94701f 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherAdapter.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherAdapter.java @@ -7,7 +7,7 @@ import android.widget.TextView; import net.twisterrob.android.adapter.BaseListAdapter; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.ui.activity.main.LauncherAdapter.LauncherViewHolder; class LauncherAdapter extends BaseListAdapter { diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherItem.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherItem.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherItem.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/LauncherItem.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/MainActivity.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/MainActivity.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/MainActivity.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/MainActivity.java index 8bcc595d..970af238 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/MainActivity.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/activity/main/MainActivity.java @@ -10,7 +10,7 @@ import net.twisterrob.android.activity.AboutActivity; import net.twisterrob.android.utils.tools.AndroidTools; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.ui.activity.*; import net.twisterrob.blt.model.Line; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PlatformPlatformDirectionFilter.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PlatformPlatformDirectionFilter.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PlatformPlatformDirectionFilter.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PlatformPlatformDirectionFilter.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionDetailsAdapter.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionDetailsAdapter.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionDetailsAdapter.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionDetailsAdapter.java index 23fff12f..8854c716 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionDetailsAdapter.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionDetailsAdapter.java @@ -8,7 +8,7 @@ import android.widget.TextView; import net.twisterrob.android.adapter.BaseExpandableList2Adapter; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.ui.adapter.PredictionDetailsAdapter.*; import net.twisterrob.blt.io.feeds.trackernet.model.*; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionSummaryAdapter.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionSummaryAdapter.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionSummaryAdapter.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionSummaryAdapter.java index 3ff41116..0f46db59 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionSummaryAdapter.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/PredictionSummaryAdapter.java @@ -8,8 +8,8 @@ import android.widget.*; import net.twisterrob.android.adapter.BaseFilteringExpandableList3Adapter; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.android.ui.adapter.PredictionSummaryAdapter.*; import net.twisterrob.blt.io.feeds.trackernet.model.*; import net.twisterrob.blt.model.*; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/StationStatusAdapter.java b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/StationStatusAdapter.java similarity index 96% rename from Android/src/main/java/net/twisterrob/blt/android/ui/adapter/StationStatusAdapter.java rename to android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/StationStatusAdapter.java index c53f58b5..6732dd09 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/StationStatusAdapter.java +++ b/android/app/full/src/main/java/net/twisterrob/blt/android/ui/adapter/StationStatusAdapter.java @@ -8,8 +8,8 @@ import android.widget.TextView; import net.twisterrob.android.adapter.BaseListAdapter; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.app.full.R; import net.twisterrob.blt.io.feeds.trackernet.model.*; import net.twisterrob.blt.model.LineColors; diff --git a/Android/src/main/proguard.pro b/android/app/full/src/main/proguard.pro similarity index 62% rename from Android/src/main/proguard.pro rename to android/app/full/src/main/proguard.pro index b90870d7..52f5f670 100644 --- a/Android/src/main/proguard.pro +++ b/android/app/full/src/main/proguard.pro @@ -1,4 +1,4 @@ -### -- BLT/proguard.pro -- ### +### -- android/app/full/proguard.pro -- ### # Debugging helpers #-dontobfuscate @@ -8,9 +8,5 @@ # See res/menu/main.xml / stations_list.xml and b.android.com/170471 -keep class android.support.v7.widget.SearchView { (...); } -# TODEL https://issuetracker.google.com/issues/312677256 --dontwarn io.grpc.internal.DnsNameResolverProvider --dontwarn io.grpc.internal.PickFirstLoadBalancerProvider - # Not used in Android, but in Shared -dontwarn net.twisterrob.blt.io.feeds.timetable.JourneyPlannerTimetableFeedKmlOut diff --git a/Android/src/main/res/drawable/compass_center.xml b/android/app/full/src/main/res/drawable/compass_center.xml similarity index 100% rename from Android/src/main/res/drawable/compass_center.xml rename to android/app/full/src/main/res/drawable/compass_center.xml diff --git a/Android/src/main/res/drawable/compass_triangle.xml b/android/app/full/src/main/res/drawable/compass_triangle.xml similarity index 100% rename from Android/src/main/res/drawable/compass_triangle.xml rename to android/app/full/src/main/res/drawable/compass_triangle.xml diff --git a/Android/src/main/res/layout/activity_common.xml b/android/app/full/src/main/res/layout/activity_common.xml similarity index 100% rename from Android/src/main/res/layout/activity_common.xml rename to android/app/full/src/main/res/layout/activity_common.xml diff --git a/Android/src/main/res/layout/activity_main.xml b/android/app/full/src/main/res/layout/activity_main.xml similarity index 100% rename from Android/src/main/res/layout/activity_main.xml rename to android/app/full/src/main/res/layout/activity_main.xml diff --git a/Android/src/main/res/layout/activity_prediction_summary.xml b/android/app/full/src/main/res/layout/activity_prediction_summary.xml similarity index 100% rename from Android/src/main/res/layout/activity_prediction_summary.xml rename to android/app/full/src/main/res/layout/activity_prediction_summary.xml diff --git a/Android/src/main/res/layout/activity_station_info.xml b/android/app/full/src/main/res/layout/activity_station_info.xml similarity index 100% rename from Android/src/main/res/layout/activity_station_info.xml rename to android/app/full/src/main/res/layout/activity_station_info.xml diff --git a/Android/src/main/res/layout/activity_stations.xml b/android/app/full/src/main/res/layout/activity_stations.xml similarity index 100% rename from Android/src/main/res/layout/activity_stations.xml rename to android/app/full/src/main/res/layout/activity_stations.xml diff --git a/Android/src/main/res/layout/activity_status.xml b/android/app/full/src/main/res/layout/activity_status.xml similarity index 100% rename from Android/src/main/res/layout/activity_status.xml rename to android/app/full/src/main/res/layout/activity_status.xml diff --git a/Android/src/main/res/layout/inc_common_footer.xml b/android/app/full/src/main/res/layout/inc_common_footer.xml similarity index 100% rename from Android/src/main/res/layout/inc_common_footer.xml rename to android/app/full/src/main/res/layout/inc_common_footer.xml diff --git a/Android/src/main/res/layout/inc_common_header.xml b/android/app/full/src/main/res/layout/inc_common_header.xml similarity index 100% rename from Android/src/main/res/layout/inc_common_header.xml rename to android/app/full/src/main/res/layout/inc_common_header.xml diff --git a/Android/src/main/res/layout/inc_compass.xml b/android/app/full/src/main/res/layout/inc_compass.xml similarity index 100% rename from Android/src/main/res/layout/inc_compass.xml rename to android/app/full/src/main/res/layout/inc_compass.xml diff --git a/Android/src/main/res/layout/inc_refreshable_empty_list.xml b/android/app/full/src/main/res/layout/inc_refreshable_empty_list.xml similarity index 100% rename from Android/src/main/res/layout/inc_refreshable_empty_list.xml rename to android/app/full/src/main/res/layout/inc_refreshable_empty_list.xml diff --git a/Android/src/main/res/layout/item_line_status.xml b/android/app/full/src/main/res/layout/item_line_status.xml similarity index 100% rename from Android/src/main/res/layout/item_line_status.xml rename to android/app/full/src/main/res/layout/item_line_status.xml diff --git a/Android/src/main/res/layout/item_main_launcher.xml b/android/app/full/src/main/res/layout/item_main_launcher.xml similarity index 100% rename from Android/src/main/res/layout/item_main_launcher.xml rename to android/app/full/src/main/res/layout/item_main_launcher.xml diff --git a/Android/src/main/res/layout/item_prediction_summary_platform.xml b/android/app/full/src/main/res/layout/item_prediction_summary_platform.xml similarity index 100% rename from Android/src/main/res/layout/item_prediction_summary_platform.xml rename to android/app/full/src/main/res/layout/item_prediction_summary_platform.xml diff --git a/Android/src/main/res/layout/item_prediction_summary_station.xml b/android/app/full/src/main/res/layout/item_prediction_summary_station.xml similarity index 100% rename from Android/src/main/res/layout/item_prediction_summary_station.xml rename to android/app/full/src/main/res/layout/item_prediction_summary_station.xml diff --git a/Android/src/main/res/layout/item_prediction_summary_train.xml b/android/app/full/src/main/res/layout/item_prediction_summary_train.xml similarity index 100% rename from Android/src/main/res/layout/item_prediction_summary_train.xml rename to android/app/full/src/main/res/layout/item_prediction_summary_train.xml diff --git a/Android/src/main/res/menu/main.xml b/android/app/full/src/main/res/menu/main.xml similarity index 100% rename from Android/src/main/res/menu/main.xml rename to android/app/full/src/main/res/menu/main.xml diff --git a/Android/src/main/res/menu/prediction_summary.xml b/android/app/full/src/main/res/menu/prediction_summary.xml similarity index 100% rename from Android/src/main/res/menu/prediction_summary.xml rename to android/app/full/src/main/res/menu/prediction_summary.xml diff --git a/Android/src/main/res/menu/stations_list.xml b/android/app/full/src/main/res/menu/stations_list.xml similarity index 100% rename from Android/src/main/res/menu/stations_list.xml rename to android/app/full/src/main/res/menu/stations_list.xml diff --git a/android/app/full/src/main/res/values/colors.xml b/android/app/full/src/main/res/values/colors.xml new file mode 100644 index 00000000..bb9a7bfb --- /dev/null +++ b/android/app/full/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #00ff00 + #ff0000 + + diff --git a/Android/src/main/res/values/dimens.xml b/android/app/full/src/main/res/values/dimens.xml similarity index 100% rename from Android/src/main/res/values/dimens.xml rename to android/app/full/src/main/res/values/dimens.xml diff --git a/android/app/full/src/main/res/values/strings.xml b/android/app/full/src/main/res/values/strings.xml new file mode 100644 index 00000000..cbc317a0 --- /dev/null +++ b/android/app/full/src/main/res/values/strings.xml @@ -0,0 +1,31 @@ + + + Better London Travel + Station List + Station Map + Station Info + PostCode Map + @string/range__title + Line Status + Train Predictions + Search + + Last updated at %1$tF %1$tT + + %1$s: a single train is approaching. + %1$s: %2$d trains are approaching. + + %1$s has no trains approaching + Directions + Northbound + N + Southbound + S + Westbound + W + Eastbound + E + Others + O + + diff --git a/Android/src/main/res/values/strings_about.xml b/android/app/full/src/main/res/values/strings_about.xml similarity index 100% rename from Android/src/main/res/values/strings_about.xml rename to android/app/full/src/main/res/values/strings_about.xml diff --git a/Android/src/main/res/xml/searchable_stations_list.xml b/android/app/full/src/main/res/xml/searchable_stations_list.xml similarity index 100% rename from Android/src/main/res/xml/searchable_stations_list.xml rename to android/app/full/src/main/res/xml/searchable_stations_list.xml diff --git a/Android/src/release/res/values/overrides.xml b/android/app/full/src/release/res/values/overrides.xml similarity index 100% rename from Android/src/release/res/values/overrides.xml rename to android/app/full/src/release/res/values/overrides.xml diff --git a/android/app/range/build.gradle b/android/app/range/build.gradle new file mode 100644 index 00000000..2c99995b --- /dev/null +++ b/android/app/range/build.gradle @@ -0,0 +1,17 @@ +plugins { + id("net.twisterrob.travel.android-app") +} + +android.defaultConfig.applicationId = "net.twisterrob.blt.range" +android.defaultConfig.version { + major = 1 +} + +dependencies { + implementation(projects.android.component.android) + implementation(projects.android.component.data) + implementation(projects.android.feature.range) + implementation("net.twisterrob.lib:twister-lib-android-about") + implementation("net.twisterrob.lib:twister-lib-android-slf4j") + implementation("net.twisterrob.lib:twister-lib-android-settings") +} diff --git a/android/app/range/src/debug/res/values/overrides.xml b/android/app/range/src/debug/res/values/overrides.xml new file mode 100644 index 00000000..e2b6123c --- /dev/null +++ b/android/app/range/src/debug/res/values/overrides.xml @@ -0,0 +1,8 @@ + + + !Tube Range Map + + + AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA + + diff --git a/android/app/range/src/main/AndroidManifest.xml b/android/app/range/src/main/AndroidManifest.xml new file mode 100644 index 00000000..837c861d --- /dev/null +++ b/android/app/range/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Android/src/main/art/Feature Graphic (1024x500).webp b/android/app/range/src/main/art/Feature Graphic (1024x500).webp similarity index 100% rename from Android/src/main/art/Feature Graphic (1024x500).webp rename to android/app/range/src/main/art/Feature Graphic (1024x500).webp diff --git a/Android/src/main/art/Hi-res Icon (512x512).png b/android/app/range/src/main/art/Hi-res Icon (512x512).png similarity index 100% rename from Android/src/main/art/Hi-res Icon (512x512).png rename to android/app/range/src/main/art/Hi-res Icon (512x512).png diff --git a/Android/src/main/art/Screenshots/Phone #1 Tube Map Overlay.webp b/android/app/range/src/main/art/Screenshots/Phone #1 Tube Map Overlay.webp similarity index 100% rename from Android/src/main/art/Screenshots/Phone #1 Tube Map Overlay.webp rename to android/app/range/src/main/art/Screenshots/Phone #1 Tube Map Overlay.webp diff --git a/Android/src/main/art/Screenshots/Phone #2 Range Map Overlay.webp b/android/app/range/src/main/art/Screenshots/Phone #2 Range Map Overlay.webp similarity index 100% rename from Android/src/main/art/Screenshots/Phone #2 Range Map Overlay.webp rename to android/app/range/src/main/art/Screenshots/Phone #2 Range Map Overlay.webp diff --git a/Android/src/main/art/Screenshots/Tablet 10 #1 Full UI (Portrait).webp b/android/app/range/src/main/art/Screenshots/Tablet 10 #1 Full UI (Portrait).webp similarity index 100% rename from Android/src/main/art/Screenshots/Tablet 10 #1 Full UI (Portrait).webp rename to android/app/range/src/main/art/Screenshots/Tablet 10 #1 Full UI (Portrait).webp diff --git a/Android/src/main/art/Screenshots/Tablet 7 #1 Parameters (Landscape).webp b/android/app/range/src/main/art/Screenshots/Tablet 7 #1 Parameters (Landscape).webp similarity index 100% rename from Android/src/main/art/Screenshots/Tablet 7 #1 Parameters (Landscape).webp rename to android/app/range/src/main/art/Screenshots/Tablet 7 #1 Parameters (Landscape).webp diff --git a/android/app/range/src/main/java/net/twisterrob/blt/android/app/range/App.java b/android/app/range/src/main/java/net/twisterrob/blt/android/app/range/App.java new file mode 100644 index 00000000..b27defa8 --- /dev/null +++ b/android/app/range/src/main/java/net/twisterrob/blt/android/app/range/App.java @@ -0,0 +1,47 @@ +package net.twisterrob.blt.android.app.range; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import net.twisterrob.android.app.BaseApp; +import net.twisterrob.android.log.AndroidLoggerFactory; +import net.twisterrob.android.utils.tostring.stringers.detailed.Stringers; +import net.twisterrob.blt.android.BuildConfig; +import net.twisterrob.blt.android.Injector; +import net.twisterrob.blt.android.data.AndroidDBStaticData; +import net.twisterrob.blt.android.db.DataBaseHelper; +import net.twisterrob.java.utils.tostring.StringerRepo; + +public class App extends BaseApp implements Injector.Provider { + + static { + AndroidLoggerFactory.addReplacement("^net\\.twisterrob\\.blt\\.android\\.(.+\\.)?", ""); + AndroidLoggerFactory.addReplacement("^net\\.twisterrob\\.blt\\.(.+\\.)?", ""); + } + + private Injector injector; + + @Override public void onCreate() { + super.onCreate(); + Stringers.register(StringerRepo.INSTANCE); + this.injector = createInjector(this); + } + + @Override public Injector injector() { + return injector; + } + + private static @NonNull Injector createInjector(Context context) { + BuildConfig buildConfig = new BuildConfigWrapper(); + DataBaseHelper db = new DataBaseHelper(context, buildConfig.isDebug()); + @SuppressWarnings("deprecation") + Injector injector = new net.twisterrob.blt.android.ui.activity.Injector( + buildConfig, + new AndroidDBStaticData(db), + db, + prefs() + ); + return injector; + } +} diff --git a/android/app/range/src/main/java/net/twisterrob/blt/android/app/range/BuildConfigWrapper.java b/android/app/range/src/main/java/net/twisterrob/blt/android/app/range/BuildConfigWrapper.java new file mode 100644 index 00000000..61e6c823 --- /dev/null +++ b/android/app/range/src/main/java/net/twisterrob/blt/android/app/range/BuildConfigWrapper.java @@ -0,0 +1,12 @@ +package net.twisterrob.blt.android.app.range; + +class BuildConfigWrapper implements net.twisterrob.blt.android.BuildConfig { + + @Override public boolean isDebug() { + return BuildConfig.DEBUG; + } + + @Override public String applicationId() { + return BuildConfig.APPLICATION_ID; + } +} diff --git a/Android/src/range/java/net/twisterrob/blt/android/ui/activity/StandaloneRangeMapActivity.java b/android/app/range/src/main/java/net/twisterrob/blt/android/ui/activity/StandaloneRangeMapActivity.java similarity index 93% rename from Android/src/range/java/net/twisterrob/blt/android/ui/activity/StandaloneRangeMapActivity.java rename to android/app/range/src/main/java/net/twisterrob/blt/android/ui/activity/StandaloneRangeMapActivity.java index f58eef9c..c3fff454 100644 --- a/Android/src/range/java/net/twisterrob/blt/android/ui/activity/StandaloneRangeMapActivity.java +++ b/android/app/range/src/main/java/net/twisterrob/blt/android/ui/activity/StandaloneRangeMapActivity.java @@ -4,7 +4,7 @@ import android.view.*; import net.twisterrob.android.activity.AboutActivity; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.app.range.R; public class StandaloneRangeMapActivity extends RangeMapActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { diff --git a/android/app/range/src/main/proguard.pro b/android/app/range/src/main/proguard.pro new file mode 100644 index 00000000..bb8e777d --- /dev/null +++ b/android/app/range/src/main/proguard.pro @@ -0,0 +1 @@ +### -- android/app/range/proguard.pro -- ### diff --git a/Android/src/range/res/menu/options_range_map_standalone.xml b/android/app/range/src/main/res/menu/options_range_map_standalone.xml similarity index 100% rename from Android/src/range/res/menu/options_range_map_standalone.xml rename to android/app/range/src/main/res/menu/options_range_map_standalone.xml diff --git a/android/app/range/src/main/res/values/strings.xml b/android/app/range/src/main/res/values/strings.xml new file mode 100644 index 00000000..05beb527 --- /dev/null +++ b/android/app/range/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + + @string/range__title + + diff --git a/android/app/range/src/release/res/values/overrides.xml b/android/app/range/src/release/res/values/overrides.xml new file mode 100644 index 00000000..17fb2d0c --- /dev/null +++ b/android/app/range/src/release/res/values/overrides.xml @@ -0,0 +1,6 @@ + + + + AIzaSyB6qc9WlSDbaNGO-c-mnu8ajlq3jroh2E4 + + diff --git a/android/component/android/build.gradle b/android/component/android/build.gradle new file mode 100644 index 00000000..3c68b231 --- /dev/null +++ b/android/component/android/build.gradle @@ -0,0 +1,3 @@ +plugins { + id("net.twisterrob.travel.android-library") +} diff --git a/android/component/android/src/main/java/net/twisterrob/blt/android/BuildConfig.java b/android/component/android/src/main/java/net/twisterrob/blt/android/BuildConfig.java new file mode 100644 index 00000000..254e488b --- /dev/null +++ b/android/component/android/src/main/java/net/twisterrob/blt/android/BuildConfig.java @@ -0,0 +1,7 @@ +package net.twisterrob.blt.android; + +public interface BuildConfig { + boolean isDebug(); + + String applicationId(); +} diff --git a/android/component/android/src/main/java/net/twisterrob/blt/android/Injector.java b/android/component/android/src/main/java/net/twisterrob/blt/android/Injector.java new file mode 100644 index 00000000..248b1662 --- /dev/null +++ b/android/component/android/src/main/java/net/twisterrob/blt/android/Injector.java @@ -0,0 +1,17 @@ +package net.twisterrob.blt.android; + +import android.content.Context; + +public interface Injector { + + void inject(Object target); + + static Injector from(Context context) { + return ((Provider)context.getApplicationContext()).injector(); + } + + interface Provider { + + Injector injector(); + } +} diff --git a/android/component/data/build.gradle b/android/component/data/build.gradle new file mode 100644 index 00000000..ba18bc87 --- /dev/null +++ b/android/component/data/build.gradle @@ -0,0 +1,37 @@ +plugins { + id("net.twisterrob.travel.android-library") +} + +dependencies { + api(projects.common.model) + implementation("net.twisterrob.lib:twister-lib-android-monolith") + implementation("net.twisterrob.lib:twister-lib-android-basics") + implementation("net.twisterrob.lib:twister-lib-android-slf4j") +} + +// 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")) { + include("*.data.*.sql") + } + into(output) +} + +androidComponents { + onVariants(selector().all()) { variant -> + variant.sources.assets.addGeneratedSourceDirectory(generateDataBase, { it.output }) + afterEvaluate { + tasks.named("generate${variant.name.capitalize()}Assets").configure { + // This should be not necessary with addGeneratedSourceDirectory, but without this, it doesn't work. + dependsOn(generateDataBase) + } + } + } +} diff --git a/Android/src/main/assets/LondonTravel.clean.sql b/android/component/data/src/main/assets/LondonTravel.clean.sql similarity index 100% rename from Android/src/main/assets/LondonTravel.clean.sql rename to android/component/data/src/main/assets/LondonTravel.clean.sql diff --git a/Android/src/main/assets/LondonTravel.development.sql b/android/component/data/src/main/assets/LondonTravel.development.sql similarity index 100% rename from Android/src/main/assets/LondonTravel.development.sql rename to android/component/data/src/main/assets/LondonTravel.development.sql diff --git a/Android/src/main/assets/LondonTravel.init.sql b/android/component/data/src/main/assets/LondonTravel.init.sql similarity index 100% rename from Android/src/main/assets/LondonTravel.init.sql rename to android/component/data/src/main/assets/LondonTravel.init.sql diff --git a/Android/src/main/assets/LondonTravel.schema.sql b/android/component/data/src/main/assets/LondonTravel.schema.sql similarity index 100% rename from Android/src/main/assets/LondonTravel.schema.sql rename to android/component/data/src/main/assets/LondonTravel.schema.sql diff --git a/Android/src/main/assets/getNetwork.sql b/android/component/data/src/main/assets/getNetwork.sql similarity index 100% rename from Android/src/main/assets/getNetwork.sql rename to android/component/data/src/main/assets/getNetwork.sql diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/AndroidDBStaticData.java b/android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidDBStaticData.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/AndroidDBStaticData.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidDBStaticData.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/AndroidHardcodedStaticData.java b/android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidHardcodedStaticData.java similarity index 98% rename from Android/src/main/java/net/twisterrob/blt/android/data/AndroidHardcodedStaticData.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidHardcodedStaticData.java index 967c725a..811f5ee4 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/data/AndroidHardcodedStaticData.java +++ b/android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidHardcodedStaticData.java @@ -2,7 +2,7 @@ import java.util.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.component.data.R; import net.twisterrob.blt.data.SharedStaticData; import net.twisterrob.blt.model.StopType; diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/AndroidStaticData.java b/android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidStaticData.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/AndroidStaticData.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/data/AndroidStaticData.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/DataBaseAccess.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseAccess.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/DataBaseAccess.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseAccess.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/DataBaseHelper.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseHelper.java similarity index 97% rename from Android/src/main/java/net/twisterrob/blt/android/db/DataBaseHelper.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseHelper.java index 2418bfef..c7ab3ca0 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/db/DataBaseHelper.java +++ b/android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseHelper.java @@ -8,7 +8,6 @@ import net.twisterrob.android.db.DatabaseOpenHelper; import net.twisterrob.android.utils.tools.DatabaseTools; -import net.twisterrob.blt.android.BuildConfig; import net.twisterrob.blt.android.db.model.*; import net.twisterrob.blt.model.*; @@ -24,9 +23,9 @@ public class DataBaseHelper { private final DataBaseReader m_reader; private Context m_context; - public DataBaseHelper(final Context context) { + public DataBaseHelper(final Context context, boolean isDebug) { m_context = context; - m_helper = new DatabaseOpenHelper(context, "LondonTravel", 1, BuildConfig.DEBUG) { + m_helper = new DatabaseOpenHelper(context, "LondonTravel", 1, isDebug) { @Override protected String[] getDataFiles() { return new String[] { "LondonTravel.data.StopType.sql", diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/DataBaseReader.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseReader.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/DataBaseReader.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseReader.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/DataBaseWriter.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseWriter.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/DataBaseWriter.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/DataBaseWriter.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/model/AreaHullPoint.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/model/AreaHullPoint.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/model/AreaHullPoint.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/model/AreaHullPoint.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/model/NetworkLink.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/model/NetworkLink.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/model/NetworkLink.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/model/NetworkLink.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/model/NetworkNode.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/model/NetworkNode.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/model/NetworkNode.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/model/NetworkNode.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/db/model/Station.java b/android/component/data/src/main/java/net/twisterrob/blt/android/db/model/Station.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/db/model/Station.java rename to android/component/data/src/main/java/net/twisterrob/blt/android/db/model/Station.java diff --git a/Android/src/main/res/drawable/tfl_roundel_airline.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_airline.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_airline.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_airline.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_bus.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_bus.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_bus.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_bus.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_cyclehire.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_cyclehire.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_cyclehire.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_cyclehire.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_dar.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_dar.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_dar.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_dar.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_dlr.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_dlr.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_dlr.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_dlr.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_dlr_map.png b/android/component/data/src/main/res/drawable/tfl_roundel_dlr_map.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_dlr_map.png rename to android/component/data/src/main/res/drawable/tfl_roundel_dlr_map.png diff --git a/Android/src/main/res/drawable/tfl_roundel_dlr_mini.png b/android/component/data/src/main/res/drawable/tfl_roundel_dlr_mini.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_dlr_mini.png rename to android/component/data/src/main/res/drawable/tfl_roundel_dlr_mini.png diff --git a/Android/src/main/res/drawable/tfl_roundel_lrs.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_lrs.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_lrs.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_lrs.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_lul.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_lul.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_lul.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_lul.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_lul_map.png b/android/component/data/src/main/res/drawable/tfl_roundel_lul_map.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_lul_map.png rename to android/component/data/src/main/res/drawable/tfl_roundel_lul_map.png diff --git a/Android/src/main/res/drawable/tfl_roundel_lul_mini.png b/android/component/data/src/main/res/drawable/tfl_roundel_lul_mini.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_lul_mini.png rename to android/component/data/src/main/res/drawable/tfl_roundel_lul_mini.png diff --git a/Android/src/main/res/drawable/tfl_roundel_overground.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_overground.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_overground.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_overground.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_overground_map.png b/android/component/data/src/main/res/drawable/tfl_roundel_overground_map.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_overground_map.png rename to android/component/data/src/main/res/drawable/tfl_roundel_overground_map.png diff --git a/Android/src/main/res/drawable/tfl_roundel_overground_mini.png b/android/component/data/src/main/res/drawable/tfl_roundel_overground_mini.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_overground_mini.png rename to android/component/data/src/main/res/drawable/tfl_roundel_overground_mini.png diff --git a/Android/src/main/res/drawable/tfl_roundel_streets.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_streets.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_streets.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_streets.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_taxiph.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_taxiph.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_taxiph.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_taxiph.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_tfl.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_tfl.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_tfl.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_tfl.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_tramlink.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_tramlink.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_tramlink.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_tramlink.jpg diff --git a/Android/src/main/res/drawable/tfl_roundel_tramlink_map.png b/android/component/data/src/main/res/drawable/tfl_roundel_tramlink_map.png similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_tramlink_map.png rename to android/component/data/src/main/res/drawable/tfl_roundel_tramlink_map.png diff --git a/Android/src/main/res/drawable/tfl_roundel_vcs.jpg b/android/component/data/src/main/res/drawable/tfl_roundel_vcs.jpg similarity index 100% rename from Android/src/main/res/drawable/tfl_roundel_vcs.jpg rename to android/component/data/src/main/res/drawable/tfl_roundel_vcs.jpg diff --git a/android/component/theme/build.gradle b/android/component/theme/build.gradle new file mode 100644 index 00000000..08e3d5fd --- /dev/null +++ b/android/component/theme/build.gradle @@ -0,0 +1,7 @@ +plugins { + id("net.twisterrob.travel.android-library") +} + +dependencies { + implementation("net.twisterrob.lib:twister-lib-android-monolith") +} diff --git a/Android/src/main/res/mipmap-hdpi/ic_launcher.png b/android/component/theme/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from Android/src/main/res/mipmap-hdpi/ic_launcher.png rename to android/component/theme/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/Android/src/main/res/mipmap-mdpi/ic_launcher.png b/android/component/theme/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from Android/src/main/res/mipmap-mdpi/ic_launcher.png rename to android/component/theme/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/Android/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/component/theme/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from Android/src/main/res/mipmap-xhdpi/ic_launcher.png rename to android/component/theme/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/Android/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/component/theme/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from Android/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to android/component/theme/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/component/theme/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to android/component/theme/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/Android/src/main/res/values/colors.xml b/android/component/theme/src/main/res/values/colors.xml similarity index 83% rename from Android/src/main/res/values/colors.xml rename to android/component/theme/src/main/res/values/colors.xml index 157c49a7..19ddca2d 100644 --- a/Android/src/main/res/values/colors.xml +++ b/android/component/theme/src/main/res/values/colors.xml @@ -1,10 +1,12 @@ - #00ff00 - #ff0000 + #F5F5F5 + #E0E0E0 + #FF0019A8 + diff --git a/Android/src/main/res/values/themes.xml b/android/component/theme/src/main/res/values/themes.xml similarity index 100% rename from Android/src/main/res/values/themes.xml rename to android/component/theme/src/main/res/values/themes.xml diff --git a/android/feature/range/build.gradle b/android/feature/range/build.gradle new file mode 100644 index 00000000..98975a1e --- /dev/null +++ b/android/feature/range/build.gradle @@ -0,0 +1,26 @@ +plugins { + id("net.twisterrob.travel.android-library") +} + +dependencies { + implementation(projects.android.component.android) + implementation(projects.android.component.data) + implementation(projects.android.component.theme) + + api("net.twisterrob.lib:twister-lib-android-monolith") // api because AppCompatActivity. + implementation("net.twisterrob.lib:twister-lib-android-basics") + implementation("net.twisterrob.lib:twister-lib-android-slf4j") + implementation("net.twisterrob.lib:twister-lib-android-widgets") + implementation("net.twisterrob.lib:twister-lib-android-stringers") + + implementation("net.twisterrob.lib:twister-lib-android-color_picker") + 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) +} + +android.defaultConfig.consumerProguardFile("src/main/proguard.pro") diff --git a/Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java similarity index 100% rename from Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java rename to android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java diff --git a/Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java similarity index 100% rename from Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java rename to android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java diff --git a/Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/PlaceStringer.java b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/PlaceStringer.java similarity index 100% rename from Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/PlaceStringer.java rename to android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/PlaceStringer.java diff --git a/Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java similarity index 100% rename from Android/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java rename to android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java diff --git a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/Stringers.java b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/Stringers.java new file mode 100644 index 00000000..05d08bf2 --- /dev/null +++ b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/Stringers.java @@ -0,0 +1,18 @@ +package net.twisterrob.android.utils.tostring.stringers.detailed; + +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 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()); + } +} diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/LocationUtils.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/LocationUtils.java similarity index 97% rename from Android/src/main/java/net/twisterrob/blt/android/data/LocationUtils.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/LocationUtils.java index 23e588ab..479778e5 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/data/LocationUtils.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/LocationUtils.java @@ -22,7 +22,7 @@ public static boolean near(LatLng ll, Location loc) { } public static boolean near(Location loc, LatLng ll) { - return Math.abs(ll.latitude - loc.getLatitude()) < DELTA && Math.abs(ll.longitude - loc.getLongitude()) < DELTA; + return Math.abs(ll.latitude - loc.getLatitude()) < DELTA && Math.abs(ll.longitude - loc.getLongitude()) < LocationUtils.DELTA; } public static @Nullable String getVagueAddress(@Nullable Address address) { diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/AndroidOpenGLRenderedGeoSize.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/AndroidOpenGLRenderedGeoSize.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/AndroidOpenGLRenderedGeoSize.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/AndroidOpenGLRenderedGeoSize.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/AverageSpeedTubingStrategy.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/AverageSpeedTubingStrategy.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/AverageSpeedTubingStrategy.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/AverageSpeedTubingStrategy.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/DistanceStrategy.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/DistanceStrategy.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/DistanceStrategy.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/DistanceStrategy.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawer.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawer.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawer.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawer.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerAndroid.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerAndroid.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerAndroid.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerAndroid.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerConfig.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerConfig.java similarity index 93% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerConfig.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerConfig.java index 3b7bde69..2bf342f1 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerConfig.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapDrawerConfig.java @@ -2,7 +2,6 @@ import android.graphics.Color; -import net.twisterrob.blt.android.App; import net.twisterrob.blt.model.*; public class RangeMapDrawerConfig { @@ -17,8 +16,9 @@ public class RangeMapDrawerConfig { boolean dynamicColor = true; int rangeColor = Color.RED; - LineColors colors = App.getInstance().getStaticData().getLineColors(); - public RangeMapDrawerConfig() { + LineColors colors; + public RangeMapDrawerConfig(LineColors colors) { + this.colors = colors; } public RangeMapDrawerConfig(RangeMapDrawerConfig config) { diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGenerator.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGenerator.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGenerator.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGenerator.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGeneratorConfig.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGeneratorConfig.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGeneratorConfig.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RangeMapGeneratorConfig.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/RenderedGeoSize.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RenderedGeoSize.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/RenderedGeoSize.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/RenderedGeoSize.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/SmartTubingStrategy.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/SmartTubingStrategy.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/SmartTubingStrategy.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/SmartTubingStrategy.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/TubeMapDrawer.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/TubeMapDrawer.java similarity index 93% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/TubeMapDrawer.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/TubeMapDrawer.java index 8f2999de..957d05b2 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/data/range/TubeMapDrawer.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/TubeMapDrawer.java @@ -4,9 +4,9 @@ import javax.annotation.concurrent.NotThreadSafe; +import android.annotation.SuppressLint; import android.graphics.*; -import net.twisterrob.blt.android.App; import net.twisterrob.blt.android.db.model.*; import net.twisterrob.blt.model.LineColors; import net.twisterrob.java.model.Location; @@ -18,8 +18,11 @@ public class TubeMapDrawer { protected final double minLat; protected final double maxLat; private final RenderedGeoSize size = new AndroidOpenGLRenderedGeoSize(); + private final LineColors colors; - public TubeMapDrawer(Iterable nodes) { + @SuppressLint("LambdaLast") + public TubeMapDrawer(Iterable nodes, LineColors colors) { + this.colors = colors; double minX = Double.POSITIVE_INFINITY, maxX = Double.NEGATIVE_INFINITY; double minY = Double.POSITIVE_INFINITY, maxY = Double.NEGATIVE_INFINITY; for (NetworkNode node : nodes) { @@ -75,7 +78,6 @@ private void draw(Canvas canvas, NetworkLink link, double scaleX, double scaleY) double toY = (maxLat - to.getLatitude()) * scaleY; Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - LineColors colors = App.getInstance().getStaticData().getLineColors(); int lineColor = link.getSource().getLine().getBackground(colors); paint.setColor(lineColor); paint.setStrokeWidth(4); diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/DebugGeneratedGeoTileProvider.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/DebugGeneratedGeoTileProvider.java similarity index 95% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/DebugGeneratedGeoTileProvider.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/DebugGeneratedGeoTileProvider.java index e82360d8..03f58cb6 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/DebugGeneratedGeoTileProvider.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/DebugGeneratedGeoTileProvider.java @@ -9,7 +9,6 @@ import android.text.TextPaint; import net.twisterrob.android.utils.tools.ColorTools; -import net.twisterrob.blt.android.BuildConfig; import net.twisterrob.java.annotations.DebugHelper; public class DebugGeneratedGeoTileProvider extends GeneratedGeoTileProvider implements MarkerAdder { @@ -17,9 +16,11 @@ public class DebugGeneratedGeoTileProvider extends GeneratedGeoTileProvider impl private final TextPaint textPaintProto; private final Pools.Pool pointPaints = new Pools.SynchronizedPool<>(10); private final Paint pointPaintProto; + private final boolean isDebug; - public DebugGeneratedGeoTileProvider(int tileSize) { + public DebugGeneratedGeoTileProvider(int tileSize, boolean isDebug) { super(tileSize); + this.isDebug = isDebug; textPaintProto = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); textPaintProto.setTextAlign(Align.CENTER); textPaintProto.setTextSize(tileSize * 0.04f); @@ -67,7 +68,7 @@ public DebugGeneratedGeoTileProvider(int tileSize) { @DebugHelper @Override public void addMarker(double lat, double lon, String text) { - if (BuildConfig.DEBUG && markers != null) { + if (isDebug && markers != null) { markers.addMarker(lat, lon, text); } else { throw new IllegalStateException("This method should not be called in production."); diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/MarkerAdder.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/MarkerAdder.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/MarkerAdder.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/MarkerAdder.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/TubeMapTileProvider.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/TubeMapTileProvider.java similarity index 94% rename from Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/TubeMapTileProvider.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/TubeMapTileProvider.java index d4ef2d7c..774c16ee 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/data/range/tiles/TubeMapTileProvider.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/TubeMapTileProvider.java @@ -8,7 +8,6 @@ import androidx.core.util.Pools; import android.text.TextPaint; -import net.twisterrob.blt.android.App; import net.twisterrob.blt.android.db.model.*; import net.twisterrob.blt.model.LineColors; import net.twisterrob.java.model.Location; @@ -21,10 +20,12 @@ public class TubeMapTileProvider extends DebugGeneratedGeoTileProvider { private final Pools.Pool lineShadowPaints = new Pools.SynchronizedPool<>(10); private final Paint lineShadowPaintProto; private final Set links; + private final LineColors lineColors; - public TubeMapTileProvider(Set nodes, int tileSize) { - super(tileSize); + public TubeMapTileProvider(Set nodes, LineColors lineColors, int tileSize, boolean isDebug) { + super(tileSize, isDebug); this.links = getLinks(nodes); + this.lineColors = lineColors; this.textPaintProto = new TextPaint(); textPaintProto.setTextAlign(Align.CENTER); @@ -78,7 +79,6 @@ private void drawLine(Canvas canvas, NetworkLink link, double p2x = (to.getLongitude() - minLon) / (maxLon - minLon) * tileSize; double p1y = (from.getLatitude() - minLat) / (maxLat - minLat) * tileSize; double p2y = (to.getLatitude() - minLat) / (maxLat - minLat) * tileSize; - LineColors lineColors = App.getInstance().getStaticData().getLineColors(); int lineColor = link.getSource().getLine().getBackground(lineColors); linePaint.setColor(lineColor); canvas.drawLine((float)p1x, (float)p1y, (float)p2x, (float)p2y, lineShadowPaint); diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/ColorPickerWidget.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/ColorPickerWidget.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/ui/ColorPickerWidget.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/ColorPickerWidget.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/TubeHtmlHandler.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/TubeHtmlHandler.java similarity index 94% rename from Android/src/main/java/net/twisterrob/blt/android/ui/TubeHtmlHandler.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/TubeHtmlHandler.java index 035fc855..f7c08bec 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/TubeHtmlHandler.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/TubeHtmlHandler.java @@ -16,7 +16,7 @@ import net.twisterrob.android.content.HtmlParser; import net.twisterrob.android.graphics.DrawableBinder; import net.twisterrob.android.view.TextAppearanceAccessor; -import net.twisterrob.blt.android.App; +import net.twisterrob.blt.android.data.AndroidStaticData; import net.twisterrob.blt.model.*; /** @@ -31,10 +31,10 @@ public class TubeHtmlHandler implements HtmlParser.TagHandler { private final Map logos; private final Context context; private final float textSize; - public TubeHtmlHandler(Context context) { + public TubeHtmlHandler(Context context, AndroidStaticData staticData) { this.context = context; - this.colors = new TextLineColors(App.getInstance().getStaticData().getLineColors()); - this.logos = App.getInstance().getStaticData().getStopTypeLogos(); + this.colors = new TextLineColors(staticData.getLineColors()); + this.logos = staticData.getStopTypeLogos(); this.textSize = TextAppearanceAccessor.getDefaultTextSize(context); } @Override public boolean handleTag(boolean opening, String tag, Editable output, Attributes attributes) { diff --git a/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/Injector.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/Injector.java new file mode 100644 index 00000000..2645c746 --- /dev/null +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/Injector.java @@ -0,0 +1,46 @@ +package net.twisterrob.blt.android.ui.activity; + +import net.twisterrob.android.content.pref.ResourcePreferences; +import net.twisterrob.blt.android.BuildConfig; +import net.twisterrob.blt.android.data.AndroidStaticData; +import net.twisterrob.blt.android.db.DataBaseHelper; +import net.twisterrob.blt.android.ui.activity.RangeMapActivity; +import net.twisterrob.blt.android.ui.activity.RangeNearestFragment; +import net.twisterrob.blt.android.ui.activity.RangeOptionsFragment; + +@Deprecated // TODO migrate to Hilt, this is just a temporary solution to minimize changes in rename PR. +public class Injector implements net.twisterrob.blt.android.Injector { + + private final BuildConfig buildConfig; + private final AndroidStaticData staticData; + private final DataBaseHelper db; + private final ResourcePreferences prefs; + + public Injector( + BuildConfig buildConfig, + AndroidStaticData staticData, + DataBaseHelper db, + ResourcePreferences prefs + ) { + this.buildConfig = buildConfig; + this.staticData = staticData; + this.db = db; + this.prefs = prefs; + } + + @Override public void inject(Object target) { + if (target instanceof RangeMapActivity activity) { + activity.buildConfig = buildConfig; + activity.staticData = staticData; + activity.db = db; + activity.prefs = prefs; + } else if (target instanceof RangeOptionsFragment fragment) { + fragment.prefs = prefs; + fragment.staticData = staticData; + } else if (target instanceof RangeNearestFragment fragment) { + fragment.staticData = staticData; + } else { + throw new IllegalArgumentException("Unknown target: " + target); + } + } +} diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeMapActivity.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeMapActivity.java similarity index 93% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeMapActivity.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeMapActivity.java index 4fa67fe1..76a6cb26 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeMapActivity.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeMapActivity.java @@ -2,6 +2,8 @@ import java.util.*; +import javax.inject.Inject; + import org.slf4j.*; import android.annotation.SuppressLint; @@ -19,7 +21,6 @@ import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.*; import androidx.appcompat.widget.Toolbar; -import android.util.DisplayMetrics; import android.view.*; import android.view.View.OnClickListener; import android.widget.Toast; @@ -50,20 +51,25 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.floatingactionbutton.FloatingActionButton; +import net.twisterrob.android.content.pref.ResourcePreferences; import net.twisterrob.android.utils.concurrent.SimpleAsyncTask; import net.twisterrob.android.utils.tools.AndroidTools; import net.twisterrob.android.utils.tools.StringerTools; import net.twisterrob.android.utils.tools.ViewTools; import net.twisterrob.android.view.*; import net.twisterrob.android.view.layout.DoAfterLayout; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.BuildConfig; +import net.twisterrob.blt.android.Injector; +import net.twisterrob.blt.android.data.AndroidStaticData; import net.twisterrob.blt.android.data.LocationUtils; import net.twisterrob.blt.android.data.range.*; import net.twisterrob.blt.android.data.range.tiles.*; +import net.twisterrob.blt.android.db.DataBaseHelper; import net.twisterrob.blt.android.db.model.NetworkNode; +import net.twisterrob.blt.android.feature.range.R; import net.twisterrob.blt.android.ui.activity.RangeOptionsFragment.ConfigsUpdatedListener; import net.twisterrob.blt.android.ui.activity.main.MapActivity; +import net.twisterrob.blt.model.LineColors; import net.twisterrob.blt.model.StopType; import static net.twisterrob.android.utils.tools.ResourceTools.*; @@ -75,7 +81,7 @@ public class RangeMapActivity extends MapActivity { private GroundOverlay mapOverlay; private final List markers = new LinkedList<>(); private final RangeMapGeneratorConfig genConfig = new RangeMapGeneratorConfig(); - private final RangeMapDrawerConfig drawConfig = new RangeMapDrawerConfig(); + private /*final*/ RangeMapDrawerConfig drawConfig; private BottomSheetBehavior behavior; private RangeNearestFragment nearestFragment; private RangeOptionsFragment optionsFragment; @@ -85,7 +91,21 @@ public class RangeMapActivity extends MapActivity { private LatLng lastStartPoint; private AutocompleteSupportFragment searchFragment; + @Inject + BuildConfig buildConfig; + + @Inject + AndroidStaticData staticData; + + @Inject + DataBaseHelper db; + + @Inject + ResourcePreferences prefs; + @Override protected void onCreate(Bundle savedInstanceState) { + Injector.from(this).inject(this); + drawConfig = new RangeMapDrawerConfig(staticData.getLineColors()); String apiKey = getApplicationInfoWithMetadata(this).metaData.getString("com.google.android.geo.API_KEY"); Places.initialize(getApplicationContext(), apiKey); @@ -138,7 +158,7 @@ public class RangeMapActivity extends MapActivity { @SuppressWarnings({"unused", "deprecation"}) // TODO https://github.com/TWiStErRob/net.twisterrob.travel/issues/15 Object task = new AsyncTask>() { @Override protected Set doInBackground(Void... params) { - return App.db().getTubeNetwork(); + return db.getTubeNetwork(); } @Override protected void onPostExecute(Set nodes) { super.onPostExecute(nodes); @@ -187,6 +207,7 @@ private void setupSearch(Fragment searchFragment) { @Override protected void setupMap() { SupportMapFragment mapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.view__map); mapFragment.getMapAsync(new OnMapReadyCallback() { + @SuppressLint("MissingPermission") // It's declared in Places SDK. @Override public void onMapReady(@NonNull GoogleMap map) { RangeMapActivity.this.map = map; map.setMyLocationEnabled(true); @@ -234,7 +255,7 @@ private void zoomFullLondon() { } public void updateToolbarVisibility() { - boolean showToolbar = App.prefs().getBoolean(R.string.pref__show_toolbar, R.bool.pref__show_toolbar__default); + boolean showToolbar = prefs.getBoolean(R.string.pref__show_toolbar, R.bool.pref__show_toolbar__default); final View container = findViewById(R.id.view__range__toolbar_container); ViewTools.displayedIf(container, showToolbar); new DoAfterLayout(drawers, true) { @@ -318,9 +339,8 @@ private void setNodes(Set nodes) { .image(BitmapDescriptorFactory.fromBitmap(rangeDrawer.draw(emptyNetwork))) ); // // tube map above - if (!App.prefs().getBoolean(R.string.pref__network_overlay, R.bool.pref__network_overlay__default)) { - TubeMapDrawer tubeMapDrawer = new TubeMapDrawer(nodes); - DisplayMetrics metrics = getResources().getDisplayMetrics(); + if (!prefs.getBoolean(R.string.pref__network_overlay, R.bool.pref__network_overlay__default)) { + TubeMapDrawer tubeMapDrawer = new TubeMapDrawer(nodes, staticData.getLineColors()); tubeMapDrawer.setSize(dip(this, 1024), dip(this, 1024)); map.addGroundOverlay(new GroundOverlayOptions() .positionFromBounds(rangeDrawer.getBounds()) @@ -328,8 +348,9 @@ private void setNodes(Set nodes) { .image(BitmapDescriptorFactory.fromBitmap(tubeMapDrawer.draw(nodes))) ); } else { - TubeMapTileProvider provider = new TubeMapTileProvider(nodes, Math.max(256, dipInt(this, 192))); - if (BuildConfig.DEBUG) { + int tileSize = Math.max(256, dipInt(this, 192)); + TubeMapTileProvider provider = new TubeMapTileProvider(nodes, staticData.getLineColors(), tileSize, buildConfig.isDebug()); + if (buildConfig.isDebug()) { provider.setMarkers(new MarkerAdder() { @Override public void addMarker(final double lat, final double lon, final String text) { getWindow().getDecorView().post(new Runnable() { @@ -348,7 +369,7 @@ private void setNodes(Set nodes) { .tileProvider(provider) .transparency(0.50f) ); - if (BuildConfig.DEBUG) { + if (buildConfig.isDebug()) { overlay.clearTileCache(); } } @@ -393,7 +414,7 @@ private void reCreateMarkers(Collection startNodes) { for (NetworkNode startNode : startNodes) { LOG.trace("Creating marker for {}", startNode); StopType stopType = startNode.getLine().getDefaultStopType(); - Map icons = App.getInstance().getStaticData().getStopTypeMiniIcons(); + Map icons = staticData.getStopTypeMiniIcons(); Marker marker = map.addMarker(new MarkerOptions() .title(startNode.getName()) .position(LocationUtils.toLatLng(startNode.getLocation())) @@ -414,7 +435,7 @@ private void reCreateMarkers(Collection startNodes) { private void updateNearestStations(Collection startNodes) { nearestFragment.updateNearestStations(startNodes, genConfig); - if (App.prefs().getBoolean(R.string.pref__show_nearest, R.bool.pref__show_nearest__default)) { + if (prefs.getBoolean(R.string.pref__show_nearest, R.bool.pref__show_nearest__default)) { behavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } } diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeNearestFragment.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeNearestFragment.java similarity index 94% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeNearestFragment.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeNearestFragment.java index fcaa3bc4..4194a7b5 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeNearestFragment.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeNearestFragment.java @@ -4,6 +4,8 @@ import static java.util.concurrent.TimeUnit.*; +import javax.inject.Inject; + import org.slf4j.*; import android.annotation.SuppressLint; @@ -22,10 +24,12 @@ import net.twisterrob.android.utils.tools.StringerTools; import net.twisterrob.android.utils.tostring.stringers.name.AddressNameStringer; import net.twisterrob.android.view.AutomatedViewSwitcher; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.Injector; +import net.twisterrob.blt.android.data.AndroidStaticData; import net.twisterrob.blt.android.data.LocationUtils; import net.twisterrob.blt.android.data.range.RangeMapGeneratorConfig; import net.twisterrob.blt.android.db.model.*; +import net.twisterrob.blt.android.feature.range.R; import net.twisterrob.blt.android.ui.adapter.StationAdapter; import net.twisterrob.blt.android.ui.adapter.StationAdapter.ViewHolder.DescriptionFormatter; import net.twisterrob.blt.model.*; @@ -39,6 +43,15 @@ public class RangeNearestFragment extends Fragment { private ViewGroup nearestStations; private LatLng lastStartPoint; private GeocoderTask m_geocoderTask; + + @Inject + AndroidStaticData staticData; + + @Override public void onAttach(@NonNull Context context) { + Injector.from(context).inject(this); + super.onAttach(context); + } + @Override public @Nullable View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_range_nearest, container, false); @@ -102,7 +115,7 @@ public void updateNearestStations(Collection startNodes, final Rang for (StationWithDistance station : toStations(startNodes)) { LOG.trace("Creating nearest station for {}", station); View view = inflater.inflate(R.layout.item_station, nearestStations, false); - new StationAdapter.ViewHolder(view, formatter).bind(station, null); + new StationAdapter.ViewHolder(view, staticData, formatter).bind(station, null); nearestStations.addView(view); } if (nearestStations.getChildCount() == 0) { diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeOptionsFragment.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeOptionsFragment.java similarity index 95% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeOptionsFragment.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeOptionsFragment.java index c1e14891..d0c3715c 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/RangeOptionsFragment.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/RangeOptionsFragment.java @@ -1,7 +1,10 @@ package net.twisterrob.blt.android.ui.activity; +import javax.inject.Inject; + import org.slf4j.*; +import android.content.Context; import android.os.Bundle; import androidx.annotation.*; import com.google.android.material.navigation.NavigationView; @@ -23,9 +26,10 @@ import net.twisterrob.android.utils.tools.ResourceTools; import net.twisterrob.android.wiring.NumberPickerWidget; import net.twisterrob.android.wiring.NumberPickerWidget.OnValueChangeListener; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.Injector; +import net.twisterrob.blt.android.data.AndroidStaticData; import net.twisterrob.blt.android.data.range.*; +import net.twisterrob.blt.android.feature.range.R; import net.twisterrob.blt.android.ui.*; public class RangeOptionsFragment extends Fragment { @@ -38,7 +42,6 @@ public class RangeOptionsFragment extends Fragment { private NumberPickerWidget startWalk; private CompoundButton intraStation; private CompoundButton interStation; - private final ResourcePreferences prefs = App.prefs(); private ColorPickerWidget borderColor; private NumberPickerWidget borderSize; private CompoundButton dynamicColor; @@ -53,6 +56,17 @@ interface ConfigsUpdatedListener { private RangeMapDrawerConfig drawConfig; private ConfigsUpdatedListener configsUpdatedListener; + @Inject + AndroidStaticData staticData; + + @Inject + ResourcePreferences prefs; + + @Override public void onAttach(@NonNull Context context) { + Injector.from(context).inject(this); + super.onAttach(context); + } + @Override public @Nullable View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_range_options, container, false); @@ -261,7 +275,8 @@ private ColorPickerWidget color(@IdRes int menuItemId, || item.getGroupId() == R.id.group__range__config__draw || item.getGroupId() == R.id.group__range__config__ui) { @StringRes int tooltipID = getTooltip(item); - Spanned tooltip = HtmlParser.fromHtml(getString(tooltipID), null, new TubeHtmlHandler(getContext())); + TubeHtmlHandler tagHandler = new TubeHtmlHandler(getContext(), staticData); + Spanned tooltip = HtmlParser.fromHtml(getString(tooltipID), null, tagHandler); DialogTools .notify(getContext(), PopupCallbacks.DoNothing.instance()) .setTitle(item.getTitle()) @@ -276,7 +291,7 @@ private ColorPickerWidget color(@IdRes int menuItemId, configsUpdatedListener.onConfigsUpdated(); return true; } else if (id == R.id.menu__action__range__reset_drawing) { - drawConfig.set(new RangeMapDrawerConfig()); + drawConfig.set(new RangeMapDrawerConfig(staticData.getLineColors())); bindConfigs(genConfig, drawConfig); // update self UI configsUpdatedListener.onConfigsUpdated(); return true; diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/MapActivity.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/main/MapActivity.java similarity index 100% rename from Android/src/main/java/net/twisterrob/blt/android/ui/activity/main/MapActivity.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/activity/main/MapActivity.java diff --git a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/StationAdapter.java b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/adapter/StationAdapter.java similarity index 90% rename from Android/src/main/java/net/twisterrob/blt/android/ui/adapter/StationAdapter.java rename to android/feature/range/src/main/java/net/twisterrob/blt/android/ui/adapter/StationAdapter.java index c5f160e9..5a2c93ca 100644 --- a/Android/src/main/java/net/twisterrob/blt/android/ui/adapter/StationAdapter.java +++ b/android/feature/range/src/main/java/net/twisterrob/blt/android/ui/adapter/StationAdapter.java @@ -13,16 +13,20 @@ import android.widget.*; import net.twisterrob.android.adapter.BaseListAdapter; -import net.twisterrob.blt.android.*; -import net.twisterrob.blt.android.R; +import net.twisterrob.blt.android.data.AndroidStaticData; import net.twisterrob.blt.android.db.model.Station; +import net.twisterrob.blt.android.feature.range.R; import net.twisterrob.blt.android.ui.adapter.StationAdapter.ViewHolder; import net.twisterrob.blt.android.ui.adapter.StationAdapter.ViewHolder.DescriptionFormatter; import net.twisterrob.blt.model.*; public class StationAdapter extends BaseListAdapter { - public StationAdapter(final Context context, final Collection items) { + + private final AndroidStaticData staticData; + + public StationAdapter(final Context context, final Collection items, AndroidStaticData staticData) { super(context, items, false); + this.staticData = staticData; } public static class ViewHolder { private final TextView title; @@ -32,16 +36,19 @@ public static class ViewHolder { private final View[] lines = new View[6]; private final Context context; + private final AndroidStaticData staticData; + public interface DescriptionFormatter { CharSequence format(Station station); } - public ViewHolder(final View view, DescriptionFormatter descriptionFormatter) { + public ViewHolder(final View view, AndroidStaticData staticData, DescriptionFormatter descriptionFormatter) { this.context = view.getContext(); this.descriptionFormatter = descriptionFormatter; this.title = (TextView)view.findViewById(android.R.id.text1); this.description = (TextView)view.findViewById(android.R.id.text2); this.icon = (ImageView)view.findViewById(android.R.id.icon); + this.staticData = staticData; lines[0] = view.findViewById(R.id.box_line_1); lines[1] = view.findViewById(R.id.box_line_2); lines[2] = view.findViewById(R.id.box_line_3); @@ -75,7 +82,7 @@ public ViewHolder(final View view, DescriptionFormatter descriptionFormatter) { } public void bind(Station currentItem, String filter) { - Map logos = App.getInstance().getStaticData().getStopTypeLogos(); + Map logos = staticData.getStopTypeLogos(); Drawable icon = ContextCompat.getDrawable(context, logos.get(currentItem.getType())); CharSequence title = highlight(currentItem.getName(), filter); CharSequence stationLines = descriptionFormatter.format(currentItem); @@ -105,13 +112,12 @@ private CharSequence highlight(CharSequence title, String lastFilter) { } private void updateLineColors(List lines) { - LineColors colors = App.getInstance().getStaticData().getLineColors(); for (int i = 0; i < this.lines.length; ++i) { View lineView = this.lines[i]; if (i < lines.size()) { Line line = lines.get(i); lineView.setVisibility(View.VISIBLE); - lineView.setBackgroundColor(line.getBackground(colors)); + lineView.setBackgroundColor(line.getBackground(staticData.getLineColors())); lineView.setContentDescription(line.getTitle()); lineView.setTag(line); } else { @@ -129,7 +135,7 @@ private void updateLineColors(List lines) { } @Override protected ViewHolder createHolder(final View convertView) { - return new ViewHolder(convertView, new DescriptionFormatter() { + return new ViewHolder(convertView, staticData, new DescriptionFormatter() { @Override public CharSequence format(Station station) { return convertView.getContext().getString(R.string.station_lines, station.getType(), station.getLines()); diff --git a/android/feature/range/src/main/proguard.pro b/android/feature/range/src/main/proguard.pro new file mode 100644 index 00000000..71be65ef --- /dev/null +++ b/android/feature/range/src/main/proguard.pro @@ -0,0 +1,12 @@ +### -- android/feature/range/proguard.pro -- ### + +# TODEL https://issuetracker.google.com/issues/312677256 +# WARNING: app\build\intermediates\merged_java_res\release\mergeReleaseJavaResource\base.jar: +# R8: Unexpected reference to missing service class: META-INF/services/io.grpc.LoadBalancerProvider. +-dontwarn io.grpc.LoadBalancerProvider +# R8: Unexpected reference to missing service implementation class in META-INF/services/io.grpc.LoadBalancerProvider: io.grpc.internal.PickFirstLoadBalancerProvider. +-dontwarn io.grpc.internal.PickFirstLoadBalancerProvider +# R8: Unexpected reference to missing service class: META-INF/services/io.grpc.NameResolverProvider. +-dontwarn io.grpc.NameResolverProvider +# R8: Unexpected reference to missing service implementation class in META-INF/services/io.grpc.NameResolverProvider: io.grpc.internal.DnsNameResolverProvider. +-dontwarn io.grpc.internal.DnsNameResolverProvider diff --git a/Android/src/main/res/layout/activity_range_map.xml b/android/feature/range/src/main/res/layout/activity_range_map.xml similarity index 98% rename from Android/src/main/res/layout/activity_range_map.xml rename to android/feature/range/src/main/res/layout/activity_range_map.xml index 85ee86ac..96846a21 100644 --- a/Android/src/main/res/layout/activity_range_map.xml +++ b/android/feature/range/src/main/res/layout/activity_range_map.xml @@ -55,7 +55,7 @@ android:layout_height="?attr/actionBarSize" android:fitsSystemWindows="true" toolbar:layout_collapseMode="pin" - toolbar:title="@string/launcher__range_map" + toolbar:title="@string/range__title" toolbar:popupTheme="@style/ThemeOverlay.AppCompat.Light" > - Better London Travel - Station List - Station Map - Station Info - PostCode Map - Tube Range Map - Line Status - Train Predictions - Search - - Last updated at %1$tF %1$tT - - %1$s: a single train is approaching. - %1$s: %2$d trains are approaching. - - %1$s has no trains approaching + + Tube Range Map + %1$s: %2$s Station operator icon + Near %1$.4f, %2$.4f No stations found around here. - Directions - Northbound - N - Southbound - S - Westbound - W - Eastbound - E - Others - O Parameters @@ -163,4 +140,5 @@ No, for ground; they are always shown, no time is needed to load them when zoomed, but they are a mush when zoomed in too much. A restart is needed to take effect. ]]> + diff --git a/Android/src/main/res/values/styles.xml b/android/feature/range/src/main/res/values/styles.xml similarity index 99% rename from Android/src/main/res/values/styles.xml rename to android/feature/range/src/main/res/values/styles.xml index f6cb9673..6d8b1ba0 100644 --- a/Android/src/main/res/values/styles.xml +++ b/android/feature/range/src/main/res/values/styles.xml @@ -4,4 +4,5 @@ #FF0000 bold + diff --git a/build.gradle b/build.gradle index de50dfa6..637b1086 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ plugins { + // REPORT removing this makes everything in gradle/plugins/build.gradle invisible to build.gradle plugins blocks. id("net.twisterrob.blt.convention") id("org.gradle.idea") } @@ -7,6 +8,7 @@ idea { module { excludeDirs = [ file(".gradle"), + file("build"), file(".idea"), file("temp"), ] diff --git a/Shared/android-polyfill/build.gradle b/common/android-polyfill/build.gradle similarity index 54% rename from Shared/android-polyfill/build.gradle rename to common/android-polyfill/build.gradle index 9cadc15c..b908f42f 100644 --- a/Shared/android-polyfill/build.gradle +++ b/common/android-polyfill/build.gradle @@ -4,11 +4,6 @@ plugins { id("net.twisterrob.gradle.plugin.java") } -java { - sourceCompatibility = libs.versions.java.asProvider().get() - targetCompatibility = libs.versions.java.asProvider().get() -} - dependencies { implementation(libs.kxml2) } diff --git a/Shared/android-polyfill/src/main/java/android/sax/BadXmlException.java b/common/android-polyfill/src/main/java/android/sax/BadXmlException.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/BadXmlException.java rename to common/android-polyfill/src/main/java/android/sax/BadXmlException.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/Children.java b/common/android-polyfill/src/main/java/android/sax/Children.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/Children.java rename to common/android-polyfill/src/main/java/android/sax/Children.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/Element.java b/common/android-polyfill/src/main/java/android/sax/Element.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/Element.java rename to common/android-polyfill/src/main/java/android/sax/Element.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/ElementListener.java b/common/android-polyfill/src/main/java/android/sax/ElementListener.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/ElementListener.java rename to common/android-polyfill/src/main/java/android/sax/ElementListener.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/EndElementListener.java b/common/android-polyfill/src/main/java/android/sax/EndElementListener.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/EndElementListener.java rename to common/android-polyfill/src/main/java/android/sax/EndElementListener.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/EndTextElementListener.java b/common/android-polyfill/src/main/java/android/sax/EndTextElementListener.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/EndTextElementListener.java rename to common/android-polyfill/src/main/java/android/sax/EndTextElementListener.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/RootElement.java b/common/android-polyfill/src/main/java/android/sax/RootElement.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/RootElement.java rename to common/android-polyfill/src/main/java/android/sax/RootElement.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/StartElementListener.java b/common/android-polyfill/src/main/java/android/sax/StartElementListener.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/StartElementListener.java rename to common/android-polyfill/src/main/java/android/sax/StartElementListener.java diff --git a/Shared/android-polyfill/src/main/java/android/sax/TextElementListener.java b/common/android-polyfill/src/main/java/android/sax/TextElementListener.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/sax/TextElementListener.java rename to common/android-polyfill/src/main/java/android/sax/TextElementListener.java diff --git a/Shared/android-polyfill/src/main/java/android/util/AttributeSet.java b/common/android-polyfill/src/main/java/android/util/AttributeSet.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/util/AttributeSet.java rename to common/android-polyfill/src/main/java/android/util/AttributeSet.java diff --git a/Shared/android-polyfill/src/main/java/android/util/Log.java b/common/android-polyfill/src/main/java/android/util/Log.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/util/Log.java rename to common/android-polyfill/src/main/java/android/util/Log.java diff --git a/Shared/android-polyfill/src/main/java/android/util/Xml.java b/common/android-polyfill/src/main/java/android/util/Xml.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/util/Xml.java rename to common/android-polyfill/src/main/java/android/util/Xml.java diff --git a/Shared/android-polyfill/src/main/java/android/util/XmlPullAttributes.java b/common/android-polyfill/src/main/java/android/util/XmlPullAttributes.java similarity index 100% rename from Shared/android-polyfill/src/main/java/android/util/XmlPullAttributes.java rename to common/android-polyfill/src/main/java/android/util/XmlPullAttributes.java diff --git a/Shared/android-polyfill/src/main/java/com/android/internal/util/FastXmlSerializer.java b/common/android-polyfill/src/main/java/com/android/internal/util/FastXmlSerializer.java similarity index 100% rename from Shared/android-polyfill/src/main/java/com/android/internal/util/FastXmlSerializer.java rename to common/android-polyfill/src/main/java/com/android/internal/util/FastXmlSerializer.java diff --git a/Shared/android-polyfill/src/main/java/com/android/internal/util/XmlUtils.java b/common/android-polyfill/src/main/java/com/android/internal/util/XmlUtils.java similarity index 100% rename from Shared/android-polyfill/src/main/java/com/android/internal/util/XmlUtils.java rename to common/android-polyfill/src/main/java/com/android/internal/util/XmlUtils.java diff --git a/Data/LondonTravel.v1.data-StopDistance.xlsx b/common/data/LondonTravel.v1.data-StopDistance.xlsx similarity index 100% rename from Data/LondonTravel.v1.data-StopDistance.xlsx rename to common/data/LondonTravel.v1.data-StopDistance.xlsx diff --git a/Data/README.md b/common/data/README.md similarity index 77% rename from Data/README.md rename to common/data/README.md index 21875d41..e6194c81 100644 --- a/Data/README.md +++ b/common/data/README.md @@ -1,5 +1,5 @@ Fake data can be served via ``` -gradlew :Data:appRun +gradlew :common:data:appRun ``` Change `net.twisterrob.blt.android.App.ALLOW_MOCK_URLS = true` diff --git a/Data/build.gradle b/common/data/build.gradle similarity index 82% rename from Data/build.gradle rename to common/data/build.gradle index 8e8c9a5d..51c584cf 100644 --- a/Data/build.gradle +++ b/common/data/build.gradle @@ -6,24 +6,18 @@ plugins { id("org.gradle.idea") } -java { - sourceCompatibility = libs.versions.java.asProvider().get() - targetCompatibility = libs.versions.java.asProvider().get() -} - -// name = "twister-travel-data" -version = "0.0.1-SNAPSHOT" -// Better London Travel Data Generation -// Standalone project to handle large feeds +description = "Better London Travel Data Generation: Standalone project to handle large feeds" dependencies { - api(projects.shared) + implementation(projects.common.model) + runtimeOnly(projects.common.androidPolyfill) + implementation(libs.jsr305) implementation(libs.slf4j.api) implementation(libs.slf4j.simple) implementation(libs.sqlite.jdbc) - testImplementation(projects.shared.testHelpers) + testImplementation(projects.common.testHelpers) } // TODO logging doesn't work with org.eclipse nor org.mortbay package names @@ -51,7 +45,7 @@ idea { } tasks.register("runNetwork", JavaExec.class) { - File inputDir = file("../temp/feed15/LULDLRRiverTramCable") + File inputDir = rootProject.file("temp/feed15/LULDLRRiverTramCable") File outputDir = file("output") inputs.dir(inputDir).withPathSensitivity(PathSensitivity.RELATIVE) inputs.dir("src/data/PredictionSummary") @@ -71,7 +65,7 @@ tasks.register("runNetwork", JavaExec.class) { } tasks.register("runPostCode", JavaExec.class) { - def inputDir = "../temp/feed15/LULDLRRiverTramCable" + def inputDir = rootProject.file("temp/feed15/LULDLRRiverTramCable") def outputFile = "output/LondonTravel.data.AreaHull.sql" inputs.dir(inputDir).withPathSensitivity(PathSensitivity.RELATIVE) outputs.file(outputFile) diff --git a/Data/lint.xml b/common/data/lint.xml similarity index 100% rename from Data/lint.xml rename to common/data/lint.xml diff --git a/Data/output/.gitignore b/common/data/output/.gitignore similarity index 100% rename from Data/output/.gitignore rename to common/data/output/.gitignore diff --git a/Data/src/data/.gitignore b/common/data/src/data/.gitignore similarity index 100% rename from Data/src/data/.gitignore rename to common/data/src/data/.gitignore diff --git a/Data/src/data/PredictionDetailed/PredictionDetailed-C-BNK.xml b/common/data/src/data/PredictionDetailed/PredictionDetailed-C-BNK.xml similarity index 100% rename from Data/src/data/PredictionDetailed/PredictionDetailed-C-BNK.xml rename to common/data/src/data/PredictionDetailed/PredictionDetailed-C-BNK.xml diff --git a/Data/src/data/PredictionDetailed/PredictionDetailed-H-KXX.xml b/common/data/src/data/PredictionDetailed/PredictionDetailed-H-KXX.xml similarity index 100% rename from Data/src/data/PredictionDetailed/PredictionDetailed-H-KXX.xml rename to common/data/src/data/PredictionDetailed/PredictionDetailed-H-KXX.xml diff --git a/Data/src/data/PredictionDetailed/PredictionDetailed-M-KXX.xml b/common/data/src/data/PredictionDetailed/PredictionDetailed-M-KXX.xml similarity index 100% rename from Data/src/data/PredictionDetailed/PredictionDetailed-M-KXX.xml rename to common/data/src/data/PredictionDetailed/PredictionDetailed-M-KXX.xml diff --git a/Data/src/data/PredictionDetailed/PredictionDetailed-N-KXX.xml b/common/data/src/data/PredictionDetailed/PredictionDetailed-N-KXX.xml similarity index 100% rename from Data/src/data/PredictionDetailed/PredictionDetailed-N-KXX.xml rename to common/data/src/data/PredictionDetailed/PredictionDetailed-N-KXX.xml diff --git a/Data/src/data/PredictionDetailed/PredictionDetailed-P-KXX.xml b/common/data/src/data/PredictionDetailed/PredictionDetailed-P-KXX.xml similarity index 100% rename from Data/src/data/PredictionDetailed/PredictionDetailed-P-KXX.xml rename to common/data/src/data/PredictionDetailed/PredictionDetailed-P-KXX.xml diff --git a/Data/src/data/PredictionDetailed/PredictionDetailed-V-KXX.xml b/common/data/src/data/PredictionDetailed/PredictionDetailed-V-KXX.xml similarity index 100% rename from Data/src/data/PredictionDetailed/PredictionDetailed-V-KXX.xml rename to common/data/src/data/PredictionDetailed/PredictionDetailed-V-KXX.xml diff --git a/Data/src/data/PredictionDetailed/descript.ion b/common/data/src/data/PredictionDetailed/descript.ion similarity index 100% rename from Data/src/data/PredictionDetailed/descript.ion rename to common/data/src/data/PredictionDetailed/descript.ion diff --git a/Data/src/data/PredictionSummary/PredictionSummary-B.xml b/common/data/src/data/PredictionSummary/PredictionSummary-B.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-B.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-B.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-C.xml b/common/data/src/data/PredictionSummary/PredictionSummary-C.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-C.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-C.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-D.xml b/common/data/src/data/PredictionSummary/PredictionSummary-D.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-D.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-D.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-H.xml b/common/data/src/data/PredictionSummary/PredictionSummary-H.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-H.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-H.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-J.xml b/common/data/src/data/PredictionSummary/PredictionSummary-J.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-J.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-J.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-M.xml b/common/data/src/data/PredictionSummary/PredictionSummary-M.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-M.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-M.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-N.xml b/common/data/src/data/PredictionSummary/PredictionSummary-N.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-N.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-N.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-P.xml b/common/data/src/data/PredictionSummary/PredictionSummary-P.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-P.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-P.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-V.xml b/common/data/src/data/PredictionSummary/PredictionSummary-V.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-V.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-V.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary-W.xml b/common/data/src/data/PredictionSummary/PredictionSummary-W.xml similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary-W.xml rename to common/data/src/data/PredictionSummary/PredictionSummary-W.xml diff --git a/Data/src/data/PredictionSummary/PredictionSummary.cmd b/common/data/src/data/PredictionSummary/PredictionSummary.cmd similarity index 100% rename from Data/src/data/PredictionSummary/PredictionSummary.cmd rename to common/data/src/data/PredictionSummary/PredictionSummary.cmd diff --git a/Data/src/data/PredictionSummary/descript.ion b/common/data/src/data/PredictionSummary/descript.ion similarity index 100% rename from Data/src/data/PredictionSummary/descript.ion rename to common/data/src/data/PredictionSummary/descript.ion diff --git a/Data/src/data/Readme.txt b/common/data/src/data/Readme.txt similarity index 100% rename from Data/src/data/Readme.txt rename to common/data/src/data/Readme.txt diff --git a/Data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml b/common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml similarity index 100% rename from Data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml rename to common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml diff --git a/Data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml b/common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml similarity index 100% rename from Data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml rename to common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml diff --git a/Data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml b/common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml similarity index 100% rename from Data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml rename to common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml diff --git a/Data/src/data/TrackerNetStatus/LineStatus.xmas.xml b/common/data/src/data/TrackerNetStatus/LineStatus.xmas.xml similarity index 100% rename from Data/src/data/TrackerNetStatus/LineStatus.xmas.xml rename to common/data/src/data/TrackerNetStatus/LineStatus.xmas.xml diff --git a/Data/src/data/TrackerNetStatus/LineStatus.xml b/common/data/src/data/TrackerNetStatus/LineStatus.xml similarity index 100% rename from Data/src/data/TrackerNetStatus/LineStatus.xml rename to common/data/src/data/TrackerNetStatus/LineStatus.xml diff --git a/Data/src/data/TrackerNetStatus/descript.ion b/common/data/src/data/TrackerNetStatus/descript.ion similarity index 100% rename from Data/src/data/TrackerNetStatus/descript.ion rename to common/data/src/data/TrackerNetStatus/descript.ion diff --git a/Data/src/data/descript.ion b/common/data/src/data/descript.ion similarity index 100% rename from Data/src/data/descript.ion rename to common/data/src/data/descript.ion diff --git a/Data/src/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml b/common/data/src/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml similarity index 100% rename from Data/src/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml rename to common/data/src/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml diff --git a/Data/src/data/london.csv.gz b/common/data/src/data/london.csv.gz similarity index 100% rename from Data/src/data/london.csv.gz rename to common/data/src/data/london.csv.gz diff --git a/Data/src/data/samples/PierLocations_v1.kml b/common/data/src/data/samples/PierLocations_v1.kml similarity index 100% rename from Data/src/data/samples/PierLocations_v1.kml rename to common/data/src/data/samples/PierLocations_v1.kml diff --git a/Data/src/data/samples/StationFacilitiessample.xml b/common/data/src/data/samples/StationFacilitiessample.xml similarity index 100% rename from Data/src/data/samples/StationFacilitiessample.xml rename to common/data/src/data/samples/StationFacilitiessample.xml diff --git a/Data/src/data/samples/Stations.kml b/common/data/src/data/samples/Stations.kml similarity index 100% rename from Data/src/data/samples/Stations.kml rename to common/data/src/data/samples/Stations.kml diff --git a/Data/src/data/samples/descript.ion b/common/data/src/data/samples/descript.ion similarity index 100% rename from Data/src/data/samples/descript.ion rename to common/data/src/data/samples/descript.ion diff --git a/Data/src/data/schemas/PierLocations_v1.xsd b/common/data/src/data/schemas/PierLocations_v1.xsd similarity index 100% rename from Data/src/data/schemas/PierLocations_v1.xsd rename to common/data/src/data/schemas/PierLocations_v1.xsd diff --git a/Data/src/data/schemas/StationLocations_v1.xsd b/common/data/src/data/schemas/StationLocations_v1.xsd similarity index 100% rename from Data/src/data/schemas/StationLocations_v1.xsd rename to common/data/src/data/schemas/StationLocations_v1.xsd diff --git a/Data/src/data/schemas/descript.ion b/common/data/src/data/schemas/descript.ion similarity index 100% rename from Data/src/data/schemas/descript.ion rename to common/data/src/data/schemas/descript.ion diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java rename to common/data/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java b/common/data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java rename to common/data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java b/common/data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java rename to common/data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java b/common/data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java rename to common/data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java b/common/data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java rename to common/data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/io/FeedReader.java b/common/data/src/main/java/net/twisterrob/blt/data/io/FeedReader.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/io/FeedReader.java rename to common/data/src/main/java/net/twisterrob/blt/data/io/FeedReader.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java b/common/data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java rename to common/data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java b/common/data/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java rename to common/data/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java b/common/data/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java rename to common/data/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java b/common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java rename to common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java b/common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java rename to common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java b/common/data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java rename to common/data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java b/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java rename to common/data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java b/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java rename to common/data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java diff --git a/Data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java b/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java similarity index 100% rename from Data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java rename to common/data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java diff --git a/Data/src/main/resources/simplelogger.properties b/common/data/src/main/resources/simplelogger.properties similarity index 100% rename from Data/src/main/resources/simplelogger.properties rename to common/data/src/main/resources/simplelogger.properties diff --git a/Data/src/main/webapp/WEB-INF/web.xml b/common/data/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from Data/src/main/webapp/WEB-INF/web.xml rename to common/data/src/main/webapp/WEB-INF/web.xml diff --git a/common/diff/build.gradle b/common/diff/build.gradle new file mode 100644 index 00000000..97535fef --- /dev/null +++ b/common/diff/build.gradle @@ -0,0 +1,9 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") +} + +dependencies { + testImplementation(libs.test.junit4) +} diff --git a/Shared/diff/src/main/java/name/fraser/neil/plaintext/diff_match_patch.java b/common/diff/src/main/java/name/fraser/neil/plaintext/diff_match_patch.java similarity index 100% rename from Shared/diff/src/main/java/name/fraser/neil/plaintext/diff_match_patch.java rename to common/diff/src/main/java/name/fraser/neil/plaintext/diff_match_patch.java diff --git a/Shared/diff/src/main/java/net/twisterrob/blt/diff/HtmlDiff.java b/common/diff/src/main/java/net/twisterrob/blt/diff/HtmlDiff.java similarity index 100% rename from Shared/diff/src/main/java/net/twisterrob/blt/diff/HtmlDiff.java rename to common/diff/src/main/java/net/twisterrob/blt/diff/HtmlDiff.java diff --git a/AppEngine/src/test/diff/name/fraser/neil/plaintext/diff_match_patch_test.java b/common/diff/src/test/java/name/fraser/neil/plaintext/diff_match_patch_test.java similarity index 100% rename from AppEngine/src/test/diff/name/fraser/neil/plaintext/diff_match_patch_test.java rename to common/diff/src/test/java/name/fraser/neil/plaintext/diff_match_patch_test.java diff --git a/Shared/build.gradle b/common/model/build.gradle similarity index 56% rename from Shared/build.gradle rename to common/model/build.gradle index 7f50d522..801b5cb5 100644 --- a/Shared/build.gradle +++ b/common/model/build.gradle @@ -5,25 +5,17 @@ plugins { id("com.android.lint") } -java { - sourceCompatibility = libs.versions.java.asProvider().get() - targetCompatibility = libs.versions.java.asProvider().get() -} - -// Better London Travel Shared -// Shared model and surrounding classes -//name = "twister-travel-shared" -version = "0.0.1-SNAPSHOT" dependencies { api("net.twisterrob.lib:twister-lib-general") api("net.twisterrob.lib:twister-lib-core") implementation(libs.jsr305) implementation(libs.slf4j.api) - implementation(projects.shared.androidPolyfill) + compileOnly(projects.common.androidPolyfill) implementation("net.twisterrob.lib:twister-lib-java_desktop") - testImplementation(projects.shared.testHelpers) + testImplementation(projects.common.testHelpers) + testRuntimeOnly(projects.common.androidPolyfill) } lint { diff --git a/Shared/src/main/java/net/twisterrob/blt/data/SharedStaticData.java b/common/model/src/main/java/net/twisterrob/blt/data/SharedStaticData.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/data/SharedStaticData.java rename to common/model/src/main/java/net/twisterrob/blt/data/SharedStaticData.java diff --git a/Shared/src/main/java/net/twisterrob/blt/data/StaticData.java b/common/model/src/main/java/net/twisterrob/blt/data/StaticData.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/data/StaticData.java rename to common/model/src/main/java/net/twisterrob/blt/data/StaticData.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/Feed.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/Feed.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/Feed.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/Feed.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java diff --git a/Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java b/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java rename to common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/Line.java b/common/model/src/main/java/net/twisterrob/blt/model/Line.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/Line.java rename to common/model/src/main/java/net/twisterrob/blt/model/Line.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/LineColors.java b/common/model/src/main/java/net/twisterrob/blt/model/LineColors.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/LineColors.java rename to common/model/src/main/java/net/twisterrob/blt/model/LineColors.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/Operator.java b/common/model/src/main/java/net/twisterrob/blt/model/Operator.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/Operator.java rename to common/model/src/main/java/net/twisterrob/blt/model/Operator.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/PlatformDirection.java b/common/model/src/main/java/net/twisterrob/blt/model/PlatformDirection.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/PlatformDirection.java rename to common/model/src/main/java/net/twisterrob/blt/model/PlatformDirection.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/StopType.java b/common/model/src/main/java/net/twisterrob/blt/model/StopType.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/StopType.java rename to common/model/src/main/java/net/twisterrob/blt/model/StopType.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java b/common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java rename to common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java b/common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java rename to common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java b/common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java rename to common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/TextLineColors.java b/common/model/src/main/java/net/twisterrob/blt/model/TextLineColors.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/TextLineColors.java rename to common/model/src/main/java/net/twisterrob/blt/model/TextLineColors.java diff --git a/Shared/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java b/common/model/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java rename to common/model/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java diff --git a/Shared/src/main/java/net/twisterrob/java/io/MailSender.java b/common/model/src/main/java/net/twisterrob/java/io/MailSender.java similarity index 100% rename from Shared/src/main/java/net/twisterrob/java/io/MailSender.java rename to common/model/src/main/java/net/twisterrob/java/io/MailSender.java diff --git a/Shared/src/main/java/org/maptiler/GlobalGeodetic.java b/common/model/src/main/java/org/maptiler/GlobalGeodetic.java similarity index 100% rename from Shared/src/main/java/org/maptiler/GlobalGeodetic.java rename to common/model/src/main/java/org/maptiler/GlobalGeodetic.java diff --git a/Shared/src/main/java/org/maptiler/GlobalMercator.java b/common/model/src/main/java/org/maptiler/GlobalMercator.java similarity index 100% rename from Shared/src/main/java/org/maptiler/GlobalMercator.java rename to common/model/src/main/java/org/maptiler/GlobalMercator.java diff --git a/Shared/src/main/java/org/maptiler/LatLon.java b/common/model/src/main/java/org/maptiler/LatLon.java similarity index 100% rename from Shared/src/main/java/org/maptiler/LatLon.java rename to common/model/src/main/java/org/maptiler/LatLon.java diff --git a/Shared/src/main/java/org/maptiler/Meters.java b/common/model/src/main/java/org/maptiler/Meters.java similarity index 100% rename from Shared/src/main/java/org/maptiler/Meters.java rename to common/model/src/main/java/org/maptiler/Meters.java diff --git a/Shared/src/main/java/org/maptiler/Pixels.java b/common/model/src/main/java/org/maptiler/Pixels.java similarity index 100% rename from Shared/src/main/java/org/maptiler/Pixels.java rename to common/model/src/main/java/org/maptiler/Pixels.java diff --git a/Shared/src/main/java/org/maptiler/Tile.java b/common/model/src/main/java/org/maptiler/Tile.java similarity index 100% rename from Shared/src/main/java/org/maptiler/Tile.java rename to common/model/src/main/java/org/maptiler/Tile.java diff --git a/Shared/src/main/java/org/maptiler/globalmaptiles.java b/common/model/src/main/java/org/maptiler/globalmaptiles.java similarity index 100% rename from Shared/src/main/java/org/maptiler/globalmaptiles.java rename to common/model/src/main/java/org/maptiler/globalmaptiles.java diff --git a/Shared/src/main/java/org/maptiler/package-info.java b/common/model/src/main/java/org/maptiler/package-info.java similarity index 100% rename from Shared/src/main/java/org/maptiler/package-info.java rename to common/model/src/main/java/org/maptiler/package-info.java diff --git a/Shared/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java b/common/model/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java similarity index 100% rename from Shared/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java rename to common/model/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java diff --git a/Shared/src/test/java/net/twisterrob/blt/model/LineTest.java b/common/model/src/test/java/net/twisterrob/blt/model/LineTest.java similarity index 100% rename from Shared/src/test/java/net/twisterrob/blt/model/LineTest.java rename to common/model/src/test/java/net/twisterrob/blt/model/LineTest.java diff --git a/Shared/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml b/common/model/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml similarity index 100% rename from Shared/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml rename to common/model/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml diff --git a/Shared/test-helpers/build.gradle b/common/test-helpers/build.gradle similarity index 77% rename from Shared/test-helpers/build.gradle rename to common/test-helpers/build.gradle index d8af37a6..c194b101 100644 --- a/Shared/test-helpers/build.gradle +++ b/common/test-helpers/build.gradle @@ -3,11 +3,6 @@ plugins { id("org.gradle.java-library") } -java { - sourceCompatibility = libs.versions.java.asProvider().get() - targetCompatibility = libs.versions.java.asProvider().get() -} - dependencies { api(libs.test.junit4) { // we don't need this because we use org.hamcrest v2 diff --git a/config/lint/lint-baseline.xml b/config/lint/lint-baseline-android-app-full.xml similarity index 100% rename from config/lint/lint-baseline.xml rename to config/lint/lint-baseline-android-app-full.xml diff --git a/config/lint/lint-baseline-android-app-range.xml b/config/lint/lint-baseline-android-app-range.xml new file mode 100644 index 00000000..d218b6a7 --- /dev/null +++ b/config/lint/lint-baseline-android-app-range.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-android-component-android.xml b/config/lint/lint-baseline-android-component-android.xml new file mode 100644 index 00000000..d218b6a7 --- /dev/null +++ b/config/lint/lint-baseline-android-component-android.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-android-component-data.xml b/config/lint/lint-baseline-android-component-data.xml new file mode 100644 index 00000000..d218b6a7 --- /dev/null +++ b/config/lint/lint-baseline-android-component-data.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-android-component-theme.xml b/config/lint/lint-baseline-android-component-theme.xml new file mode 100644 index 00000000..d218b6a7 --- /dev/null +++ b/config/lint/lint-baseline-android-component-theme.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-android-feature-range.xml b/config/lint/lint-baseline-android-feature-range.xml new file mode 100644 index 00000000..d218b6a7 --- /dev/null +++ b/config/lint/lint-baseline-android-feature-range.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint.xml b/config/lint/lint.xml index 4e6c85a9..e1eb3de0 100644 --- a/config/lint/lint.xml +++ b/config/lint/lint.xml @@ -32,7 +32,9 @@ + + @@ -41,6 +43,9 @@ + + + diff --git a/buildSrc/build.gradle b/gradle/plugins/build.gradle similarity index 100% rename from buildSrc/build.gradle rename to gradle/plugins/build.gradle diff --git a/buildSrc/settings.gradle b/gradle/plugins/settings.gradle similarity index 84% rename from buildSrc/settings.gradle rename to gradle/plugins/settings.gradle index ad30b27a..9ba70c15 100644 --- a/buildSrc/settings.gradle +++ b/gradle/plugins/settings.gradle @@ -10,7 +10,7 @@ dependencyResolutionManagement { versionCatalogs { create("libs") { - from(files("../gradle/libs.versions.toml")) + from(files("../libs.versions.toml")) } } } diff --git a/buildSrc/src/main/groovy/net.twisterrob.blt.convention.gradle b/gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle similarity index 50% rename from buildSrc/src/main/groovy/net.twisterrob.blt.convention.gradle rename to gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle index a7988075..56173328 100644 --- a/buildSrc/src/main/groovy/net.twisterrob.blt.convention.gradle +++ b/gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle @@ -1,14 +1,28 @@ -group = "net.twisterrob.travel" +pluginManager.withPlugin("org.gradle.java-base") { + java { + sourceCompatibility = libs.versions.java.asProvider().get() + targetCompatibility = libs.versions.java.asProvider().get() + } -tasks.withType(JavaCompile).configureEach { - options.encoding = "UTF-8" - options.compilerArgs += [ - "-Werror", - "-Xmaxwarns", "1000", - "-Xmaxerrs", "1000", - "-Xlint:all", - "-Xlint:-processing", - ] + tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" + options.compilerArgs += [ + "-Werror", + "-Xmaxwarns", "1000", + "-Xmaxerrs", "1000", + "-Xlint:all", + "-Xlint:-processing", + ] + } +} + +pluginManager.withPlugin("com.android.base") { + android { + compileOptions { + sourceCompatibility = libs.versions.java.android.get() + targetCompatibility = libs.versions.java.android.get() + } + } } if (project.gradle.startParameter.isConfigurationCacheRequested()) { diff --git a/gradle/plugins/src/main/groovy/net.twisterrob.travel.android-app.gradle b/gradle/plugins/src/main/groovy/net.twisterrob.travel.android-app.gradle new file mode 100644 index 00000000..c7d93578 --- /dev/null +++ b/gradle/plugins/src/main/groovy/net.twisterrob.travel.android-app.gradle @@ -0,0 +1,33 @@ +plugins { + id("net.twisterrob.blt.convention") + id("net.twisterrob.gradle.plugin.android-app") + id("com.android.application") +} + +android { + namespace = "net.twisterrob.blt${project.path.replace(":", ".")}" + compileSdk = 34 + defaultConfig { + minSdk = 21 + targetSdk = 21 + } + lint { + checkAllWarnings = true + warningsAsErrors = true + checkDependencies = true + lintConfig = rootProject.file("config/lint/lint.xml") + baseline = rootProject.file("config/lint/lint-baseline${project.path.replace(":", "-")}.xml") + } + twisterrob { + decorateBuildConfig = false + } + buildTypes { + release { + minifyEnabled true + shrinkResources true + } + } + buildFeatures { + buildConfig = true + } +} diff --git a/gradle/plugins/src/main/groovy/net.twisterrob.travel.android-library.gradle b/gradle/plugins/src/main/groovy/net.twisterrob.travel.android-library.gradle new file mode 100644 index 00000000..3cd0fdcb --- /dev/null +++ b/gradle/plugins/src/main/groovy/net.twisterrob.travel.android-library.gradle @@ -0,0 +1,20 @@ +plugins { + id("net.twisterrob.blt.convention") + id("net.twisterrob.gradle.plugin.android-library") + id("com.android.library") +} + +android { + namespace = "net.twisterrob.blt${project.path.replace(":", ".")}" + compileSdk = 34 + defaultConfig { + minSdk = 21 + } + lint { + checkAllWarnings = true + warningsAsErrors = true + checkDependencies = true + lintConfig = rootProject.file("config/lint/lint.xml") + baseline = rootProject.file("config/lint/lint-baseline${project.path.replace(":", "-")}.xml") + } +} diff --git a/settings.gradle b/settings.gradle index deb45562..93a8356d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,18 +1,41 @@ import static net.twisterrob.gradle.settings.SettingsUtils.enableFeaturePreviewQuietly +pluginManagement { + includeBuild("gradle/plugins") + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + plugins { id("net.twisterrob.gradle.plugin.settings") version "0.16" + id("com.gradle.enterprise") version "3.16" } rootProject.name = "net-twisterrob-blt" -include(":Android") -include(":AppEngine") -include(":Data") -include(":Shared") -include(":Shared:android-polyfill") -include(":Shared:diff") -include(":Shared:test-helpers") +include(":android:app:full") +include(":android:app:range") +include(":android:component:android") +//include(":android:component:map") +include(":android:component:data") +include(":android:component:theme") +include(":android:feature:range") +include(":common:android-polyfill") +include(":common:data") +//include(":common:data:network") +//include(":common:data:routes") +//include(":common:data:postcodes") +include(":common:diff") +//include(":common:feed:timetable") +//include(":common:feed:trackernet") +//include(":common:feed:facilities") +include(":common:model") +include(":common:test-helpers") +//include(":desktop:routes") +include(":web:status-history") enableFeaturePreviewQuietly(settings, "TYPESAFE_PROJECT_ACCESSORS", "Type-safe project accessors") @@ -34,3 +57,10 @@ dependencyResolutionManagement { includeBuild("libs") { build -> apply from: new File(build.projectDir, "gradle/settings.substitutions.gradle"), to: build } + +gradleEnterprise { + buildScan { + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + } +} diff --git a/AppEngine/README.md b/web/status-history/README.md similarity index 100% rename from AppEngine/README.md rename to web/status-history/README.md diff --git a/AppEngine/build.gradle b/web/status-history/build.gradle similarity index 95% rename from AppEngine/build.gradle rename to web/status-history/build.gradle index 8c9059f2..c44d4e21 100644 --- a/AppEngine/build.gradle +++ b/web/status-history/build.gradle @@ -22,13 +22,14 @@ dependencies { runtimeOnly(libs.micronaut.jackson) implementation(libs.micronaut.handlebars) - implementation(projects.shared) - implementation(projects.shared.diff) + implementation(projects.common.model) + runtimeOnly(projects.common.androidPolyfill) + implementation(projects.common.diff) implementation(libs.slf4j.api) runtimeOnly(libs.log4j.slf4j2) - testImplementation(projects.shared.testHelpers) + testImplementation(projects.common.testHelpers) testImplementation(libs.micronaut.httpClient) testImplementation(libs.jtidy) } diff --git a/AppEngine/src/main/appengine/app.yaml b/web/status-history/src/main/appengine/app.yaml similarity index 100% rename from AppEngine/src/main/appengine/app.yaml rename to web/status-history/src/main/appengine/app.yaml diff --git a/AppEngine/src/main/appengine/cron.yaml b/web/status-history/src/main/appengine/cron.yaml similarity index 100% rename from AppEngine/src/main/appengine/cron.yaml rename to web/status-history/src/main/appengine/cron.yaml diff --git a/AppEngine/src/main/appengine/placeholder.txt b/web/status-history/src/main/appengine/placeholder.txt similarity index 100% rename from AppEngine/src/main/appengine/placeholder.txt rename to web/status-history/src/main/appengine/placeholder.txt diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/Application.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/Application.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/Application.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/Application.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/FeedConsts.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/FeedConsts.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/FeedConsts.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/FeedConsts.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/FeedCronServlet.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/FeedCronServlet.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/FeedCronServlet.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/FeedCronServlet.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/IndexController.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/IndexController.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/IndexController.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/IndexController.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/InternalFeedbackServlet.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/InternalFeedbackServlet.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/InternalFeedbackServlet.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/InternalFeedbackServlet.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/LineStatusHistoryServlet.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/LineStatusHistoryServlet.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/LineStatusHistoryServlet.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/LineStatusHistoryServlet.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/view/handlebars/CustomHandlebarsViewsRenderer.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/view/handlebars/CustomHandlebarsViewsRenderer.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/view/handlebars/CustomHandlebarsViewsRenderer.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/view/handlebars/CustomHandlebarsViewsRenderer.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/view/handlebars/HandlebarsHelpers.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/view/handlebars/HandlebarsHelpers.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/view/handlebars/HandlebarsHelpers.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/view/handlebars/HandlebarsHelpers.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/LineColor.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/LineColor.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/LineColor.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/LineColor.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/Result.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/Result.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/Result.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/Result.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/ResultChange.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/ResultChange.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/ResultChange.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/ResultChange.java diff --git a/AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/Versions.java b/web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/Versions.java similarity index 100% rename from AppEngine/src/main/java/net/twisterrob/blt/gapp/viewmodel/Versions.java rename to web/status-history/src/main/java/net/twisterrob/blt/gapp/viewmodel/Versions.java diff --git a/AppEngine/src/main/resources/application.yml b/web/status-history/src/main/resources/application.yml similarity index 100% rename from AppEngine/src/main/resources/application.yml rename to web/status-history/src/main/resources/application.yml diff --git a/AppEngine/src/main/resources/log4j2.xml b/web/status-history/src/main/resources/log4j2.xml similarity index 100% rename from AppEngine/src/main/resources/log4j2.xml rename to web/status-history/src/main/resources/log4j2.xml diff --git a/AppEngine/src/main/resources/public/favicon.ico b/web/status-history/src/main/resources/public/favicon.ico similarity index 100% rename from AppEngine/src/main/resources/public/favicon.ico rename to web/status-history/src/main/resources/public/favicon.ico diff --git a/AppEngine/src/main/resources/public/static/descript.ion b/web/status-history/src/main/resources/public/static/descript.ion similarity index 100% rename from AppEngine/src/main/resources/public/static/descript.ion rename to web/status-history/src/main/resources/public/static/descript.ion diff --git a/AppEngine/src/main/resources/public/static/htmltooltip.js b/web/status-history/src/main/resources/public/static/htmltooltip.js similarity index 100% rename from AppEngine/src/main/resources/public/static/htmltooltip.js rename to web/status-history/src/main/resources/public/static/htmltooltip.js diff --git a/AppEngine/src/main/resources/public/static/jquery-1.10.2.min.js b/web/status-history/src/main/resources/public/static/jquery-1.10.2.min.js similarity index 100% rename from AppEngine/src/main/resources/public/static/jquery-1.10.2.min.js rename to web/status-history/src/main/resources/public/static/jquery-1.10.2.min.js diff --git a/AppEngine/src/main/resources/public/static/jquery-1.2.2.pack.js b/web/status-history/src/main/resources/public/static/jquery-1.2.2.pack.js similarity index 100% rename from AppEngine/src/main/resources/public/static/jquery-1.2.2.pack.js rename to web/status-history/src/main/resources/public/static/jquery-1.2.2.pack.js diff --git a/AppEngine/src/main/resources/public/static/jquery.min.map b/web/status-history/src/main/resources/public/static/jquery.min.map similarity index 100% rename from AppEngine/src/main/resources/public/static/jquery.min.map rename to web/status-history/src/main/resources/public/static/jquery.min.map diff --git a/AppEngine/src/main/resources/views/LineStatus.hbs b/web/status-history/src/main/resources/views/LineStatus.hbs similarity index 100% rename from AppEngine/src/main/resources/views/LineStatus.hbs rename to web/status-history/src/main/resources/views/LineStatus.hbs diff --git a/AppEngine/src/main/resources/views/index.hbs b/web/status-history/src/main/resources/views/index.hbs similarity index 100% rename from AppEngine/src/main/resources/views/index.hbs rename to web/status-history/src/main/resources/views/index.hbs diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/HtmlValidator.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/HtmlValidator.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/HtmlValidator.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/HtmlValidator.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/IndexControllerTest.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/IndexControllerTest.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/IndexControllerTest.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/IndexControllerTest.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenChange.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenChange.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenChange.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenChange.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenStatus.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenStatus.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenStatus.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/GwenStatus.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/LineColorTest.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/LineColorTest.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/LineColorTest.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/LineColorTest.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Delays.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Delays.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Delays.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Delays.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Descriptions.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Descriptions.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Descriptions.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Descriptions.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Errors.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Errors.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Errors.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultChangeTest_Errors.java diff --git a/AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultTest.java b/web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultTest.java similarity index 100% rename from AppEngine/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultTest.java rename to web/status-history/src/test/java/net/twisterrob/blt/gapp/viewmodel/ResultTest.java