Skip to content

fix(compat): remove API 23/24 calls flagged by lint - #817

Merged
LeanBitLab merged 1 commit into
mainfrom
fix/api23-lint-errors
Nov 15, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
fix/api23-lint-errors

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Summary of Changes

Fixes the 4 NewApi lint errors that lintStandardDebug reports on main, plus one more that only the offline flavor (minSdk 21) reports.

Motivation & Context

./gradlew :app:lintStandardDebug failed with 4 errors. Core library desugaring is not enabled (isCoreLibraryDesugaringEnabled is unset), so these calls throw NoSuchMethodError on older devices. CI runs compileOfflineRunTestsKotlin only, so it never caught them.

Changes Made

  • SettingsContainer.kt: HashMap.putIfAbsent (API 24, added with the settings-search jump in beta2) replaced with containsKey + put.
  • UnicodeStyleEngine.kt: String.codePoints() and IntStream (API 24, from the custom text styles parser) replaced with a codePointAt loop. Without this, typing in the Custom text styles dialog would crash on Android 6.
  • InputView.kt: View.rootWindowInsets (API 23) is now behind a version check on the pre-API-30 path; API 21-22 get their insets from onApplyWindowInsets.

Verification & Testing

  • CustomTextStylesTest passes
  • lintStandardDebug: 0 errors (was 4), warnings unchanged at 1258
  • lintOfflineDebug: the InputView error is gone; the remaining ~295 offline errors (vector paths, long log tags, setForeground, Paint.hasGlyph) are unrelated and not touched here
  • Not run on an Android 6 device

Guidelines Checklist

  • This PR addresses a single focused concern.
  • Does not add unnecessary dependencies or binary blobs.
  • No em dashes used in comments, descriptions, or documentation.

HashMap.putIfAbsent (settings search map) and String.codePoints/IntStream
(custom text styles parser) need API 24, and View.getRootWindowInsets in
InputView needs API 23 on the pre-API-30 path. Use plain equivalents and a
version guard so Android 6 and the offline flavor do not hit NoSuchMethodError.
@LeanBitLab
LeanBitLab merged commit 945c138 into main Nov 15, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix/api23-lint-errors branch November 15, 2026 06:44
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.

1 participant

⌂ Proxy