Merge "Sharesheet - update direct share loading animation" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-23 23:48:41 +00:00
committed by Android (Google) Code Review
7 changed files with 102 additions and 2 deletions

View File

@@ -60,6 +60,7 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
@@ -1680,7 +1681,10 @@ public class ChooserActivity extends ResolverActivity {
final class PlaceHolderTargetInfo extends NotSelectableTargetInfo {
public Drawable getDisplayIcon() {
return getDrawable(R.drawable.resolver_icon_placeholder);
AnimatedVectorDrawable avd = (AnimatedVectorDrawable)
getDrawable(R.drawable.chooser_direct_share_icon_placeholder);
avd.start(); // Start animation after generation
return avd;
}
}

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="36dp"
android:height="36dp"
android:viewportHeight="64"
android:viewportWidth="64">
<group android:name="background">
<path android:pathData="M0,0 L 64,0 64,64 0,64 z"
android:fillColor="@color/chooser_gradient_background"/>
</group>
<!-- Gradient starts offscreen so it is not visible in the first frame before start -->
<group android:name="gradient" android:translateX="-128">
<path
android:pathData="M0,0 L 128,0 128,128 0,128 z">
<aapt:attr name="android:fillColor">
<gradient
android:type="linear"
android:startX="0"
android:endX="128"
android:startY="0"
android:endY="0">
<item
android:color="@android:color/transparent"
android:offset="0.0" />
<item
android:color="@color/chooser_gradient_highlight"
android:offset="0.5" />
<item
android:color="@android:color/transparent"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
</group>
<!-- Use a foregroud with a cutout shape matching direct share inset for appx applied
shadow. Using clip-path is a more elegant solution but leaves awful jaggies around
the path's shape. -->
<group android:name="cover">
<path android:fillColor="?attr/colorBackgroundFloating"
android:pathData="M0,0 L64,0 L64,64 L0,64 L0,0 Z M59.0587325,42.453601 C60.3124932,39.2104785 61,35.6855272 61,32 C61,15.9837423 48.0162577,3 32,3 C15.9837423,3 3,15.9837423 3,32 C3,48.0162577 15.9837423,61 32,61 C35.6855272,61 39.2104785,60.3124932 42.453601,59.0587325 C44.3362195,60.2864794 46.5847839,61 49,61 C55.627417,61 61,55.627417 61,49 C61,46.5847839 60.2864794,44.3362195 59.0587325,42.453601 Z"/>
</group>
</vector>
</aapt:attr>
<!-- This AVD uses special properties so that once started it will loop infinitely with no
need for callbacks to restart. -->
<target android:name="gradient">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="1700"
android:pathData="M -128,0 L 192,0"
android:propertyXName="translateX"
android:repeatMode="restart"
android:repeatCount="infinite"
android:startOffset="0">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.833,0.833 1.0,1.0" />
</aapt:attr>
</objectAnimator>
</aapt:attr>
</target>
</animated-vector>

View File

@@ -14,6 +14,6 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#10000000"/>
<solid android:color="@color/chooser_gradient_background"/>
<size android:width="36dp" android:height="36dp"/>
</shape>

View File

@@ -30,4 +30,6 @@
<color name="notification_material_background_color">@color/black</color>
<color name="chooser_row_divider">@color/list_divider_color_dark</color>
<color name="chooser_gradient_background">@color/loading_gradient_background_color_dark</color>
<color name="chooser_gradient_highlight">@color/loading_gradient_highlight_color_dark</color>
</resources>

View File

@@ -216,4 +216,6 @@
<color name="default_magnifier_color_overlay">#00FFFFFF</color>
<color name="chooser_row_divider">@color/list_divider_color_light</color>
<color name="chooser_gradient_background">@color/loading_gradient_background_color_light</color>
<color name="chooser_gradient_highlight">@color/loading_gradient_highlight_color_light</color>
</resources>

View File

@@ -48,4 +48,8 @@
<color name="list_divider_color_light">#ffdadce0</color>
<color name="list_divider_color_dark">#85ffffff</color>
<color name="loading_gradient_background_color_dark">#2D3033</color>
<color name="loading_gradient_background_color_light">#DADCE0</color>
<color name="loading_gradient_highlight_color_dark">#3C4043</color>
<color name="loading_gradient_highlight_color_light">#F1F3F4</color>
</resources>

View File

@@ -3762,4 +3762,8 @@
<java-symbol type="drawable" name="perm_group_camera" />
<java-symbol type="drawable" name="perm_group_location" />
<java-symbol type="drawable" name="perm_group_microphone" />
<java-symbol type="drawable" name="chooser_direct_share_icon_placeholder" />
<java-symbol type="color" name="chooser_gradient_background" />
<java-symbol type="color" name="chooser_gradient_highlight" />
</resources>