Some Moto 360s won't load rounded layout

I wrote an app that works on a round and square clock with two layouts and watchViewStub. Since the moto 360 is sold in Europe, I have a lot of reports that the moto 360 does not load the rounded layout. With an emulator, I cannot reproduce this behavior even if I change the locale, as explained here: https://developer.android.com/guide/topics/resources/localization.html#testing So I guess this is my code .. ...

This is how I implemented it:

<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rectLayout="@layout/rect_activity_camera"
app:roundLayout="@layout/round_activity_camera">

      

Then in the snippet I inflate the WatchViewStub

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final WatchViewStub stub = (WatchViewStub) getView().findViewById(R.id.watch_view_stub);
    stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
        @Override
        public void onLayoutInflated(WatchViewStub stub) {
            ...
        } 
    }

      

Fragment is used in FragmentViewPager / FragmentGridPagerAdapter. Until I get Moto 360, any ideas on how I can debug this?

Edit

The WatchViewStub sample in Wear Sdk has two different behaviors, depends on the locale, so I'm filling this issue: https://code.google.com/p/android/issues/detail?id=77642

Attention!

This issue is discussed in various posts. to avoid repeating updated information, only google code issue will be updated and I will end this post as soon as issue is resolved: https://code.google.com/p/android/issues/detail?id=77642

+3


source to share


2 answers


There are many layout bloat issues caused by misuse of WatchViewStub. I don't see enough code above to know for sure, but one common problem is when you register a listener to insert a clock:

    final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    stub.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
        @Override
        public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
            // Need to also call the original insets since we have overridden the original                                                  
            // https://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener.html                                   
            stub.onApplyWindowInsets(windowInsets);

            return windowInsets;
        }
    });

      

I see cases where people forget to return windowInsets or forget to call stub.onApplyWindowInsets (). This results in a square layout instead of a circular layout.



Other problems are caused by forgetting to put the same XML elements in round.xml as square.xml.

What error message are you getting in adb logcat?

+1


source


I have information for you about this error.

The problem is related to the watch switching languages ​​when pairing with the phone after factory reset. You can avoid the problem by selecting the same language on the wearable as on the phone, so that no change occurs after the device is connected.



Troubleshooting instructions:

  • Factory reset Moto 360.
  • When it reboots, it will ask which language you want to use. Select the same language you use on your phone (do not select the default for English)
  • On your phone, launch the app from the Android Wear satellite and select the "Pair with a new wearable" option from the overflow menu.
  • Pair your phone with Moto 360.
+1


source







All Articles