私はRippleForegroundRippleDrawable
(ソフトウェア レンダリング部分) の実装を読んでいますが、境界があるということは、リップルにマスクがあることを意味することを既に知っていました。
しかし、私はまだ実装のいくつかの点で混乱しています:
実装で「境界のある波紋には開始アニメーションがありません」と表示され、単純に開始アニメーションがスキップされたのはなぜですか? この場合、リップル アニメーションを開始するにはどうすればよいですか (ユーザーがタッチを離していないため、終了が発生しない場合)。
@Override protected Animator createSoftwareEnter(boolean fast) { // Bounded ripples don't have enter animations. if (mIsBounded) { return null; } ... }
実装が and に対してほぼ一定の値を選択したのはなぜですか(そして、それはなぜですか
random()
) ? でマスクされたビューがそのサイズよりも大きい場合、正しく機能しますか?mBoundedRadius
mTargetRadius
ColorDrawable
public RippleForeground(RippleDrawable owner, Rect bounds, float startingX, float startingY, boolean isBounded) { ... if (isBounded) { mBoundedRadius = MAX_BOUNDED_RADIUS * 0.9f + (float) (MAX_BOUNDED_RADIUS * Math.random() * 0.1); } ... } ... private void computeBoundedTargetValues() { ... mTargetRadius = mBoundedRadius; }