Added DNS configuration functionality.

This commit is contained in:
Revertron 2022-10-29 21:57:42 +02:00
parent 80fc552603
commit dd67347cd8
14 changed files with 369 additions and 25 deletions

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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=".DnsActivity">
<FrameLayout
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerPadding="4pt"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/pageTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8pt"
android:text="DNS"
android:textColor="?attr/textDefault"
android:textSize="24sp"
android:textStyle="bold" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageButton
android:id="@+id/addServerButton"
android:layout_width="16pt"
android:layout_height="16pt"
android:layout_marginTop="6pt"
android:layout_marginRight="8pt"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_baseline_add_circle_24" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/configuredDnsLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16pt"
android:layout_marginLeft="16pt"
android:layout_marginTop="8pt"
android:layout_marginEnd="8pt"
android:layout_marginRight="8pt"
android:layout_marginBottom="2pt"
android:alpha="0.7"
android:paddingRight="8pt"
android:text="DNS servers"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp" />
<TableLayout
android:id="@+id/configuredDnsTableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8pt"
android:layout_marginLeft="8pt"
android:layout_marginEnd="8pt"
android:layout_marginRight="8pt"
android:background="@drawable/rounded"
android:divider="#46878787"
android:dividerPadding="4pt"
android:paddingLeft="4pt"
android:paddingTop="2pt"
android:paddingRight="4pt"
android:paddingBottom="2pt"
android:showDividers="middle" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16pt"
android:layout_marginLeft="16pt"
android:layout_marginTop="4pt"
android:layout_marginEnd="8pt"
android:layout_marginRight="8pt"
android:layout_marginBottom="4pt"
android:alpha="0.7"
android:paddingRight="8pt"
android:text="Yggdrasil will use these DNS servers in VPN config when service starts. All your DNS requests will be resolved through them."
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
</LinearLayout>

View file

@ -94,7 +94,7 @@
android:layout_weight="2" />
<Switch
android:id="@+id/enableMulticastBeacon"
android:id="@+id/enableYggdrasil"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
@ -347,6 +347,50 @@
app:srcCompat="@drawable/ic_baseline_chevron_right_24" />
</TableRow>
<TableRow
android:id="@+id/dnsTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:paddingStart="4pt"
android:paddingTop="6pt"
android:paddingEnd="4pt"
android:paddingBottom="6pt">
<TextView
android:id="@+id/dnsLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DNS servers"
android:textColor="?attr/textDefault" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2" />
<TextView
android:id="@+id/dnsValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.5"
android:text="No servers"
android:textAlignment="textEnd" />
<ImageView
android:id="@+id/dnsChevron"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="2pt"
android:alpha="0.4"
android:cropToPadding="false"
android:scaleType="fitEnd"
android:scaleX="1.2"
android:scaleY="1.2"
app:srcCompat="@drawable/ic_baseline_chevron_right_24" />
</TableRow>
<TableRow
android:id="@+id/settingsTableRow"
android:layout_width="match_parent"
@ -426,12 +470,12 @@
android:layout_height="wrap_content"
android:layout_marginStart="16pt"
android:layout_marginLeft="16pt"
android:layout_marginTop="2pt"
android:layout_marginTop="4pt"
android:layout_marginEnd="8pt"
android:layout_marginRight="8pt"
android:alpha="0.7"
android:paddingRight="8pt"
android:text="You must re-enable Yggdrasil after modifying Peers or Settings to make any changes effective."
android:text="You must re-enable Yggdrasil after modifying Peers, DNS servers or Settings to make any changes effective."
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp" />

View file

@ -128,7 +128,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16pt"
android:layout_marginLeft="16pt"
android:layout_marginTop="2pt"
android:layout_marginTop="4pt"
android:layout_marginEnd="8pt"
android:layout_marginRight="8pt"
android:layout_marginBottom="4pt"
@ -237,7 +237,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16pt"
android:layout_marginLeft="16pt"
android:layout_marginTop="2pt"
android:layout_marginTop="4pt"
android:layout_marginEnd="8pt"
android:layout_marginRight="8pt"
android:alpha="0.7"

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10pt"
android:paddingTop="4pt"
android:paddingRight="10pt"
android:paddingBottom="4pt">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Enter the IP address of DNS server to add. It will be used by OS and all apps when Yggdrasil starts." />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/addDnsInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4pt"
android:lines="1"
android:hint="8.8.8.8 or 302:7991::53" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</FrameLayout>

View file

@ -27,6 +27,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4pt"
android:lines="1"
android:hint="tcp://address:port" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:id="@+id/tableRow"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -16,7 +15,7 @@
android:layout_marginBottom="12dp"
android:ellipsize="end"
android:singleLine="true"
android:text="TextView"
android:text=""
android:textColor="?attr/textDefault"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/deletePeerButton"