-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextScript
More file actions
executable file
·130 lines (114 loc) · 3.31 KB
/
textScript
File metadata and controls
executable file
·130 lines (114 loc) · 3.31 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
scroll=$1
name=$2
xml=activity_$name.xml
java=$name.java
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<android.support.constraint.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
xmlns:app=\"http://schemas.android.com/apk/res-auto\"
xmlns:tools=\"http://schemas.android.com/tools\"
android:layout_width=\"match_parent\"
android:layout_height=\"match_parent\"
tools:context=\".$name\"" > $xml
if [ "$scroll" = "-s" ]
then
echo ">
<ScrollView
android:id=\"@+id/scrollView2\"
android:layout_width=\"match_parent\"
android:layout_height=\"match_parent\"
android:layout_marginStart=\"8dp\"
android:layout_marginEnd=\"8dp\"
android:layout_marginTop=\"8dp\"
android:clipToPadding=\"true\"
app:layout_constraintEnd_toEndOf=\"parent\"
app:layout_constraintHorizontal_bias=\"0.0\"
app:layout_constraintStart_toStartOf=\"parent\"
app:layout_constraintTop_toTopOf=\"parent\">
<android.support.constraint.ConstraintLayout
android:id=\"@+id/layoutView\"
android:layout_width=\"match_parent\"
android:layout_height=\"wrap_content\"
android:onClick=\"screenTapped\">" >> $xml
else
echo "android:layout_marginStart=\"8dp\"
android:layout_marginTop=\"8dp\"
android:layout_marginEnd=\"8dp\"
android:clipToPadding=\"true\"
android:onClick=\"screenTapped\"
android:id=\"@+id/layoutView\">" >> $xml
fi
echo "package com.example.practice;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import com.example.practice.R;
import com.example.practice.Template;
public class $name extends Template {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_$name);
findViews((ViewGroup) findViewById(R.id.layoutView));
tapHelper();
}
public void screenTapped(View view)
{
tapHelper();
}
}" > $java
color="GhostWhite"
flag=0
imagevar=0
textvar=0
topid="parent"
sideid="parent"
bottomid="parent"
while read line
do
if [ "$line" = "b" ]
then
color="blueMask"
flag=1
elif [ "$line" = "r" ]
then
color="redMask"
flag=1
elif [ "$line" = "y" ]
then
color="yellowMask"
flag=1
elif [ "$line" = "w" ]
then
color="GhostWhite"
continue
fi
if [ $flag -eq 1 ]
then
echo "<ImageView
android:id=\"@+id/imageView$imagevar\"
android:layout_width=\"@dimen/mask_value\"
android:layout_height=\"@dimen/mask_value\"
android:layout_marginTop=\"8dp\"
android:visibility=\"visible\"" >> $xml
if [ $imagevar -eq 0 ]
then
echo "android:layout_marginStart=\"8dp\"
app:layout_constraintStart_toStartOf=\"parent\"
app:layout_constraintTop_toTopOf=\"parent\"" >> $xml
elif [ $imagevar % 2 -eq 0 ]
then
echo "android:layout_marginStart=\"8dp\"
app:layout_constraintStart_toStartOf=\"parent\"
app:layout_constraintTop_toBottomOf=\"$topid\"" >> $xml
else
echo "android:layout_marginEnd=\"8dp\"
app:layout_constraintEnd_toEndOf=\"parent\"
app:layout_constraintTop_toBottomOf=\"$topid\"" >> $xml
fi
topid="imageView$imagevar"
imagevar=$imagevar+1
flag=0
continue
fi
done