feat(network): socks5 proxy support (#530)

This commit is contained in:
Sadwhy 2024-11-19 22:22:13 +06:00 committed by GitHub
parent a4bd367f98
commit ff3372754a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 399 additions and 7 deletions

View file

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:id="@+id/proxyLayoutContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bottom_sheet_background">
<LinearLayout
android:id="@+id/proxyLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="32dp"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/proxyTitle"
android:layout_width="0dp"
android:layout_height="54dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:fontFamily="@font/poppins"
android:gravity="center_vertical"
android:text="@string/socks5"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="16dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/proxyHostLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="5"
android:layout_marginEnd="8dp"
android:hint="@string/host"
app:boxCornerRadiusBottomEnd="16dp"
app:boxCornerRadiusBottomStart="16dp"
app:boxCornerRadiusTopEnd="16dp"
app:boxCornerRadiusTopStart="16dp"
app:boxStrokeColor="@color/text_input_layout_stroke_color"
app:endIconMode="none"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/ic_round_dns_24">
<AutoCompleteTextView
android:id="@+id/proxyHost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:inputType="textUri"
android:padding="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
tools:ignore="LabelFor,TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/proxyPortLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="3"
android:hint="@string/port"
app:boxCornerRadiusBottomEnd="16dp"
app:boxCornerRadiusBottomStart="16dp"
app:boxCornerRadiusTopEnd="16dp"
app:boxCornerRadiusTopStart="16dp"
app:boxStrokeColor="@color/text_input_layout_stroke_color"
app:endIconMode="none"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/network_node_24">
<AutoCompleteTextView
android:id="@+id/proxyPort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:inputType="number"
android:padding="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
tools:ignore="LabelFor,TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/proxyAuthentication"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:layout_marginTop="10dp"
android:text="@string/authentication" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/proxyUsernameLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginTop="10dp"
android:hint="@string/username"
android:enabled="false"
app:boxCornerRadiusBottomEnd="16dp"
app:boxCornerRadiusBottomStart="16dp"
app:boxCornerRadiusTopEnd="16dp"
app:boxCornerRadiusTopStart="16dp"
app:boxStrokeColor="@color/text_input_layout_stroke_color"
app:endIconMode="none"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/ic_round_person_24">
<AutoCompleteTextView
android:id="@+id/proxyUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:inputType="text"
android:padding="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
android:enabled="false"
tools:ignore="LabelFor,TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/proxyPasswordLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginTop="16dp"
android:hint="@string/password"
android:enabled="false"
app:boxCornerRadiusBottomEnd="16dp"
app:boxCornerRadiusBottomStart="16dp"
app:boxCornerRadiusTopEnd="16dp"
app:boxCornerRadiusTopStart="16dp"
app:boxStrokeColor="@color/text_input_layout_stroke_color"
app:endIconMode="password_toggle"
app:hintAnimationEnabled="true"
app:startIconDrawable="@drawable/vpn_key_24">
<AutoCompleteTextView
android:id="@+id/proxyPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
android:enabled="false"
tools:ignore="LabelFor,TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<Button
android:id="@+id/proxySave"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="56dp"
android:fontFamily="@font/poppins_bold"
android:insetTop="0dp"
android:insetBottom="0dp"
android:padding="8dp"
android:text="@string/save"
android:textSize="16sp"
app:cornerRadius="16dp"
app:strokeColor="?attr/colorPrimaryContainer" />
</LinearLayout>
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="32dp"
android:layout_height="4dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="14dp"
app:cardBackgroundColor="?attr/colorPrimary"
app:cardCornerRadius="2dp"
app:cardElevation="0dp" />
</FrameLayout>