It seems that the usual Moto 360 screen shape detection methods do not work properly.
I know that there are reports that windowInset.isRound() returns false in Moto 360.
Currently my code is as follows
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 onApplyWindowInsets will never be called on both my LG G watch and Samsung Galaxy Gear Live. I did a test with 360 users and, according to the test, this method is also not called on its device.
- Why
OnApplyWindowInsetListener n't OnApplyWindowInsetListener called? - Why do people who get a working callback report that
windowInset.isRound() returns false on the Moto 360? - How should we recognize the Moto 360 (and future ones with a circular shape)? From
Build.MODEL ?
source share