Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggest with container provider #930

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
0dfcc20
refactoring SingleLayerComposeScene
dima-avdeev-jb Nov 25, 2023
4eb6b94
todo New Compose Scene
dima-avdeev-jb Nov 25, 2023
fa8ce2d
IntermediateTextInputUIView
dima-avdeev-jb Nov 26, 2023
054b0b7
password TextField
dima-avdeev-jb Nov 26, 2023
3428907
rm buildEntities
dima-avdeev-jb Nov 26, 2023
e21e996
FocusStack
dima-avdeev-jb Nov 26, 2023
a6ab70b
createSkikoUIView
dima-avdeev-jb Nov 27, 2023
8dff3ca
Entities
dima-avdeev-jb Nov 27, 2023
ad97f6b
prepareSingleLayerComposeScene
dima-avdeev-jb Nov 27, 2023
a5bd701
fix double ViewDI
dima-avdeev-jb Nov 27, 2023
ecd3c25
reformat code
dima-avdeev-jb Nov 27, 2023
e5cee52
fun doBoilerplate
dima-avdeev-jb Nov 27, 2023
fc027f7
SceneEntities
dima-avdeev-jb Nov 27, 2023
00b8160
densityProvider
dima-avdeev-jb Nov 27, 2023
d577fd5
createSceneEntities
dima-avdeev-jb Nov 28, 2023
2423666
createSceneEntities
dima-avdeev-jb Nov 28, 2023
84c16b9
move attachComposeIfNeeded
dima-avdeev-jb Nov 28, 2023
72bfa83
temp
dima-avdeev-jb Nov 28, 2023
0bd5ba0
SceneEntities<View>
dima-avdeev-jb Nov 28, 2023
e1c26d4
simplify
dima-avdeev-jb Nov 28, 2023
4facb78
simplify
dima-avdeev-jb Nov 28, 2023
a490006
simplify
dima-avdeev-jb Nov 28, 2023
4946156
simplify
dima-avdeev-jb Nov 29, 2023
3e6b10e
DensityProvider
dima-avdeev-jb Nov 29, 2023
8f9f578
simplify SkikoUIView
dima-avdeev-jb Nov 29, 2023
471da0c
KeyboardVisibilityListener
dima-avdeev-jb Nov 29, 2023
620c666
val sceneStates:List<SceneViewState<SceneView>>
dima-avdeev-jb Nov 29, 2023
a1a4cd0
setContentWithCompositionLocalProvider
dima-avdeev-jb Nov 29, 2023
ac861f2
CompositionLocalProvider
dima-avdeev-jb Nov 29, 2023
a65ab03
rm doBoilerplate
dima-avdeev-jb Nov 29, 2023
8850a22
focusStack
dima-avdeev-jb Nov 29, 2023
b774d23
rename
dima-avdeev-jb Nov 29, 2023
f649cb9
LayerState
dima-avdeev-jb Nov 30, 2023
9306bf1
LayerState display()
dima-avdeev-jb Nov 30, 2023
83b00ee
createRootUIViewControllerState
dima-avdeev-jb Nov 30, 2023
89d7f20
layout direction
dima-avdeev-jb Nov 30, 2023
5a5d7a6
SingleLayerSceneUIViewState.kt
dima-avdeev-jb Nov 30, 2023
200729e
KeyboardVisibilityListenerImpl
dima-avdeev-jb Nov 30, 2023
2d5d21a
updateLayout
dima-avdeev-jb Nov 30, 2023
1d6f067
keyboardVisibilityListener
dima-avdeev-jb Nov 30, 2023
1a8da29
densityProvider
dima-avdeev-jb Nov 30, 2023
a27d9b9
onDisplayed arg
dima-avdeev-jb Nov 30, 2023
3917386
insets
dima-avdeev-jb Nov 30, 2023
c9acbe9
simplify
dima-avdeev-jb Nov 30, 2023
18120e7
comments
dima-avdeev-jb Nov 30, 2023
12581c1
simplify isReadyToShowContent
dima-avdeev-jb Dec 1, 2023
6f9b4c7
simplify
dima-avdeev-jb Dec 1, 2023
a75d9bc
simplify
dima-avdeev-jb Dec 1, 2023
b95ec5e
simplify
dima-avdeev-jb Dec 1, 2023
ca107eb
simplify
dima-avdeev-jb Dec 1, 2023
1c2523c
simplify
dima-avdeev-jb Dec 1, 2023
09143a7
render bounds and transparent
dima-avdeev-jb Dec 1, 2023
5c96c38
temp
dima-avdeev-jb Dec 2, 2023
a72fa56
remove redundant code
dima-avdeev-jb Dec 2, 2023
6cade42
fixed start layout
dima-avdeev-jb Dec 2, 2023
fdf9635
SkikoUIView init size
dima-avdeev-jb Dec 2, 2023
f804d07
fix todos
dima-avdeev-jb Dec 2, 2023
e24400a
code format
dima-avdeev-jb Dec 2, 2023
f199a69
revert redundant changes
dima-avdeev-jb Dec 4, 2023
6af82a9
simplify
dima-avdeev-jb Dec 4, 2023
88a7cf4
IntermediateTextInputUIView constraints
dima-avdeev-jb Dec 4, 2023
f80382b
handleUIViewPresses
dima-avdeev-jb Dec 4, 2023
8877a60
prepare for review
dima-avdeev-jb Dec 4, 2023
8ab0bb4
prepare for review
dima-avdeev-jb Dec 4, 2023
4477ad7
internal modifiers
dima-avdeev-jb Dec 4, 2023
fabd2e5
simplify SceneState
dima-avdeev-jb Dec 5, 2023
b180217
doc comments
dima-avdeev-jb Dec 5, 2023
b6ca981
simplify
dima-avdeev-jb Dec 5, 2023
11693fa
Update compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/…
dima-avdeev-jb Dec 5, 2023
0cb3b42
Update compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/window/…
dima-avdeev-jb Dec 5, 2023
40b02d1
press is UIPress
dima-avdeev-jb Dec 5, 2023
d42fecd
fix TODO's and comments on review
dima-avdeev-jb Dec 6, 2023
2bf5858
names
dima-avdeev-jb Dec 6, 2023
3a92933
remove generic params
dima-avdeev-jb Dec 6, 2023
8997933
simplify
dima-avdeev-jb Dec 6, 2023
658b30f
simplify
dima-avdeev-jb Dec 6, 2023
330db0e
import and file names
dima-avdeev-jb Dec 6, 2023
d65d08e
Fix review comment about viewController dependencies (#924)
dima-avdeev-jb Dec 6, 2023
ad1adfb
get rid of ComposeSceneLayerBridge
dima-avdeev-jb Dec 7, 2023
c63852f
simplify
dima-avdeev-jb Dec 7, 2023
470a53f
naming
dima-avdeev-jb Dec 7, 2023
2af4268
simplify
dima-avdeev-jb Dec 7, 2023
72a9adb
get rid of interfaces
dima-avdeev-jb Dec 7, 2023
2b18e65
close and dispose
dima-avdeev-jb Dec 7, 2023
323df11
work in progress
dima-avdeev-jb Dec 7, 2023
7cc9f1e
temp
dima-avdeev-jb Dec 7, 2023
9dc4154
temp
dima-avdeev-jb Dec 7, 2023
9bfba2f
Merge branch 'jb-main' into dima.avdeev/ios-single-layer-compose-scene
dima-avdeev-jb Dec 8, 2023
73621ef
fix setContent
dima-avdeev-jb Dec 8, 2023
1d289f9
review fixes
dima-avdeev-jb Dec 8, 2023
ec3e451
detachLayer
dima-avdeev-jb Dec 8, 2023
441d0bd
windowInfo.isWindowFocused = true
dima-avdeev-jb Dec 8, 2023
75acf2e
private values in KeyboardVisibilityListenerImpl
dima-avdeev-jb Dec 8, 2023
24334fd
simplify visibility of values in some classes
dima-avdeev-jb Dec 8, 2023
3016f93
suggest to simplify visibility
dima-avdeev-jb Dec 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package androidx.compose.ui.platform

import androidx.compose.ui.input.InputMode
import androidx.compose.ui.text.input.PlatformTextInputService
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DensityProvider

internal class IOSPlatformContextImpl(
inputServices: PlatformTextInputService,
override val textToolbar: TextToolbar,
override val windowInfo: WindowInfo,
densityProvider: DensityProvider,
) : PlatformContext by PlatformContext.Empty {
override val textInputService: PlatformTextInputService = inputServices
override val viewConfiguration = object : ViewConfiguration by EmptyViewConfiguration {
override val touchSlop: Float
get() = with(densityProvider()) {
// this value is originating from iOS 16 drag behavior reverse engineering
10.dp.toPx()
}
}
override val inputModeManager = DefaultInputModeManager(InputMode.Touch)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package androidx.compose.ui.platform

import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.ImeOptions
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import platform.UIKit.UIKeyboardAppearance
import platform.UIKit.UIKeyboardAppearanceDefault
import platform.UIKit.UIKeyboardType
import platform.UIKit.UIKeyboardTypeASCIICapable
import platform.UIKit.UIKeyboardTypeDecimalPad
import platform.UIKit.UIKeyboardTypeDefault
import platform.UIKit.UIKeyboardTypeEmailAddress
import platform.UIKit.UIKeyboardTypeNumberPad
import platform.UIKit.UIKeyboardTypePhonePad
import platform.UIKit.UIKeyboardTypeURL
import platform.UIKit.UIReturnKeyType
import platform.UIKit.UITextAutocapitalizationType
import platform.UIKit.UITextAutocorrectionType
import platform.UIKit.UITextContentType
import platform.UIKit.UITextContentTypeEmailAddress
import platform.UIKit.UITextContentTypePassword
import platform.UIKit.UITextContentTypeTelephoneNumber
import platform.UIKit.UITextSmartDashesType
import platform.UIKit.UITextSmartInsertDeleteType
import platform.UIKit.UITextSmartQuotesType
import platform.UIKit.UITextSpellCheckingType

internal interface SkikoUITextInputTraits {
fun keyboardType(): UIKeyboardType =
UIKeyboardTypeDefault

fun keyboardAppearance(): UIKeyboardAppearance =
UIKeyboardAppearanceDefault

fun returnKeyType(): UIReturnKeyType =
UIReturnKeyType.UIReturnKeyDefault

fun textContentType(): UITextContentType? =
null

fun isSecureTextEntry(): Boolean =
false

fun enablesReturnKeyAutomatically(): Boolean =
false

fun autocapitalizationType(): UITextAutocapitalizationType =
UITextAutocapitalizationType.UITextAutocapitalizationTypeSentences

fun autocorrectionType(): UITextAutocorrectionType =
UITextAutocorrectionType.UITextAutocorrectionTypeYes

fun spellCheckingType(): UITextSpellCheckingType =
UITextSpellCheckingType.UITextSpellCheckingTypeDefault

fun smartQuotesType(): UITextSmartQuotesType =
UITextSmartQuotesType.UITextSmartQuotesTypeDefault

fun smartDashesType(): UITextSmartDashesType =
UITextSmartDashesType.UITextSmartDashesTypeDefault

fun smartInsertDeleteType(): UITextSmartInsertDeleteType =
UITextSmartInsertDeleteType.UITextSmartInsertDeleteTypeDefault

}

internal fun getUITextInputTraits(currentImeOptions: ImeOptions?) =
object : SkikoUITextInputTraits {
override fun keyboardType(): UIKeyboardType =
when (currentImeOptions?.keyboardType) {
KeyboardType.Text -> UIKeyboardTypeDefault
KeyboardType.Ascii -> UIKeyboardTypeASCIICapable
KeyboardType.Number -> UIKeyboardTypeNumberPad
KeyboardType.Phone -> UIKeyboardTypePhonePad
KeyboardType.Uri -> UIKeyboardTypeURL
KeyboardType.Email -> UIKeyboardTypeEmailAddress
KeyboardType.Password -> UIKeyboardTypeASCIICapable // TODO Correct?
KeyboardType.NumberPassword -> UIKeyboardTypeNumberPad // TODO Correct?
KeyboardType.Decimal -> UIKeyboardTypeDecimalPad
else -> UIKeyboardTypeDefault
}

override fun keyboardAppearance(): UIKeyboardAppearance = UIKeyboardAppearanceDefault
override fun returnKeyType(): UIReturnKeyType =
when (currentImeOptions?.imeAction) {
ImeAction.Default -> UIReturnKeyType.UIReturnKeyDefault
ImeAction.None -> UIReturnKeyType.UIReturnKeyDefault
ImeAction.Go -> UIReturnKeyType.UIReturnKeyGo
ImeAction.Search -> UIReturnKeyType.UIReturnKeySearch
ImeAction.Send -> UIReturnKeyType.UIReturnKeySend
ImeAction.Previous -> UIReturnKeyType.UIReturnKeyDefault
ImeAction.Next -> UIReturnKeyType.UIReturnKeyNext
ImeAction.Done -> UIReturnKeyType.UIReturnKeyDone
else -> UIReturnKeyType.UIReturnKeyDefault
}

override fun textContentType(): UITextContentType? =
when (currentImeOptions?.keyboardType) {
KeyboardType.Password, KeyboardType.NumberPassword -> UITextContentTypePassword
KeyboardType.Email -> UITextContentTypeEmailAddress
KeyboardType.Phone -> UITextContentTypeTelephoneNumber
else -> null
}

override fun isSecureTextEntry(): Boolean =
when (currentImeOptions?.keyboardType) {
KeyboardType.Password, KeyboardType.NumberPassword -> true
else -> false
}

override fun enablesReturnKeyAutomatically(): Boolean = false

override fun autocapitalizationType(): UITextAutocapitalizationType =
when (currentImeOptions?.capitalization) {
KeyboardCapitalization.None ->
UITextAutocapitalizationType.UITextAutocapitalizationTypeNone

KeyboardCapitalization.Characters ->
UITextAutocapitalizationType.UITextAutocapitalizationTypeAllCharacters

KeyboardCapitalization.Words ->
UITextAutocapitalizationType.UITextAutocapitalizationTypeWords

KeyboardCapitalization.Sentences ->
UITextAutocapitalizationType.UITextAutocapitalizationTypeSentences

else ->
UITextAutocapitalizationType.UITextAutocapitalizationTypeNone
}

override fun autocorrectionType(): UITextAutocorrectionType =
when (currentImeOptions?.autoCorrect) {
true -> UITextAutocorrectionType.UITextAutocorrectionTypeYes
false -> UITextAutocorrectionType.UITextAutocorrectionTypeNo
else -> UITextAutocorrectionType.UITextAutocorrectionTypeDefault
}

}

Loading