fix(train): a recording's screen opens as it starts, and pages run on beneath the floating bar (ADR 0030, D21)
An indoor row started showed its notification but not its screen: the Record tab's card pushed the screen only after the service had started, and gave up silently where the card was gone by then. Train's frame now opens it as the recording's phase turns to recording; one found running as the app opens leaves the tabs as they were. The notification tapped opens the recording's screen, not merely the app (RecordingOpenings.kt). A workout's page kept a SafeArea at its foot, whose inset under the floating bar is the bar itself: its content stopped at the bar's top, a plain band behind it. It runs on beneath the bar as the tabs do, and the tabs' lists and a day's page end with the body's bottom padding rather than a fixed 88 px, which left their last item under the bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
e26ba47fb9
commit
1aa679fe3e
3 changed files with 258 additions and 20 deletions
|
|
@ -33,17 +33,22 @@ class MainActivity : FlutterActivity() {
|
|||
/** Music from Jellyfin: the network, and the tempo of what is downloaded (ADR 0030, D47). */
|
||||
private val music by lazy { MusicBridge(this) }
|
||||
|
||||
/** The recording's notification tapped: the recording's screen (ADR 0030, D21). */
|
||||
private val recordingOpenings = RecordingOpenings()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
health.onIntent(intent)
|
||||
// Not again where Android makes the activity anew with the same intent.
|
||||
if (savedInstanceState == null) files.onIntent(intent)
|
||||
recordingOpenings.onIntent(intent)
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
health.onIntent(intent)
|
||||
files.onIntent(intent)
|
||||
recordingOpenings.onIntent(intent)
|
||||
}
|
||||
|
||||
@Deprecated("FlutterActivity has no result registry")
|
||||
|
|
@ -118,6 +123,8 @@ class MainActivity : FlutterActivity() {
|
|||
EventChannel(messenger, "app.halkyon.train/loop/search").setStreamHandler(loop.search)
|
||||
MethodChannel(messenger, "app.halkyon.train/files").setMethodCallHandler(files)
|
||||
EventChannel(messenger, "app.halkyon.train/files/opened").setStreamHandler(files.opened)
|
||||
EventChannel(messenger, "app.halkyon.train/recorder/opened")
|
||||
.setStreamHandler(recordingOpenings.opened)
|
||||
MethodChannel(messenger, "app.halkyon.train/music").setMethodCallHandler(music)
|
||||
EventChannel(messenger, "app.halkyon.train/music/fetched").setStreamHandler(music.fetched)
|
||||
EventChannel(messenger, "app.halkyon.train/recorder/lines").setStreamHandler(
|
||||
|
|
|
|||
|
|
@ -832,6 +832,8 @@ class RecorderService : Service(), LocationListener, SensorEventListener {
|
|||
|
||||
private fun openApp(): PendingIntent? =
|
||||
packageManager.getLaunchIntentForPackage(packageName)?.let {
|
||||
// Onto the recording's screen, not wherever the app was (D21).
|
||||
it.putExtra(RecordingOpenings.EXTRA_OPEN_RECORDING, true)
|
||||
PendingIntent.getActivity(this, 0, it, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package app.halkyon.train
|
||||
|
||||
import android.content.Intent
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
|
||||
/**
|
||||
* The recording's notification tapped (ADR 0030, D21): the app opens on the
|
||||
* recording's screen, not wherever it was. The tap is handed to the app as it
|
||||
* listens (now, or once it does, after a cold start).
|
||||
*/
|
||||
class RecordingOpenings {
|
||||
companion object {
|
||||
/** The extra of the notification's intent that asks for the recording. */
|
||||
const val EXTRA_OPEN_RECORDING = "app.halkyon.train.OPEN_RECORDING"
|
||||
}
|
||||
|
||||
private var sink: EventChannel.EventSink? = null
|
||||
private var waiting = false
|
||||
|
||||
val opened =
|
||||
object : EventChannel.StreamHandler {
|
||||
override fun onListen(arguments: Any?, events: EventChannel.EventSink) {
|
||||
sink = events
|
||||
if (waiting) {
|
||||
waiting = false
|
||||
events.success(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancel(arguments: Any?) {
|
||||
sink = null
|
||||
}
|
||||
}
|
||||
|
||||
/** Takes in [intent]'s ask for the recording, if it asks. */
|
||||
fun onIntent(intent: Intent?) {
|
||||
if (intent?.getBooleanExtra(EXTRA_OPEN_RECORDING, false) != true) {
|
||||
return
|
||||
}
|
||||
// Asked once: the activity made anew with the same intent asks no more.
|
||||
intent.removeExtra(EXTRA_OPEN_RECORDING)
|
||||
sink?.success(null) ?: run { waiting = true }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue