summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorRevath S Kumar <rsk@revathskumar.com>2019-05-19 14:10:48 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-05 21:07:50 +0200
commite9e4fd4e8b244748ca7052f0026fe4db43b46c8f (patch)
tree35fdca94a545b9dd409a7164e568f6c4ceec0ca4 /app
parentb5d9fbf1f43cc031d99f8654495f7aff7f80d381 (diff)
TunnelList: Get focus to toggle button via remote for Fire TV
This removes a no-longer-needed workaround for the ListView OnItemClickListener (it won't fire if a focusable view is inside the item view). Since converting our ListView instances to RecyclerView instances, we set the OnClick and OnLongClick listeners directly on the item view, and this workaround no longer has any effect. Unsurprisingly, the workaround breaks focusability of the Switch, which is necessary to toggle tunnels on devices with keypad-based navigation, such as the Fire TV. This commit also adds explicit focusability hints for the Switch. Related mail thread: https://lists.zx2c4.com/pipermail/wireguard/2019-May/004112.html Reported-by: Christophe-Marie Duquesne <chmd@chmd.fr> Reported-by: Revath S Kumar <gmail@revathskumar.com> [Samuel: sorted attributes; expanded commit message] Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/res/layout/tunnel_list_item.xml6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/res/layout/tunnel_list_item.xml b/app/src/main/res/layout/tunnel_list_item.xml
index cf25b83e..13e14fed 100644
--- a/app/src/main/res/layout/tunnel_list_item.xml
+++ b/app/src/main/res/layout/tunnel_list_item.xml
@@ -26,10 +26,13 @@
</data>
<com.wireguard.android.widget.MultiselectableRelativeLayout
+ android:id="@+id/tunnel_list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_item_background"
- android:descendantFocusability="blocksDescendants"
+ android:descendantFocusability="beforeDescendants"
+ android:focusable="true"
+ android:nextFocusRight="@+id/tunnel_switch"
android:padding="16dp">
<TextView
@@ -49,6 +52,7 @@
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tunnel_name"
android:layout_alignParentEnd="true"
+ android:nextFocusLeft="@+id/tunnel_list_item"
app:checked="@{item.state == State.UP}"
app:onBeforeCheckedChanged="@{fragment::setTunnelState}" />
</com.wireguard.android.widget.MultiselectableRelativeLayout>