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

Commit efca0aa9 authored by Gus Prevas's avatar Gus Prevas Committed by Android Git Automerger
Browse files

am 3197cd36: am 41110261: am b17d1e5e: Merge "Adds an option to override...

am 3197cd36: am 41110261: am b17d1e5e: Merge "Adds an option to override RemoteViews transition." into cw-e-dev

* commit '3197cd36':
  Adds an option to override RemoteViews transition.
parents 3a089750 3197cd36
Loading
Loading
Loading
Loading
+38 −3
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.ColorStateList;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Rect;
@@ -55,6 +56,8 @@ import android.view.ViewGroup;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemClickListener;
import libcore.util.Objects;
import libcore.util.Objects;


import com.android.internal.R;

import java.lang.annotation.ElementType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
@@ -206,14 +209,22 @@ public class RemoteViews implements Parcelable, Filter {


    /** @hide */
    /** @hide */
    public static class OnClickHandler {
    public static class OnClickHandler {

        private int mEnterAnimationId;

        public boolean onClickHandler(View view, PendingIntent pendingIntent,
        public boolean onClickHandler(View view, PendingIntent pendingIntent,
                Intent fillInIntent) {
                Intent fillInIntent) {
            try {
            try {
                // TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
                // TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT?
                Context context = view.getContext();
                Context context = view.getContext();
                ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(view,
                ActivityOptions opts;
                if (mEnterAnimationId != 0) {
                    opts = ActivityOptions.makeCustomAnimation(context, mEnterAnimationId, 0);
                } else {
                    opts = ActivityOptions.makeScaleUpAnimation(view,
                            0, 0,
                            0, 0,
                            view.getMeasuredWidth(), view.getMeasuredHeight());
                            view.getMeasuredWidth(), view.getMeasuredHeight());
                }
                context.startIntentSender(
                context.startIntentSender(
                        pendingIntent.getIntentSender(), fillInIntent,
                        pendingIntent.getIntentSender(), fillInIntent,
                        Intent.FLAG_ACTIVITY_NEW_TASK,
                        Intent.FLAG_ACTIVITY_NEW_TASK,
@@ -228,6 +239,10 @@ public class RemoteViews implements Parcelable, Filter {
            }
            }
            return true;
            return true;
        }
        }

        public void setEnterAnimationId(int enterAnimationId) {
            mEnterAnimationId = enterAnimationId;
        }
    }
    }


    /**
    /**
@@ -2761,11 +2776,31 @@ public class RemoteViews implements Parcelable, Filter {
        inflater.setFilter(this);
        inflater.setFilter(this);
        result = inflater.inflate(rvToApply.getLayoutId(), parent, false);
        result = inflater.inflate(rvToApply.getLayoutId(), parent, false);


        loadTransitionOverride(context, handler);

        rvToApply.performApply(result, parent, handler);
        rvToApply.performApply(result, parent, handler);


        return result;
        return result;
    }
    }


    private static void loadTransitionOverride(Context context,
            RemoteViews.OnClickHandler handler) {
        if (handler != null && context.getResources().getBoolean(
                com.android.internal.R.bool.config_overrideRemoteViewsActivityTransition)) {
            TypedArray windowStyle = context.getTheme().obtainStyledAttributes(
                    com.android.internal.R.styleable.Window);
            int windowAnimations = windowStyle.getResourceId(
                    com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
            TypedArray windowAnimationStyle = context.obtainStyledAttributes(
                    windowAnimations, com.android.internal.R.styleable.WindowAnimation);
            handler.setEnterAnimationId(windowAnimationStyle.getResourceId(
                    com.android.internal.R.styleable.
                            WindowAnimation_activityOpenRemoteViewsEnterAnimation, 0));
            windowStyle.recycle();
            windowAnimationStyle.recycle();
        }
    }

    /**
    /**
     * Applies all of the actions to the provided view.
     * Applies all of the actions to the provided view.
     *
     *
+3 −0
Original line number Original line Diff line number Diff line
@@ -54,4 +54,7 @@


    <!-- Do not show the message saying USB is connected in charging mode. -->
    <!-- Do not show the message saying USB is connected in charging mode. -->
    <bool name="config_usbChargingMessage">false</bool>
    <bool name="config_usbChargingMessage">false</bool>

    <!-- Use a custom transition for RemoteViews. -->
    <bool name="config_overrideRemoteViewsActivityTransition">true</bool>
</resources>
</resources>
+7 −0
Original line number Original line Diff line number Diff line
@@ -2150,6 +2150,13 @@ i
              (which is exiting the screen).  The wallpaper remains
              (which is exiting the screen).  The wallpaper remains
              static behind the animation. -->
              static behind the animation. -->
        <attr name="wallpaperIntraCloseExitAnimation" format="reference" />
        <attr name="wallpaperIntraCloseExitAnimation" format="reference" />

        <!--  When opening a new activity from a RemoteViews, this is the
              animation that is run on the next activity (which is entering the
              screen). Requires config_overrideRemoteViewsActivityTransition to
              be true. -->
        <attr name="activityOpenRemoteViewsEnterAnimation" format="reference" />

    </declare-styleable>
    </declare-styleable>


    <!-- ============================= -->
    <!-- ============================= -->
+4 −0
Original line number Original line Diff line number Diff line
@@ -2214,6 +2214,10 @@
    <bool name="config_defaultWindowFeatureOptionsPanel">true</bool>
    <bool name="config_defaultWindowFeatureOptionsPanel">true</bool>
    <bool name="config_defaultWindowFeatureContextMenu">true</bool>
    <bool name="config_defaultWindowFeatureContextMenu">true</bool>


    <!-- If true, the transition for a RemoteViews is read from a resource instead of using the
         default scale-up transition. -->
    <bool name="config_overrideRemoteViewsActivityTransition">false</bool>

    <!-- This config is used to check if the carrier requires converting destination
    <!-- This config is used to check if the carrier requires converting destination
         number before sending out a SMS.
         number before sending out a SMS.
         Formats for this configuration as below:
         Formats for this configuration as below:
+1 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@


    <style name="Animation.Micro.Activity" parent="Animation.Material.Activity">
    <style name="Animation.Micro.Activity" parent="Animation.Material.Activity">
        <item name="activityOpenEnterAnimation">@anim/slide_in_micro</item>
        <item name="activityOpenEnterAnimation">@anim/slide_in_micro</item>
        <item name="activityOpenRemoteViewsEnterAnimation">@anim/slide_in_micro</item>
        <item name="activityOpenExitAnimation">@null</item>
        <item name="activityOpenExitAnimation">@null</item>
        <item name="activityCloseEnterAnimation">@null</item>
        <item name="activityCloseEnterAnimation">@null</item>
        <item name="activityCloseExitAnimation">@anim/slide_out_micro</item>
        <item name="activityCloseExitAnimation">@anim/slide_out_micro</item>
Loading