Skip to content

Commit

Permalink
Update for iOS and Android
Browse files Browse the repository at this point in the history
- iOS not finished yet
- Android fully working with demo app included
  • Loading branch information
mbender74 committed Sep 6, 2022
1 parent 2bedddf commit c82024b
Show file tree
Hide file tree
Showing 103 changed files with 3,168 additions and 822 deletions.
17 changes: 3 additions & 14 deletions .gitignore
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 modified LICENSE
100644 → 100755
Empty file.
Empty file modified README
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified android/.clang-format
100644 → 100755
Empty file.
Empty file modified android/Resources/README.md
100644 → 100755
Empty file.
13 changes: 11 additions & 2 deletions android/build.gradle
100644 → 100755
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 modified android/lib/README
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion android/manifest
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ name: TiDAKeyboardControl
moduleid: it.smc.dakeyboardcontrol
guid: b828232e-dbf7-4615-9924-39f539a94727
platform: android
minsdk: 9.0.3.GA
minsdk: 10.1.0.GA
27 changes: 0 additions & 27 deletions android/platform/README.md

This file was deleted.

24 changes: 24 additions & 0 deletions android/platform/android/res/layout/animationlayout.xml
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>
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()
}
}
}
104 changes: 0 additions & 104 deletions android/src/it/smc/dakeyboardcontrol/ExampleProxy.java

This file was deleted.

0 comments on commit c82024b

Please sign in to comment.