mirror of
https://github.com/FatttSnake/OxygenToolbox.git
synced 2026-04-06 03:51:27 +08:00
Optimized FoldLayout: Set default status is hide.
This commit is contained in:
@@ -86,9 +86,11 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener {
|
|||||||
|
|
||||||
int contentHeight = content.getMeasuredHeight();
|
int contentHeight = content.getMeasuredHeight();
|
||||||
if (!init) {
|
if (!init) {
|
||||||
|
LayoutParams layoutParams = (LayoutParams) content.getLayoutParams();
|
||||||
|
layoutParams.height = 0;
|
||||||
|
content.setLayoutParams(layoutParams);
|
||||||
showAnimator = ValueAnimator.ofInt(0, contentHeight);
|
showAnimator = ValueAnimator.ofInt(0, contentHeight);
|
||||||
showAnimator.addUpdateListener(animation -> {
|
showAnimator.addUpdateListener(animation -> {
|
||||||
LayoutParams layoutParams = (LayoutParams) content.getLayoutParams();
|
|
||||||
layoutParams.height = (int) animation.getAnimatedValue();
|
layoutParams.height = (int) animation.getAnimatedValue();
|
||||||
content.setLayoutParams(layoutParams);
|
content.setLayoutParams(layoutParams);
|
||||||
});
|
});
|
||||||
@@ -103,7 +105,6 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener {
|
|||||||
|
|
||||||
hideAnimator = ValueAnimator.ofInt(contentHeight, 0);
|
hideAnimator = ValueAnimator.ofInt(contentHeight, 0);
|
||||||
hideAnimator.addUpdateListener(animation -> {
|
hideAnimator.addUpdateListener(animation -> {
|
||||||
LayoutParams layoutParams = (LayoutParams) content.getLayoutParams();
|
|
||||||
layoutParams.height = (int) animation.getAnimatedValue();
|
layoutParams.height = (int) animation.getAnimatedValue();
|
||||||
content.setLayoutParams(layoutParams);
|
content.setLayoutParams(layoutParams);
|
||||||
});
|
});
|
||||||
@@ -119,8 +120,6 @@ public class FoldLayout extends LinearLayout implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
init = true;
|
init = true;
|
||||||
|
|
||||||
showItem();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user