-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
301 additions
and
96 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
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
20 changes: 13 additions & 7 deletions
20
android/src/main/kotlin/qiuxiang/android_window/AndroidWindowApi.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 |
---|---|---|
@@ -1,23 +1,29 @@ | ||
package qiuxiang.android_window | ||
|
||
class AndroidWindowApi(private val androidWindow: AndroidWindow) : Pigeon.AndroidWindowApi { | ||
override fun setLayout(width: Long, height: Long) { | ||
androidWindow.setLayout(width.toInt(), height.toInt()) | ||
class AndroidWindowApi(private val window: AndroidWindow) : Pigeon.AndroidWindowApi { | ||
override fun resize(width: Long, height: Long) { | ||
window.setLayout(width.toInt(), height.toInt()) | ||
} | ||
|
||
override fun setPosition(x: Long, y: Long) { | ||
androidWindow.setPosition(x.toInt(), y.toInt()) | ||
window.setPosition(x.toInt(), y.toInt()) | ||
} | ||
|
||
override fun dragStart() { | ||
androidWindow.dragStart() | ||
window.dragStart() | ||
} | ||
|
||
override fun dragEnd() { | ||
androidWindow.dragEnd() | ||
window.dragEnd() | ||
} | ||
|
||
override fun close() { | ||
androidWindow.service.stopSelf() | ||
window.service.stopSelf() | ||
} | ||
|
||
override fun post(data: MutableMap<Any, Any>?, result: Pigeon.Result<MutableMap<Any, Any>>?) { | ||
window.app?.mainBinaryMessenger?.let { | ||
Pigeon.MainHandler(it).handler(data) { response -> result?.success(response) } | ||
} | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
android/src/main/kotlin/qiuxiang/android_window/AndroidWindowApplication.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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
package qiuxiang.android_window | ||
|
||
import io.flutter.app.FlutterApplication | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.BinaryMessenger | ||
|
||
open class AndroidWindowApplication : FlutterApplication() { | ||
var engine: FlutterEngine? = null | ||
var mainBinaryMessenger: BinaryMessenger? = null | ||
var androidWindowBinaryMessenger: BinaryMessenger? = null | ||
var mainApi: MainApi? = null | ||
} | ||
|
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 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 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 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
Oops, something went wrong.