mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Use a single click target that covers all transport indicators.
This commit is contained in:
@@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
@@ -147,7 +148,8 @@ public class NavDrawerActivity extends BriarActivity implements
|
|||||||
drawerLayout = findViewById(R.id.drawer_layout);
|
drawerLayout = findViewById(R.id.drawer_layout);
|
||||||
navigation = findViewById(R.id.navigation);
|
navigation = findViewById(R.id.navigation);
|
||||||
GridView transportsView = findViewById(R.id.transportsView);
|
GridView transportsView = findViewById(R.id.transportsView);
|
||||||
transportsView.setOnItemClickListener((parent, view, position, id) -> {
|
LinearLayout transportsLayout = findViewById(R.id.transports);
|
||||||
|
transportsLayout.setOnClickListener(v -> {
|
||||||
LOG.info("Starting transports activity");
|
LOG.info("Starting transports activity");
|
||||||
startActivity(new Intent(this, TransportsActivity.class));
|
startActivity(new Intent(this, TransportsActivity.class));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package org.briarproject.briar.android.widget;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
@NotNullByDefault
|
||||||
|
public class TouchInterceptingLinearLayout extends LinearLayout {
|
||||||
|
|
||||||
|
public TouchInterceptingLinearLayout(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TouchInterceptingLinearLayout(Context context,
|
||||||
|
@Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TouchInterceptingLinearLayout(Context context,
|
||||||
|
@Nullable AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(21)
|
||||||
|
public TouchInterceptingLinearLayout(Context context, AttributeSet attrs,
|
||||||
|
int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||||
|
onTouchEvent(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<org.briarproject.briar.android.widget.TouchInterceptingLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:showIn="@layout/navigation_menu">
|
tools:showIn="@layout/navigation_menu">
|
||||||
|
|
||||||
@@ -12,7 +13,8 @@
|
|||||||
android:id="@+id/transportsView"
|
android:id="@+id/transportsView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:listSelector="@android:color/transparent"
|
||||||
android:numColumns="3"
|
android:numColumns="3"
|
||||||
tools:listitem="@layout/list_item_transport" />
|
tools:listitem="@layout/list_item_transport" />
|
||||||
|
|
||||||
</LinearLayout>
|
</org.briarproject.briar.android.widget.TouchInterceptingLinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user