Package com.example.lottery.util
Class QRCodeUtils
java.lang.Object
com.example.lottery.util.QRCodeUtils
Utility class for QR code related operations.
Provides methods to generate unique QR content strings and render them as Bitmaps.
Satisfies requirements for: US 02.01.01: Event creation with promotional QR code.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringextractEventId(String qrContent) Extracts the eventId from scanned QR content.static android.graphics.BitmapgenerateQRCodeBitmap(String content) Generates a QR Code Bitmap from the given content string using the ZXing library.static StringgenerateUniqueQrContent(String eventId) Generates a unique string to be used as QR code content.
-
Constructor Details
-
QRCodeUtils
public QRCodeUtils()
-
-
Method Details
-
generateUniqueQrContent
Generates a unique string to be used as QR code content. Combines the eventId with a random UUID to ensure global uniqueness.- Parameters:
eventId- The unique ID of the event to link with the QR code.- Returns:
- A unique string combining eventId and a random UUID seed.
-
generateQRCodeBitmap
Generates a QR Code Bitmap from the given content string using the ZXing library.- Parameters:
content- The string content to be encoded into the QR code.- Returns:
- A 512x512 Bitmap of the generated QR code, or null if an error occurs.
-
extractEventId
Extracts the eventId from scanned QR content. QR content format: eventId_UUID
-