Commit b32bcc6f authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Add a dialog to the navigation drawer to explain the latency

Implements #255
parent e53c18a9
......@@ -125,6 +125,13 @@ class MainActivity : NavigationDrawerActivity() {
update()
}
}
view.infoButton.setOnClickListener {
showInfoTextDialog(this,
getString(R.string.dialog_latency_sidebar_title),
getString(R.string.dialog_latency_sidebar_message),
)
}
networkManager.registerNetworkCallback(NetworkRequest.Builder().apply {
addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
}.build(), cardNetworkCallback!!)
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:padding="8dp"
android:layout_height="wrap_content">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp">
<ImageView
android:id="@+id/icon"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_launcher_flat"
android:layout_height="42dp"/>
android:src="@drawable/ic_launcher_flat" />
<ImageButton
android:id="@+id/infoButton"
style="?android:attr/borderlessButtonStyle"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:layout_marginEnd="4dp"
android:adjustViewBounds="true"
android:padding="8dp"
android:scaleType="centerInside"
android:src="@drawable/ic_info" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginLeft="12dp"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_toStartOf="@id/infoButton"
android:layout_toEndOf="@id/icon"
android:orientation="vertical">
<TextView
android:id="@+id/serverName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"
android:id="@+id/serverName"
android:layout_height="wrap_content"/>
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/latency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="- ms"
tools:ignore="HardcodedText"
android:layout_height="wrap_content"/>
tools:ignore="HardcodedText" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/dns1"
android:layout_height="wrap_content"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/dns2"
android:layout_height="wrap_content"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
......@@ -206,4 +206,8 @@
</string>
<string name="dialog_nonvpn_help_generic">To use Nebulo in non-vpn mode together with a third-party VPN app you have to change your DNS settings inside this other app.\nNot all VPN apps allow you to change the DNS settings. If yours does, simply set the DNS server to \'localhost:%1d\' or \'127.0.0.1:%2d\' (you can configure the port above).\n\nAfter configuring the apps simply start both.</string>
<string name="dialog_latency_sidebar_title">Information about latency</string>
<string name="dialog_latency_sidebar_message">The latency shown here is not your ping or how fast your network is.\n It shows how long it takes for Nebulo to send a request and get an answer from the DNS server. The displayed value is not always the most current one and fluctuations can be possible.\n This can cause the value to be displayed higher than it is because it has become lower since it was measured.</string>
</resources>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment