Skip to content

refactor: move AnkiBroadcastReceiver to :common:android#21229

Merged
david-allison merged 2 commits into
ankidroid:mainfrom
criticalAY:refactor/ankibroadcastreceiver-common-android
Jun 6, 2026
Merged

refactor: move AnkiBroadcastReceiver to :common:android#21229
david-allison merged 2 commits into
ankidroid:mainfrom
criticalAY:refactor/ankibroadcastreceiver-common-android

Conversation

@criticalAY
Copy link
Copy Markdown
Contributor

Purpose / Description

Moves AnkiBroadcastReceiver and its locale-helper dependencies (Context.withAppLocale(), getCurrentLocaleTag()) from :AnkiDroid down to :common:android, so widgets, services and other receivers can extend the base receiver without depending on :AnkiDroid.

Fixes

Approach

See commits

How Has This Been Tested?

Local build and CI

Learning (optional, can help others)

NA

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Moves Context.withAppLocale() and getCurrentLocaleTag() out of
LanguageUtil so non-AnkiDroid modules (broadcast receivers, services,
widgets) can apply the in-app locale to a Context without depending
on :AnkiDroid.
The base class is a thin Context-locale wrapper around BroadcastReceiver
with no Anki/libanki coupling. Moving it down lets widgets, services
and other receivers extend it without depending on :AnkiDroid.
Comment on lines +1 to +15
/*
* Copyright (c) 2020 David Allison <davidallisongithub@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/*
* Copyright (c) 2020 David Allison <davidallisongithub@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0-or-later

Beautiful stuff :D

@david-allison david-allison added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Review labels Jun 6, 2026
@david-allison david-allison added this pull request to the merge queue Jun 6, 2026
Merged via the queue into ankidroid:main with commit 891b268 Jun 6, 2026
20 checks passed
@github-actions github-actions Bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Jun 6, 2026
@github-actions github-actions Bot added this to the 2.25 release milestone Jun 6, 2026
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