Clean code

This commit is contained in:
FongMi 2023-05-30 15:02:39 +08:00
parent d764885c7c
commit 125da5d91b
3 changed files with 8 additions and 8 deletions

View File

@ -34,18 +34,12 @@ public class Notice extends Spider {
} }
private void createView() { private void createView() {
createLayout();
createText(); createText();
createRoot();
setColor(); setColor();
hide(); hide();
} }
private void createLayout() {
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.TOP;
Utils.addView(view, params);
}
private void createText() { private void createText() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < 2; i++) sb.append(SPACE).append(text); for (int i = 0; i < 2; i++) sb.append(SPACE).append(text);
@ -59,6 +53,12 @@ public class Notice extends Spider {
view.startScroll(); view.startScroll();
} }
private void createRoot() {
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.TOP;
Utils.addView(view, params);
}
private void hide() { private void hide() {
Init.run(() -> Utils.removeView(view), time * 1000); Init.run(() -> Utils.removeView(view), time * 1000);
} }

Binary file not shown.

View File

@ -1 +1 @@
8d3f8cfed4f4ac1731da98acc255b189 73954c18f409c0cadb91e6a4aff10381