peachsim 0.1.1655 → 0.1.1660
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/app-config.ts +4 -0
- package/cli/app-stubs.ts +43 -6
- package/cli/commands/inspect/shared.ts +5 -2
- package/cli/commands/inspect/url.ts +2 -1
- package/cli/commands/screenshot.ts +5 -5
- package/cli/commands/state.ts +9 -6
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/output-redaction.ts +49 -0
- package/detox/index.ts +0 -1
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +12772 -1132
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +29 -5
- package/dist-lib/config.mjs +29 -5
- package/dist-lib/detox/index.cjs +19 -6
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +10411 -73
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +11220 -670
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -197
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +653 -338
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +443 -312
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +548 -163
- package/dist-lib/native-app-identity-project.cjs +179 -33
- package/dist-lib/native-app-identity-project.mjs +179 -33
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +23 -23
- package/dist-lib/public-origins-lib.json +96 -63
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +12193 -1448
- package/dist-lib/swift-compile.cjs +10348 -172
- package/dist-lib/swift-compile.mjs +10348 -172
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +10411 -73
- package/dist-lib/vite.cjs +149 -163
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +34 -0
- package/kotlin/README.md +38 -23
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -12
- package/runtime-companion.json +1 -1
- package/src/bundleGlobalFooter.ts +0 -2
- package/src/config.ts +54 -2
- package/src/configured-bundle-producer.ts +7 -1
- package/src/host/fetch-proxy-handler.ts +14 -50
- package/src/host/rolldown-bundle-forward.ts +71 -0
- package/src/installed-package-versions.ts +54 -2
- package/src/kotlin-host.ts +138 -285
- package/src/kotlin-module.ts +4 -7
- package/src/kotlin-sdk.ts +81 -0
- package/src/kotlin-toolchain.ts +152 -0
- package/src/kotlin-view-models.ts +1 -1
- package/src/kotlinSdkContract.ts +113 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/nitro-bundle.ts +18 -4
- package/src/nitro-compile.ts +5 -1
- package/src/nitro-source.ts +112 -28
- package/src/nitroContract.ts +16 -4
- package/src/stub-pattern-matcher.ts +4 -0
- package/src/swift-compile.ts +44 -14
- package/src/swift-host.ts +2 -1
- package/src/swift-objc-compile.ts +117 -4
- package/src/swift-objc-sdk.ts +10215 -59
- package/src/swift-objc-standin.ts +5 -2
- package/src/vite-plugin-one.ts +73 -134
- package/src/worker-system-chunks.ts +14 -4
- package/src/xcode-project.ts +261 -34
- package/kotlin/AndroidViewSources/android/content/Context.kt +0 -22
- package/kotlin/AndroidViewSources/android/content/res/Configuration.kt +0 -25
- package/kotlin/AndroidViewSources/android/content/res/Resources.kt +0 -72
- package/kotlin/AndroidViewSources/android/graphics/Canvas.kt +0 -22
- package/kotlin/AndroidViewSources/android/graphics/Color.kt +0 -13
- package/kotlin/AndroidViewSources/android/graphics/Paint.kt +0 -18
- package/kotlin/AndroidViewSources/android/util/DisplayMetrics.kt +0 -12
- package/kotlin/AndroidViewSources/android/view/View.kt +0 -211
- package/kotlin/AndroidViewSources/android/widget/FrameLayout.kt +0 -61
- package/kotlin/AndroidViewSources/android/widget/LinearLayout.kt +0 -49
- package/kotlin/AndroidViewSources/dev/peach/app/JavaFormat.kt +0 -272
- package/kotlin/AppSources/android/app/Activity.kt +0 -174
- package/kotlin/AppSources/android/app/Application.kt +0 -11
- package/kotlin/AppSources/android/app/UiModeManager.kt +0 -9
- package/kotlin/AppSources/android/content/Intent.kt +0 -16
- package/kotlin/AppSources/android/os/Bundle.kt +0 -11
- package/kotlin/AppSources/android/util/SuperNotCalledException.kt +0 -3
- package/kotlin/AppSources/android/view/Window.kt +0 -182
- package/kotlin/AppSources/android/view/WindowInsets.kt +0 -9
- package/kotlin/AppSources/android/view/WindowInsetsController.kt +0 -17
- package/kotlin/AppSources/android/view/WindowManager.kt +0 -16
- package/kotlin/AppSources/android/window/BackEvent.kt +0 -24
- package/kotlin/AppSources/android/window/OnBackAnimationCallback.kt +0 -7
- package/kotlin/AppSources/android/window/OnBackInvokedDispatcher.kt +0 -84
- package/kotlin/AppSources/androidx/activity/ActivityFlags.kt +0 -9
- package/kotlin/AppSources/androidx/activity/ActivityViewModelLazy.kt +0 -21
- package/kotlin/AppSources/androidx/activity/BackEventCompat.kt +0 -43
- package/kotlin/AppSources/androidx/activity/ComponentActivity.kt +0 -122
- package/kotlin/AppSources/androidx/activity/EdgeToEdge.kt +0 -75
- package/kotlin/AppSources/androidx/activity/ExperimentalActivityApi.kt +0 -6
- package/kotlin/AppSources/androidx/activity/OnBackPressedCallback.kt +0 -69
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcher.kt +0 -144
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcherOwner.kt +0 -7
- package/kotlin/AppSources/androidx/activity/compose/BackHandler.kt +0 -86
- package/kotlin/AppSources/androidx/activity/compose/ComponentActivity.kt +0 -29
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerCompat.kt +0 -38
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerDispatcherCompat.kt +0 -27
- package/kotlin/AppSources/androidx/compose/foundation/layout/WindowInsets.kt +0 -15
- package/kotlin/AppSources/androidx/compose/ui/platform/AndroidCompositionLocals.kt +0 -27
- package/kotlin/AppSources/androidx/compose/ui/platform/ComposeView.kt +0 -68
- package/kotlin/AppSources/androidx/compose/ui/res/ColorResources.kt +0 -16
- package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +0 -70
- package/kotlin/AppSources/androidx/compose/ui/res/StringResources.kt +0 -38
- package/kotlin/AppSources/androidx/core/view/WindowCompat.kt +0 -32
- package/kotlin/AppSources/androidx/lifecycle/AndroidViewModel.kt +0 -10
- package/kotlin/AppSources/dev/peach/app/PeachApp.kt +0 -388
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +0 -102
- package/kotlin/AppSources/dev/peach/app/PeachWindowHost.kt +0 -14
- package/kotlin/CompilerSources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +0 -1
- package/kotlin/CompilerSources/PeachJniIncoming.kt +0 -243
- package/kotlin/CompilerSources/PeachJniPlugin.kt +0 -116
- package/kotlin/ComposeSources/PeachComposeHost.kt +0 -724
- package/kotlin/ComposeSources/PeachMagnifier.kt +0 -185
- package/kotlin/ComposeSources/PeachSemantics.kt +0 -127
- package/kotlin/ExpoComposeSources/PeachAndroidView.kt +0 -103
- package/kotlin/ExpoComposeSources/PeachExpoViewMount.kt +0 -24
- package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +0 -28
- package/kotlin/ExpoComposeSources/expo/modules/kotlin/views/ExpoComposeView.kt +0 -70
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +0 -516
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +0 -173
- package/kotlin/ExpoSources/expo/modules/kotlin/AppContext.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/Promise.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +0 -198
- package/kotlin/ExpoSources/expo/modules/kotlin/exception/CodedException.kt +0 -126
- package/kotlin/ExpoSources/expo/modules/kotlin/functions/Functions.kt +0 -132
- package/kotlin/ExpoSources/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +0 -81
- package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +0 -98
- package/kotlin/ExpoSources/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +0 -236
- package/kotlin/ExpoSources/expo/modules/kotlin/records/Record.kt +0 -12
- package/kotlin/ExpoSources/expo/modules/kotlin/runtime/Runtime.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObject.kt +0 -50
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +0 -57
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedRef.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +0 -158
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/GenericTypedArray.kt +0 -8
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArray.kt +0 -29
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/types/AnyType.kt +0 -155
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Either.kt +0 -91
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Enumerable.kt +0 -6
- package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +0 -68
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +0 -72
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +0 -36
- package/kotlin/JniPlatformSources/androidx/annotation/CallSuper.kt +0 -5
- package/kotlin/JniPlatformSources/com/facebook/proguard/annotations/DoNotStrip.kt +0 -5
- package/kotlin/JniPlatformSources/dalvik/annotation/optimization/FastNative.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/Synchronized.kt +0 -6
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmField.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmStatic.kt +0 -5
- package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -66
- package/kotlin/JniSources/dev/peach/jni/IncomingBindings.kt +0 -157
- package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -77
- package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -89
- package/kotlin/Sources/android/os/Build.kt +0 -17
- package/kotlin/Sources/android/os/Handler.kt +0 -35
- package/kotlin/Sources/android/os/Looper.kt +0 -17
- package/kotlin/Sources/android/os/MessageQueue.kt +0 -56
- package/kotlin/Sources/android/os/SystemClock.kt +0 -14
- package/kotlin/Sources/android/util/Log.kt +0 -64
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +0 -14
- package/kotlin/Sources/androidx/annotation/Keep.kt +0 -4
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceDispatch.kt +0 -7
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceViewDispatch.kt +0 -13
- package/kotlin/Sources/dev/onejs/one/source/OneModule.kt +0 -4
- package/kotlin/Sources/java/lang/Runnable.kt +0 -6
- package/kotlin/Sources/java/security/MessageDigest.kt +0 -114
- package/kotlin/Sources/java/util/IllegalFormatCodePointException.kt +0 -10
- package/kotlin/Sources/java/util/IllegalFormatException.kt +0 -5
- package/kotlin/Sources/kotlin/text/StringFormat.kt +0 -9
- package/kotlin/Sources/org/json/JSON.kt +0 -307
- package/kotlin/tools/abi-classes.main.kts +0 -41
- package/kotlin/tools/expo-types.main.kts +0 -127
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
package android.app
|
|
2
|
-
|
|
3
|
-
import android.content.ComponentName
|
|
4
|
-
import android.content.ContextWrapper
|
|
5
|
-
import android.content.Intent
|
|
6
|
-
import android.content.res.Configuration
|
|
7
|
-
import android.os.Bundle
|
|
8
|
-
import android.util.SuperNotCalledException
|
|
9
|
-
import android.view.View
|
|
10
|
-
import android.view.ViewGroup
|
|
11
|
-
import android.view.Window
|
|
12
|
-
|
|
13
|
-
// the cold-start half of Activity: ActivityThread attaches it, then drives the
|
|
14
|
-
// perform calls in its own order. each lifecycle method must call through to
|
|
15
|
-
// super, as Activity.mCalled enforces, and the post callbacks run after it
|
|
16
|
-
// returns, where ActivityLifecycleCallbacks see them.
|
|
17
|
-
open class Activity : ContextWrapper() {
|
|
18
|
-
private var called = false
|
|
19
|
-
private var attachedIntent: Intent? = null
|
|
20
|
-
private var attachedApplication: Application? = null
|
|
21
|
-
private var attachedWindow: Window? = null
|
|
22
|
-
private var attachedComponent: ComponentName? = null
|
|
23
|
-
|
|
24
|
-
val intent: Intent get() = checkNotNull(attachedIntent)
|
|
25
|
-
val application: Application get() = checkNotNull(attachedApplication)
|
|
26
|
-
val window: Window get() = checkNotNull(attachedWindow)
|
|
27
|
-
|
|
28
|
-
// the activity class that runs; launched through an alias, the intent
|
|
29
|
-
// still names the alias
|
|
30
|
-
val componentName: ComponentName get() = checkNotNull(attachedComponent)
|
|
31
|
-
|
|
32
|
-
// what the activity this one replaces returned from
|
|
33
|
-
// onRetainNonConfigurationInstance, across a configuration relaunch
|
|
34
|
-
var lastNonConfigurationInstance: Any? = null
|
|
35
|
-
private set
|
|
36
|
-
|
|
37
|
-
// true from the start of a configuration relaunch until this instance is
|
|
38
|
-
// destroyed, so its owners keep what the next instance takes over
|
|
39
|
-
var isChangingConfigurations = false
|
|
40
|
-
internal set
|
|
41
|
-
|
|
42
|
-
internal fun attach(
|
|
43
|
-
application: Application,
|
|
44
|
-
component: ComponentName,
|
|
45
|
-
intent: Intent,
|
|
46
|
-
window: Window,
|
|
47
|
-
lastNonConfigurationInstance: Any?,
|
|
48
|
-
) {
|
|
49
|
-
attachedApplication = application
|
|
50
|
-
attachedComponent = component
|
|
51
|
-
attachedIntent = intent
|
|
52
|
-
attachedWindow = window
|
|
53
|
-
this.lastNonConfigurationInstance = lastNonConfigurationInstance
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
open fun setContentView(view: View) {
|
|
57
|
-
setContentView(view, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
open fun setContentView(view: View, params: ViewGroup.LayoutParams) {
|
|
61
|
-
window.setContentView(view, params)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected open fun onCreate(savedInstanceState: Bundle?) { called = true }
|
|
65
|
-
protected open fun onStart() { called = true }
|
|
66
|
-
protected open fun onPostCreate(savedInstanceState: Bundle?) { called = true }
|
|
67
|
-
protected open fun onResume() { called = true }
|
|
68
|
-
protected open fun onPostResume() { called = true }
|
|
69
|
-
protected open fun onPause() { called = true }
|
|
70
|
-
protected open fun onStop() { called = true }
|
|
71
|
-
protected open fun onRestart() { called = true }
|
|
72
|
-
|
|
73
|
-
protected open fun onDestroy() { called = true }
|
|
74
|
-
|
|
75
|
-
// a configuration change the manifest's configChanges lets it handle
|
|
76
|
-
// itself, without a relaunch
|
|
77
|
-
open fun onConfigurationChanged(newConfig: Configuration) { called = true }
|
|
78
|
-
|
|
79
|
-
// Activity's own save and restore carry the window's view hierarchy state;
|
|
80
|
-
// the decor window here holds no view state of its own
|
|
81
|
-
protected open fun onSaveInstanceState(outState: Bundle) {}
|
|
82
|
-
protected open fun onRestoreInstanceState(savedInstanceState: Bundle) {}
|
|
83
|
-
|
|
84
|
-
open fun onRetainNonConfigurationInstance(): Any? = null
|
|
85
|
-
|
|
86
|
-
// a back the window's callbacks left: the activity asks the task manager,
|
|
87
|
-
// which moves a root launcher task to the back rather than finishing it
|
|
88
|
-
// (from Android 12). the only activity Peach runs is that task's root.
|
|
89
|
-
open fun onBackPressed() {
|
|
90
|
-
movedTaskToBack = true
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
internal var movedTaskToBack = false
|
|
94
|
-
|
|
95
|
-
// ActivityLifecycleCallbacks' post events; ComponentActivity's lifecycle
|
|
96
|
-
// moves on these, as its ReportFragment does from API 29.
|
|
97
|
-
internal open fun dispatchActivityPostCreated() {}
|
|
98
|
-
internal open fun dispatchActivityPostStarted() {}
|
|
99
|
-
internal open fun dispatchActivityPostResumed() {}
|
|
100
|
-
internal open fun dispatchActivityPrePaused() {}
|
|
101
|
-
internal open fun dispatchActivityPreStopped() {}
|
|
102
|
-
internal open fun dispatchActivityPreDestroyed() {}
|
|
103
|
-
|
|
104
|
-
private fun require(method: String, call: () -> Unit) {
|
|
105
|
-
called = false
|
|
106
|
-
call()
|
|
107
|
-
if (!called) throw SuperNotCalledException(
|
|
108
|
-
"Activity {${componentName.flattenToShortString()}} did not call through to super.$method()"
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
internal fun performCreate(icicle: Bundle?) {
|
|
113
|
-
require("onCreate") { onCreate(icicle) }
|
|
114
|
-
dispatchActivityPostCreated()
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
internal fun performStart() {
|
|
118
|
-
require("onStart") { onStart() }
|
|
119
|
-
dispatchActivityPostStarted()
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
internal fun performPostCreate(icicle: Bundle?) {
|
|
123
|
-
require("onPostCreate") { onPostCreate(icicle) }
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
internal fun performPause() {
|
|
127
|
-
dispatchActivityPrePaused()
|
|
128
|
-
require("onPause") { onPause() }
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private var stopped = false
|
|
132
|
-
|
|
133
|
-
internal fun performStop() {
|
|
134
|
-
dispatchActivityPreStopped()
|
|
135
|
-
require("onStop") { onStop() }
|
|
136
|
-
stopped = true
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
internal fun performSaveInstanceState(outState: Bundle) {
|
|
140
|
-
onSaveInstanceState(outState)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// ActivityThread restores after onStart, only with saved state
|
|
144
|
-
internal fun performRestoreInstanceState(savedInstanceState: Bundle) {
|
|
145
|
-
onRestoreInstanceState(savedInstanceState)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// ActivityThread collects what the next instance keeps before onDestroy
|
|
149
|
-
internal fun retainNonConfigurationInstances(): Any? = onRetainNonConfigurationInstance()
|
|
150
|
-
|
|
151
|
-
internal fun performDestroy() {
|
|
152
|
-
dispatchActivityPreDestroyed()
|
|
153
|
-
require("onDestroy") { onDestroy() }
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
internal fun performConfigurationChanged(newConfig: Configuration) {
|
|
157
|
-
require("onConfigurationChanged") { onConfigurationChanged(newConfig) }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// ActivityThread brings a stopped activity back with onRestart, then
|
|
161
|
-
// onStart; one that never stopped has nothing to restart
|
|
162
|
-
internal fun performRestart() {
|
|
163
|
-
if (!stopped) return
|
|
164
|
-
stopped = false
|
|
165
|
-
require("onRestart") { onRestart() }
|
|
166
|
-
performStart()
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
internal fun performResume() {
|
|
170
|
-
require("onResume") { onResume() }
|
|
171
|
-
require("onPostResume") { onPostResume() }
|
|
172
|
-
dispatchActivityPostResumed()
|
|
173
|
-
}
|
|
174
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
package android.app
|
|
2
|
-
|
|
3
|
-
import android.content.ContextWrapper
|
|
4
|
-
import android.content.res.Configuration
|
|
5
|
-
|
|
6
|
-
open class Application : ContextWrapper() {
|
|
7
|
-
open fun onCreate() {}
|
|
8
|
-
|
|
9
|
-
// the process's configuration changed, before any activity relaunches
|
|
10
|
-
open fun onConfigurationChanged(newConfig: Configuration) {}
|
|
11
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package android.content
|
|
2
|
-
|
|
3
|
-
class ComponentName(val packageName: String, val className: String) {
|
|
4
|
-
fun flattenToShortString(): String =
|
|
5
|
-
if (className.startsWith("$packageName.")) "$packageName/${className.removePrefix(packageName)}"
|
|
6
|
-
else "$packageName/$className"
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
class Intent(val action: String?, val categories: Set<String>?, val component: ComponentName?) {
|
|
10
|
-
fun hasCategory(category: String): Boolean = categories?.contains(category) == true
|
|
11
|
-
|
|
12
|
-
companion object {
|
|
13
|
-
const val ACTION_MAIN = "android.intent.action.MAIN"
|
|
14
|
-
const val CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
package android.os
|
|
2
|
-
|
|
3
|
-
import androidx.savedstate.SavedState
|
|
4
|
-
import androidx.savedstate.savedState
|
|
5
|
-
|
|
6
|
-
// on Android androidx's SavedState is Bundle; here a Bundle holds the
|
|
7
|
-
// multiplatform SavedState that a save writes into. a cold start has no saved
|
|
8
|
-
// instance state, so the launcher receives null.
|
|
9
|
-
class Bundle internal constructor(internal val state: SavedState) {
|
|
10
|
-
constructor() : this(savedState())
|
|
11
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
package android.view
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import android.graphics.Color
|
|
5
|
-
import android.widget.FrameLayout
|
|
6
|
-
import androidx.compose.runtime.getValue
|
|
7
|
-
import androidx.compose.runtime.mutableStateOf
|
|
8
|
-
import androidx.compose.runtime.setValue
|
|
9
|
-
import dev.peach.app.PeachWindowHost
|
|
10
|
-
import org.json.JSONObject
|
|
11
|
-
|
|
12
|
-
// what PhoneWindow.generateLayout read from the activity's theme
|
|
13
|
-
internal class WindowTheme(
|
|
14
|
-
val edgeToEdgeEnforced: Boolean,
|
|
15
|
-
val statusBarColor: Int,
|
|
16
|
-
val navigationBarColor: Int,
|
|
17
|
-
val statusBarContrastEnforced: Boolean,
|
|
18
|
-
val navigationBarContrastEnforced: Boolean,
|
|
19
|
-
val lightStatusBar: Boolean,
|
|
20
|
-
val lightNavigationBar: Boolean,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
// DecorView's light contrast scrim behind a transparent bar
|
|
24
|
-
private const val SCRIM_LIGHT = -0x19000001
|
|
25
|
-
|
|
26
|
-
// PhoneWindow's content parent (android.R.id.content) inside its decor. the
|
|
27
|
-
// window is added, and its views attached, after the activity resumes.
|
|
28
|
-
class Window internal constructor(
|
|
29
|
-
context: Context,
|
|
30
|
-
theme: WindowTheme,
|
|
31
|
-
internal val host: PeachWindowHost,
|
|
32
|
-
private val predictiveBackEnabled: Boolean,
|
|
33
|
-
) {
|
|
34
|
-
private companion object { var nextBackGeneration = 0 }
|
|
35
|
-
internal val backGeneration = ++nextBackGeneration
|
|
36
|
-
private val edgeToEdgeEnforced = theme.edgeToEdgeEnforced
|
|
37
|
-
internal val contentParent = FrameLayout(context)
|
|
38
|
-
val decorView: View get() = contentParent
|
|
39
|
-
val attributes = WindowManager.LayoutParams()
|
|
40
|
-
private val backDispatcher = android.window.WindowOnBackInvokedDispatcher { host.windowChanged() }
|
|
41
|
-
val onBackInvokedDispatcher: android.window.OnBackInvokedDispatcher get() = backDispatcher
|
|
42
|
-
internal fun invokeBack(): Boolean = backDispatcher.invoke()
|
|
43
|
-
internal fun backPhase(phase: String, registration: Int, event: android.window.BackEvent) =
|
|
44
|
-
backDispatcher.phase(phase, registration, event)
|
|
45
|
-
internal fun cancelBackGesture() = backDispatcher.cancelGesture()
|
|
46
|
-
|
|
47
|
-
// PhoneWindow fits system windows until told otherwise; an enforced edge
|
|
48
|
-
// to edge window never does, and ignores the request
|
|
49
|
-
private var fits by mutableStateOf(!edgeToEdgeEnforced)
|
|
50
|
-
internal val fitsSystemWindows: Boolean get() = fits
|
|
51
|
-
|
|
52
|
-
fun setDecorFitsSystemWindows(decorFitsSystemWindows: Boolean) {
|
|
53
|
-
if (edgeToEdgeEnforced || fits == decorFitsSystemWindows) return
|
|
54
|
-
fits = decorFitsSystemWindows
|
|
55
|
-
host.windowChanged()
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
fun decorFitsSystemWindows(): Boolean = fits
|
|
59
|
-
|
|
60
|
-
// the theme's statusBarColor, transparent while edge to edge is enforced,
|
|
61
|
-
// where setting it does nothing
|
|
62
|
-
private var statusBar = if (edgeToEdgeEnforced) Color.TRANSPARENT else theme.statusBarColor
|
|
63
|
-
|
|
64
|
-
var statusBarColor: Int
|
|
65
|
-
get() = statusBar
|
|
66
|
-
set(color) {
|
|
67
|
-
if (edgeToEdgeEnforced || color == statusBar) return
|
|
68
|
-
statusBar = color
|
|
69
|
-
host.windowChanged()
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
fun getStatusBarColor(): Int = statusBarColor
|
|
73
|
-
fun setStatusBarColor(color: Int) { statusBarColor = color }
|
|
74
|
-
|
|
75
|
-
// the theme's navigation bar color as PhoneWindow resolved it; an enforced
|
|
76
|
-
// edge to edge window reports and draws transparent
|
|
77
|
-
private var navigationBar = theme.navigationBarColor
|
|
78
|
-
|
|
79
|
-
var navigationBarColor: Int
|
|
80
|
-
get() = if (edgeToEdgeEnforced) Color.TRANSPARENT else navigationBar
|
|
81
|
-
set(color) {
|
|
82
|
-
if (color == navigationBar) return
|
|
83
|
-
navigationBar = color
|
|
84
|
-
host.windowChanged()
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
fun getNavigationBarColor(): Int = navigationBarColor
|
|
88
|
-
fun setNavigationBarColor(color: Int) { navigationBarColor = color }
|
|
89
|
-
|
|
90
|
-
var isStatusBarContrastEnforced: Boolean = theme.statusBarContrastEnforced
|
|
91
|
-
set(value) {
|
|
92
|
-
if (field == value) return
|
|
93
|
-
field = value
|
|
94
|
-
host.windowChanged()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
var isNavigationBarContrastEnforced: Boolean = theme.navigationBarContrastEnforced
|
|
98
|
-
|
|
99
|
-
fun setStatusBarContrastEnforced(enforced: Boolean) { isStatusBarContrastEnforced = enforced }
|
|
100
|
-
fun setNavigationBarContrastEnforced(enforced: Boolean) { isNavigationBarContrastEnforced = enforced }
|
|
101
|
-
|
|
102
|
-
val insetsController: WindowInsetsController = object : WindowInsetsController {
|
|
103
|
-
override fun hide(types: Int) = setSystemBarsVisible(types, false)
|
|
104
|
-
override fun show(types: Int) = setSystemBarsVisible(types, true)
|
|
105
|
-
|
|
106
|
-
override var systemBarsBehavior: Int = WindowInsetsController.BEHAVIOR_DEFAULT
|
|
107
|
-
set(value) {
|
|
108
|
-
require(value == WindowInsetsController.BEHAVIOR_DEFAULT ||
|
|
109
|
-
value == WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE) {
|
|
110
|
-
"unsupported system bar behavior: $value"
|
|
111
|
-
}
|
|
112
|
-
if (field == value) return
|
|
113
|
-
field = value
|
|
114
|
-
host.windowChanged()
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private var appearance =
|
|
118
|
-
(if (theme.lightStatusBar) WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS else 0) or
|
|
119
|
-
(if (theme.lightNavigationBar) WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS else 0)
|
|
120
|
-
|
|
121
|
-
override val systemBarsAppearance: Int get() = appearance
|
|
122
|
-
|
|
123
|
-
override fun setSystemBarsAppearance(appearance: Int, mask: Int) {
|
|
124
|
-
val next = (this.appearance and mask.inv()) or (appearance and mask)
|
|
125
|
-
if (next == this.appearance) return
|
|
126
|
-
this.appearance = next
|
|
127
|
-
host.windowChanged()
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private var hiddenSystemBars = 0
|
|
132
|
-
|
|
133
|
-
private fun setSystemBarsVisible(types: Int, visible: Boolean) {
|
|
134
|
-
val supported = WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars()
|
|
135
|
-
require(types and supported.inv() == 0) { "unsupported window inset visibility types: $types" }
|
|
136
|
-
val next = if (visible) hiddenSystemBars and types.inv() else hiddenSystemBars or types
|
|
137
|
-
if (next == hiddenSystemBars) return
|
|
138
|
-
hiddenSystemBars = next
|
|
139
|
-
host.windowChanged()
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// DecorView.calculateBarColor for the status bar of a window that draws
|
|
143
|
-
// its bar backgrounds: a transparent color under enforced contrast shows
|
|
144
|
-
// the scrim for the bar's appearance
|
|
145
|
-
private fun drawnStatusBarColor(): Int {
|
|
146
|
-
if (!isStatusBarContrastEnforced || Color.alpha(statusBar) != 0) return statusBar
|
|
147
|
-
check(insetsController.systemBarsAppearance and WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS != 0) {
|
|
148
|
-
"a dark status bar's contrast scrim is the device's dynamic system_bar_background_semi_transparent, which peach kotlin does not model"
|
|
149
|
-
}
|
|
150
|
-
return SCRIM_LIGHT
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// what the decor draws for this window: its inset policy and its bar
|
|
154
|
-
// colors as unsigned ARGB. gesture navigation draws no contrast scrim
|
|
155
|
-
// behind a transparent navigation bar, as the oracle's edge to edge
|
|
156
|
-
// captures show
|
|
157
|
-
internal fun describe(): JSONObject = JSONObject()
|
|
158
|
-
.put("decorFitsSystemWindows", fits)
|
|
159
|
-
.put("statusBarColor", drawnStatusBarColor().toLong() and 0xffffffffL)
|
|
160
|
-
.put("navigationBarColor", navigationBarColor.toLong() and 0xffffffffL)
|
|
161
|
-
.put("systemBarsAppearance", insetsController.systemBarsAppearance)
|
|
162
|
-
.put("hiddenSystemBars", hiddenSystemBars)
|
|
163
|
-
.put("systemBarsBehavior", insetsController.systemBarsBehavior)
|
|
164
|
-
.put("backCallbacks", backDispatcher.registrations())
|
|
165
|
-
.put("backGeneration", backGeneration)
|
|
166
|
-
.put("predictiveBackEnabled", predictiveBackEnabled)
|
|
167
|
-
|
|
168
|
-
// Activity.setContentView(View) fills the content parent
|
|
169
|
-
internal fun setContentView(view: View, params: ViewGroup.LayoutParams) {
|
|
170
|
-
contentParent.removeAllViews()
|
|
171
|
-
contentParent.addView(view, params)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
internal fun addToWindowManager() {
|
|
175
|
-
contentParent.dispatchAttachedToWindow(this)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
internal fun removeFromWindowManager() {
|
|
179
|
-
if (contentParent.isAttachedToWindow) contentParent.dispatchDetachedFromWindow()
|
|
180
|
-
backDispatcher.clear()
|
|
181
|
-
}
|
|
182
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package android.view
|
|
2
|
-
|
|
3
|
-
// the window's requested system bar appearance: light bars ask for dark icons
|
|
4
|
-
interface WindowInsetsController {
|
|
5
|
-
fun hide(types: Int)
|
|
6
|
-
fun show(types: Int)
|
|
7
|
-
fun setSystemBarsAppearance(appearance: Int, mask: Int)
|
|
8
|
-
val systemBarsAppearance: Int
|
|
9
|
-
var systemBarsBehavior: Int
|
|
10
|
-
|
|
11
|
-
companion object {
|
|
12
|
-
const val APPEARANCE_LIGHT_STATUS_BARS = 1 shl 3
|
|
13
|
-
const val APPEARANCE_LIGHT_NAVIGATION_BARS = 1 shl 4
|
|
14
|
-
const val BEHAVIOR_DEFAULT = 1
|
|
15
|
-
const val BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE = 2
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package android.view
|
|
2
|
-
|
|
3
|
-
interface WindowManager {
|
|
4
|
-
// the window attributes edge to edge code sets; the cutout mode is held as
|
|
5
|
-
// the app sets it
|
|
6
|
-
class LayoutParams {
|
|
7
|
-
var layoutInDisplayCutoutMode: Int = LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
|
|
8
|
-
|
|
9
|
-
companion object {
|
|
10
|
-
const val LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0
|
|
11
|
-
const val LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1
|
|
12
|
-
const val LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2
|
|
13
|
-
const val LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package android.window
|
|
2
|
-
|
|
3
|
-
class BackEvent(
|
|
4
|
-
val touchX: Float,
|
|
5
|
-
val touchY: Float,
|
|
6
|
-
val progress: Float,
|
|
7
|
-
val swipeEdge: Int,
|
|
8
|
-
val frameTimeMillis: Long = 0,
|
|
9
|
-
) {
|
|
10
|
-
companion object {
|
|
11
|
-
const val EDGE_LEFT = 0
|
|
12
|
-
const val EDGE_RIGHT = 1
|
|
13
|
-
const val EDGE_NONE = 2
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
override fun toString(): String =
|
|
17
|
-
"BackEvent{mTouchX=$touchX, mTouchY=$touchY, mProgress=$progress, " +
|
|
18
|
-
"mSwipeEdge=$swipeEdge, mFrameTimeMillis=$frameTimeMillis}"
|
|
19
|
-
|
|
20
|
-
override fun equals(other: Any?): Boolean = other is BackEvent &&
|
|
21
|
-
touchX.compareTo(other.touchX) == 0 && touchY.compareTo(other.touchY) == 0 &&
|
|
22
|
-
progress.compareTo(other.progress) == 0 && swipeEdge == other.swipeEdge &&
|
|
23
|
-
frameTimeMillis == other.frameTimeMillis
|
|
24
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
package android.window
|
|
2
|
-
|
|
3
|
-
fun interface OnBackInvokedCallback {
|
|
4
|
-
fun onBackInvoked()
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface OnBackInvokedDispatcher {
|
|
8
|
-
fun registerOnBackInvokedCallback(priority: Int, callback: OnBackInvokedCallback)
|
|
9
|
-
fun unregisterOnBackInvokedCallback(callback: OnBackInvokedCallback)
|
|
10
|
-
|
|
11
|
-
companion object {
|
|
12
|
-
const val PRIORITY_DEFAULT = 0
|
|
13
|
-
const val PRIORITY_OVERLAY = 1000000
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// the receiving window orders by priority, then latest registration.
|
|
18
|
-
internal class WindowOnBackInvokedDispatcher(private val changed: () -> Unit) : OnBackInvokedDispatcher {
|
|
19
|
-
private data class Registration(val priority: Int, val order: Int)
|
|
20
|
-
private val callbacks = linkedMapOf<OnBackInvokedCallback, Registration>()
|
|
21
|
-
private var order = 0
|
|
22
|
-
private var gesture: OnBackInvokedCallback? = null
|
|
23
|
-
private var gestureRegistration = 0
|
|
24
|
-
|
|
25
|
-
override fun registerOnBackInvokedCallback(priority: Int, callback: OnBackInvokedCallback) {
|
|
26
|
-
require(priority >= 0) { "application back callback priority must be nonnegative" }
|
|
27
|
-
callbacks[callback] = Registration(priority, ++order)
|
|
28
|
-
changed()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
override fun unregisterOnBackInvokedCallback(callback: OnBackInvokedCallback) {
|
|
32
|
-
if (callbacks.remove(callback) != null) {
|
|
33
|
-
if (gesture === callback) cancelGesture()
|
|
34
|
-
changed()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
fun registrations(): org.json.JSONArray = org.json.JSONArray().also { result ->
|
|
39
|
-
callbacks.values.sortedBy { it.order }.forEach {
|
|
40
|
-
result.put(org.json.JSONObject().put("priority", it.priority).put("registration", it.order))
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
fun invoke(): Boolean {
|
|
45
|
-
val callback = callbacks.maxWithOrNull(compareBy({ it.value.priority }, { it.value.order }))?.key ?: return false
|
|
46
|
-
callback.onBackInvoked()
|
|
47
|
-
return true
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// the system retains the callback chosen at gesture start. registration
|
|
51
|
-
// changes cannot redirect its remaining phases to another callback.
|
|
52
|
-
fun phase(phase: String, registration: Int, event: BackEvent) {
|
|
53
|
-
if (phase == "started") {
|
|
54
|
-
cancelGesture()
|
|
55
|
-
gesture = callbacks.entries.firstOrNull { it.value.order == registration }?.key
|
|
56
|
-
gestureRegistration = registration
|
|
57
|
-
(gesture as? OnBackAnimationCallback)?.onBackStarted(event)
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
if (registration != gestureRegistration) return
|
|
61
|
-
val callback = gesture ?: return
|
|
62
|
-
when (phase) {
|
|
63
|
-
"progressed" -> (callback as? OnBackAnimationCallback)?.onBackProgressed(event)
|
|
64
|
-
"cancelled" -> cancelGesture()
|
|
65
|
-
"invoked" -> {
|
|
66
|
-
gesture = null
|
|
67
|
-
gestureRegistration = 0
|
|
68
|
-
callback.onBackInvoked()
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
fun cancelGesture() {
|
|
74
|
-
val callback = gesture
|
|
75
|
-
gesture = null
|
|
76
|
-
gestureRegistration = 0
|
|
77
|
-
(callback as? OnBackAnimationCallback)?.onBackCancelled()
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fun clear() {
|
|
81
|
-
cancelGesture()
|
|
82
|
-
callbacks.clear()
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package androidx.activity
|
|
2
|
-
|
|
3
|
-
// androidx.activity 1.13.0's ActivityFlags
|
|
4
|
-
@ExperimentalActivityApi
|
|
5
|
-
object ActivityFlags {
|
|
6
|
-
// a lifecycle-bound back callback keeps its place in the dispatch queue
|
|
7
|
-
// across ON_STOP and ON_START, rather than moving to the top on each start
|
|
8
|
-
var isOnBackPressedLifecycleOrderMaintained: Boolean = true
|
|
9
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
package androidx.activity
|
|
2
|
-
|
|
3
|
-
import androidx.lifecycle.ViewModel
|
|
4
|
-
import androidx.lifecycle.ViewModelLazy
|
|
5
|
-
import androidx.lifecycle.ViewModelProvider
|
|
6
|
-
import androidx.lifecycle.viewmodel.CreationExtras
|
|
7
|
-
|
|
8
|
-
// activity-ktx's viewModels(): the activity's store, its default factory and
|
|
9
|
-
// creation extras unless the caller passes its own
|
|
10
|
-
inline fun <reified VM : ViewModel> ComponentActivity.viewModels(
|
|
11
|
-
noinline extrasProducer: (() -> CreationExtras)? = null,
|
|
12
|
-
noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null,
|
|
13
|
-
): Lazy<VM> {
|
|
14
|
-
val factoryPromise = factoryProducer ?: { defaultViewModelProviderFactory }
|
|
15
|
-
return ViewModelLazy(
|
|
16
|
-
VM::class,
|
|
17
|
-
{ viewModelStore },
|
|
18
|
-
factoryPromise,
|
|
19
|
-
{ extrasProducer?.invoke() ?: this.defaultViewModelCreationExtras },
|
|
20
|
-
)
|
|
21
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
package androidx.activity
|
|
2
|
-
|
|
3
|
-
import androidx.navigationevent.NavigationEvent
|
|
4
|
-
|
|
5
|
-
// androidx.activity 1.13.0's BackEventCompat: one predictive back gesture sample
|
|
6
|
-
class BackEventCompat(
|
|
7
|
-
val touchX: Float,
|
|
8
|
-
val touchY: Float,
|
|
9
|
-
val progress: Float,
|
|
10
|
-
val swipeEdge: Int,
|
|
11
|
-
val frameTimeMillis: Long = 0,
|
|
12
|
-
) {
|
|
13
|
-
constructor(backEvent: android.window.BackEvent) : this(
|
|
14
|
-
backEvent.touchX, backEvent.touchY, backEvent.progress,
|
|
15
|
-
backEvent.swipeEdge, backEvent.frameTimeMillis,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
constructor(navigationEvent: NavigationEvent) : this(
|
|
19
|
-
touchX = navigationEvent.touchX,
|
|
20
|
-
touchY = navigationEvent.touchY,
|
|
21
|
-
progress = navigationEvent.progress,
|
|
22
|
-
swipeEdge = navigationEvent.swipeEdge,
|
|
23
|
-
frameTimeMillis = navigationEvent.frameTimeMillis,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
fun toNavigationEvent(): NavigationEvent = NavigationEvent(
|
|
27
|
-
touchX = touchX,
|
|
28
|
-
touchY = touchY,
|
|
29
|
-
progress = progress,
|
|
30
|
-
swipeEdge = swipeEdge,
|
|
31
|
-
frameTimeMillis = frameTimeMillis,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
override fun toString(): String =
|
|
35
|
-
"BackEventCompat(touchX=$touchX, touchY=$touchY, progress=$progress, " +
|
|
36
|
-
"swipeEdge=$swipeEdge, frameTimeMillis=$frameTimeMillis)"
|
|
37
|
-
|
|
38
|
-
companion object {
|
|
39
|
-
const val EDGE_LEFT: Int = 0
|
|
40
|
-
const val EDGE_RIGHT: Int = 1
|
|
41
|
-
const val EDGE_NONE: Int = 2
|
|
42
|
-
}
|
|
43
|
-
}
|