Initial satInfo window setup
This commit is contained in:
1 parent
5db1f3bff9
commit
805713c672
4 files changed
+91
-12
No files matched your search
@@ -5,6 +5,7 @@ import android.graphics.ColorMatrix
|
||||
import android.graphics.ColorMatrixColorFilter
|
||||
import android.graphics.Paint
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -177,9 +178,10 @@ class MapOsmFragment : Fragment(R.layout.fragment_map_osm) {
|
||||
else if (lat < -85.05) lat = -85.05
|
||||
if (lon > 180.0) lon -= 360.0
|
||||
|
||||
val satItem = SatItem(it.tle.name, it.tle.name, GeoPoint(lat, lon), it)
|
||||
satItem.markerHotspot = OverlayItem.HotspotPlace.CENTER
|
||||
items.add(satItem)
|
||||
SatItem(it.tle.name, it.tle.name, GeoPoint(lat, lon), it).apply {
|
||||
markerHotspot = OverlayItem.HotspotPlace.CENTER
|
||||
items.add(this)
|
||||
}
|
||||
}
|
||||
|
||||
val listener = object : ItemizedIconOverlay.OnItemGestureListener<SatItem> {
|
||||
@@ -197,13 +199,18 @@ class MapOsmFragment : Fragment(R.layout.fragment_map_osm) {
|
||||
return@withContext ItemizedIconOverlay<SatItem>(items, icon, listener, mainActivity)
|
||||
}
|
||||
|
||||
private fun setSatDetails(pass: SatPass) {
|
||||
binding.mapView.overlays[1] = getSatTrack(pass)
|
||||
binding.mapView.overlays[2] = getSatFootprint(pass)
|
||||
// showSatInfo(pass)
|
||||
private fun setSatDetails(satPass: SatPass) {
|
||||
setSatInfo(satPass)
|
||||
binding.mapView.overlays[1] = getSatTrack(satPass)
|
||||
binding.mapView.overlays[2] = getSatFootprint(satPass)
|
||||
binding.mapView.invalidate()
|
||||
}
|
||||
|
||||
private fun setSatInfo(satPass: SatPass) {
|
||||
val satPos = satPass.predictor.getSatPos(dateNow)
|
||||
Log.d("myTag", satPos.toString())
|
||||
}
|
||||
|
||||
private fun getSatTrack(pass: SatPass): Overlay {
|
||||
val period = (24 * 60 / pass.tle.meanmo).toInt()
|
||||
val positions = pass.predictor.getPositions(dateNow, 20, 0, period * 3)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/osmLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragments.MapOsmFragment">
|
||||
@@ -15,13 +16,65 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmCopyright"
|
||||
android:layout_width="wrap_content"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/satInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/backgroundMapInfoLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/idName"
|
||||
style="@style/MapOsmSatInfo.Name"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="@string/placeholder"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alt"
|
||||
style="@style/MapOsmSatInfo"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="@string/placeholder"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/speed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/latLon"
|
||||
style="@style/MapOsmSatInfo"
|
||||
android:text="@string/placeholder"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/range"
|
||||
app:layout_constraintStart_toStartOf="@+id/alt" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/speed"
|
||||
style="@style/MapOsmSatInfo"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/placeholder"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/idName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/range"
|
||||
style="@style/MapOsmSatInfo"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:text="@string/placeholder"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/speed"
|
||||
app:layout_constraintTop_toBottomOf="@+id/speed" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mapOsmCopyright"
|
||||
style="@style/MapOsmCopyright"
|
||||
android:text="@string/osmCopyright"
|
||||
android:textColor="@color/athens_gray"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<color name="themeButton">#242424</color>
|
||||
<color name="backgroundDark">#080808</color>
|
||||
<color name="backgroundMapText">#CC000000</color>
|
||||
<color name="backgroundMapInfoLayout">#66000000</color>
|
||||
<color name="satTrack">#D50000</color>
|
||||
<color name="satPrimary">#FFE082</color>
|
||||
<color name="satSecondary">#80FFE082</color>
|
||||
|
||||
@@ -134,6 +134,24 @@
|
||||
<item name="android:textSize">17sp</item>
|
||||
</style>
|
||||
|
||||
<style name="MapOsmSatInfo">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:textColor">@color/themeAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="MapOsmSatInfo.Name">
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
|
||||
<style name="MapOsmCopyright">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textColor">@color/themeAccent</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
||||
<style name="AboutTitle">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
|
||||
Reference in new issue
Block a user