refactor: move AnkiBroadcastReceiver to :common:android#21229
Merged
david-allison merged 2 commits intoJun 6, 2026
Merged
Conversation
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.
david-allison
approved these changes
Jun 6, 2026
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/>. | ||
| */ |
Member
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.