Skip to content

Add initial UI for NFC scanning#13299

Merged
samer-stripe merged 2 commits into
masterfrom
samer/nfc-initial-ui
Jun 30, 2026
Merged

Add initial UI for NFC scanning#13299
samer-stripe merged 2 commits into
masterfrom
samer/nfc-initial-ui

Conversation

@samer-stripe

@samer-stripe samer-stripe commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add initial UI for NFC scanning that renders the NFC coil and the cancel button on the screen based on the NFC antenna location, taking into account the device rotation.

Motivation

Setup UI for NFC Scanning

Testing

  • Added tests
  • Modified tests
  • Manually verified

@samer-stripe samer-stripe added the nfc-scanning Work related to the NFC scanning project label Jun 25, 2026
@samer-stripe samer-stripe force-pushed the samer/nfc-initial-ui branch from 39f4dde to c0cc127 Compare June 25, 2026 20:09
yBias = normalizedYBias,
)
}
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalizes the tap zone based on the screen orientation, important because the biases received assume portrait mode only. Normalizing these values based on the exact orientation allows for accurately showing where the NFC coil is located.

NfcCoilLayout(tapZone, deviceRotation)
CloseButtonLayout(tapZone, deviceRotation, onClose)
}
}

@samer-stripe samer-stripe Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of logic for handling device orientation. We can no longer just build features like this for portrait mode anymore and lock activities in that orientation for larger devices (width greater than 600dp). Android 16 initially disabled this behavior for larger devices (more than 600dp) by default with a developer opt-out. Android 17 is doing away the developer opt-in, completely removing the ability to lock orientation.

While this does mean that most devices can still be locked on orientation, foldable devices like the Google Pixel Pro Fold would not respect the lock.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terminal had to do the same thing recently.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting!

@samer-stripe samer-stripe force-pushed the samer/nfc-initial-ui branch from c0cc127 to ec7eab1 Compare June 26, 2026 00:04
@samer-stripe samer-stripe requested a review from amk-stripe June 26, 2026 00:05
@samer-stripe samer-stripe marked this pull request as ready for review June 26, 2026 00:05
@samer-stripe samer-stripe requested review from a team as code owners June 26, 2026 00:05
@samer-stripe samer-stripe force-pushed the samer/nfc-initial-ui branch from ec7eab1 to 465b19c Compare June 26, 2026 00:51
@samer-stripe samer-stripe force-pushed the samer/nfc-initial-ui branch from 465b19c to 57964ff Compare June 26, 2026 01:47
@samer-stripe samer-stripe changed the title Add initial UI setup for NFC scanning Add initial UI for NFC scanning Jun 26, 2026

@amk-stripe amk-stripe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some more tests? E.g. do we have test coverage for DeviceRotation and for the changes made to NfcScanningActivity?

@samer-stripe samer-stripe requested a review from amk-stripe June 27, 2026 17:05
}
}

internal fun Context.getDeviceRotation(): DeviceRotation {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we annotate this as @VisibleForTesting?

@samer-stripe samer-stripe merged commit 151405a into master Jun 30, 2026
56 of 57 checks passed
@samer-stripe samer-stripe deleted the samer/nfc-initial-ui branch June 30, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nfc-scanning Work related to the NFC scanning project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants