Skip to content

Commit

Permalink
Make entire right side of list item tappable
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed Dec 3, 2019
1 parent 25f5840 commit 9cf5a01
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public FormListAdapter(

@Override public void bindView(View view, Context context, Cursor cursor) {
super.bindView(view, context, cursor);
View mapButton = view.findViewById(R.id.map_button);
if (mapButton != null) {
View mapView = view.findViewById(R.id.map_view);
if (mapView != null) {
long id = cursor.getLong(cursor.getColumnIndex("_id"));
mapButton.setOnClickListener(v -> mapButtonListener.onItemClick(
mapView.setOnClickListener(v -> mapButtonListener.onItemClick(
listView, view, cursor.getPosition(), id));
}
}
Expand Down
18 changes: 16 additions & 2 deletions collect_app/src/main/res/layout/form_chooser_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:padding="@dimen/margin_standard">

<!-- Material Design reference: https://material.io/design/components/lists.html#specs -->
Expand All @@ -16,6 +17,7 @@
</FrameLayout>

<FrameLayout
android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/imageView"
Expand All @@ -35,11 +37,23 @@
<FrameLayout
android:id="@+id/map_view"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="0dp"

android:layout_alignParentTop="true"
android:layout_alignBottom="@id/text_view"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true">
android:layout_alignParentRight="true"

android:layout_marginRight="-16dp"
android:layout_marginStart="-16dp"
android:layout_marginLeft="-16dp"
android:layout_marginEnd="-16dp"
android:layout_marginTop="-16dp"
android:layout_marginBottom="-16dp"

android:padding="@dimen/margin_standard">

<include layout="@layout/form_chooser_list_item_map_button" />
</FrameLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
android:background="?selectableItemBackground"
android:focusable="false"
android:clickable="false"
android:layout_width="40sp"
android:layout_height="40sp"
android:insetLeft="0sp"
Expand Down

0 comments on commit 9cf5a01

Please sign in to comment.