Now using theme colors for RadarView and WorldMapView

This commit is contained in:
Arty Bishop committed 2019-12-10 10:45:01 +00:00
1 parent 4d3930db89
commit 8bbd7cb4d2
3 files changed
+11 -15

No files matched your search

@@ -115,24 +115,24 @@ class RadarFragment : Fragment() {
} }
private val radarPaint = Paint().apply { private val radarPaint = Paint().apply {
isAntiAlias = true isAntiAlias = true
color = Color.parseColor("#C0C0C0") color = resources.getColor(R.color.lightOnDark, (activity as MainActivity).theme)
style = Paint.Style.STROKE style = Paint.Style.STROKE
strokeWidth = scale strokeWidth = scale
} }
private val txtPaint = Paint().apply { private val txtPaint = Paint().apply {
isAntiAlias = true isAntiAlias = true
color = Color.parseColor("#FFE082") color = resources.getColor(R.color.themeAccent, (activity as MainActivity).theme)
textSize = txtSize textSize = txtSize
} }
private val passPaint = Paint().apply { private val trackPaint = Paint().apply {
isAntiAlias = true isAntiAlias = true
color = Color.RED color = resources.getColor(R.color.satTrack, (activity as MainActivity).theme)
style = Paint.Style.STROKE style = Paint.Style.STROKE
strokeWidth = scale strokeWidth = scale
} }
private val satPaint = Paint().apply { private val satPaint = Paint().apply {
isAntiAlias = true isAntiAlias = true
color = Color.parseColor("#FFE082") color = resources.getColor(R.color.themeAccent, (activity as MainActivity).theme)
style = Paint.Style.FILL style = Paint.Style.FILL
} }
private val path: Path = Path() private val path: Path = Path()
@@ -189,7 +189,7 @@ class RadarFragment : Fragment() {
} }
startTime.time += delay startTime.time += delay
} }
cvs.drawPath(path, passPaint) cvs.drawPath(path, trackPaint)
} }
private fun drawSatellite() { private fun drawSatellite() {
@@ -2,7 +2,6 @@ package com.rtbishop.lookingsat.ui
import android.content.Context import android.content.Context
import android.graphics.Canvas import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint import android.graphics.Paint
import android.graphics.Path import android.graphics.Path
import android.os.Bundle import android.os.Bundle
@@ -102,13 +101,13 @@ class WorldMapFragment : Fragment() {
inner class TrackView(context: Context) : View(context) { inner class TrackView(context: Context) : View(context) {
private val groundTrackPaint = Paint().apply { private val groundTrackPaint = Paint().apply {
isAntiAlias = true isAntiAlias = true
color = Color.RED color = resources.getColor(R.color.satTrack, (activity as MainActivity).theme)
style = Paint.Style.STROKE style = Paint.Style.STROKE
strokeWidth = scale strokeWidth = scale
} }
private val footprintPaint = Paint().apply { private val footprintPaint = Paint().apply {
isAntiAlias = true isAntiAlias = true
color = Color.YELLOW color = resources.getColor(R.color.satFootprint, (activity as MainActivity).theme)
style = Paint.Style.STROKE style = Paint.Style.STROKE
strokeWidth = scale strokeWidth = scale
} }
@@ -120,17 +119,12 @@ class WorldMapFragment : Fragment() {
val frameHeight = mapFrame.measuredHeight val frameHeight = mapFrame.measuredHeight
val currentTime = getDateFor(System.currentTimeMillis()) val currentTime = getDateFor(System.currentTimeMillis())
val orbitalPeriod = (24 * 60 / selectedSat.meanmo).toInt() val orbitalPeriod = (24 * 60 / selectedSat.meanmo).toInt()
val orbitEndTime = getDateFor(currentTime.time + orbitalPeriod * 60 * 1000)
val satPos = predictor.getSatPos(currentTime) val satPos = predictor.getSatPos(currentTime)
val footprintPositions = satPos.rangeCircle val footprintPositions = satPos.rangeCircle
val positions = predictor.getPositions(currentTime, 60, 0, orbitalPeriod * 3)
var positions = predictor.getPositions(currentTime, 60, orbitalPeriod, orbitalPeriod)
drawGroundTrack(canvas, frameWidth, frameHeight, positions)
positions = predictor.getPositions(orbitEndTime, 60, 1, orbitalPeriod)
drawGroundTrack(canvas, frameWidth, frameHeight, positions) drawGroundTrack(canvas, frameWidth, frameHeight, positions)
drawFootprint(canvas, frameWidth, frameHeight, footprintPositions) drawFootprint(canvas, frameWidth, frameHeight, footprintPositions)
var longitude = rad2Deg(satPos.longitude) var longitude = rad2Deg(satPos.longitude)
if (longitude > 180.0) longitude -= 180.0 if (longitude > 180.0) longitude -= 180.0
else longitude += 180.0 else longitude += 180.0
} }
+2
View File
@@ -6,4 +6,6 @@
<color name="toolbarButton">#191919</color> <color name="toolbarButton">#191919</color>
<color name="backgroundDark">#080808</color> <color name="backgroundDark">#080808</color>
<color name="error">#800000</color> <color name="error">#800000</color>
<color name="satTrack">#D50000</color>
<color name="satFootprint">#FFE082</color>
</resources> </resources>