Refactor CaptionAppearanceFragment to improve maintainability (4/n)
Root cause: There is a bunch of different logic of preferences in CaptionAppearanceFragment. It’s hard to implement new features and hard to maintain and hard to be testable. Solution: Move out preset preference logic of CaptionAppearanceFragment into controllers to reduce the complexity of the relationship between preference and fragment. Bug: 197695932 Test: make RunSettingsRoboTests ROBOTEST_FILTER=CaptionPresetControllerTest CaptionAppearanceFragmentTest Change-Id: I5409c1e8a6bdfc633abc304d8cf800ea0943de78
This commit is contained in:
@@ -186,4 +186,19 @@ public class CaptionHelper {
|
||||
final CaptionStyle attrs = CaptionStyle.getCustomStyle(mContentResolver);
|
||||
return attrs.edgeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the caption raw user style.
|
||||
*
|
||||
* @param type The caption raw user style
|
||||
*/
|
||||
public void setRawUserStyle(int type) {
|
||||
Settings.Secure.putInt(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_CAPTIONING_PRESET, type);
|
||||
}
|
||||
|
||||
/** Returns the caption raw user style.*/
|
||||
public int getRawUserStyle() {
|
||||
return mCaptioningManager.getRawUserStyle();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user