Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework module structure and split up flavored Android apps #30

Merged
merged 27 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
967a2f7
Move buildSrc to explicit included build
TWiStErRob Dec 5, 2023
e4f1689
Move modules
TWiStErRob Dec 9, 2023
42c998e
Move modules v2
TWiStErRob Dec 9, 2023
167bf48
Extract range module
TWiStErRob Dec 9, 2023
71d6ee3
Use convention plugins to reduce duplication
TWiStErRob Dec 10, 2023
2b45748
Make application namespaces specific
TWiStErRob Dec 10, 2023
b89a97b
Isolate problematic App references
TWiStErRob Dec 10, 2023
38f57ae
Suppress MissingPermission lint
TWiStErRob Dec 10, 2023
2ce5c02
Inject dependencies
TWiStErRob Dec 10, 2023
f65620b
Extract database module
TWiStErRob Dec 10, 2023
e03e5aa
Rename range2 to range
TWiStErRob Dec 10, 2023
f03cea4
Code review
TWiStErRob Dec 10, 2023
dc6cc35
Build database once
TWiStErRob Dec 10, 2023
8a96a52
Work around LambdaLast, BuildConfig is not a functional interface
TWiStErRob Dec 10, 2023
35303e6
Fix recursive build problem
TWiStErRob Dec 10, 2023
c86d0b7
Merge branch 'main' into modules
TWiStErRob Dec 11, 2023
5778a49
Diagnose `build` task and its dependencies not executing
TWiStErRob Dec 11, 2023
21ba4c6
Self-protect
TWiStErRob Dec 11, 2023
b004fa4
Add missing baselines
TWiStErRob Dec 12, 2023
257c7f3
Rename /Android/ to /android/
TWiStErRob Dec 12, 2023
6b39d11
Disable scan
TWiStErRob Dec 12, 2023
afed0c2
Fix lint issues
TWiStErRob Dec 12, 2023
b3eb7c4
Move stringers to module and reuse in both apps.
TWiStErRob Dec 12, 2023
e108c50
Rework workaround of https://issuetracker.google.com/issues/312677256
TWiStErRob Dec 12, 2023
2ed4af5
Merge branch 'main' into modules
TWiStErRob Dec 12, 2023
dd513fa
Code review
TWiStErRob Dec 12, 2023
f5417fb
Final touches
TWiStErRob Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/CI-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
--continue
--no-build-cache
build
:AppEngine:appengineStage
:web:status-history:appengineStage

- name: "Upload 'Unit Test Results' artifact."
if: success() || failure()
Expand Down
41 changes: 41 additions & 0 deletions Android/app/full/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
id("net.twisterrob.travel.android-app")
id("net.twisterrob.blt.use-database")
}

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(projects.common.model) {
exclude module: "android-polyfill"
}
implementation(libs.gms.maps)
implementation(libs.gms.places)
implementation(libs.jsr305)
implementation(libs.glide)
implementation(libs.androidx.swiperefreshlayout)
}

android {
defaultConfig {
applicationId = "net.twisterrob.blt"
version {
major = 1
}
}
packagingOptions {
// TODEL https://issuetracker.google.com/issues/312677256
exclude("META-INF/services/io.grpc.LoadBalancerProvider")
exclude("META-INF/services/io.grpc.NameResolverProvider")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
android:value="@integer/google_play_services_version" />

<provider
android:name=".ui.StationSuggestProvider"
android:name="net.twisterrob.blt.android.ui.StationSuggestProvider"
android:authorities="${applicationId}.suggest_station"
android:exported="false"
android:syncable="false"
/>

<activity
android:name=".ui.activity.main.MainActivity"
android:name="net.twisterrob.blt.android.ui.activity.main.MainActivity"
android:exported="true"
android:label="@string/app_name"
tools:ignore="RedundantLabel"
Expand All @@ -49,7 +49,7 @@
</activity>

<activity
android:name=".ui.activity.StatusActivity"
android:name="net.twisterrob.blt.android.ui.activity.StatusActivity"
android:exported="false"
android:label="@string/launcher__line_status"
>
Expand All @@ -59,7 +59,7 @@
</activity>

<activity
android:name=".ui.activity.PredictionSummaryActivity"
android:name="net.twisterrob.blt.android.ui.activity.PredictionSummaryActivity"
android:exported="false"
android:label="@string/launcher__prediction_summary"
>
Expand All @@ -69,7 +69,7 @@
</activity>

<activity
android:name=".ui.activity.StationListActivity"
android:name="net.twisterrob.blt.android.ui.activity.StationListActivity"
android:exported="false"
android:label="@string/launcher__station_list"
>
Expand All @@ -85,7 +85,7 @@
</activity>

<activity
android:name=".ui.activity.StationInfoActivity"
android:name="net.twisterrob.blt.android.ui.activity.StationInfoActivity"
android:exported="false"
android:label="@string/launcher__station_info"
>
Expand All @@ -95,7 +95,7 @@
</activity>

<activity
android:name=".ui.activity.StationMapsActivity"
android:name="net.twisterrob.blt.android.ui.activity.StationMapsActivity"
android:exported="false"
android:label="@string/launcher__station_map"
>
Expand All @@ -105,7 +105,7 @@
</activity>

<activity
android:name=".ui.activity.PostCodesActivity"
android:name="net.twisterrob.blt.android.ui.activity.PostCodesActivity"
android:exported="false"
android:label="@string/launcher__postcode_map"
>
Expand All @@ -115,7 +115,7 @@
</activity>

<activity
android:name=".ui.activity.RangeMapActivity"
android:name="net.twisterrob.blt.android.ui.activity.RangeMapActivity"
android:exported="false"
android:label="@string/launcher__range_map"
android:theme="@style/AppTheme.NoActionBar"
Expand All @@ -126,4 +126,5 @@
</activity>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
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.android.ui.activity.RangeMapActivity;
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\\.(.+\\.)?", "");
Expand Down Expand Up @@ -56,7 +58,7 @@ public App() {
}

@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() {
Expand Down Expand Up @@ -92,4 +94,14 @@ public static void sendMail(String body) {
}
}.execute(body);
}

@SuppressWarnings("deprecation")
@Override public Injector injector() {
return new net.twisterrob.blt.android.feature.range.Injector(
new BuildConfigWrapper(),
m_static,
db(),
prefs()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -112,7 +112,7 @@ public void onFilterComplete(int count) {

protected void populateListData(List<Station> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<LauncherItem, LauncherViewHolder> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions Android/app/full/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<color name="compass_on">#00ff00</color>
<color name="compass_off">#ff0000</color>
</resources>
31 changes: 31 additions & 0 deletions Android/app/full/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<resources>

<string name="app_name">Better London Travel</string>
<string name="launcher__station_list">Station List</string>
<string name="launcher__station_map">Station Map</string>
<string name="launcher__station_info">Station Info</string>
<string name="launcher__postcode_map">PostCode Map</string>
<string name="launcher__range_map">@string/range__title</string>
<string name="launcher__line_status">Line Status</string>
<string name="launcher__prediction_summary">Train Predictions</string>
<string name="label_search">Search</string>
<!-- yyyy-MM-dd HH:mm:ss -> %tY-%<tm-%<td %<tH:%<tM:%<tS -> %tF %<tT-->
<string name="last_updated">Last updated at %1$tF %1$tT</string>
<plurals name="prediction_approach">
<item quantity="one">%1$s: a single train is approaching.</item>
<item quantity="other">%1$s: %2$d trains are approaching.</item>
</plurals>
<string name="prediction_approach_zero">%1$s has no trains approaching</string>
<string name="compass_directions">Directions</string>
<string name="compass_north">Northbound</string>
<string name="compass_north_short">N</string>
<string name="compass_south">Southbound</string>
<string name="compass_south_short">S</string>
<string name="compass_west">Westbound</string>
<string name="compass_west_short">W</string>
<string name="compass_east">Eastbound</string>
<string name="compass_east_short">E</string>
<string name="compass_other">Others</string>
<string name="compass_other_short">O</string>

</resources>
27 changes: 27 additions & 0 deletions Android/app/range/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
plugins {
id("net.twisterrob.travel.android-app")
id("net.twisterrob.blt.use-database")
}

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")
}

android {
defaultConfig {
applicationId = "net.twisterrob.blt.range"
version {
major = 1
}
}
packagingOptions {
// TODEL https://issuetracker.google.com/issues/312677256
exclude("META-INF/services/io.grpc.LoadBalancerProvider")
exclude("META-INF/services/io.grpc.NameResolverProvider")
}
}
8 changes: 8 additions & 0 deletions Android/app/range/src/debug/res/values/overrides.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

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

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

</resources>
Loading
Loading