Skip to content

Commit

Permalink
Fix cast bug
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuxiang committed Mar 5, 2023
1 parent cf05060 commit b6451f9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class AndroidWindow(
initialY = layoutParams.y
}
}

MotionEvent.ACTION_DOWN -> {
if (focusable) {
layoutParams.flags = layoutParams.flags and WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE.inv()
Expand All @@ -92,6 +93,7 @@ class AndroidWindow(
windowManager.updateViewLayout(rootView, layoutParams)
true
}

else -> false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class WindowService : android.app.Service() {
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
if (!running) {
engine = FlutterEngine(application)
(application as AndroidWindowApplication).androidWindowMessenger = engine.dartExecutor.binaryMessenger
val entry = intent.getStringExtra("entry") ?: "androidWindow"
val entryPoint = DartExecutor.DartEntrypoint(findAppBundlePath(), entry)
engine.dartExecutor.executeDartEntrypoint(entryPoint)
Expand All @@ -42,7 +41,8 @@ class WindowService : android.app.Service() {
androidWindow.open()
startForeground(1, getNotification())
running = true
(application as AndroidWindowApplication).running = true
androidWindow.app?.androidWindowMessenger = engine.dartExecutor.binaryMessenger
androidWindow.app?.running = true
}
return super.onStartCommand(intent, flags, startId)
}
Expand All @@ -62,6 +62,6 @@ class WindowService : android.app.Service() {
override fun onDestroy() {
androidWindow.close()
engine.destroy()
(application as AndroidWindowApplication).running = false
androidWindow.app?.running = false
}
}
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
3 changes: 1 addition & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

0 comments on commit b6451f9

Please sign in to comment.