wear-osmoto-360

Detect if Android Wear screen has chin (aka flat tire)


While developing Android Wear watch face, how can one detect if screen is round and has chin (aka flat tire band), like Moto 360? I tried onSurfaceChanged, but width and height are identical overthere.

I tried this on emulator having chin, but still can't detect chin, is the problem with emulator or my code?:

@Override
void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);
    // check if MOTO360 or other Chin layouts
    Log.d(TAG,String.format("isRound : %s, BottomInset :%d",insets.isRound()?"YES":"NO",insets.getStableInsetBottom()));
    // LOG OUTPUT : isRound : YES, BottomInset :0
    if (insets.isRound() && insets.getStableInsetBottom() > 0)
        ClockPaintingRoutines.flat_display_mode=true;
 }

Solution

  • I am using:

    insets.getSystemWindowInsetBottom() > 0
    

    This is working for me on the emulator, but I don't have a real device to test it on.