From 1b1e2452b3042fbabe4bffc44a58f12b3ab21e5c Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Thu, 29 Jan 2026 21:10:15 -0800 Subject: [PATCH 1/5] fix bug --- .../scouting_app/activities/MatchTally.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java index 33ea2e9..744daa3 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java @@ -943,7 +943,9 @@ private void initZoneButtons() { }); matchBinding.butCenterZone.setOnClickListener(view -> { - in_alliance_zone = false; + // For the Neutral Zone, we need to determine if the edge of the robot was touching the + // alliance zone. This will be done in the OnTouchListener. The other zones have no + // ambiguity so we'll do it in the OnClickListener for those. // If the match hasn't even started yet, just return if (Globals.CurrentMatchPhase.equals(Constants.Phases.NONE)) return; @@ -995,16 +997,38 @@ private void initZoneButtons() { }); matchBinding.butLeftZone.setOnTouchListener((view, motionEvent) -> { + // only handle DOWN actions + if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + tele_button_position_x = matchBinding.butLeftZone.getX(); tele_button_position_y = matchBinding.butLeftZone.getY(); matchBinding.FieldTouch.dispatchTouchEvent(motionEvent); return false; }); matchBinding.butCenterZone.setOnTouchListener((view, motionEvent) -> { + // only handle DOWN actions + if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + + // if the alliance zone is on the LEFT, check the left edge of the robot + in_alliance_zone = false; + if (((currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT)) + && team_alliance.substring(0, 1).equalsIgnoreCase("R")) + || ((currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) + && team_alliance.substring(0, 1).equalsIgnoreCase("B"))) { + if (motionEvent.getX() <= (matchBinding.textRobot.getWidth() / 2f)) + in_alliance_zone = true; + // otherwise the alliance zone is on the RIGHT, check the right edge of the robot + } else + if (motionEvent.getX() >= (matchBinding.butCenterZone.getWidth() - matchBinding.textRobot.getWidth() / 2f)) + in_alliance_zone = true; + tele_button_position_x = matchBinding.butCenterZone.getX(); tele_button_position_y = matchBinding.butCenterZone.getY(); matchBinding.FieldTouch.dispatchTouchEvent(motionEvent); return false; }); matchBinding.butRightZone.setOnTouchListener((view, motionEvent) -> { + // only handle DOWN actions + if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + tele_button_position_x = matchBinding.butRightZone.getX(); tele_button_position_y = matchBinding.butRightZone.getY(); matchBinding.FieldTouch.dispatchTouchEvent(motionEvent); From 5a5c1c4f28273bf50e617be907dfbe19a401a29a Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Thu, 29 Jan 2026 21:29:45 -0800 Subject: [PATCH 2/5] fixes --- .../scouting_app/activities/MatchTally.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java index 744daa3..6d0a6c6 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java @@ -225,8 +225,8 @@ else if (current_X_Absolute < matchBinding.butRightZone.getX()) matchBinding.butPickup.setVisibility(View.INVISIBLE); // Enable the climb button - matchBinding.butClimb.setEnabled(true); - matchBinding.butClimb.setClickable(true); + if (in_alliance_zone) matchBinding.butClimb.setEnabled(true); + if (in_alliance_zone) matchBinding.butClimb.setClickable(true); climb_button_pressed = false; // Certain actions can't be set from a non-UI thread (like within a TimerTask that runs on a @@ -916,11 +916,6 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { private void initZoneButtons() { // Set up an OnClick listener per button matchBinding.butLeftZone.setOnClickListener(view -> { - // We'll use the button click to determine if we should allow or disallow shooting / climbing but won't process - // anything else if we're not in Tele mode. - in_alliance_zone = ((currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT)) && team_alliance.substring(0, 1).equalsIgnoreCase("R")) || - ((currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) && team_alliance.substring(0, 1).equalsIgnoreCase("B")); - // If the match hasn't even started yet, just return if (Globals.CurrentMatchPhase.equals(Constants.Phases.NONE)) return; @@ -943,10 +938,6 @@ private void initZoneButtons() { }); matchBinding.butCenterZone.setOnClickListener(view -> { - // For the Neutral Zone, we need to determine if the edge of the robot was touching the - // alliance zone. This will be done in the OnTouchListener. The other zones have no - // ambiguity so we'll do it in the OnClickListener for those. - // If the match hasn't even started yet, just return if (Globals.CurrentMatchPhase.equals(Constants.Phases.NONE)) return; @@ -970,11 +961,6 @@ private void initZoneButtons() { }); matchBinding.butRightZone.setOnClickListener(view -> { - // We'll use the button click to determine if we should allow or disallow shooting / climbing but won't process - // anything else if we're not in Tele mode. - in_alliance_zone = ((!currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT)) || !team_alliance.substring(0, 1).equalsIgnoreCase("R")) && - ((!currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) || !team_alliance.substring(0, 1).equalsIgnoreCase("B")); - // If the match hasn't even started yet, just return if (Globals.CurrentMatchPhase.equals(Constants.Phases.NONE)) return; @@ -1000,6 +986,11 @@ private void initZoneButtons() { // only handle DOWN actions if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + // We'll use the button click to determine if we should allow or disallow shooting / climbing but won't process + // anything else if we're not in Tele mode. + in_alliance_zone = ((currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT)) && team_alliance.substring(0, 1).equalsIgnoreCase("R")) || + ((currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) && team_alliance.substring(0, 1).equalsIgnoreCase("B")); + tele_button_position_x = matchBinding.butLeftZone.getX(); tele_button_position_y = matchBinding.butLeftZone.getY(); matchBinding.FieldTouch.dispatchTouchEvent(motionEvent); @@ -1029,6 +1020,11 @@ private void initZoneButtons() { // only handle DOWN actions if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + // We'll use the button click to determine if we should allow or disallow shooting / climbing but won't process + // anything else if we're not in Tele mode. + in_alliance_zone = ((!currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT)) || !team_alliance.substring(0, 1).equalsIgnoreCase("R")) && + ((!currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) || !team_alliance.substring(0, 1).equalsIgnoreCase("B")); + tele_button_position_x = matchBinding.butRightZone.getX(); tele_button_position_y = matchBinding.butRightZone.getY(); matchBinding.FieldTouch.dispatchTouchEvent(motionEvent); From 13c392a71bec404e9804f375f72b269a90c6d8ae Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Thu, 29 Jan 2026 23:46:27 -0800 Subject: [PATCH 3/5] small fix --- .../java/com/team3663/scouting_app/activities/MatchTally.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java index 6d0a6c6..3c8e5fd 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java @@ -225,8 +225,8 @@ else if (current_X_Absolute < matchBinding.butRightZone.getX()) matchBinding.butPickup.setVisibility(View.INVISIBLE); // Enable the climb button - if (in_alliance_zone) matchBinding.butClimb.setEnabled(true); - if (in_alliance_zone) matchBinding.butClimb.setClickable(true); + matchBinding.butClimb.setEnabled(in_alliance_zone); + matchBinding.butClimb.setClickable(in_alliance_zone); climb_button_pressed = false; // Certain actions can't be set from a non-UI thread (like within a TimerTask that runs on a From d3ca65409307aa732d17182d51fa23752267f051 Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Fri, 30 Jan 2026 13:48:13 -0800 Subject: [PATCH 4/5] fixes #530 Fixes #530 so robot starting location avoids the hub. --- .../scouting_app/activities/MatchTally.java | 15 ++++++++++++--- .../team3663/scouting_app/config/Constants.java | 2 ++ app/src/main/res/layout/match_tally.xml | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java index 3c8e5fd..01fe6cf 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java @@ -785,6 +785,15 @@ private void setRobotLocation(float in_X, float in_Y) { starting_X_Absolute = Math.min(Math.max(in_X, matchBinding.FieldTouch.getWidth() * (100.0f - Constants.Match.START_LINE_X) / 100.0f - offset), matchBinding.FieldTouch.getWidth() * (100.0f - Constants.Match.START_LINE_X) / 100.0f + offset); } + // Ensure we aren't placing a robot where it can't be located - 2026 Season + if ((starting_Y_Absolute > Constants.Match.HUB_TOP_Y) && (starting_Y_Absolute < Constants.Match.HUB_BOTTOM_Y)) { + if ((blue_alliance && currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) || + (!blue_alliance && currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT))) + starting_X_Absolute = matchBinding.FieldTouch.getWidth() * Constants.Match.START_LINE_X / 100.0f - offset; + else + starting_X_Absolute = matchBinding.FieldTouch.getWidth() * (100.0f - Constants.Match.START_LINE_X) / 100.0f + offset; + } + // Save off the correct relative values based on the orientation if (currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT)) { starting_X_Relative = starting_X_Absolute; @@ -984,7 +993,7 @@ private void initZoneButtons() { matchBinding.butLeftZone.setOnTouchListener((view, motionEvent) -> { // only handle DOWN actions - if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + if (motionEvent.getAction() == MotionEvent.ACTION_UP) return false; // We'll use the button click to determine if we should allow or disallow shooting / climbing but won't process // anything else if we're not in Tele mode. @@ -997,7 +1006,7 @@ private void initZoneButtons() { return false; }); matchBinding.butCenterZone.setOnTouchListener((view, motionEvent) -> { // only handle DOWN actions - if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + if (motionEvent.getAction() == MotionEvent.ACTION_UP) return false; // if the alliance zone is on the LEFT, check the left edge of the robot in_alliance_zone = false; @@ -1018,7 +1027,7 @@ private void initZoneButtons() { return false; }); matchBinding.butRightZone.setOnTouchListener((view, motionEvent) -> { // only handle DOWN actions - if (motionEvent.getAction() != MotionEvent.ACTION_DOWN) return false; + if (motionEvent.getAction() == MotionEvent.ACTION_UP) return false; // We'll use the button click to determine if we should allow or disallow shooting / climbing but won't process // anything else if we're not in Tele mode. diff --git a/app/src/main/java/com/team3663/scouting_app/config/Constants.java b/app/src/main/java/com/team3663/scouting_app/config/Constants.java index ab3f459..e93287c 100644 --- a/app/src/main/java/com/team3663/scouting_app/config/Constants.java +++ b/app/src/main/java/com/team3663/scouting_app/config/Constants.java @@ -60,6 +60,8 @@ public static class Match { public static float START_LINE_X = 24.17f; public static final int TRANSITION_EVENT_DNE = -1; public static final int SEEKBAR_MAX = 60; + public static final int HUB_TOP_Y = 130; + public static final int HUB_BOTTOM_Y = 210; } public static class Data { diff --git a/app/src/main/res/layout/match_tally.xml b/app/src/main/res/layout/match_tally.xml index 3c909b5..b06a6d8 100644 --- a/app/src/main/res/layout/match_tally.xml +++ b/app/src/main/res/layout/match_tally.xml @@ -184,7 +184,7 @@ android:text="@string/button_climb" android:textSize="22sp" android:layout_gravity="center_vertical" - android:backgroundTint="@color/light_blue" + android:backgroundTint="@color/dark_green" app:cornerRadius="20dp"/> From 2e26e0a6c8167d3de43b5b192d42adca8ce3564b Mon Sep 17 00:00:00 2001 From: Jeff Stammler Date: Fri, 30 Jan 2026 15:01:20 -0800 Subject: [PATCH 5/5] need to use %age values for HUB to account for scaling issues --- app/build.gradle.kts | 2 +- .../java/com/team3663/scouting_app/activities/MatchTally.java | 2 +- .../main/java/com/team3663/scouting_app/config/Constants.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1fbe258..1c7614f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,7 +5,7 @@ plugins { var versionMajor = 3 var versionMinor = 0 -var versionPatch = 7 +var versionPatch = 9 android { namespace = "com.team3663.scouting_app" diff --git a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java index 01fe6cf..5b5bd5f 100644 --- a/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java +++ b/app/src/main/java/com/team3663/scouting_app/activities/MatchTally.java @@ -786,7 +786,7 @@ private void setRobotLocation(float in_X, float in_Y) { } // Ensure we aren't placing a robot where it can't be located - 2026 Season - if ((starting_Y_Absolute > Constants.Match.HUB_TOP_Y) && (starting_Y_Absolute < Constants.Match.HUB_BOTTOM_Y)) { + if ((starting_Y_Absolute > (Constants.Match.HUB_TOP_Y_PERCENT * matchBinding.FieldTouch.getHeight())) && (starting_Y_Absolute < (Constants.Match.HUB_BOTTOM_Y_PERCENT * matchBinding.FieldTouch.getHeight()))) { if ((blue_alliance && currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_BLUE_ON_LEFT)) || (!blue_alliance && currentAllianceOnLeft.equals(Constants.Match.ORIENTATION_RED_ON_LEFT))) starting_X_Absolute = matchBinding.FieldTouch.getWidth() * Constants.Match.START_LINE_X / 100.0f - offset; diff --git a/app/src/main/java/com/team3663/scouting_app/config/Constants.java b/app/src/main/java/com/team3663/scouting_app/config/Constants.java index e93287c..09acc13 100644 --- a/app/src/main/java/com/team3663/scouting_app/config/Constants.java +++ b/app/src/main/java/com/team3663/scouting_app/config/Constants.java @@ -60,8 +60,8 @@ public static class Match { public static float START_LINE_X = 24.17f; public static final int TRANSITION_EVENT_DNE = -1; public static final int SEEKBAR_MAX = 60; - public static final int HUB_TOP_Y = 130; - public static final int HUB_BOTTOM_Y = 210; + public static final float HUB_TOP_Y_PERCENT = 129f / 337f; + public static final float HUB_BOTTOM_Y_PERCENT = 208f / 337f; } public static class Data {