Merge "Obtain handler from context in CaptioningManager" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2d4dc8db64
@@ -52,11 +52,9 @@ public class CaptioningManager {
|
|||||||
/** Default scaling value for caption fonts. */
|
/** Default scaling value for caption fonts. */
|
||||||
private static final float DEFAULT_FONT_SCALE = 1;
|
private static final float DEFAULT_FONT_SCALE = 1;
|
||||||
|
|
||||||
private final ArrayList<CaptioningChangeListener>
|
private final ArrayList<CaptioningChangeListener> mListeners = new ArrayList<>();
|
||||||
mListeners = new ArrayList<CaptioningChangeListener>();
|
|
||||||
private final Handler mHandler = new Handler();
|
|
||||||
|
|
||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
|
private final ContentObserver mContentObserver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new captioning manager for the specified context.
|
* Creates a new captioning manager for the specified context.
|
||||||
@@ -65,6 +63,9 @@ public class CaptioningManager {
|
|||||||
*/
|
*/
|
||||||
public CaptioningManager(Context context) {
|
public CaptioningManager(Context context) {
|
||||||
mContentResolver = context.getContentResolver();
|
mContentResolver = context.getContentResolver();
|
||||||
|
|
||||||
|
final Handler handler = new Handler(context.getMainLooper());
|
||||||
|
mContentObserver = new MyContentObserver(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,7 +221,15 @@ public class CaptioningManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ContentObserver mContentObserver = new ContentObserver(mHandler) {
|
private class MyContentObserver extends ContentObserver {
|
||||||
|
private final Handler mHandler;
|
||||||
|
|
||||||
|
public MyContentObserver(Handler handler) {
|
||||||
|
super(handler);
|
||||||
|
|
||||||
|
mHandler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange, Uri uri) {
|
public void onChange(boolean selfChange, Uri uri) {
|
||||||
final String uriPath = uri.getPath();
|
final String uriPath = uri.getPath();
|
||||||
|
|||||||
Reference in New Issue
Block a user