mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-06 04:27:29 +00:00
Code cleanup and strings refactoring
This commit is contained in:
1 parent
32df8c4c04
commit
7c60fa9b2b
3 files changed
+5
-11
No files matched your search
@@ -92,9 +92,8 @@ class MapViewFragment : Fragment(R.layout.fragment_map_view) {
|
|||||||
binding.fabMap.setOnClickListener { showSelectSatDialog(satPassList) }
|
binding.fabMap.setOnClickListener { showSelectSatDialog(satPassList) }
|
||||||
selectedSat = satPassList.first().tle
|
selectedSat = satPassList.first().tle
|
||||||
predictor = satPassList.first().predictor
|
predictor = satPassList.first().predictor
|
||||||
mapView = MapView(mainActivity)
|
mapView = MapView(mainActivity, gsp)
|
||||||
mapView.setList(satPassList)
|
mapView.setList(satPassList)
|
||||||
mapView.setGSP(gsp)
|
|
||||||
mapView.setChecked(checkedItem)
|
mapView.setChecked(checkedItem)
|
||||||
binding.frameMap.addView(mapView)
|
binding.frameMap.addView(mapView)
|
||||||
refreshView()
|
refreshView()
|
||||||
@@ -132,8 +131,6 @@ class MapViewFragment : Fragment(R.layout.fragment_map_view) {
|
|||||||
checkedItem = which
|
checkedItem = which
|
||||||
selectedSat = list[which].tle
|
selectedSat = list[which].tle
|
||||||
predictor = list[which].predictor
|
predictor = list[which].predictor
|
||||||
mapView.setList(satPassList)
|
|
||||||
mapView.setGSP(gsp)
|
|
||||||
mapView.setChecked(checkedItem)
|
mapView.setChecked(checkedItem)
|
||||||
mapView.invalidate()
|
mapView.invalidate()
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import kotlin.math.abs
|
|||||||
|
|
||||||
class MapView(context: Context) : View(context) {
|
class MapView(context: Context) : View(context) {
|
||||||
|
|
||||||
|
constructor(context: Context, groundStationPosition: GroundStationPosition) : this(context) {
|
||||||
|
gsp = groundStationPosition
|
||||||
|
}
|
||||||
|
|
||||||
private lateinit var passList: List<SatPass>
|
private lateinit var passList: List<SatPass>
|
||||||
private lateinit var gsp: GroundStationPosition
|
private lateinit var gsp: GroundStationPosition
|
||||||
private lateinit var selectedSat: TLE
|
private lateinit var selectedSat: TLE
|
||||||
@@ -62,10 +66,6 @@ class MapView(context: Context) : View(context) {
|
|||||||
passList = satPassList
|
passList = satPassList
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setGSP(groundStationPosition: GroundStationPosition) {
|
|
||||||
gsp = groundStationPosition
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setChecked(item: Int) {
|
fun setChecked(item: Int) {
|
||||||
checked = item
|
checked = item
|
||||||
selectedSat = passList[checked].tle
|
selectedSat = passList[checked].tle
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.rtbishop.look4sat.ui.views
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.graphics.Matrix
|
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import android.graphics.Path
|
import android.graphics.Path
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -24,7 +23,6 @@ class PolarView(context: Context) : View(context) {
|
|||||||
private val radius = polarWidth * 0.49f
|
private val radius = polarWidth * 0.49f
|
||||||
private val txtSize = scale * 15
|
private val txtSize = scale * 15
|
||||||
private val path: Path = Path()
|
private val path: Path = Path()
|
||||||
private val mMatrix = Matrix()
|
|
||||||
var azimuth = 0f
|
var azimuth = 0f
|
||||||
|
|
||||||
private val radarPaint = Paint().apply {
|
private val radarPaint = Paint().apply {
|
||||||
@@ -51,7 +49,6 @@ class PolarView(context: Context) : View(context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDraw(canvas: Canvas) {
|
override fun onDraw(canvas: Canvas) {
|
||||||
// Log.w("myTag", "$measuredWidth, $measuredHeight")
|
|
||||||
canvas.rotate(-azimuth, polarCenter, polarCenter)
|
canvas.rotate(-azimuth, polarCenter, polarCenter)
|
||||||
canvas.translate(polarCenter, polarCenter)
|
canvas.translate(polarCenter, polarCenter)
|
||||||
drawRadarView(canvas)
|
drawRadarView(canvas)
|
||||||
|
|||||||
Reference in new issue
Block a user