mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-05 20:17:29 +00:00
Minor cleanup
This commit is contained in:
1 parent
571164cdd5
commit
d8bb1ae796
5 files changed
+6
-71
No files matched your search
@@ -101,15 +101,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
tleSelectedMap = mutableMap
|
tleSelectedMap = mutableMap
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updatePassPrefs(hoursAhead: Int, maxEl: Double) {
|
|
||||||
passPrefs = SatPassPrefs(hoursAhead, maxEl)
|
|
||||||
preferences.edit {
|
|
||||||
putInt(keyHours, hoursAhead)
|
|
||||||
putLong(keyMinEl, maxEl.toRawBits())
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateGsp() {
|
fun updateGsp() {
|
||||||
val lat = preferences.getString(keyLat, defValueLoc)!!.toDouble()
|
val lat = preferences.getString(keyLat, defValueLoc)!!.toDouble()
|
||||||
val lon = preferences.getString(keyLon, defValueLoc)!!.toDouble()
|
val lon = preferences.getString(keyLon, defValueLoc)!!.toDouble()
|
||||||
|
|||||||
@@ -131,11 +131,8 @@ class WorldMapFragment : Fragment() {
|
|||||||
drawFootprint(canvas, frameWidth, frameHeight, footprintPositions)
|
drawFootprint(canvas, frameWidth, frameHeight, footprintPositions)
|
||||||
var longitude = rad2Deg(satPos.longitude)
|
var longitude = rad2Deg(satPos.longitude)
|
||||||
|
|
||||||
if (longitude > 180.0) {
|
if (longitude > 180.0) longitude -= 180.0
|
||||||
longitude -= 180.0
|
else longitude += 180.0
|
||||||
} else {
|
|
||||||
longitude += 180.0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawGroundTrack(canvas: Canvas, width: Int, height: Int, list: List<SatPos>) {
|
private fun drawGroundTrack(canvas: Canvas, width: Int, height: Int, list: List<SatPos>) {
|
||||||
@@ -151,9 +148,8 @@ class WorldMapFragment : Fragment() {
|
|||||||
else trackX -= 180
|
else trackX -= 180
|
||||||
|
|
||||||
trackX *= width / 360f
|
trackX *= width / 360f
|
||||||
trackY = ((90.0 - rad2Deg(satPos.latitude)) * (height / 180.0))
|
trackY =
|
||||||
.roundToInt()
|
((90.0 - rad2Deg(satPos.latitude)) * (height / 180.0)).roundToInt().toFloat()
|
||||||
.toFloat()
|
|
||||||
|
|
||||||
if (index == 0 || abs(trackX - prevX) > 180) trackPath.moveTo(trackX, trackY)
|
if (index == 0 || abs(trackX - prevX) > 180) trackPath.moveTo(trackX, trackY)
|
||||||
else trackPath.lineTo(trackX, trackY)
|
else trackPath.lineTo(trackX, trackY)
|
||||||
@@ -176,9 +172,7 @@ class WorldMapFragment : Fragment() {
|
|||||||
else printX -= 180f
|
else printX -= 180f
|
||||||
|
|
||||||
printX *= width / 360f
|
printX *= width / 360f
|
||||||
printY = ((90.0 - position.lat) * (height / 180.0))
|
printY = ((90.0 - position.lat) * (height / 180.0)).roundToInt().toFloat()
|
||||||
.roundToInt()
|
|
||||||
.toFloat()
|
|
||||||
|
|
||||||
if (index == 0 || abs(printX - prevX) > 180) printPath.moveTo(printX, printY)
|
if (index == 0 || abs(printX - prevX) > 180) printPath.moveTo(printX, printY)
|
||||||
else printPath.lineTo(printX, printY)
|
else printPath.lineTo(printX, printY)
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/pass_pref_root"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/pass_pref_tv_hours"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/pref_hours_ahead_title"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/pass_pref_et_hours"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/pref_hours_ahead_title"
|
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:inputType="number"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/pass_pref_tv_hours"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/pass_pref_tv_hours"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pass_pref_tv_hours" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/pass_pref_tv_maxEl"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:text="@string/pref_min_el_title"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/pass_pref_et_hours"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/pass_pref_et_hours"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pass_pref_et_hours" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/pass_pref_et_maxEl"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/pref_min_el_title"
|
|
||||||
android:importantForAutofill="no"
|
|
||||||
android:inputType="numberDecimal"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/pass_pref_tv_maxEl"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/pass_pref_tv_maxEl"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pass_pref_tv_maxEl" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
<string name="btn_cancel">Cancel</string>
|
<string name="btn_cancel">Cancel</string>
|
||||||
<string name="btn_clear">Clear All</string>
|
<string name="btn_clear">Clear All</string>
|
||||||
|
|
||||||
<string name="title_pass_pref">Passes preferences</string>
|
|
||||||
<string name="title_select_sat">Select satellites to track</string>
|
<string name="title_select_sat">Select satellites to track</string>
|
||||||
|
|
||||||
<string name="pref_gsp_title">Ground station position settings</string>
|
<string name="pref_gsp_title">Ground station position settings</string>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
android:summary="@string/pref_hours_ahead_summary"
|
android:summary="@string/pref_hours_ahead_summary"
|
||||||
android:title="@string/pref_hours_ahead_title" />
|
android:title="@string/pref_hours_ahead_title" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:defaultValue="@string/def_hours_ahead"
|
android:defaultValue="@string/def_min_el"
|
||||||
android:key="@string/key_min_el"
|
android:key="@string/key_min_el"
|
||||||
android:selectAllOnFocus="true"
|
android:selectAllOnFocus="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
|||||||
Reference in new issue
Block a user