It looks like common ways to detect the screen shape of the Moto 360 do not work properly.
I know there are reports saying that windowInset.isRound()
returns false in the Moto 360.
Currently my code is the following
WatchViewStub viewStub = new WatchViewStub(this);
viewStub.setRoundLayout(com.pizzaentertainment.weatherwatchface.R.layout.bau);
viewStub.setRectLayout(com.pizzaentertainment.weatherwatchface.R.layout.bau_rect);
viewStub.setOnApplyWindowInsetsListener( new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
Log.d("ISWHAT?", "ASD" +windowInsets.isRound());
return windowInsets;
}
});
addContentView(viewStub, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
viewStub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
Log.d("INFLATED", "INFLATED");
}
});
My main problem is that the onApplyWindowInsets
never gets called on both my LG G watch and the Samsung Galaxy Gear Live. I made a test with a 360 user and, according to the test, that method doesn't get called on his device either.
- Why is
OnApplyWindowInsetListener
not being called? - Why do people who got the callback working report that
windowInset.isRound()
returns false on the Moto 360? - How are we supposed to recognize the Moto 360 (and future ones with the circular shape)? From the
Build.MODEL
?