VPN Hotspot 2.0: Client+ (#39)

Fix #13, #38. I don't have a lot of confidence that this would work very well for every device.

Also here's an SQL command that hopefully somebody could make into the app for me: `SELECT TrafficRecord.mac, SUM(TrafficRecord.sentPackets), SUM(TrafficRecord.sentBytes), SUM(TrafficRecord.receivedPackets), SUM(TrafficRecord.receivedBytes) FROM TrafficRecord LEFT JOIN TrafficRecord AS Next ON TrafficRecord.id = Next.previousId WHERE Next.id IS NULL GROUP BY TrafficRecord.mac;`
This commit is contained in:
Mygod
2018-10-02 21:12:19 +08:00
committed by GitHub
parent 16d1eda0d4
commit 38f95a382e
35 changed files with 946 additions and 98 deletions

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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">
<EditText
android:id="@android:id/edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:importantForAutofill="no"
tools:text="Nick">
<requestFocus/>
</EditText>
</FrameLayout>

View File

@@ -11,6 +11,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:padding="16dp">
<ImageView
@@ -32,15 +34,15 @@
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{client.title}"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textIsSelectable="true"
android:textIsSelectable="@{client.record.nickname.length() == 0}"
tools:text="01:23:45:ab:cd:ef%p2p-p2p0-0"/>
<TextView
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{client.description}"
android:textIsSelectable="true"

View File

@@ -41,7 +41,7 @@
tools:text="wlan0"/>
<be.mygod.vpnhotspot.widget.AutoCollapseTextView
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{data.text}"
android:textIsSelectable="@{data.selectable}"

View File

@@ -44,7 +44,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
<be.mygod.vpnhotspot.widget.AutoCollapseTextView
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{data.addresses}"
android:textIsSelectable="true"

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/nickname"
android:title="@string/clients_popup_nickname"/>
<item android:id="@+id/block"
android:title="@string/clients_popup_block"/>
<item android:id="@+id/unblock"
android:title="@string/clients_popup_unblock"/>
<item android:id="@+id/stats"
android:title="@string/clients_popup_stats"/>
</menu>

View File

@@ -57,6 +57,22 @@
<string name="connected_state_valid">%s (已连上)</string>
<string name="connected_state_failed">%s (已断开)</string>
<string name="clients_popup_nickname">昵称…</string>
<string name="clients_popup_block">拉黑</string>
<string name="clients_popup_unblock">洗白</string>
<string name="clients_popup_stats">流量…</string>
<string name="clients_nickname_title">%s 的昵称</string>
<string name="clients_stats_title">%s 的流量</string>
<plurals name="clients_stats_message_1">
<item quantity="other">自 %2$s 以来连了 %1$s 次</item>
</plurals>
<plurals name="clients_stats_message_2">
<item quantity="other">上传 %1$s 个包,%2$s</item>
</plurals>
<plurals name="clients_stats_message_3">
<item quantity="other">下载 %1$s 个包,%2$s</item>
</plurals>
<string name="settings_upstream">上游</string>
<string name="settings_downstream">下游</string>
<string name="settings_service_masquerade">IP 掩蔽</string>

View File

@@ -61,6 +61,25 @@
<string name="connected_state_valid">%s (reachable)</string>
<string name="connected_state_failed">%s (lost)</string>
<string name="clients_popup_nickname">Nickname…</string>
<string name="clients_popup_block">Block</string>
<string name="clients_popup_unblock">Unblock</string>
<string name="clients_popup_stats">Stats…</string>
<string name="clients_nickname_title">Nickname for %s</string>
<string name="clients_stats_title">Stats for %s</string>
<plurals name="clients_stats_message_1">
<item quantity="one">Connected 1 time since %2$s</item>
<item quantity="other">Connected %1$s times since %2$s</item>
</plurals>
<plurals name="clients_stats_message_2">
<item quantity="one">Sent 1 packet, %2$s</item>
<item quantity="other">Sent %1$s packets, %2$s</item>
</plurals>
<plurals name="clients_stats_message_3">
<item quantity="one">Received 1 packet, %2$s</item>
<item quantity="other">Received %1$s packets, %2$s</item>
</plurals>
<string name="settings_upstream">Upstream</string>
<string name="settings_downstream">Downstream</string>
<string name="settings_service_masquerade">IP Masquerade</string>