Skip to content

Commit b133427

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Cleanup unsed code on AccessibilityInfoModule
Summary: This diff cleansup unused code on AccessibilityInfoModule class changelog: [Android][Deprecated] Remove code used by deprecated Android API levels Reviewed By: JoshuaGross Differential Revision: D22771912 fbshipit-source-id: f32808fa93f75c10324e8875b85fe4e541b284b8
1 parent b7d8641 commit b133427

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java

+9-15
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ public String getName() {
9090
return "AccessibilityInfo";
9191
}
9292

93+
@TargetApi(Build.VERSION_CODES.KITKAT)
9394
private boolean getIsReduceMotionEnabledValue() {
9495
String value =
95-
Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1
96-
? null
97-
: Settings.Global.getString(
98-
mContentResolver, Settings.Global.TRANSITION_ANIMATION_SCALE);
96+
Settings.Global.getString(mContentResolver, Settings.Global.TRANSITION_ANIMATION_SCALE);
9997

10098
return value != null && value.equals("0.0");
10199
}
@@ -139,11 +137,10 @@ private void updateAndSendTouchExplorationChangeEvent(boolean enabled) {
139137
}
140138

141139
@Override
140+
@TargetApi(Build.VERSION_CODES.KITKAT)
142141
public void onHostResume() {
143-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
144-
mAccessibilityManager.addTouchExplorationStateChangeListener(
145-
mTouchExplorationStateChangeListener);
146-
}
142+
mAccessibilityManager.addTouchExplorationStateChangeListener(
143+
mTouchExplorationStateChangeListener);
147144

148145
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
149146
Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE);
@@ -155,15 +152,12 @@ public void onHostResume() {
155152
}
156153

157154
@Override
155+
@TargetApi(Build.VERSION_CODES.KITKAT)
158156
public void onHostPause() {
159-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
160-
mAccessibilityManager.removeTouchExplorationStateChangeListener(
161-
mTouchExplorationStateChangeListener);
162-
}
157+
mAccessibilityManager.removeTouchExplorationStateChangeListener(
158+
mTouchExplorationStateChangeListener);
163159

164-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
165-
mContentResolver.unregisterContentObserver(animationScaleObserver);
166-
}
160+
mContentResolver.unregisterContentObserver(animationScaleObserver);
167161
}
168162

169163
@Override

0 commit comments

Comments
 (0)