@Test public void testRoundOffsetting() throws Throwable { ((CurvingLayoutCallback) mWearableLinearLayoutManagerUnderTest.getLayoutCallback()) .setRound(true); final AtomicReference<WearableRecyclerView> wrvReference = new AtomicReference<>(); mActivityRule.runOnUiThread(new Runnable() { @Override public void run() { WearableRecyclerView wrv = (WearableRecyclerView) mActivityRule.getActivity().findViewById(R.id.wrv); wrv.setLayoutParams(new FrameLayout.LayoutParams(390, 390)); } }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); mActivityRule.runOnUiThread(new Runnable() { @Override public void run() { WearableRecyclerView wrv = (WearableRecyclerView) mActivityRule.getActivity().findViewById(R.id.wrv); wrv.setLayoutManager(mWearableLinearLayoutManagerUnderTest); wrvReference.set(wrv); } }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); WearableRecyclerView wrv = wrvReference.get(); View child1 = wrv.getChildAt(0); View child2 = wrv.getChildAt(1); View child3 = wrv.getChildAt(2); View child4 = wrv.getChildAt(3); View child5 = wrv.getChildAt(4); assertEquals(136, child1.getLeft()); assertEquals(-6.3, child1.getTranslationY(), 0.1); assertEquals(91, child2.getLeft(), 1); assertEquals(-15.21, child2.getTranslationY(), 0.1); assertEquals(58, child3.getLeft(), 1); assertEquals(-13.5, child3.getTranslationY(), 0.1); assertEquals(42, child4.getLeft(), 1); assertEquals(-4.5, child4.getTranslationY(), 0.1); if (child5 != null) { assertEquals(43, child5.getLeft(), 1); assertEquals(6.7, child5.getTranslationY(), 0.1); } }
@Nullable public LayoutCallback getLayoutCallback() { return mLayoutCallback; }
WearableLinearLayoutManager extends LinearLayoutManager { @Nullable public LayoutCallback getLayoutCallback() { return mLayoutCallback; } }
WearableLinearLayoutManager extends LinearLayoutManager { @Nullable public LayoutCallback getLayoutCallback() { return mLayoutCallback; } WearableLinearLayoutManager(Context context, LayoutCallback layoutCallback);  WearableLinearLayoutManager(Context context); }
WearableLinearLayoutManager extends LinearLayoutManager { @Nullable public LayoutCallback getLayoutCallback() { return mLayoutCallback; } WearableLinearLayoutManager(Context context, LayoutCallback layoutCallback);  WearableLinearLayoutManager(Context context); void setLayoutCallback(@Nullable LayoutCallback layoutCallback); @Nullable LayoutCallback getLayoutCallback(); @Override int scrollVerticallyBy(
            int dy, RecyclerView.Recycler recycler, RecyclerView.State state); @Override void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state); }
WearableLinearLayoutManager extends LinearLayoutManager { @Nullable public LayoutCallback getLayoutCallback() { return mLayoutCallback; } WearableLinearLayoutManager(Context context, LayoutCallback layoutCallback);  WearableLinearLayoutManager(Context context); void setLayoutCallback(@Nullable LayoutCallback layoutCallback); @Nullable LayoutCallback getLayoutCallback(); @Override int scrollVerticallyBy(
            int dy, RecyclerView.Recycler recycler, RecyclerView.State state); @Override void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state);  }