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

Commit cfade7bb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix UiTranslationSpec#shouldPadContentForCompat javadoc." into sc-dev am: 3d18b83a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14506857

Change-Id: Ie6687ab4d158251a2d06a0624cfd78209744f915
parents fb507c47 3d18b83a
Loading
Loading
Loading
Loading
+38 −34
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.widget.TextView;


import com.android.internal.util.DataClass;
import com.android.internal.util.DataClass;


@@ -35,36 +36,38 @@ import com.android.internal.util.DataClass;
public final class UiTranslationSpec implements Parcelable {
public final class UiTranslationSpec implements Parcelable {


    /**
    /**
     * Whether the original content of the view should be directly modified to include padding that
     * Whether the original content of the view should be made to appear as if it is the same size
     * makes it the same size as the translated content. Defaults to {@code false}.
     * as the translated content. Defaults to {@code false}.
     * <p>
     * <p>
     * For {@link android.widget.TextView}, the system does not directly modify the original text,
     * For {@link TextView}, the system does not directly modify the original text, rather
     * rather changes the displayed content using a
     * changes the displayed content using a {@link android.text.method.TransformationMethod}. This
     * {@link android.text.method.TransformationMethod}.
     * can cause issues in apps that do not account for length-changing TransformationMethods. For
     * This can cause issues in apps that do not account for TransformationMethods. For example, an
     * example, an app using DynamicLayout may use the calculated line-offsets to operate on the
     * app using DynamicLayout may use the calculated text offsets to operate on the original text,
     * original text, but this can cause crashes when the layout was calculated on translated text
     * but this can be problematic when the layout was calculated on translated text with a
     * with a different length.
     * different length.
     * <p>
     * <p>
     * If this is {@code true}, for a TextView the default implementation will append spaces to the
     * If this is {@code true}, for a TextView the default implementation appends spaces to the
     * text to make the length the same as the translated text.
     * result of {@link TextView#getText()} to make the length the same as the translated text.
     * <p>
     * This only affects apps with target SDK R or lower.
     */
     */
    private boolean mShouldPadContentForCompat = false;
    private boolean mShouldPadContentForCompat = false;


    /**
    /**
     * Whether the original content of the view should be directly modified to include padding that
     * Whether the original content of the view should be made to appear as if it is the same size
     * makes it the same size as the translated content.
     * as the translated content.
     * <p>
     * For {@link TextView}, the system does not directly modify the original text, rather
     * changes the displayed content using a {@link android.text.method.TransformationMethod}. This
     * can cause issues in apps that do not account for length-changing TransformationMethods. For
     * example, an app using DynamicLayout may use the calculated line-offsets to operate on the
     * original text, but this can cause crashes when the layout was calculated on translated text
     * with a different length.
     * <p>
     * <p>
     * For {@link android.widget.TextView}, the system does not directly modify the original text,
     * If this is {@code true}, for a TextView the default implementation appends spaces to the
     * rather changes the displayed content using a
     * result of {@link TextView#getText()} to make the length the same as the translated text.
     * {@link android.text.method.TransformationMethod}.
     * This can cause issues in apps that do not account for TransformationMethods. For example, an
     * app using DynamicLayout may use the calculated text offsets to operate on the original text,
     * but this can be problematic when the layout was calculated on translated text with a
     * different length.
     * <p>
     * <p>
     * If this is {@code true}, for a TextView the default implementation will append spaces to the
     * This only affects apps with target SDK R or lower.
     * text to make the length the same as the translated text.
     */
     */
    public boolean shouldPadContentForCompat() {
    public boolean shouldPadContentForCompat() {
        return mShouldPadContentForCompat;
        return mShouldPadContentForCompat;
@@ -190,19 +193,20 @@ public final class UiTranslationSpec implements Parcelable {
        }
        }


        /**
        /**
         * Whether the original content of the view should be directly modified to include padding that
         * Whether the original content of the view should be made to appear as if it is the same size
         * makes it the same size as the translated content. Defaults to {@code false}.
         * as the translated content. Defaults to {@code false}.
         * <p>
         * For {@link TextView}, the system does not directly modify the original text, rather
         * changes the displayed content using a {@link android.text.method.TransformationMethod}. This
         * can cause issues in apps that do not account for length-changing TransformationMethods. For
         * example, an app using DynamicLayout may use the calculated line-offsets to operate on the
         * original text, but this can cause crashes when the layout was calculated on translated text
         * with a different length.
         * <p>
         * <p>
         * For {@link android.widget.TextView}, the system does not directly modify the original text,
         * If this is {@code true}, for a TextView the default implementation appends spaces to the
         * rather changes the displayed content using a
         * result of {@link TextView#getText()} to make the length the same as the translated text.
         * {@link android.text.method.TransformationMethod}.
         * This can cause issues in apps that do not account for TransformationMethods. For example, an
         * app using DynamicLayout may use the calculated text offsets to operate on the original text,
         * but this can be problematic when the layout was calculated on translated text with a
         * different length.
         * <p>
         * <p>
         * If this is {@code true}, for a TextView the default implementation will append spaces to the
         * This only affects apps with target SDK R or lower.
         * text to make the length the same as the translated text.
         */
         */
        @DataClass.Generated.Member
        @DataClass.Generated.Member
        public @NonNull Builder setShouldPadContentForCompat(boolean value) {
        public @NonNull Builder setShouldPadContentForCompat(boolean value) {
@@ -234,7 +238,7 @@ public final class UiTranslationSpec implements Parcelable {
    }
    }


    @DataClass.Generated(
    @DataClass.Generated(
            time = 1619034161701L,
            time = 1620790033058L,
            codegenVersion = "1.0.23",
            codegenVersion = "1.0.23",
            sourceFile = "frameworks/base/core/java/android/view/translation/UiTranslationSpec.java",
            sourceFile = "frameworks/base/core/java/android/view/translation/UiTranslationSpec.java",
            inputSignatures = "private  boolean mShouldPadContentForCompat\npublic  boolean shouldPadContentForCompat()\nclass UiTranslationSpec extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true, genHiddenConstDefs=true, genToString=true)")
            inputSignatures = "private  boolean mShouldPadContentForCompat\npublic  boolean shouldPadContentForCompat()\nclass UiTranslationSpec extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true, genHiddenConstDefs=true, genToString=true)")