From e608b4839d2775264a8632ffd7cf4cf2117d5622 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 23 Jul 2019 17:51:04 +0300 Subject: [PATCH 1/2] Fix button --- OsmAnd/res/layout/gpx_item_altitude.xml | 1 + OsmAnd/res/layout/gpx_item_general.xml | 1 + OsmAnd/res/layout/gpx_item_list_header.xml | 2 ++ OsmAnd/res/layout/gpx_item_speed.xml | 1 + .../plus/myplaces/TrackSegmentFragment.java | 15 ++++++--------- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index f0a2511519..98eefe504a 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -22,6 +22,7 @@ android:id="@+id/gpx_join_gaps_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:minHeight="@dimen/card_row_min_height" android:orientation="horizontal"> diff --git a/OsmAnd/res/layout/gpx_item_general.xml b/OsmAnd/res/layout/gpx_item_general.xml index f98049b06c..3ac0f8f529 100644 --- a/OsmAnd/res/layout/gpx_item_general.xml +++ b/OsmAnd/res/layout/gpx_item_general.xml @@ -22,6 +22,7 @@ android:id="@+id/gpx_join_gaps_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:minHeight="@dimen/card_row_min_height" android:orientation="horizontal"> diff --git a/OsmAnd/res/layout/gpx_item_list_header.xml b/OsmAnd/res/layout/gpx_item_list_header.xml index cf4990ba48..45e7da9cbb 100644 --- a/OsmAnd/res/layout/gpx_item_list_header.xml +++ b/OsmAnd/res/layout/gpx_item_list_header.xml @@ -53,8 +53,10 @@ android:background="?attr/bg_color"> diff --git a/OsmAnd/res/layout/gpx_item_speed.xml b/OsmAnd/res/layout/gpx_item_speed.xml index 4203be447c..bf5ff46f87 100644 --- a/OsmAnd/res/layout/gpx_item_speed.xml +++ b/OsmAnd/res/layout/gpx_item_speed.xml @@ -22,6 +22,7 @@ android:id="@+id/gpx_join_gaps_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:minHeight="@dimen/card_row_min_height" android:orientation="horizontal"> diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index fe907e54f8..d0c48c3eb4 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -716,11 +716,10 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit ((ImageView) view.findViewById(R.id.end_time_icon)) .setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_time_end)); - final SwitchCompat joinGapsSwitch = (SwitchCompat) view.findViewById(R.id.gpx_join_gaps_switch); - joinGapsSwitch.setOnClickListener(new View.OnClickListener() { + view.findViewById(R.id.gpx_join_gaps_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - joinGapsEnabled = joinGapsSwitch.isChecked(); + joinGapsEnabled = !joinGapsEnabled; for (int i = 0; i < getCount(); i++) { View view = getViewAtPosition(i); updateJoinGapsInfo(view, i); @@ -854,11 +853,10 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit ((TextView) view.findViewById(R.id.ascent_text)).setText(asc); ((TextView) view.findViewById(R.id.descent_text)).setText(desc); - final SwitchCompat joinGapsSwitch = (SwitchCompat) view.findViewById(R.id.gpx_join_gaps_switch); - joinGapsSwitch.setOnClickListener(new View.OnClickListener() { + view.findViewById(R.id.gpx_join_gaps_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - joinGapsEnabled = joinGapsSwitch.isChecked(); + joinGapsEnabled = !joinGapsEnabled; for (int i = 0; i < getCount(); i++) { View view = getViewAtPosition(i); updateJoinGapsInfo(view, i); @@ -961,11 +959,10 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit ((TextView) view.findViewById(R.id.average_text)).setText(avg); ((TextView) view.findViewById(R.id.max_text)).setText(max); - final SwitchCompat joinGapsSwitch = (SwitchCompat) view.findViewById(R.id.gpx_join_gaps_switch); - joinGapsSwitch.setOnClickListener(new View.OnClickListener() { + view.findViewById(R.id.gpx_join_gaps_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - joinGapsEnabled = joinGapsSwitch.isChecked(); + joinGapsEnabled = !joinGapsEnabled; for (int i = 0; i < getCount(); i++) { View view = getViewAtPosition(i); updateJoinGapsInfo(view, i); From f9c34e88cd6bb1b1a01ca20d1aed3ee258017d7b Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 23 Jul 2019 21:09:25 +0300 Subject: [PATCH 2/2] Make whole row with switch clickable --- OsmAnd/res/layout/gpx_item_altitude.xml | 4 ++++ OsmAnd/res/layout/gpx_item_general.xml | 4 ++++ OsmAnd/res/layout/gpx_item_list_header.xml | 4 ++++ OsmAnd/res/layout/gpx_item_speed.xml | 4 ++++ .../osmand/plus/myplaces/TrackActivityFragmentAdapter.java | 3 ++- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index 98eefe504a..884018d248 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -43,6 +43,10 @@ android:id="@+id/gpx_join_gaps_switch" android:layout_width="wrap_content" android:layout_height="match_parent" + android:background="@null" + android:clickable="false" + android:focusable="false" + android:focusableInTouchMode="false" android:paddingLeft="@dimen/content_padding" android:paddingRight="@dimen/content_padding" /> diff --git a/OsmAnd/res/layout/gpx_item_general.xml b/OsmAnd/res/layout/gpx_item_general.xml index 3ac0f8f529..b7894c13f9 100644 --- a/OsmAnd/res/layout/gpx_item_general.xml +++ b/OsmAnd/res/layout/gpx_item_general.xml @@ -43,6 +43,10 @@ android:id="@+id/gpx_join_gaps_switch" android:layout_width="wrap_content" android:layout_height="match_parent" + android:background="@null" + android:clickable="false" + android:focusable="false" + android:focusableInTouchMode="false" android:paddingLeft="@dimen/content_padding" android:paddingRight="@dimen/content_padding" /> diff --git a/OsmAnd/res/layout/gpx_item_list_header.xml b/OsmAnd/res/layout/gpx_item_list_header.xml index 45e7da9cbb..9070d8bcde 100644 --- a/OsmAnd/res/layout/gpx_item_list_header.xml +++ b/OsmAnd/res/layout/gpx_item_list_header.xml @@ -83,6 +83,10 @@ android:id="@+id/showOnMapToggle" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:background="@null" + android:clickable="false" + android:focusable="false" + android:focusableInTouchMode="false" android:paddingLeft="16dp" android:paddingRight="8dp"/> diff --git a/OsmAnd/res/layout/gpx_item_speed.xml b/OsmAnd/res/layout/gpx_item_speed.xml index bf5ff46f87..5969fe376d 100644 --- a/OsmAnd/res/layout/gpx_item_speed.xml +++ b/OsmAnd/res/layout/gpx_item_speed.xml @@ -43,6 +43,10 @@ android:id="@+id/gpx_join_gaps_switch" android:layout_width="wrap_content" android:layout_height="match_parent" + android:background="@null" + android:clickable="false" + android:focusable="false" + android:focusableInTouchMode="false" android:paddingLeft="@dimen/content_padding" android:paddingRight="@dimen/content_padding" /> diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java index e73eb6c94a..7633edc764 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackActivityFragmentAdapter.java @@ -321,9 +321,10 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener { } vis.setChecked(gpxFileSelected); - vis.setOnClickListener(new View.OnClickListener() { + headerView.findViewById(R.id.showOnMapContainer).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + vis.toggle(); if (!vis.isChecked()) { selectedSplitInterval = 0; }