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

Commit d6287836 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Applying Fading and Scaling animation to ViewGroupFader" into main

parents aee03ce6 2275f935
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
package: "android.widget.flags"
container: "system"
flag {
  name: "enable_fading_view_group"
  namespace: "system_performance"
  description: "FRP screen during OOBE must have fading and scaling animation in Wear Watches"
  bug: "348515581"
  metadata {
      purpose: PURPOSE_BUGFIX
    }
}
 No newline at end of file
+16 −7
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package com.android.internal.widget;

import android.content.res.Resources;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.animation.BaseInterpolator;
import android.view.animation.PathInterpolator;
import android.widget.flags.Flags;

/**
 * This class is ported from
@@ -36,7 +38,7 @@ import android.view.animation.PathInterpolator;
 * height of the child. When not in the top or bottom regions, children have their default alpha and
 * scale.
 */
class ViewGroupFader {
public class ViewGroupFader {

    private static final float SCALE_LOWER_BOUND = 0.7f;
    private float mScaleLowerBound = SCALE_LOWER_BOUND;
@@ -68,7 +70,7 @@ class ViewGroupFader {
    private BaseInterpolator mBottomInterpolator = new PathInterpolator(0.3f, 0f, 0.7f, 1f);

    /** Callback which is called when attempting to fade a view. */
    interface AnimationCallback {
    public interface AnimationCallback {
        boolean shouldFadeFromTop(View view);

        boolean shouldFadeFromBottom(View view);
@@ -82,7 +84,7 @@ class ViewGroupFader {
     * of the current position.
     */
    // TODO(b/182846214): Clean up the interface design to avoid exposing too much details to users.
    interface ChildViewBoundsProvider {
    public interface ChildViewBoundsProvider {
        /**
         * Provide the bounds of the child view.
         *
@@ -168,7 +170,7 @@ class ViewGroupFader {
        }
    }

    ViewGroupFader(
    public ViewGroupFader(
            ViewGroup parent,
            AnimationCallback callback,
            ChildViewBoundsProvider childViewBoundsProvider) {
@@ -212,7 +214,7 @@ class ViewGroupFader {
        this.mContainerBoundsProvider = boundsProvider;
    }

    void updateFade() {
    public void updateFade() {
        mContainerBoundsProvider.provideBounds(mParent, mContainerBounds);
        mTopBoundPixels = mContainerBounds.height() * mChainedBoundsTop;
        mBottomBoundPixels = mContainerBounds.height() * mChainedBoundsBottom;
@@ -221,13 +223,20 @@ class ViewGroupFader {
    }

    /** For each list element, calculate and adjust the scale and alpha based on its position */
    private void updateListElementFades(ViewGroup parent, boolean shouldFade) {
    public void updateListElementFades(ViewGroup parent, boolean shouldFade) {
        for (int i = 0; i < parent.getChildCount(); i++) {
            View child = parent.getChildAt(i);
            if (child.getVisibility() != View.VISIBLE) {
                continue;
            }

            if (Flags.enableFadingViewGroup() && Resources.getSystem().getBoolean(
                    com.android.internal.R.bool.config_enableViewGroupScalingFading)) {
                if (child instanceof ViewGroup) {
                    updateListElementFades((ViewGroup) child, true);
                }
            }

            if (shouldFade) {
                fadeElement(parent, child);
            }
+4 −0
Original line number Diff line number Diff line
@@ -96,4 +96,8 @@

    <!-- True if the device supports system decorations on secondary displays. -->
    <bool name="config_supportsSystemDecorsOnSecondaryDisplays">false</bool>

    <!-- Whether to enable scaling and fading animation to scrollviews while scrolling.
         P.S this is a change only intended for wear devices. -->
    <bool name="config_enableViewGroupScalingFading">true</bool>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -7121,4 +7121,8 @@
    <!-- The maximum number of call log entries for each sim card that can be stored in the call log
         provider on the device. -->
    <integer name="config_maximumCallLogEntriesPerSim">500</integer>

    <!-- Whether to enable scaling and fading animation to scrollviews while scrolling.
         P.S this is a change only intended for wear devices. -->
    <bool name="config_enableViewGroupScalingFading">false</bool>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5601,4 +5601,6 @@

  <!-- Fingerprint loe notification string -->
  <java-symbol type="string" name="fingerprint_loe_notification_msg" />

  <java-symbol type="bool" name="config_enableViewGroupScalingFading"/>
</resources>
Loading