This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP 1.1 GET <- request line | |
content-type: application/json; | |
Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08jU534c0p | |
: | |
(1行あける) | |
{"foo": "bar"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) { | |
int[] out = new int[2]; | |
if (layoutManager.canScrollHorizontally()) { | |
out[0] = getDistance(layoutManager, targetView, OrientationHelper.createHorizontalHelper(layoutManager)); | |
} else { | |
out[0] = 0; | |
} | |
if (layoutManager.canScrollVertically()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
View findSnapView(RecyclerView.LayoutManager layoutManager) { | |
OrientationHelper helper = layoutManager.canScrollHorizontally() | |
? OrientationHelper.createHorizontalHelper(layoutManager) | |
: OrientationHelper.createVerticalHelper(layoutManager); | |
int childCount = layoutManager.getChildCount(); | |
View closestChild = null; | |
int containerStart = helper.getStartAfterPadding(); | |
int absClosest = Integer.MAX_VALUE; | |
for (int i = 0; i < childCount; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY) { | |
boolean forwardDirection = layoutManager.canScrollHorizontally() ? velocityX > 0 : velocityY > 0; | |
return forwardDirection ? previousClosestPosition + 1 : previousClosestPosition - 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onAttachedToWindow() { | |
super.onAttachedToWindow(); | |
new YourCustomSnapHelper().attachToRecyclerView(MultiSnapRecyclerView.this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CanvasView extends View { | |
private Paint paint = new Paint(); | |
public CanvasView(Context context) { | |
super(context); | |
} | |
public CanvasView(Context context, @Nullable AttributeSet attrs) { | |
super(context, attrs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CanvasView extends View { | |
private Paint backgroundPaint = new Paint(); | |
private Paint paint = new Paint(); | |
public CanvasView(Context context) { | |
super(context); | |
} | |
public CanvasView(Context context, @Nullable AttributeSet attrs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpringPositionView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr) { | |
private companion object Params { | |
private const val STIFFNESS = SpringForce.STIFFNESS_MEDIUM | |
private const val DAMPING_RATIO = SpringForce.DAMPING_RATIO_HIGH_BOUNCY | |
} | |
private lateinit var xAnim: SpringAnimation | |
private lateinit var yAnim: SpringAnimation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpringRotationView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr) { | |
private companion object Params { | |
val INITIAL_ROTATION = 0f | |
val STIFFNESS = SpringForce.STIFFNESS_MEDIUM | |
val DAMPING_RATIO = SpringForce.DAMPING_RATIO_HIGH_BOUNCY | |
} | |
private val rotationAnim: SpringAnimation = SpringAnimation(this, SpringAnimation.ROTATION).apply { | |
spring = SpringForce(INITIAL_ROTATION).apply { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SpringScaleView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr) { | |
private companion object Params { | |
val INITIAL_SCALE = 1f | |
val STIFFNESS = SpringForce.STIFFNESS_MEDIUM | |
val DAMPING_RATIO = SpringForce.DAMPING_RATIO_HIGH_BOUNCY | |
} | |
private val xAnim: SpringAnimation = SpringAnimation(this, SpringAnimation.SCALE_X).apply { | |
spring = SpringForce(INITIAL_SCALE).apply { |
OlderNewer