Support toggling hotspots in app
This is a just-for-fun feature. It probably doesn't work.
This commit is contained in:
62
mobile/src/main/res/layout/listitem_manage_tether.xml
Normal file
62
mobile/src/main/res/layout/listitem_manage_tether.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<data>
|
||||
<import type="be.mygod.vpnhotspot.TetheringFragment"/>
|
||||
<variable
|
||||
name="icon"
|
||||
type="Integer"/>
|
||||
<variable
|
||||
name="title"
|
||||
type="String"/>
|
||||
<variable
|
||||
name="tetherListener"
|
||||
type="TetheringFragment.TetherListener"/>
|
||||
<variable
|
||||
name="type"
|
||||
type="be.mygod.vpnhotspot.net.TetherType"/>
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:paddingStart="56dp"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@{safeUnbox(icon)}"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
tools:src="@drawable/ic_device_network_wifi"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@{title}"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
|
||||
tools:text="@string/tethering_manage_wifi"/>
|
||||
|
||||
<Switch
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:checked="@{tetherListener.isStarted(type, tetherListener.enabledTypes)}"
|
||||
android:clickable="false"
|
||||
android:ellipsize="end"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -21,18 +21,30 @@
|
||||
<string name="repeater_reset_credentials_failure">重置凭据失败(原因:%s)</string>
|
||||
|
||||
<string name="repeater_inactive">未打开</string>
|
||||
<string name="repeater_p2p_unavailable">Wi-Fi 直连不可用</string>
|
||||
<string name="repeater_p2p_unavailable">Wi\u2011Fi 直连不可用</string>
|
||||
<string name="repeater_create_group_failure">创建 P2P 群组失败(原因:%s)</string>
|
||||
<string name="repeater_remove_group_failure">关闭已有 P2P 群组失败(原因:%s)</string>
|
||||
<string name="repeater_remove_old_group_failure">关闭 P2P 群组失败(原因:%s)</string>
|
||||
|
||||
<string name="repeater_failure_reason_error">内部异常</string>
|
||||
<string name="repeater_failure_reason_p2p_unsupported">设备不支持 Wi-Fi 直连</string>
|
||||
<string name="repeater_failure_reason_p2p_unsupported">设备不支持 Wi\u2011Fi 直连</string>
|
||||
<string name="repeater_failure_reason_busy">系统忙</string>
|
||||
<string name="repeater_failure_reason_no_service_requests">未添加服务请求</string>
|
||||
<string name="repeater_failure_reason_unknown">未知 #%d</string>
|
||||
|
||||
<string name="tethering_manage">管理…</string>
|
||||
<!--
|
||||
Values copied from:
|
||||
* https://android.googlesource.com/platform/packages/apps/Settings/+/7686ef8/res/xml/tether_prefs.xml
|
||||
* https://android.googlesource.com/platform/packages/apps/Settings/+/b63de87/res/values-zh-rCN/strings.xml
|
||||
* @string/usb_tethering_button_text
|
||||
* @string/wifi_hotspot_checkbox_text
|
||||
* @string/bluetooth_tether_checkbox_text
|
||||
-->
|
||||
<string name="tethering_manage_usb">USB 网络共享</string>
|
||||
<string name="tethering_manage_wifi">WLAN 热点</string>
|
||||
<string name="tethering_manage_wifi_legacy">WLAN 热点 (旧 API)</string>
|
||||
<string name="tethering_manage_bluetooth">蓝牙网络共享</string>
|
||||
|
||||
<string name="connected_devices">已连接设备</string>
|
||||
<string name="connected_state_incomplete">%s (正在连接)</string>
|
||||
|
||||
@@ -23,18 +23,30 @@
|
||||
<string name="repeater_reset_credentials_failure">Failed to reset credentials (reason: %s)</string>
|
||||
|
||||
<string name="repeater_inactive">Service inactive</string>
|
||||
<string name="repeater_p2p_unavailable">Wi-Fi direct unavailable</string>
|
||||
<string name="repeater_p2p_unavailable">Wi\u2011Fi direct unavailable</string>
|
||||
<string name="repeater_create_group_failure">Failed to create P2P group (reason: %s)</string>
|
||||
<string name="repeater_remove_group_failure">Failed to remove P2P group (reason: %s)</string>
|
||||
<string name="repeater_remove_old_group_failure">Failed to remove old P2P group (reason: %s)</string>
|
||||
|
||||
<string name="repeater_failure_reason_error">internal error</string>
|
||||
<string name="repeater_failure_reason_p2p_unsupported">Wi-Fi direct unsupported</string>
|
||||
<string name="repeater_failure_reason_p2p_unsupported">Wi\u2011Fi direct unsupported</string>
|
||||
<string name="repeater_failure_reason_busy">framework is busy</string>
|
||||
<string name="repeater_failure_reason_no_service_requests">no service requests added</string>
|
||||
<string name="repeater_failure_reason_unknown">unknown #%d</string>
|
||||
|
||||
<string name="tethering_manage">Manage…</string>
|
||||
<!--
|
||||
Values copied from:
|
||||
* https://android.googlesource.com/platform/packages/apps/Settings/+/7686ef8/res/xml/tether_prefs.xml
|
||||
* https://android.googlesource.com/platform/packages/apps/Settings/+/e5ed810/res/values/strings.xml
|
||||
* @string/usb_tethering_button_text
|
||||
* @string/wifi_hotspot_checkbox_text
|
||||
* @string/bluetooth_tether_checkbox_text
|
||||
-->
|
||||
<string name="tethering_manage_usb">USB tethering</string>
|
||||
<string name="tethering_manage_wifi">Wi\u2011Fi hotspot</string>
|
||||
<string name="tethering_manage_wifi_legacy">Wi\u2011Fi hotspot (legacy)</string>
|
||||
<string name="tethering_manage_bluetooth">Bluetooth tethering</string>
|
||||
|
||||
<string name="connected_devices">Connected devices</string>
|
||||
<string name="connected_state_incomplete">%s (connecting)</string>
|
||||
|
||||
Reference in New Issue
Block a user