File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
android/src/main/java/io/rumors/reactnativesettings/listeners Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 12
12
13
13
import java .util .concurrent .CountDownLatch ;
14
14
15
-
16
15
public class CaptioningChangeListener extends CaptioningManager .CaptioningChangeListener {
17
16
private Context mContext ;
18
17
19
18
private CaptioningManager mCaptioningManager ;
20
19
21
20
private CaptioningManager getCaptioningManager () {
22
- if (Build .VERSION .SDK_INT > Build .VERSION_CODES .LOLLIPOP ) {
21
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
23
22
return (CaptioningManager ) mContext .getSystemService (Context .CAPTIONING_SERVICE );
24
23
} else {
25
24
// Android <= 5 bug workaround
@@ -28,19 +27,19 @@ private CaptioningManager getCaptioningManager() {
28
27
29
28
Handler handler = new Handler (Looper .getMainLooper ());
30
29
handler .post (new Runnable () {
31
- @ Override
32
- public void run () {
33
- mCaptioningManager = (CaptioningManager ) mContext .getSystemService (Context .CAPTIONING_SERVICE );
34
- latch .countDown ();
35
- }
30
+ @ Override
31
+ public void run () {
32
+ mCaptioningManager = (CaptioningManager ) mContext .getSystemService (Context .CAPTIONING_SERVICE );
33
+ latch .countDown ();
34
+ }
36
35
});
37
-
36
+
38
37
try {
39
- latch .await ();
38
+ latch .await ();
40
39
} catch (InterruptedException e ) {
41
- e .printStackTrace ();
40
+ e .printStackTrace ();
42
41
}
43
-
42
+
44
43
return mCaptioningManager ;
45
44
}
46
45
}
You can’t perform that action at this time.
0 commit comments