This commit is contained in:
Piotr Dec 2024-09-21 00:22:53 +02:00
parent c2e0beb863
commit 807e422884
No known key found for this signature in database
GPG key ID: 0408E63FD8E1C0E3
22 changed files with 1047 additions and 10 deletions

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'

View file

@ -1,3 +1,22 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin
import android.annotation.SuppressLint

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin
import android.Manifest

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin
import android.content.res.Resources
@ -59,4 +77,4 @@ class UI(b: ActivityMainBinding) {
val searchResultsView = b.searchResults
val searchPlaceView = b.searchPlaces
val queryEditText = b.query
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.data
import com.mapbox.navigation.core.trip.session.LocationMatcherResult
@ -60,4 +78,4 @@ class DataCache {
session = sessionState
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.data
class GarminMapper {
@ -149,4 +167,4 @@ class GarminMapper {
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.data
import com.mapbox.navigation.tripdata.maneuver.model.Maneuver

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.data
enum class OutType(val value: Int) {

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import com.mapbox.common.location.Location

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import android.content.res.Configuration
@ -168,4 +186,4 @@ class MapControl(
const val TAG = "MAPCTRL"
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import kotlinx.coroutines.delay
@ -46,4 +64,4 @@ fun interface NavigationStatusObserver {
fun onNavigationStatusChanged(navigationStatus: NavigationStatus)
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import android.content.Context
@ -316,4 +334,4 @@ class RouteControl(private val mapControl: MapControl, ui: UI, private val conte
routeLineView.cancel()
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import android.content.Context
@ -278,4 +296,4 @@ class SearchControl(val mapControl: MapControl, val ui: UI): NavigationStatusObs
private fun dpToPx(dp: Int): Int = (dp * Resources.getSystem().displayMetrics.density).toInt()
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import com.mapbox.api.directions.v5.models.DirectionsRoute

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mapbox
import android.content.Context

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.mock
import com.mapbox.api.directions.v5.models.DirectionsRoute
@ -70,4 +88,4 @@ class ReplayResources(private val mapControl: MapControl) {
mapboxNavigation.mapboxReplayer.finish()
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.util
import android.app.Activity
@ -47,4 +65,4 @@ class PermissionsHelper(val activityRef: WeakReference<Activity>) {
) {
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
}
}

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin
import org.junit.jupiter.api.Assertions.*

View file

@ -1,3 +1,21 @@
/*
* Garmin HUD Companion Application
* Copyright (C) 2022 Piotr Dec / ztsh.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.ztsh.garmin.data
import eu.ztsh.garmin.Garmin
@ -272,4 +290,4 @@ class GarminMapperTest {
assertThat(resultBoxed).containsExactly(expectedBoxed.toTypedArray())
}
}
}