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

Commit 27a97f0f authored by Ioana Stefan's avatar Ioana Stefan Committed by Android (Google) Code Review
Browse files

Merge "Add IntDef annotation to gravity field"

parents 46e59fe8 422afa91
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -15,8 +15,13 @@
 */

package android.view;

import android.annotation.IntDef;
import android.graphics.Rect;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Standard constants and tools for placing an object within a potentially
 * larger container.
@@ -122,6 +127,32 @@ public class Gravity
     */
    public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = START | END;


    /**
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, value = {
        Gravity.FILL,
        Gravity.FILL_HORIZONTAL,
        Gravity.FILL_VERTICAL,
        Gravity.START,
        Gravity.END,
        Gravity.LEFT,
        Gravity.RIGHT,
        Gravity.TOP,
        Gravity.BOTTOM,
        Gravity.CENTER,
        Gravity.CENTER_HORIZONTAL,
        Gravity.CENTER_VERTICAL,
        Gravity.DISPLAY_CLIP_HORIZONTAL,
        Gravity.DISPLAY_CLIP_VERTICAL,
        Gravity.CLIP_HORIZONTAL,
        Gravity.CLIP_VERTICAL,
        Gravity.NO_GRAVITY
    })
    public @interface GravityFlags {}

    /**
     * Apply a gravity constant to an object. This supposes that the layout direction is LTR.
     * 
+2 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.util.proto.ProtoOutputStream;
import android.view.Gravity.GravityFlags;
import android.view.View.OnApplyWindowInsetsListener;
import android.view.WindowInsets.Side;
import android.view.WindowInsets.Side.InsetsSide;
@@ -2572,6 +2573,7 @@ public interface WindowManager extends ViewManager {
         *
         * @see Gravity
         */
        @GravityFlags
        public int gravity;

        /**
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ message WindowLayoutParamsProto {
    optional int32 height = 5;
    optional float horizontal_margin = 6;
    optional float vertical_margin = 7;
    optional int32 gravity = 8;
    optional int32 gravity = 8 [(.android.typedef) = "android.view.Gravity.GravityFlags"];
    optional int32 soft_input_mode = 9 [(.android.typedef) = "android.view.WindowManager.LayoutParams.SoftInputModeFlags"];
    optional .android.graphics.PixelFormatProto.Format format = 10;
    optional int32 window_animations = 11;