Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
 }
like image 470
AVEbrahimi Avatar asked Dec 18 '22 20:12

AVEbrahimi


1 Answers

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.

like image 57
Hakanai Avatar answered Feb 24 '23 22:02

Hakanai