mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
v4.4.8 - Fuzzy satellites search, light theme, various fixes
This commit is contained in:
1 parent
fac319b215
commit
782b438a07
12 files changed
+88
-70
No files matched your search
@@ -116,8 +116,9 @@ class MapNightOverlay : Overlay() {
|
||||
|
||||
else -> {
|
||||
// Terminator crosses this column — find the crossing pixel by binary search
|
||||
val crossY = findCrossingY(proj, x, 0, h - 1, sinSunLat, cosSunLat, cosLonDiff)
|
||||
if (dotTop < 0) {
|
||||
val isNightAtTop = dotTop < 0
|
||||
val crossY = findCrossingY(proj, x, 0, h - 1, sinSunLat, cosSunLat, cosLonDiff, isNightAtTop)
|
||||
if (isNightAtTop) {
|
||||
// Night at top, day at bottom
|
||||
rect.set(x.toFloat(), 0f, (x + stepPx).toFloat(), crossY.toFloat())
|
||||
canvas.drawRect(rect, nightPaint)
|
||||
@@ -134,7 +135,11 @@ class MapNightOverlay : Overlay() {
|
||||
|
||||
/**
|
||||
* Binary-search for the pixel row where the day/night boundary crosses column [x].
|
||||
* [yTop] is in day, [yBot] is in night (or vice versa).
|
||||
*
|
||||
* [isNightAtTop] states which side [yTop] is on. Both polarities occur: the pole nearest
|
||||
* the sub-solar point is lit, so the terminator runs day-over-night while the sub-solar
|
||||
* latitude is positive and night-over-day once it turns negative after the September
|
||||
* equinox. Anchoring lo to the top pixel's side keeps the search valid either way.
|
||||
*/
|
||||
private fun findCrossingY(
|
||||
proj: org.osmdroid.views.Projection,
|
||||
@@ -143,7 +148,8 @@ class MapNightOverlay : Overlay() {
|
||||
yBot: Int,
|
||||
sinSunLat: Double,
|
||||
cosSunLat: Double,
|
||||
cosLonDiff: Double
|
||||
cosLonDiff: Double,
|
||||
isNightAtTop: Boolean
|
||||
): Int {
|
||||
var lo = yTop
|
||||
var hi = yBot
|
||||
@@ -152,7 +158,8 @@ class MapNightOverlay : Overlay() {
|
||||
val geo = proj.fromPixels(x, mid, reusableGeoPoint) ?: return mid
|
||||
val latRad = Math.toRadians(geo.latitude)
|
||||
val dot = sin(latRad) * sinSunLat + cos(latRad) * cosSunLat * cosLonDiff
|
||||
if (dot < 0) hi = mid else lo = mid
|
||||
// Keep lo on the top pixel's side of the terminator and hi on the opposite side
|
||||
if ((dot < 0) == isNightAtTop) lo = mid else hi = mid
|
||||
}
|
||||
return (lo + hi) / 2
|
||||
}
|
||||
|
||||
+26
-30
@@ -495,19 +495,21 @@ private fun OtherCard(settings: OtherSettings, onAction: (SettingsAction) -> Uni
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
// Appearance: light theme (paired with a spacer to align with the two-column rows)
|
||||
// Data preferences: auto-update + UTC clock
|
||||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SwitchTile(R.string.prefs_other_switch_update, settings.stateOfAutoUpdate) {
|
||||
onAction(SettingsAction.ToggleUpdate(it))
|
||||
}
|
||||
SwitchTile(R.string.prefs_other_switch_utc, settings.stateOfUtc) {
|
||||
onAction(SettingsAction.ToggleUtc(it))
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
// Appearance: light theme + night filter
|
||||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SwitchTile(R.string.prefs_other_switch_light_theme, settings.stateOfLightTheme) {
|
||||
onAction(SettingsAction.ToggleLightTheme(it))
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
// Display preferences: UTC clock + night filter
|
||||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SwitchTile(R.string.prefs_other_switch_utc, settings.stateOfUtc) {
|
||||
onAction(SettingsAction.ToggleUtc(it))
|
||||
}
|
||||
SwitchTile(
|
||||
R.string.prefs_other_switch_night_mode,
|
||||
settings.stateOfNightMode,
|
||||
@@ -517,7 +519,7 @@ private fun OtherCard(settings: OtherSettings, onAction: (SettingsAction) -> Uni
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
// Radar behavior: sweep animation + sensor control
|
||||
// Radar behavior: sweep animation + sensors, followed by the compass offset sliders
|
||||
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SwitchTile(R.string.prefs_other_switch_sweep, settings.stateOfSweep) {
|
||||
onAction(SettingsAction.ToggleSweep(it))
|
||||
@@ -527,14 +529,9 @@ private fun OtherCard(settings: OtherSettings, onAction: (SettingsAction) -> Uni
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
// Data management (full width)
|
||||
SwitchRow(R.string.prefs_other_switch_update, settings.stateOfAutoUpdate) {
|
||||
onAction(SettingsAction.ToggleUpdate(it))
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
// Compass calibration sliders at the bottom
|
||||
CompassOffsetRow(
|
||||
labelResId = R.string.prefs_other_compass_offset,
|
||||
labelResId = R.string.prefs_other_compass_offset_az,
|
||||
value = settings.radarCompassOffset,
|
||||
range = -180f..180f
|
||||
) { onAction(SettingsAction.SetRadarCompassOffset(it)) }
|
||||
@@ -561,7 +558,14 @@ private fun CompassOffsetRow(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(text = stringResource(id = labelResId))
|
||||
Text(
|
||||
text = stringResource(id = labelResId),
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.padding(end = 4.dp)
|
||||
.infiniteMarquee(),
|
||||
maxLines = 1
|
||||
)
|
||||
Text(text = "${value.toInt()}°")
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
@@ -572,18 +576,6 @@ private fun CompassOffsetRow(
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SwitchRow(labelResId: Int, checked: Boolean, onCheckedChange: (Boolean) -> Unit) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(text = stringResource(id = labelResId))
|
||||
Switch(checked = checked, onCheckedChange = onCheckedChange)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.SwitchTile(
|
||||
labelResId: Int,
|
||||
@@ -598,7 +590,11 @@ private fun RowScope.SwitchTile(
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = labelResId),
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.padding(end = 4.dp)
|
||||
.infiniteMarquee(),
|
||||
maxLines = 1
|
||||
)
|
||||
Switch(checked = checked, enabled = enabled, onCheckedChange = onCheckedChange)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user