Skip to content

Conversation

@scottpeterson
Copy link
Collaborator

@scottpeterson scottpeterson commented Oct 22, 2025

This commit addresses deprecated method calls identified in issue #159, updating them to use modern Android APIs compatible with the current minSdk (API 23+).

Files Changed:

CustomTabsUtil.java

  • Replaced deprecated setToolbarColor(int) with setDefaultColorSchemeParams(CustomTabColorSchemeParams)
  • Modern approach supports color schemes for light/dark mode
  • Smoketest: Open About screen, tap any web link buttons (About Us, Why Calling, Privacy, Dashboard). Chrome Custom Tabs should open with app's primary color in toolbar.

GridItemDecoration.java

  • Replaced deprecated getViewAdapterPosition() with getBindingAdapterPosition()
  • Smoketest: Navigate to RepCallActivity, verify grid spacing displays correctly on outcome buttons.

IssueActivity.java

  • Replaced deprecated startActivityForResult() with modern Activity Result API
  • Added ActivityResultLauncher and moved result handling to callback
  • Removed deprecated onActivityResult() method
  • Smoketest: Select an issue, tap on a representative row to launch RepCallActivity, navigate back and verify result handling works (especially server error state).

IssuesAdapter.java

  • Replaced 3 instances of deprecated getResources().getColor() with ContextCompat.getColor()
  • Affects button icon tinting in empty state views
  • Smoketest: Trigger empty states (no internet for refresh button, no location for location button, no search match for search button). Verify colored icons display correctly.

NotifyBroadcastReceiver.java

  • Replaced 3 deprecated Notification.Action.Builder(int, CharSequence, PendingIntent) constructors with modern Icon.createWithResource() approach
  • Replaced deprecated getResources().getColor() with ContextCompat.getColor()
  • Smoketest: Enable reminders in settings, wait for/trigger notification. Verify notification appears with Snooze, Settings, and Dismiss buttons with correct icons and primary color accent.

StatsActivity.java

  • Replaced 9 instances of deprecated getResources().getColor() with ContextCompat.getColor()
  • Affects pie chart colors, line graph colors, grid colors, and text colors
  • Smoketest: Open Stats screen, verify pie chart displays with correct outcome colors (green/orange/gray) and line graph shows white grid lines with colored series.

MainActivity.java

  • Replaced deprecated getResources().getColor() with ContextCompat.getColor()
  • Affects snackbar action button color
  • Smoketest: Enter a location/zip that splits congressional districts, verify snackbar appears with "UPDATE" button in accent light color.

Notes:

  • OkHttpStack.java contains many deprecation warnings but is dead code (commented out in FiveCallsApi.java due to Samsung Galaxy device failures). Left untouched as it's never instantiated.
  • Optimized imports across modified files.

Addresses #159

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization

Description

I did not fix EVERY deprecated API usage warning, so we may not want this PR to close 159 yet.

Related Issues

Were the changes tested?

  • Yes, automated tests in please name test methods or files
  • Yes, manually tested: smoketested each change as detailed at the top. It's possible I missed some unhappy state
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

  This commit addresses deprecated method calls identified in issue 5calls#159, updating them to use modern Android APIs compatible with the current minSdk (API 23+).

  ## Files Changed:

  **CustomTabsUtil.java**
  - Replaced deprecated `setToolbarColor(int)` with `setDefaultColorSchemeParams(CustomTabColorSchemeParams)`
  - Modern approach supports color schemes for light/dark mode
  - Smoketest: Open About screen, tap any web link buttons (About Us, Why Calling, Privacy, Dashboard). Chrome Custom Tabs should open with app's primary color in toolbar.

  **GridItemDecoration.java**
  - Replaced deprecated `getViewAdapterPosition()` with `getBindingAdapterPosition()`
  - Smoketest: Navigate to RepCallActivity, verify grid spacing displays correctly on outcome buttons.

  **IssueActivity.java**
  - Replaced deprecated `startActivityForResult()` with modern Activity Result API
  - Added `ActivityResultLauncher` and moved result handling to callback
  - Removed deprecated `onActivityResult()` method
  - Smoketest: Select an issue, tap on a representative row to launch RepCallActivity, navigate back and verify result handling works (especially server error state).

  **IssuesAdapter.java**
  - Replaced 3 instances of deprecated `getResources().getColor()` with `ContextCompat.getColor()`
  - Affects button icon tinting in empty state views
  - Smoketest: Trigger empty states (no internet for refresh button, no location for location button, no search match for search button). Verify colored icons display correctly.

  **NotifyBroadcastReceiver.java**
  - Replaced 3 deprecated `Notification.Action.Builder(int, CharSequence, PendingIntent)` constructors with modern `Icon.createWithResource()` approach
  - Replaced deprecated `getResources().getColor()` with `ContextCompat.getColor()`
  - Smoketest: Enable reminders in settings, wait for/trigger notification. Verify notification appears with Snooze, Settings, and Dismiss buttons with correct icons and primary color accent.

  **StatsActivity.java**
  - Replaced 9 instances of deprecated `getResources().getColor()` with `ContextCompat.getColor()`
  - Affects pie chart colors, line graph colors, grid colors, and text colors
  - Smoketest: Open Stats screen, verify pie chart displays with correct outcome colors (green/orange/gray) and line graph shows white grid lines with colored series.

  **MainActivity.java**
  - Replaced deprecated `getResources().getColor()` with `ContextCompat.getColor()`
  - Affects snackbar action button color
  - Smoketest: Enter a location/zip that splits congressional districts, verify snackbar appears with "UPDATE" button in accent light color.

  ## Notes:

  - OkHttpStack.java contains many deprecation warnings but is dead code (commented out in FiveCallsApi.java due to Samsung Galaxy device failures). Left untouched as it's never instantiated.
  - Optimized imports across modified files.

  Addresses 5calls#159
Copy link
Collaborator

@dektar dektar left a comment

Choose a reason for hiding this comment

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

LG % one nit below. Thanks for the clean-up. I tried this on a Pixel XL running Android 10 and it's fine there, FWIW.

@dektar dektar merged commit 9fd8878 into 5calls:master Oct 24, 2025
1 check failed
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