Skip to content

Commit 12cbb0b

Browse files
committed
Improve detection of round screen.
1 parent c9265bd commit 12cbb0b

File tree

1 file changed

+4
-4
lines changed
  • android/src/main/kotlin/com/mjohnsullivan/flutterwear/wear

1 file changed

+4
-4
lines changed

android/src/main/kotlin/com/mjohnsullivan/flutterwear/wear/WearPlugin.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ class WearPlugin : FlutterPlugin, ActivityAware, MethodCallHandler, LifecycleObs
7474
override fun onMethodCall(call: MethodCall, result: Result) {
7575
when (call.method) {
7676
"getShape" -> {
77-
val view = mActivityBinding?.activity?.window?.decorView
77+
val activity = mActivityBinding?.activity
7878
when {
79-
view == null -> {
80-
result.error("no-view", "No android view available.", null)
79+
activity == null -> {
80+
result.error("no-activity", "No android activity available.", null)
8181
}
82-
getRootWindowInsets(view)?.isRound == true -> {
82+
activity.resources.configuration.isScreenRound -> {
8383
result.success("round")
8484
}
8585
else -> {

0 commit comments

Comments
 (0)