mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 19:17:21 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc684b6e3a | ||
|
|
6cb5b062d3 |
No files matched your search
+2
-1
@@ -67,7 +67,8 @@ class MaidenheadGridOverlay : Overlay() {
|
||||
private val ownLinePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
strokeWidth = 6f
|
||||
style = Paint.Style.STROKE
|
||||
color = Color.argb(255, 90, 200, 255)
|
||||
// 与普通网格线同色(淡黄), 仅加粗 — 用户要求当前网格框线不换色
|
||||
color = Color.argb(160, 255, 224, 130)
|
||||
}
|
||||
private val selectedLinePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
strokeWidth = 4.5f
|
||||
|
||||
@@ -256,7 +256,8 @@ private fun MapScreen(uiState: MapState, onAction: (MapAction) -> Unit, mapView:
|
||||
val shouldCenter = uiState.isGridMode && !prevGridMode
|
||||
setGridMode(
|
||||
uiState.isGridMode, uiState.workedGrids, uiState.roamedGrids, view,
|
||||
if (shouldCenter) uiState.stationPosition else null
|
||||
uiState.stationPosition,
|
||||
centerOnStation = shouldCenter
|
||||
)
|
||||
if (!shouldCenter || uiState.stationPosition != null) {
|
||||
prevGridMode = uiState.isGridMode
|
||||
@@ -639,7 +640,8 @@ private fun setGridMode(
|
||||
workedGrids: Set<String>,
|
||||
roamedGrids: Set<String>,
|
||||
mapView: MapView,
|
||||
stationPosition: GeoPos?
|
||||
stationPosition: GeoPos?,
|
||||
centerOnStation: Boolean = false
|
||||
) {
|
||||
try {
|
||||
val gridOverlay = mapView.overlays[OVERLAY_GRID]
|
||||
@@ -647,6 +649,9 @@ private fun setGridMode(
|
||||
gridOverlay.isEnabled = gridMode
|
||||
gridOverlay.workedGrids = workedGrids
|
||||
gridOverlay.roamedGrids = roamedGrids
|
||||
// ownGrid must be set on EVERY update — the position is available
|
||||
// regardless of whether this frame centers (centering happens only
|
||||
// on entry, but passing null here would wipe the bold outline).
|
||||
gridOverlay.ownGrid = ownGridOf(stationPosition)
|
||||
} else {
|
||||
mapView.overlays[OVERLAY_GRID] = MaidenheadGridOverlay().apply {
|
||||
@@ -666,7 +671,7 @@ private fun setGridMode(
|
||||
// first composition this runs before MapView's first layout, and a
|
||||
// setCenter issued pre-layout is discarded when the view lays out —
|
||||
// the map then keeps its default center forever.
|
||||
if (gridMode) {
|
||||
if (gridMode && centerOnStation) {
|
||||
val pos = stationPosition ?: return
|
||||
val lat = pos.latitude
|
||||
val lon = pos.longitude
|
||||
|
||||
@@ -156,7 +156,7 @@ private fun PassesScreen(
|
||||
TopBar(
|
||||
isVerticalLayout = isVerticalLayout,
|
||||
startAction = {
|
||||
IconCard(action = { onAction(PassesAction.TogglePassesDialog) }, resId = R.drawable.ic_filter)
|
||||
IconCard(action = { onAction(PassesAction.ToggleRadiosDialog) }, resId = R.drawable.ic_radios)
|
||||
},
|
||||
topInfo = {
|
||||
TimerRow(timeString = uiState.nextTime, isTimeAos = uiState.isNextTimeAos)
|
||||
@@ -165,19 +165,7 @@ private fun PassesScreen(
|
||||
NextPassRow(pass = uiState.nextPass, isUtc = uiState.isUtc)
|
||||
},
|
||||
endAction = {
|
||||
// 日程功能: 把下个过境写入系统日历 (原仓库雷达页的 addToCalendar).
|
||||
IconCard(
|
||||
action = {
|
||||
onAction(
|
||||
PassesAction.AddToCalendar(
|
||||
uiState.nextPass.name,
|
||||
uiState.nextPass.aosTime,
|
||||
uiState.nextPass.losTime
|
||||
)
|
||||
)
|
||||
},
|
||||
resId = R.drawable.ic_calendar
|
||||
)
|
||||
IconCard(action = { onAction(PassesAction.TogglePassesDialog) }, resId = R.drawable.ic_filter)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -61,6 +61,4 @@ sealed interface PassesAction {
|
||||
data object ToggleRadiosDialog : PassesAction
|
||||
data class FocusCatNum(val catNum: Int) : PassesAction
|
||||
data object ClearFocus : PassesAction
|
||||
/** 日程功能: 把下个过境写入系统日历 (ic_calendar 按钮). */
|
||||
data class AddToCalendar(val name: String, val aosTime: Long, val losTime: Long) : PassesAction
|
||||
}
|
||||
+2
-7
@@ -28,7 +28,6 @@ import com.rtbishop.look4sat.core.domain.predict.OrbitalPass
|
||||
import com.rtbishop.look4sat.core.domain.repository.IMainContainer
|
||||
import com.rtbishop.look4sat.core.domain.repository.ISatelliteRepo
|
||||
import com.rtbishop.look4sat.core.domain.repository.ISettingsRepo
|
||||
import com.rtbishop.look4sat.core.domain.usecase.IAddToCalendar
|
||||
import com.rtbishop.look4sat.core.domain.utility.round
|
||||
import com.rtbishop.look4sat.core.domain.utility.toTimerString
|
||||
import com.rtbishop.look4sat.core.presentation.getDefaultPass
|
||||
@@ -47,8 +46,7 @@ import java.util.TimeZone
|
||||
|
||||
class PassesViewModel(
|
||||
private val satelliteRepo: ISatelliteRepo,
|
||||
private val settingsRepo: ISettingsRepo,
|
||||
private val addToCalendar: IAddToCalendar
|
||||
private val settingsRepo: ISettingsRepo
|
||||
) : ViewModel() {
|
||||
|
||||
private val defaultPass = getDefaultPass()
|
||||
@@ -153,8 +151,6 @@ class PassesViewModel(
|
||||
_uiState.update { it.copy(isRadiosDialogShown = !it.isRadiosDialogShown) }
|
||||
is PassesAction.FocusCatNum -> _uiState.update { it.copy(focusedCatNum = action.catNum) }
|
||||
PassesAction.ClearFocus -> _uiState.update { it.copy(focusedCatNum = null) }
|
||||
is PassesAction.AddToCalendar ->
|
||||
addToCalendar(action.name, action.aosTime, action.losTime)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,8 +345,7 @@ class PassesViewModel(
|
||||
initializer {
|
||||
PassesViewModel(
|
||||
satelliteRepo = container.satelliteRepo,
|
||||
settingsRepo = container.settingsRepo,
|
||||
addToCalendar = container.provideAddToCalendar()
|
||||
settingsRepo = container.settingsRepo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#noinspection UnusedVersionCatalogEntry
|
||||
appVersionCode = "468"
|
||||
#noinspection UnusedVersionCatalogEntry
|
||||
appVersionName = "4.4.6-ba7opf.10"
|
||||
appVersionName = "4.4.6-ba7opf.10.1"
|
||||
#noinspection UnusedVersionCatalogEntry
|
||||
compileSdk = "37"
|
||||
#noinspection UnusedVersionCatalogEntry
|
||||
|
||||
Reference in new issue
Block a user