-
Notifications
You must be signed in to change notification settings - Fork 2
/
scroll.sh
57 lines (37 loc) · 1.22 KB
/
scroll.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/tgui-bash
set -u
# Let the Activity start as a dialog
declare -A aparams=()
declare -a activity=()
tg_activity_new aparams activity
aid="${activity[0]}"
declare -A params=()
layout="$(tg_create_linear "$aid" params)"
# Create a Horizontal LinearLayout
params[$tgc_create_vertical]=false
bar="$(tg_create_linear "$aid" params "$layout")"
unset "params[$tgc_create_vertical]"
# Set the height no the minimum needed
tg_view_height "$aid" "$bar" "$tgc_view_wrap_content"
# Don't let it expand to unused space
tg_view_linear "$aid" "$bar" 0
# Create 2 Buttons in the bar
params[$tgc_create_text]="Bar button 1"
bt1="$(tg_create_button "$aid" params "$bar")"
params[$tgc_create_text]="Bar button 2"
bt2="$(tg_create_button "$aid" params "$bar")"
unset "params[$tgc_create_text]"
# Create a NestedScrollView and a LinearLayout in it
sc="$(tg_create_nested_scroll "$aid" params "$layout")"
scl="$(tg_create_linear "$aid" params "$sc")"
# Create Buttons in the NestedScrollView
for i in {1..30}; do
params[$tgc_create_text]="Button $i"
tg_create_button "$aid" params "$scl" >/dev/null
done
while true; do
ev="$(tg_msg_recv_event_blocking)"
if [ "$(tg_event_type "$ev")" = "$tgc_ev_destroy" ]; then
exit 0
fi
done