3

I am developing a watch face using CanvasWatchFaceService.Engine

I need to detect if watch is round or square.

I overrided onApplyWindowInsets, but it is not called.

Shall I set a specific listener or something like that?

AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210

2 Answers2

2

In my experience, onApplywindowInsets only gets called when you're using Theme.DeviceDefault, or a theme descending from it. It won't get called if you're using a completely custom theme.

So in the manifest for your watch face, your application tag needs to look something like this:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.DeviceDefault" >

Or if you have a theme for the watch face service, that will override it.

Sterling
  • 6,365
  • 2
  • 32
  • 40
2

In my experience, onApplyWindowInsets is not called unless android:

isScrollContainer = "true"

is set to any view in layout.

Gourav Joshi
  • 2,419
  • 2
  • 27
  • 45
Takao Sumitomo
  • 511
  • 4
  • 7