Skip to content

Add a barcode home screen widget for displaying a selected loyalty card's barcode and with proper orientation handling.#3125

Open
JorySeverijnse wants to merge 3 commits into
CatimaLoyalty:mainfrom
JorySeverijnse:main
Open

Add a barcode home screen widget for displaying a selected loyalty card's barcode and with proper orientation handling.#3125
JorySeverijnse wants to merge 3 commits into
CatimaLoyalty:mainfrom
JorySeverijnse:main

Conversation

@JorySeverijnse
Copy link
Copy Markdown

Full implementation of the #737 issue. Have tested it out on my android 16 (pixel 9a) for which it works perfectly

Add barcode widget for displaying loyalty card barcodes on home screen

  • New BarcodeWidget (AppWidgetProvider) that loads a card from the database, generates a barcode bitmap via ZXing, and renders it on the home screen
  • New BarcodeWidgetConfigureActivity with a grid layout for selecting which card to display per widget instance
  • Widget supports 1×1 cell minimum size, resizable horizontally and vertically
  • Widget metadata, layouts, and manifest entry added

Refactor barcode generation to use fixed dimensions and add optional format display setting

  • Replaced density-based dynamic sizing with fixed barcode dimensions (1000×300 for 1D barcodes, 500×500 for 2D)
  • Added a setting ("Show barcode type on widget") that toggles the barcode format label visibility below the barcode
  • Setting changes apply immediately to all existing widget instances via hotswap

Fix widget resize handling and correct inverted format toggle behavior

  • Fixed barcode orientation not updating on widget resize by overriding onAppWidgetOptionsChanged to re-render when the user resizes on the home screen
  • Added 90° rotation for 1D barcodes when the widget is taller than wide, filling the vertical space
  • Fixed the setting toggle being inverted — the preference change listener was reading the stale value before the preference was saved

Apply ktlint formatting to entire codebase

  • Project-wide code style cleanup applied with ktlint

@JorySeverijnse JorySeverijnse changed the title Add a barcode home screen widget for displaying a selected loyalty card's barcode, with configurable options and proper orientation handling. Add a barcode home screen widget for displaying a selected loyalty card's barcode and with proper orientation handling. May 11, 2026
@TheLastProject
Copy link
Copy Markdown
Member

Apply ktlint formatting to entire codebase
Project-wide code style cleanup applied with ktlint

Please drop that commit from your change. It turns a single-feature PR into a 3000 line change, way too much to review properly.

@TheLastProject
Copy link
Copy Markdown
Member

I'm not opposed to introducing some style lint, but that should really be its own unique change.

@JorySeverijnse
Copy link
Copy Markdown
Author

Alright, removed the linting. Also, do you have a suggestion as to what preview icon to use? We are now just using the same one that is being used for the Card list widget @drawable/widget_preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants