-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- iOS not finished yet - Android fully working with demo app included
- Loading branch information
Showing
103 changed files
with
3,168 additions
and
822 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
ios/ti.animation.xcodeproj/xcuserdata | ||
ios/build | ||
ios/*.xcuserstate | ||
/build | ||
android/build | ||
android/libs | ||
android/example | ||
android/dist | ||
android/java-sources.txt | ||
android/build.properties | ||
ios/ti.animation.xcodeproj/project.xcworkspace/xcuserdata/* | ||
ios/Build | ||
.DS_Store | ||
ios/Cartfile.resolved | ||
ios/Carthage | ||
/android/.gradle | ||
/android/.settings/org.eclipse.buildship.core.prefs | ||
/ios/dist | ||
ios/build |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
android { | ||
compileSdkVersion 31 | ||
defaultConfig { | ||
minSdkVersion 26 | ||
targetSdkVersion 31 | ||
} | ||
} | ||
|
||
dependencies { | ||
// Add the module's library dependencies here. | ||
// See: https://developer.android.com/studio/build/dependencies | ||
implementation 'androidx.core:core-ktx:1.7.0' | ||
implementation 'androidx.dynamicanimation:dynamicanimation-ktx:1.0.0-alpha03' | ||
implementation 'androidx.appcompat:appcompat:1.4.1' | ||
implementation 'com.google.android.material:material:1.6.1' | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright 2020 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. | ||
--> | ||
|
||
<it.smc.dakeyboardcontrol.InsetsAnimationLinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
</it.smc.dakeyboardcontrol.InsetsAnimationLinearLayout> |
73 changes: 73 additions & 0 deletions
73
android/src/it/smc/dakeyboardcontrol/ControlFocusInsetsAnimationCallback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2020 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 it.smc.dakeyboardcontrol | ||
|
||
import android.view.View | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsAnimationCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
|
||
/** | ||
* A [WindowInsetsAnimationCompat.Callback] which will request and clear focus on the given view, | ||
* depending on the [WindowInsetsCompat.Type.ime] visibility state when an IME | ||
* [WindowInsetsAnimationCompat] has finished. | ||
* | ||
* This is primarily used when animating the [WindowInsetsCompat.Type.ime], so that the | ||
* appropriate view is focused for accepting input from the IME. | ||
* | ||
* @param view the view to request/clear focus | ||
* @param dispatchMode The dispatch mode for this callback. | ||
* | ||
* @see WindowInsetsAnimationCompat.Callback.getDispatchMode | ||
*/ | ||
class ControlFocusInsetsAnimationCallback( | ||
private val view: View, | ||
dispatchMode: Int = DISPATCH_MODE_STOP | ||
) : WindowInsetsAnimationCompat.Callback(dispatchMode) { | ||
|
||
override fun onProgress( | ||
insets: WindowInsetsCompat, | ||
runningAnimations: List<WindowInsetsAnimationCompat> | ||
): WindowInsetsCompat { | ||
// no-op and return the insets | ||
return insets | ||
} | ||
|
||
override fun onEnd(animation: WindowInsetsAnimationCompat) { | ||
if (animation.typeMask and WindowInsetsCompat.Type.ime() != 0) { | ||
// The animation has now finished, so we can check the view's focus state. | ||
// We post the check because the rootWindowInsets has not yet been updated, but will | ||
// be in the next message traversal | ||
view.post { | ||
checkFocus() | ||
} | ||
} | ||
} | ||
|
||
private fun checkFocus() { | ||
val imeVisible = ViewCompat.getRootWindowInsets(view) | ||
?.isVisible(WindowInsetsCompat.Type.ime()) == true | ||
if (imeVisible && view.rootView.findFocus() == null) { | ||
// If the IME will be visible, and there is not a currently focused view in | ||
// the hierarchy, request focus on our view | ||
view.requestFocus() | ||
} else if (!imeVisible && view.isFocused) { | ||
// If the IME will not be visible and our view is currently focused, clear the focus | ||
view.clearFocus() | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.