diff options
author | Stefan Niedermann <info@niedermann.it> | 2021-07-30 12:58:49 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2021-07-30 12:58:49 +0300 |
commit | 56d43b3b9ba4738d48cd2caadd42841478699c3a (patch) | |
tree | d1134146f3c1508fed1a6274e5fce4ba849489b2 /News-Android-App/src/main/java | |
parent | 7ea23133f8778177fddf3ecc6f7920da5e14df6c (diff) |
SuppressLint for illegal reflective access
The app won't crash, but it also won't apply cursor colors for the search view on API 30+
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'News-Android-App/src/main/java')
-rw-r--r-- | News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/ThemeUtils.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/ThemeUtils.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/ThemeUtils.java index 4188b15d..179c6728 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/ThemeUtils.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/ThemeUtils.java @@ -21,6 +21,7 @@ package de.luhmer.owncloudnewsreader.helper; +import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.ColorFilter; import android.graphics.PorterDuff; @@ -62,7 +63,8 @@ public class ThemeUtils { searchTextViewRef.setAccessible(true); Object searchAutoComplete = searchTextViewRef.get(searchView); - Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); + // FIXME Reflective access to mTextSelectHandleRes will throw an exception when targeting API 30 and above + @SuppressLint("SoonBlockedPrivateApi") Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); mCursorDrawableRes.setAccessible(true); mCursorDrawableRes.set(searchAutoComplete, R.drawable.cursor); @@ -70,7 +72,8 @@ public class ThemeUtils { // https://stackoverflow.com/a/49555923 //get the pointer resource id - Field textSelectHandleRef = TextView.class.getDeclaredField("mTextSelectHandleRes"); + // FIXME Reflective access to mTextSelectHandleRes will throw an exception when targeting API 30 and above + @SuppressLint("SoonBlockedPrivateApi") Field textSelectHandleRef = TextView.class.getDeclaredField("mTextSelectHandleRes"); textSelectHandleRef.setAccessible(true); int drawableResId = textSelectHandleRef.getInt(searchAutoComplete); |