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

Commit 9b1ce52f authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Using initial activity layout to position the launching activity.

The activity can be positioned in the center or in one of the corners.
From there it shifts its position and tries to find a spot where it
doesn't collide with other activities.

The CL also includes a few fixes necessary to pipe the information about
the initial layout through the system.

Change-Id: I2aaf5b6d20044aafec713b7bd4193b05cfbd16f3
parent 8adc30a8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -240,8 +240,10 @@ package android {
    field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
    field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba
    field public static final int activityCloseExitAnimation = 16842939; // 0x10100bb
    field public static final int activityHeight = 16844019; // 0x10104f3
    field public static final int activityOpenEnterAnimation = 16842936; // 0x10100b8
    field public static final int activityOpenExitAnimation = 16842937; // 0x10100b9
    field public static final int activityWidth = 16844018; // 0x10104f2
    field public static final int addPrintersActivity = 16843750; // 0x10103e6
    field public static final int addStatesFromChildren = 16842992; // 0x10100f0
    field public static final int adjustViewBounds = 16843038; // 0x101011e
+2 −0
Original line number Diff line number Diff line
@@ -333,8 +333,10 @@ package android {
    field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
    field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba
    field public static final int activityCloseExitAnimation = 16842939; // 0x10100bb
    field public static final int activityHeight = 16844019; // 0x10104f3
    field public static final int activityOpenEnterAnimation = 16842936; // 0x10100b8
    field public static final int activityOpenExitAnimation = 16842937; // 0x10100b9
    field public static final int activityWidth = 16844018; // 0x10104f2
    field public static final int addPrintersActivity = 16843750; // 0x10103e6
    field public static final int addStatesFromChildren = 16842992; // 0x10100f0
    field public static final int adjustViewBounds = 16843038; // 0x101011e
+1 −0
Original line number Diff line number Diff line
@@ -719,6 +719,7 @@ public class ActivityInfo extends ComponentInfo
        maxRecents = orig.maxRecents;
        resizeable = orig.resizeable;
        lockTaskLaunchMode = orig.lockTaskLaunchMode;
        initialLayout = orig.initialLayout;
    }

    /**
+7 −6
Original line number Diff line number Diff line
@@ -3307,25 +3307,25 @@ public class PackageParser {
        int height = -1;
        float heightFraction = -1f;
        final int widthType = sw.getType(
                com.android.internal.R.styleable.AndroidManifestInitialLayout_activity_width);
                com.android.internal.R.styleable.AndroidManifestInitialLayout_activityWidth);
        if (widthType == TypedValue.TYPE_FRACTION) {
            widthFraction = sw.getFraction(
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activity_width,
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activityWidth,
                    1, 1, -1);
        } else if (widthType == TypedValue.TYPE_DIMENSION) {
            width = sw.getDimensionPixelSize(
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activity_width,
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activityWidth,
                    -1);
        }
        final int heightType = sw.getType(
                com.android.internal.R.styleable.AndroidManifestInitialLayout_activity_height);
                com.android.internal.R.styleable.AndroidManifestInitialLayout_activityHeight);
        if (heightType == TypedValue.TYPE_FRACTION) {
            heightFraction = sw.getFraction(
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activity_height,
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activityHeight,
                    1, 1, -1);
        } else if (heightType == TypedValue.TYPE_DIMENSION) {
            height = sw.getDimensionPixelSize(
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activity_height,
                    com.android.internal.R.styleable.AndroidManifestInitialLayout_activityHeight,
                    -1);
        }
        int gravity = sw.getInt(
@@ -3415,6 +3415,7 @@ public class PackageParser {
        info.uiOptions = target.info.uiOptions;
        info.parentActivityName = target.info.parentActivityName;
        info.maxRecents = target.info.maxRecents;
        info.initialLayout = target.info.initialLayout;

        Activity a = new Activity(mParseActivityAliasArgs, info);
        if (outError[0] != null) {
+2 −2
Original line number Diff line number Diff line
@@ -2200,10 +2200,10 @@
    <declare-styleable name="AndroidManifestInitialLayout" parent="AndroidManifestActivity">
        <!-- Initial width of the activity. Can be either a fixed value or fraction, in which case
             the width will be constructed as a fraction of the total available width. -->
        <attr name="activity_width" format="dimension|fraction" />
        <attr name="activityWidth" format="dimension|fraction" />
        <!-- Initial height of the activity. Can be either a fixed value or fraction, in which case
             the height will be constructed as a fraction of the total available height. -->
        <attr name="activity_height" format="dimension|fraction" />
        <attr name="activityHeight" format="dimension|fraction" />
        <!-- Where to initially position the activity inside the available space. Uses constants
             defined in {@link android.view.Gravity}. -->
        <attr name="gravity" />
Loading