Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ce6beb8 authored by Menghan Li's avatar Menghan Li Committed by Android (Google) Code Review
Browse files

Merge "Fix Live Caption does not follow caption size if caption is not enabled" into tm-dev

parents 20907481 0d47c548
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.accessibility;

import static com.android.settings.accessibility.AccessibilityUtil.State.ON;

import android.app.settings.SettingsEnums;
import android.content.ContentResolver;
import android.content.Context;
@@ -400,6 +402,7 @@ public class CaptionAppearanceFragment extends DashboardFragment
        }

        refreshPreviewText();
        enableCaptioningManager();
    }

    @Override
@@ -409,16 +412,26 @@ public class CaptionAppearanceFragment extends DashboardFragment
            Settings.Secure.putString(
                    cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE, (String) value);
            refreshPreviewText();
            enableCaptioningManager();
        } else if (mFontSize == preference) {
            Settings.Secure.putFloat(
                    cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
                    Float.parseFloat((String) value));
            refreshPreviewText();
            enableCaptioningManager();
        }

        return true;
    }

    private void enableCaptioningManager() {
        if (mCaptioningManager.isEnabled()) {
            return;
        }
        Settings.Secure.putInt(getContentResolver(),
                Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, ON);
    }

    @Override
    public int getHelpResource() {
        return R.string.help_url_caption;