Skip to content

Commit

Permalink
refactor: Use ScannerSearchOptions instead of explicit intent
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentKobz committed May 27, 2024
1 parent 6dc6a9a commit 36d11d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@ public void onClickBt1(View v) {
options.allowIntentDevices = preferences.getBoolean(ScannerServiceApi.EXTRA_SEARCH_ALLOW_INTENT_BOOLEAN, options.allowIntentDevices);
options.allowedProviderKeys = preferences.getStringSet(ScannerServiceApi.EXTRA_SEARCH_ALLOWED_PROVIDERS_STRING_ARRAY, options.allowedProviderKeys);
options.excludedProviderKeys = preferences.getStringSet(ScannerServiceApi.EXTRA_SEARCH_EXCLUDED_PROVIDERS_STRING_ARRAY, options.excludedProviderKeys);
options.symbologySelection = preferences.getStringSet(ScannerServiceApi.EXTRA_SYMBOLOGY_SELECTION, ScannerService.defaultSymbologyByName());

options.toIntentExtras(intent);
// add symbology
final String[] symbologies = preferences.getStringSet(ScannerServiceApi.EXTRA_SYMBOLOGY_SELECTION, ScannerService.defaultSymbologyByName()).toArray(new String[0]);
intent.putExtra(ScannerServiceApi.EXTRA_SYMBOLOGY_SELECTION, symbologies);
// add logging intent extra

// Add extra settings for scanner activity (logging and camera fallback)
intent.putExtra(SettingsActivity.ENABLE_LOGGING_KEY, preferences.getBoolean(SettingsActivity.ENABLE_LOGGING_KEY, false));
// add allow camera fallback intent extra
intent.putExtra(SettingsActivity.ALLOW_CAMERA_FALLBACK_KEY, preferences.getBoolean(SettingsActivity.ALLOW_CAMERA_FALLBACK_KEY, false));

startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public void testScannerSearchDelayedAfterBind() {

final Intent serviceIntent = new Intent(ctx, ScannerService.class);
options.toIntentExtras(serviceIntent);
serviceIntent.putExtra(ScannerServiceApi.EXTRA_START_SEARCH_ON_SERVICE_BIND, false);
ctx.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);

// Wait for binding with ScannerService
Expand Down

0 comments on commit 36d11d5

Please sign in to comment.