Skip to content

Commit e14e531

Browse files
2dustAnGgIt886
authored andcommitted
Optimize layout Histeria2
1 parent d31085a commit e14e531

File tree

5 files changed

+87
-16
lines changed

5 files changed

+87
-16
lines changed

app/src/main/kotlin/com/neko/v2ray/ui/ServerActivity.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ class ServerActivity : BaseActivity() {
108108
private val sp_security: Spinner? by lazy { findViewById(R.id.sp_security) }
109109
private val sp_stream_security: Spinner? by lazy { findViewById(R.id.sp_stream_security) }
110110
private val sp_allow_insecure: Spinner? by lazy { findViewById(R.id.sp_allow_insecure) }
111-
private val container_allow_insecure: LinearLayout? by lazy { findViewById(R.id.l5) }
111+
private val container_allow_insecure: LinearLayout? by lazy { findViewById(R.id.lay_allow_insecure) }
112112
private val et_sni: EditText? by lazy { findViewById(R.id.et_sni) }
113-
private val container_sni: LinearLayout? by lazy { findViewById(R.id.l2) }
113+
private val container_sni: LinearLayout? by lazy { findViewById(R.id.lay_sni) }
114114
private val sp_stream_fingerprint: Spinner? by lazy { findViewById(R.id.sp_stream_fingerprint) } //uTLS
115-
private val container_fingerprint: LinearLayout? by lazy { findViewById(R.id.l3) }
115+
private val container_fingerprint: LinearLayout? by lazy { findViewById(R.id.lay_stream_fingerprint) }
116116
private val sp_network: Spinner? by lazy { findViewById(R.id.sp_network) }
117117
private val sp_header_type: Spinner? by lazy { findViewById(R.id.sp_header_type) }
118118
private val sp_header_type_title: TextView? by lazy { findViewById(R.id.sp_header_type_title) }
@@ -121,13 +121,13 @@ class ServerActivity : BaseActivity() {
121121
private val tv_path: TextInputLayout? by lazy { findViewById(R.id.tv_path) }
122122
private val et_path: EditText? by lazy { findViewById(R.id.et_path) }
123123
private val sp_stream_alpn: Spinner? by lazy { findViewById(R.id.sp_stream_alpn) } //uTLS
124-
private val container_alpn: LinearLayout? by lazy { findViewById(R.id.l4) }
124+
private val container_alpn: LinearLayout? by lazy { findViewById(R.id.lay_stream_alpn) }
125125
private val et_public_key: EditText? by lazy { findViewById(R.id.et_public_key) }
126-
private val container_public_key: LinearLayout? by lazy { findViewById(R.id.l6) }
126+
private val container_public_key: LinearLayout? by lazy { findViewById(R.id.lay_public_key) }
127127
private val et_short_id: EditText? by lazy { findViewById(R.id.et_short_id) }
128-
private val container_short_id: LinearLayout? by lazy { findViewById(R.id.l7) }
128+
private val container_short_id: LinearLayout? by lazy { findViewById(R.id.lay_short_id) }
129129
private val et_spider_x: EditText? by lazy { findViewById(R.id.et_spider_x) }
130-
private val container_spider_x: LinearLayout? by lazy { findViewById(R.id.l8) }
130+
private val container_spider_x: LinearLayout? by lazy { findViewById(R.id.lay_spider_x) }
131131
private val et_reserved1: EditText? by lazy { findViewById(R.id.et_reserved1) }
132132
private val et_reserved2: EditText? by lazy { findViewById(R.id.et_reserved2) }
133133
private val et_reserved3: EditText? by lazy { findViewById(R.id.et_reserved3) }

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
android:inputType="text" />
295295
</com.google.android.material.textfield.TextInputLayout>
296296
</LinearLayout>
297-
<include layout="@layout/layout_tls" />
297+
<include layout="@layout/layout_tls_hysteria2" />
298298
</LinearLayout>
299299
</LinearLayout>
300300
</androidx.core.widget.NestedScrollView>

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:android="http://schemas.android.com/apk/res/android">
77
<LinearLayout
88
android:orientation="vertical"
9-
android:id="@+id/l1"
9+
android:id="@+id/lay_stream_security"
1010
android:layout_width="match_parent"
1111
android:layout_height="wrap_content"
1212
android:layout_marginTop="8.0dip"
@@ -28,7 +28,7 @@
2828
</LinearLayout>
2929
<LinearLayout
3030
android:orientation="vertical"
31-
android:id="@+id/l2"
31+
android:id="@+id/lay_sni"
3232
android:layout_width="match_parent"
3333
android:layout_height="wrap_content"
3434
android:layout_marginTop="0.0dip"
@@ -48,7 +48,7 @@
4848
</LinearLayout>
4949
<LinearLayout
5050
android:orientation="vertical"
51-
android:id="@+id/l3"
51+
android:id="@+id/lay_stream_fingerprint"
5252
android:layout_width="match_parent"
5353
android:layout_height="wrap_content"
5454
android:layout_marginTop="8.0dip"
@@ -70,7 +70,7 @@
7070
</LinearLayout>
7171
<LinearLayout
7272
android:orientation="vertical"
73-
android:id="@+id/l4"
73+
android:id="@+id/lay_stream_alpn"
7474
android:layout_width="match_parent"
7575
android:layout_height="wrap_content"
7676
android:layout_marginTop="8.0dip"
@@ -92,7 +92,7 @@
9292
</LinearLayout>
9393
<LinearLayout
9494
android:orientation="vertical"
95-
android:id="@+id/l5"
95+
android:id="@+id/lay_allow_insecure"
9696
android:layout_width="match_parent"
9797
android:layout_height="wrap_content"
9898
android:layout_marginTop="8.0dip"
@@ -113,7 +113,7 @@
113113
</LinearLayout>
114114
<LinearLayout
115115
android:orientation="vertical"
116-
android:id="@+id/l6"
116+
android:id="@+id/lay_public_key"
117117
android:layout_width="match_parent"
118118
android:layout_height="wrap_content"
119119
android:layout_marginTop="8.0dip"
@@ -133,7 +133,7 @@
133133
</LinearLayout>
134134
<LinearLayout
135135
android:orientation="vertical"
136-
android:id="@+id/l7"
136+
android:id="@+id/lay_short_id"
137137
android:layout_width="match_parent"
138138
android:layout_height="wrap_content"
139139
android:layout_marginTop="8.0dip"
@@ -153,7 +153,7 @@
153153
</LinearLayout>
154154
<LinearLayout
155155
android:orientation="vertical"
156-
android:id="@+id/l8"
156+
android:id="@+id/lay_spider_x"
157157
android:layout_width="match_parent"
158158
android:layout_height="wrap_content"
159159
android:layout_marginTop="8.0dip"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
android:orientation="vertical"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
xmlns:android="http://schemas.android.com/apk/res/android">
7+
<LinearLayout
8+
android:orientation="vertical"
9+
android:id="@+id/lay_stream_security"
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:layout_marginTop="8.0dip"
13+
android:layout_marginBottom="16.0dip">
14+
<TextView
15+
android:layout_width="wrap_content"
16+
android:layout_height="wrap_content"
17+
android:text="@string/server_lab_stream_security" />
18+
<Spinner
19+
android:entries="@array/streamsecuritys"
20+
android:id="@+id/sp_stream_security"
21+
android:background="@drawable/uwu_bg_spinner"
22+
android:focusable="true"
23+
android:nextFocusDown="@+id/et_sni"
24+
android:clickable="true"
25+
android:layout_width="match_parent"
26+
android:layout_height="@dimen/edit_height"
27+
android:foreground="?android:selectableItemBackground" />
28+
</LinearLayout>
29+
<LinearLayout
30+
android:orientation="vertical"
31+
android:id="@+id/lay_sni"
32+
android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:layout_marginTop="0.0dip"
35+
android:layout_marginBottom="8.0dip">
36+
<com.google.android.material.textfield.TextInputLayout
37+
android:layout_width="match_parent"
38+
android:layout_height="wrap_content"
39+
android:hint="@string/server_lab_sni"
40+
style="@style/Outline_TextInputLayout">
41+
<com.google.android.material.textfield.TextInputEditText
42+
android:id="@+id/et_sni"
43+
android:nextFocusDown="@+id/sp_stream_fingerprint"
44+
android:layout_width="match_parent"
45+
android:layout_height="wrap_content"
46+
android:inputType="text" />
47+
</com.google.android.material.textfield.TextInputLayout>
48+
</LinearLayout>
49+
<LinearLayout
50+
android:orientation="vertical"
51+
android:id="@+id/lay_allow_insecure"
52+
android:layout_width="match_parent"
53+
android:layout_height="wrap_content"
54+
android:layout_marginTop="8.0dip"
55+
android:layout_marginBottom="16.0dip">
56+
<TextView
57+
android:layout_width="wrap_content"
58+
android:layout_height="wrap_content"
59+
android:text="@string/server_lab_allow_insecure" />
60+
<Spinner
61+
android:entries="@array/allowinsecures"
62+
android:id="@+id/sp_allow_insecure"
63+
android:background="@drawable/uwu_bg_spinner"
64+
android:focusable="true"
65+
android:clickable="true"
66+
android:layout_width="match_parent"
67+
android:layout_height="@dimen/edit_height"
68+
android:foreground="?android:selectableItemBackground" />
69+
</LinearLayout>
70+
</LinearLayout>

app/src/main/res/values/resource.xml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<item></item>
7575
<item>tls</item>
7676
</string-array>
77+
7778
<string-array name="streamsecurityxs" translatable="false">
7879
<item></item>
7980
<item>tls</item>

0 commit comments

Comments
 (0)