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

WearableRecyclerView

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for funnelbit funnelbit
October 26, 2016

 WearableRecyclerView

Avatar for funnelbit

funnelbit

October 26, 2016
Tweet

More Decks by funnelbit

Other Decks in Technology

Transcript

  1. 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);
 }
  2. BEKVTU"ODIPS0⒎TFU9: public class CustomOffsettingHelper extends DefaultOffsettingHelper {
 …
 
 @Override


    protected void adjustAnchorOffsetXY(View child, float[] anchorOffsetXY) {
 anchorOffsetXY[0] = child.getHeight() / 2.0f;
 } …
 }