Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WearableRecyclerView

8928b5277aa7234dbca4ff782952343a?s=47 funnelbit
October 26, 2016

 WearableRecyclerView

8928b5277aa7234dbca4ff782952343a?s=128

funnelbit

October 26, 2016
Tweet

More Decks by funnelbit

Other Decks in Technology

Transcript

  1. 8FBSBCMF 3FDZDMFS7JFX

  2. ࣗݾ঺հ ๺ଜྋ גࣜձࣾ͸ͯͳ )BUFOBGVOOFMCJU 5XJUUFS!FYQFSPQFSP

  3. ހʹͦͬͯ഑ஔ͢Δ 3FDZDMFS7JFX

  4. None
  5. 8FBSBCMF 3FDZDMFS7JFX w ؙܕ8FBSBCMFσόΠεʹରԠͨ͠ 3FDZDMFS7JFX w 3FDZDMFS7JFXͷࢠΫϥε w ހʹͦͬͯεΫϩʔϧ͍ͯ͘͠ w

    8FBSd
  6. None
  7. 
 <android.support.wearable.view.WearableRecyclerView
 xmlns:android="http://schemas.android.com/apk/res/ android"
 xmlns:tools="http://schemas.android.com/tools"
 android:id="@+id/recycler_launcher_view"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:scrollbars="vertical"/> 8FBSBCMF

    3FDZDMFS7JFX
  8. 8FBSBCMF 3FDZDMFS7JFX mWearableRecyclerView.setAdapter(adapter);

  9. None
  10. 0⒎TFUUJOH)FMQFS

  11. 0⒎TFUUJOH)FMQFS w JUFNͷP⒎TFUΛࢦఆͰ͖Δ public class CustomOffsettingHelper extends DefaultOffsettingHelper {
 @Override


    public void updateChild(View child, WearableRecyclerView parent) {
 super.updateChild(child, parent);
 // Figure out % progress from top to bottom
 float centerOffset = ((float) child.getHeight() / 2.0f) / (float) parent.getHeight();
 float yRelativeToCenterOffset = (child.getY() / parent.getHeight()) + centerOffset;
 
 // Normalize for center
 mProgressToCenter = Math.abs(0.5f - yRelativeToCenterOffset);
 // Adjust to the maximum scale
 mProgressToCenter = Math.min(mProgressToCenter, MAX_ICON_PROGRESS);
 
 child.setScaleX(1 - mProgressToCenter);
 child.setScaleY(1 - mProgressToCenter);
 }
  12. $JSDVMBS4DSPMMJOH (FTUVSF

  13. $JSDVMBS4DSPMMJOH(FTUVSF mWearableRecyclerView.setCircularScrollingGestu reEnabled(true); w ؙ͍εΫϩʔϦϯάΛ༗ޮʹ͢Δ

  14. $JSDVMBS4DSPMMJOH(FTUVSF

  15. $JSDVMBS4DSPMMJOH(FTUVSF mWearableRecyclerView.setScrollDegreesPerScreen (90); w εΫϩʔϧͷ౓߹͍ΛมߋͰ͖Δ

  16. "ODIPS

  17. w σϑΥϧτͰ͸JUFNͷY ZJUFNͷߴ͞ ͷத৺఺

  18. BEKVTU"ODIPS0⒎TFU9: public class CustomOffsettingHelper extends DefaultOffsettingHelper {
 …
 
 @Override


    protected void adjustAnchorOffsetXY(View child, float[] anchorOffsetXY) {
 anchorOffsetXY[0] = child.getHeight() / 2.0f;
 } …
 }
  19. ·ͱΊ w ؙܕσόΠεͷڧΈΛ׆͔ͤΔ w ໊લͷҙਤ͕ΠϚΠνΑ͘Θ͔Βͳ͍ ʢ8FBSBCMF3FDZDMFS7JFXʣ

  20. ৄࡉ w IUUQTEFWFMPQFSBOESPJEDPNXFBS QSFWJFXGFBUVSFTXFBSBCMFSFDZDMFS WJFXIUNM

  21. ͋Γ͕ͱ͏͍͟͝·ͨ͠