|
2 | 2 |
|
3 | 3 | import android.view.View; |
4 | 4 |
|
5 | | -import androidx.annotation.NonNull; |
6 | | -import androidx.recyclerview.widget.RecyclerView; |
7 | | - |
8 | 5 | import com.yuyakaido.android.cardstackview.CardStackLayoutManager; |
9 | 6 | import com.yuyakaido.android.cardstackview.CardStackListener; |
10 | 7 | import com.yuyakaido.android.cardstackview.RewindAnimationSetting; |
11 | 8 |
|
| 9 | +import androidx.annotation.NonNull; |
| 10 | +import androidx.recyclerview.widget.RecyclerView; |
| 11 | + |
12 | 12 | public class CardStackSmoothScroller extends RecyclerView.SmoothScroller { |
13 | 13 |
|
14 | 14 | public enum ScrollType { |
@@ -37,22 +37,6 @@ protected void onSeekTargetStep( |
37 | 37 | @NonNull Action action |
38 | 38 | ) { |
39 | 39 | if (type == ScrollType.AutomaticRewind) { |
40 | | - // ■ 概要 |
41 | | - // ここでViewのRemoveを行わないとRewindが無限ループに陥ってしまう |
42 | | - // ■ 再現手順 |
43 | | - // 1. `manager.removeAllViews();`をコメントアウト |
44 | | - // 2. AutomaticSwipeを1度実行する |
45 | | - // 3. AutomaticRewindを1度実行する |
46 | | - // 4. AutomaticSwipeを1度実行する |
47 | | - // 5. AutomaticRewindを1度実行する -> これが無限ループに陥ってしまう |
48 | | - // ■ 調査結果 |
49 | | - // SmoothScroller.onStartが呼ばれたタイミングでは、Rewind対象のViewが見つからない(正常挙動) |
50 | | - // Rewind処理開始後のupdateで対象のViewが追加されるはずだが、現状の実装では正常に追加されない |
51 | | - // 結果として、Rewind対象のViewが永遠に見つからずに無限ループに陥ってしまう |
52 | | - // ■ 副作用 |
53 | | - // ViewのRemoveを行っているため、表示対象となっているViewの再生成が実行されてしまう |
54 | | - // これによってパフォーマンス上の問題が発生する可能性がある |
55 | | - manager.removeAllViews(); |
56 | 40 | RewindAnimationSetting setting = manager.getCardStackSetting().rewindAnimationSetting; |
57 | 41 | action.update( |
58 | 42 | -getDx(setting), |
|
0 commit comments