Skip to content

Commit add6f75

Browse files
committed
adjust layout
1 parent 0c7da41 commit add6f75

File tree

5 files changed

+149
-106
lines changed

5 files changed

+149
-106
lines changed

app/src/main/java/com/example/sql_inject_demo/MainActivity.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import android.content.DialogInterface;
88
import android.content.Intent;
99
import android.os.Bundle;
10+
import android.view.KeyEvent;
1011
import android.view.View;
12+
import android.view.inputmethod.EditorInfo;
1113
import android.widget.Button;
1214
import android.widget.EditText;
1315
import android.widget.Switch;
16+
import android.widget.TextView;
1417

1518
import java.text.DateFormat;
1619
import java.text.SimpleDateFormat;
@@ -33,10 +36,36 @@ protected void onCreate(Bundle savedInstanceState) {
3336
usernameInput = findViewById(R.id.usernameInput);
3437
passwordInput = findViewById(R.id.passwordInput);
3538
safeSwitch = findViewById(R.id.safeSwitch);
39+
// passwordInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
40+
// @Override
41+
// public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
42+
// if (actionId== EditorInfo.IME_ACTION_DONE){
43+
// signOnClick(v);
44+
// return true;
45+
// }
46+
// return false;
47+
// }
48+
// });
49+
passwordInput.setOnKeyListener(new View.OnKeyListener() {
50+
@Override
51+
public boolean onKey(View v, int keyCode, KeyEvent event) {
52+
if(event.getAction()== KeyEvent.ACTION_DOWN)
53+
{
54+
switch (keyCode)
55+
{
56+
case KeyEvent.KEYCODE_DPAD_CENTER:
57+
case KeyEvent.KEYCODE_ENTER:
58+
signOnClick(v);
59+
return true;
60+
default:
61+
break;
62+
}
63+
}
64+
return false;
65+
}
66+
});
3667
}
3768

38-
;
39-
4069
public void signOnClick(View view) {
4170
String username = usernameInput.getText().toString();
4271
String password = passwordInput.getText().toString();

app/src/main/res/layout/activity_all_employee.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<androidx.recyclerview.widget.RecyclerView
1010
android:id="@+id/recycleViewer"
11-
android:layout_width="wrap_content"
11+
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
1313
app:fastScrollEnabled="false"
1414
app:layout_constraintStart_toStartOf="parent"

app/src/main/res/layout/activity_data_viewer.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@
1515
android:shadowColor="#CC000000"
1616
android:shadowDy="40"
1717
android:shadowRadius="100"
18-
app:layout_constraintTop_toTopOf="parent">
18+
app:layout_constraintStart_toStartOf="parent"
19+
app:layout_constraintTop_toTopOf="parent"
20+
21+
>
1922

2023
<androidx.cardview.widget.CardView
2124
android:layout_width="match_parent"
2225
android:layout_height="wrap_content"
23-
android:layout_marginTop="8dp"
24-
android:layout_marginBottom="8dp"
2526
android:layout_marginStart="4dp"
27+
android:layout_marginTop="8dp"
2628
android:layout_marginEnd="4dp"
29+
android:layout_marginBottom="8dp"
2730
android:padding="5dp">
2831

2932

@@ -51,7 +54,8 @@
5154
android:gravity="center"
5255
android:text="ID"
5356
android:textColor="@color/purple_500"
54-
android:textStyle="bold" />
57+
android:textStyle="bold"
58+
app:layout_constraintTop_toTopOf="parent" />
5559

5660
<TextView
5761
android:id="@+id/ssnViewer"
@@ -61,6 +65,7 @@
6165
android:layout_marginTop="0dp"
6266
android:gravity="center_vertical"
6367
android:text="SSN"
68+
6469
android:textColor="@color/purple_200" />
6570

6671
<TextView
@@ -122,6 +127,7 @@
122127
android:layout_marginTop="120dp"
123128
android:gravity="center_vertical"
124129
android:text="Address" />
130+
125131
</androidx.cardview.widget.CardView>
126132
</LinearLayout>
127133

app/src/main/res/layout/activity_main.xml

Lines changed: 105 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -6,111 +6,119 @@
66
android:layout_height="match_parent"
77
tools:context=".MainActivity">
88

9-
<TableLayout
10-
android:layout_width="match_parent"
11-
android:layout_height="wrap_content"
12-
android:layout_marginTop="120dp"
13-
android:orientation="vertical"
14-
app:layout_constraintTop_toTopOf="parent">
159

10+
<TableLayout
11+
android:layout_width="match_parent"
12+
android:layout_height="wrap_content"
13+
android:layout_marginTop="120dp"
14+
android:orientation="vertical"
15+
app:layout_constraintTop_toTopOf="parent"
16+
app:layout_constraintStart_toEndOf="parent"
17+
android:stretchColumns="0">
1618

17-
<TableRow>
1819

19-
<com.google.android.material.textfield.TextInputLayout
20-
android:layout_width="match_parent"
21-
android:layout_height="wrap_content"
22-
android:layout_marginStart="65dp"
23-
android:layout_marginTop="20dp"
24-
android:layout_marginEnd="65dp"
20+
<TableRow>
2521

26-
android:hint="Username">
22+
<com.google.android.material.textfield.TextInputLayout
23+
android:layout_width="fill_parent"
24+
android:layout_height="wrap_content"
25+
android:layout_marginStart="65dp"
26+
android:layout_marginTop="20dp"
27+
android:layout_marginEnd="65dp"
28+
29+
android:hint="Username">
30+
31+
<com.google.android.material.textfield.TextInputEditText
32+
android:id="@+id/usernameInput"
33+
android:layout_width="match_parent"
34+
android:layout_height="wrap_content"
35+
36+
android:ems="15"
37+
android:inputType="text" />
38+
</com.google.android.material.textfield.TextInputLayout>
39+
</TableRow>
40+
41+
<TableRow>
2742

28-
<com.google.android.material.textfield.TextInputEditText
29-
android:id="@+id/usernameInput"
43+
<com.google.android.material.textfield.TextInputLayout
3044
android:layout_width="wrap_content"
3145
android:layout_height="wrap_content"
32-
android:ems="15"
33-
android:inputType="text" />
34-
</com.google.android.material.textfield.TextInputLayout>
35-
</TableRow>
36-
37-
<TableRow>
38-
39-
<com.google.android.material.textfield.TextInputLayout
40-
android:layout_width="match_parent"
41-
android:layout_height="wrap_content"
42-
android:layout_marginStart="65dp"
43-
android:layout_marginTop="20dp"
44-
android:layout_marginEnd="65dp"
45-
android:hint="Password"
46-
app:passwordToggleEnabled="true">
47-
48-
<com.google.android.material.textfield.TextInputEditText
49-
android:id="@+id/passwordInput"
46+
android:layout_marginStart="65dp"
47+
android:layout_marginTop="20dp"
48+
android:layout_marginEnd="65dp"
49+
android:hint="Password"
50+
app:passwordToggleEnabled="true">
51+
52+
<com.google.android.material.textfield.TextInputEditText
53+
android:id="@+id/passwordInput"
54+
android:layout_width="match_parent"
55+
android:layout_height="wrap_content"
56+
android:ems="15"
57+
android:inputType="textPassword" />
58+
</com.google.android.material.textfield.TextInputLayout>
59+
</TableRow>
60+
61+
<TableRow>
62+
63+
<Switch
64+
android:id="@+id/safeSwitch"
5065
android:layout_width="wrap_content"
5166
android:layout_height="wrap_content"
52-
android:ems="15"
53-
android:inputType="textPassword" />
54-
</com.google.android.material.textfield.TextInputLayout>
55-
</TableRow>
56-
57-
<TableRow>
58-
59-
<Switch
60-
android:id="@+id/safeSwitch"
61-
android:layout_width="wrap_content"
62-
android:layout_height="wrap_content"
63-
android:layout_marginStart="65dp"
64-
android:layout_marginTop="10dp"
65-
android:layout_marginEnd="65dp"
66-
android:clickable="true"
67-
android:fontFamily="sans-serif-medium"
68-
android:text="Safe Mode"
69-
android:textAllCaps="false"
70-
android:textSize="16sp"
71-
android:textStyle="italic" />
72-
</TableRow>
73-
74-
<TableRow>
75-
76-
<Button
77-
android:id="@+id/signinButton"
78-
android:layout_width="wrap_content"
79-
android:layout_height="wrap_content"
80-
android:layout_marginStart="65dp"
81-
android:layout_marginTop="10dp"
82-
android:layout_marginEnd="65dp"
83-
android:onClick="signOnClick"
84-
android:text="Sign in" />
85-
</TableRow>
86-
87-
<TableRow>
88-
89-
<Button
90-
android:id="@+id/resetButton"
91-
android:layout_width="wrap_content"
92-
android:layout_height="wrap_content"
93-
android:layout_marginStart="65dp"
94-
android:layout_marginTop="0dp"
95-
android:layout_marginEnd="65dp"
96-
android:onClick="resetOnClick"
97-
android:text="Reset" />
98-
</TableRow>
99-
100-
<TableRow>
101-
102-
<Button
103-
android:id="@+id/exitButton"
104-
android:layout_width="wrap_content"
105-
android:layout_height="wrap_content"
106-
android:layout_marginStart="65dp"
107-
android:layout_marginTop="0dp"
108-
android:layout_marginEnd="65dp"
109-
android:onClick="exitOnClick"
110-
android:text="Exit" />
111-
</TableRow>
112-
113-
114-
</TableLayout>
67+
android:layout_marginStart="65dp"
68+
android:layout_marginTop="10dp"
69+
android:layout_marginEnd="65dp"
70+
android:clickable="true"
71+
android:fontFamily="sans-serif-medium"
72+
android:text="Safe Mode"
73+
android:textAllCaps="false"
74+
android:textSize="16sp"
75+
android:textStyle="italic"
76+
tools:ignore="UseSwitchCompatOrMaterialXml"
77+
android:focusable="true" />
78+
</TableRow>
79+
80+
<TableRow>
81+
82+
<Button
83+
android:id="@+id/signinButton"
84+
android:layout_width="wrap_content"
85+
android:layout_height="wrap_content"
86+
android:layout_marginStart="65dp"
87+
android:layout_marginTop="10dp"
88+
android:layout_marginEnd="65dp"
89+
android:onClick="signOnClick"
90+
91+
android:text="Sign in" />
92+
</TableRow>
93+
94+
<TableRow>
95+
96+
<Button
97+
android:id="@+id/resetButton"
98+
android:layout_width="wrap_content"
99+
android:layout_height="wrap_content"
100+
android:layout_marginStart="65dp"
101+
android:layout_marginTop="0dp"
102+
android:layout_marginEnd="65dp"
103+
android:onClick="resetOnClick"
104+
android:text="Reset" />
105+
</TableRow>
106+
107+
<TableRow>
108+
109+
<Button
110+
android:id="@+id/exitButton"
111+
android:layout_width="wrap_content"
112+
android:layout_height="wrap_content"
113+
android:layout_marginStart="65dp"
114+
android:layout_marginTop="0dp"
115+
android:layout_marginEnd="65dp"
116+
android:onClick="exitOnClick"
117+
android:text="Exit" />
118+
</TableRow>
119+
120+
121+
</TableLayout>
122+
115123

116124
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/activity_result.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
android:id="@+id/nameInput"
4242
android:layout_width="match_parent"
4343
android:layout_height="wrap_content"
44-
android:inputType="text"
45-
android:ems="15" />
44+
android:ems="15"
45+
android:inputType="text" />
4646
</com.google.android.material.textfield.TextInputLayout>
4747

4848
</TableRow>

0 commit comments

Comments
 (0)