Skip to content

Commit 930f5e9

Browse files
jkmasselclaude
andcommitted
Fix CodeQL warnings for e-ink mode changes
- Add @nonnull to AniUtils.noopAnimator parameter - Add @nullable to AppSettingsFragment.mEinkModePref field - Hoist stringResource() before onClick lambda in DeviceInfoActivity to satisfy LocalContextGetResourceValueCall lint rule Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c6ba1d2 commit 930f5e9

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

WordPress/src/main/java/org/wordpress/android/ui/accounts/DeviceInfoActivity.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ private data class DeviceInfoSection(
6161
private fun DeviceInfoScreen(onNavigateBack: () -> Unit) {
6262
val context = LocalContext.current
6363
val sections = buildDeviceInfoSections()
64+
val clipLabel = stringResource(R.string.device_info_title)
6465

6566
Scaffold(
6667
topBar = {
@@ -103,12 +104,7 @@ private fun DeviceInfoScreen(onNavigateBack: () -> Unit) {
103104
ClipboardManager::class.java
104105
)
105106
clipboard.setPrimaryClip(
106-
ClipData.newPlainText(
107-
context.getString(
108-
R.string.device_info_title
109-
),
110-
text
111-
)
107+
ClipData.newPlainText(clipLabel, text)
112108
)
113109
Toast.makeText(
114110
context,

WordPress/src/main/java/org/wordpress/android/ui/prefs/AppSettingsFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class AppSettingsFragment extends PreferenceFragment
8080
private WPPreference mLanguagePreference;
8181
private ListPreference mAppThemePreference;
8282
private ListPreference mInitialScreenPreference;
83-
private WPSwitchPreference mEinkModePref;
83+
@Nullable private WPSwitchPreference mEinkModePref;
8484

8585
// This Device settings
8686
private WPSwitchPreference mOptimizedImage;

WordPress/src/main/java/org/wordpress/android/util/AniUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import android.view.animation.LinearInterpolator;
1616
import android.view.animation.TranslateAnimation;
1717

18+
import androidx.annotation.NonNull;
19+
1820
import org.wordpress.android.ui.prefs.AppPrefs;
1921

2022
public class AniUtils {
@@ -47,7 +49,7 @@ private static boolean isAnimationDisabled() {
4749
return AppPrefs.isEinkModeEnabled();
4850
}
4951

50-
private static ObjectAnimator noopAnimator(View target) {
52+
private static ObjectAnimator noopAnimator(@NonNull View target) {
5153
ObjectAnimator noop = ObjectAnimator.ofFloat(target, View.ALPHA, target.getAlpha());
5254
noop.setDuration(0);
5355
return noop;

0 commit comments

Comments
 (0)