Skip to content

Commit

Permalink
Merge pull request #300 from yuhan6665/master
Browse files Browse the repository at this point in the history
Fix UI touch issues for Android TV
  • Loading branch information
2dust committed Apr 12, 2020
2 parents 3ea04c0 + 0ec1143 commit c105d84
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 20 deletions.
10 changes: 10 additions & 0 deletions V2rayNG/app/src/main/res/drawable/background_test_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@color/secondary_text" />
<item android:state_focused="true"
android:drawable="@color/secondary_text" />
<item android:state_hovered="true"
android:drawable="@color/secondary_text" />
<item android:drawable="@color/colorPrimary_text" />
</selector>
8 changes: 6 additions & 2 deletions V2rayNG/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@
android:id="@+id/layout_test"
android:layout_width="match_parent"
android:layout_height="@dimen/connection_test_height"
android:background="@color/colorPrimary_text"
android:gravity="center|left">
android:background="@drawable/background_test_button"
android:gravity="center|left"
android:clickable="true"
android:focusable="true">

<TextView
android:id="@+id/tv_test_state"
Expand Down Expand Up @@ -92,6 +94,8 @@
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:src="@drawable/ic_v_idle"
android:clickable="true"
android:focusable="true"
app:layout_anchorGravity="bottom|right|end" />

</com.github.jorgecastilloprz.FABProgressCircle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
android:gravity="center_vertical"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">

<android.support.v7.widget.AppCompatImageView
android:id="@+id/icon"
Expand Down Expand Up @@ -40,6 +43,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:paddingStart="2dp"
android:paddingLeft="2dp"
android:paddingEnd="6dp"
Expand Down
32 changes: 21 additions & 11 deletions V2rayNG/app/src/main/res/layout/item_recycler_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal"
card_view:cardCornerRadius="5dp">

<LinearLayout
Expand All @@ -21,7 +17,11 @@
android:layout_height="@dimen/server_height"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:nextFocusRight="@+id/layout_share">

<LinearLayout
android:layout_width="wrap_content"
Expand Down Expand Up @@ -111,10 +111,14 @@
<LinearLayout
android:id="@+id/layout_share"
android:layout_width="wrap_content"
android:layout_height="@dimen/server_height"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingEnd="@dimen/layout_margin_right_height">
android:padding="@dimen/layout_margin_spacing"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:nextFocusLeft="@+id/info_container">

<ImageView
android:layout_width="wrap_content"
Expand All @@ -126,10 +130,13 @@
<LinearLayout
android:id="@+id/layout_edit"
android:layout_width="wrap_content"
android:layout_height="@dimen/server_height"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingEnd="@dimen/layout_margin_right_height">
android:padding="@dimen/layout_margin_spacing"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">

<ImageView
android:layout_width="@dimen/png_height"
Expand All @@ -141,10 +148,13 @@
<LinearLayout
android:id="@+id/layout_remove"
android:layout_width="wrap_content"
android:layout_height="@dimen/server_height"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingEnd="@dimen/layout_margin_right_height">
android:padding="@dimen/layout_margin_spacing"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">

<ImageView
android:layout_width="@dimen/png_height"
Expand Down
21 changes: 15 additions & 6 deletions V2rayNG/app/src/main/res/layout/item_recycler_sub_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
android:gravity="center_vertical">

<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/item_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal"
card_view:cardCornerRadius="5dp">
card_view:cardCornerRadius="5dp"
android:nextFocusRight="@+id/layout_edit">

<LinearLayout
android:id="@+id/info_container"
Expand Down Expand Up @@ -62,11 +64,14 @@
<LinearLayout
android:id="@+id/layout_share"
android:layout_width="wrap_content"
android:layout_height="@dimen/server_height"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingEnd="@dimen/layout_margin_right_height"
android:visibility="invisible">
android:padding="@dimen/layout_margin_spacing"
android:visibility="invisible"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true">

<ImageView
android:layout_width="@dimen/png_height"
Expand All @@ -78,10 +83,14 @@
<LinearLayout
android:id="@+id/layout_edit"
android:layout_width="wrap_content"
android:layout_height="@dimen/server_height"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingEnd="@dimen/layout_margin_right_height">
android:padding="@dimen/layout_margin_spacing"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:nextFocusLeft="@+id/item_cardview">

<ImageView
android:layout_width="@dimen/png_height"
Expand Down
1 change: 1 addition & 0 deletions V2rayNG/app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<dimen name="bypass_list_header_height">50dp</dimen>
<dimen name="layout_margin_top_height">16dp</dimen>
<dimen name="layout_margin_right_height">16dp</dimen>
<dimen name="layout_margin_spacing">8dp</dimen>
<dimen name="edit_height">50dp</dimen>
<dimen name="png_height">24dp</dimen>
<dimen name="server_height">72dp</dimen>
Expand Down

0 comments on commit c105d84

Please sign in to comment.