增加TopView粘性展示
This commit is contained in:
@@ -83,6 +83,9 @@ public class TopViewAnimHelper {
|
||||
cameraMode = rootView.findViewById(R.id.module_ext_id_north);
|
||||
// 初始化默认隐藏导航
|
||||
hideNaviView();
|
||||
|
||||
showStickView();
|
||||
|
||||
}
|
||||
|
||||
private volatile boolean isTopViewOut = true;
|
||||
@@ -185,10 +188,32 @@ public class TopViewAnimHelper {
|
||||
}).start();
|
||||
}
|
||||
|
||||
private final List<MotionViewCache> stickViewCache = new ArrayList<>();
|
||||
|
||||
private void showStickView() {
|
||||
if (stickViewCache.isEmpty()) {
|
||||
return;
|
||||
} else if (stickViewCache.size() == 1) {
|
||||
MotionViewCache stickView = stickViewCache.remove(0);
|
||||
startTopInAnim(stickView.view, stickView.params, stickView.statusListener);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < stickViewCache.size() - 2; i++) {
|
||||
MotionViewCache stickView = stickViewCache.get(i);
|
||||
stickView.statusListener.beforeViewRemoveAnim(stickView.view);
|
||||
stickView.statusListener.onViewRemoved(stickView.view);
|
||||
}
|
||||
MotionViewCache stickView = stickViewCache.get(stickViewCache.size() - 1);
|
||||
stickViewCache.clear();
|
||||
startTopInAnim(stickView.view, stickView.params, stickView.statusListener);
|
||||
}
|
||||
|
||||
public void startTopInAnim(View view, ViewGroup.LayoutParams params,
|
||||
IMogoTopViewStatusListener statusListener) {
|
||||
|
||||
if (topMotionLayout == null) {
|
||||
// 增加黏性事件
|
||||
stickViewCache.add(new MotionViewCache(view, params, statusListener));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user