Demo application for new SplashScreen
Bug: 181841992
Test: N/A
Change-Id: I82da62a1b8cd399b92c8270d994aaabc7ab3691c
diff --git a/samples/StartingWindow/Android.bp b/samples/StartingWindow/Android.bp
new file mode 100644
index 0000000..73683b9
--- /dev/null
+++ b/samples/StartingWindow/Android.bp
@@ -0,0 +1,12 @@
+android_app {
+ name: "StartingWindow",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: [
+ "androidx.appcompat_appcompat"
+ ],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/samples/StartingWindow/AndroidManifest.xml b/samples/StartingWindow/AndroidManifest.xml
new file mode 100644
index 0000000..de20407
--- /dev/null
+++ b/samples/StartingWindow/AndroidManifest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.startingwindow">
+
+ <application android:label="@string/app_name"
+ android:icon="@drawable/ic_launcher">
+ <activity
+ android:name=".CustomizeExitActivity"
+ android:label="Starting Window"
+ android:theme="@style/AppTheme"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".SecondActivity"
+ android:label="Second Activity"
+ android:exported="true">
+ </activity>
+ </application>
+</manifest>
\ No newline at end of file
diff --git a/samples/StartingWindow/res/drawable-hdpi/logo_gmail.png b/samples/StartingWindow/res/drawable-hdpi/logo_gmail.png
new file mode 100644
index 0000000..766c864
--- /dev/null
+++ b/samples/StartingWindow/res/drawable-hdpi/logo_gmail.png
Binary files differ
diff --git a/samples/StartingWindow/res/drawable-mdpi/logo_gmail.png b/samples/StartingWindow/res/drawable-mdpi/logo_gmail.png
new file mode 100644
index 0000000..9816fe5
--- /dev/null
+++ b/samples/StartingWindow/res/drawable-mdpi/logo_gmail.png
Binary files differ
diff --git a/samples/StartingWindow/res/drawable-v26/ic_launcher.xml b/samples/StartingWindow/res/drawable-v26/ic_launcher.xml
new file mode 100644
index 0000000..852a12f
--- /dev/null
+++ b/samples/StartingWindow/res/drawable-v26/ic_launcher.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@color/white"/>
+ <foreground>
+ <inset
+ android:drawable="@drawable/logo_gmail"
+ android:insetTop="22.22%"
+ android:insetLeft="22.22%"
+ android:insetBottom="22.22%"
+ android:insetRight="22.22%"
+ />
+ </foreground>
+</adaptive-icon>
\ No newline at end of file
diff --git a/samples/StartingWindow/res/drawable-xhdpi/logo_gmail.png b/samples/StartingWindow/res/drawable-xhdpi/logo_gmail.png
new file mode 100644
index 0000000..a37a04e
--- /dev/null
+++ b/samples/StartingWindow/res/drawable-xhdpi/logo_gmail.png
Binary files differ
diff --git a/samples/StartingWindow/res/drawable-xxhdpi/logo_gmail.png b/samples/StartingWindow/res/drawable-xxhdpi/logo_gmail.png
new file mode 100644
index 0000000..a2294b0
--- /dev/null
+++ b/samples/StartingWindow/res/drawable-xxhdpi/logo_gmail.png
Binary files differ
diff --git a/samples/StartingWindow/res/drawable-xxxhdpi/logo_gmail.png b/samples/StartingWindow/res/drawable-xxxhdpi/logo_gmail.png
new file mode 100644
index 0000000..dcea21a
--- /dev/null
+++ b/samples/StartingWindow/res/drawable-xxxhdpi/logo_gmail.png
Binary files differ
diff --git a/samples/StartingWindow/res/drawable/avd_anim.xml b/samples/StartingWindow/res/drawable/avd_anim.xml
new file mode 100644
index 0000000..19205d4
--- /dev/null
+++ b/samples/StartingWindow/res/drawable/avd_anim.xml
@@ -0,0 +1,94 @@
+<animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
+ <aapt:attr name="android:drawable">
+ <vector android:height="432dp" android:width="432dp" android:viewportHeight="432" android:viewportWidth="432">
+ <group android:name="_R_G">
+ <group android:name="_R_G_L_5_G" android:translateX="216" android:translateY="216" android:scaleX="1.5" android:scaleY="1.5">
+ <path android:name="_R_G_L_5_G_D_0_P_0" android:fillColor="#555555" android:fillAlpha="1" android:fillType="nonZero" android:pathData=" M53.82 -56.7 C53.82,-56.7 43.64,-49.06 43.64,-49.06 C43.64,-49.06 0,-16.34 0,-16.34 C0,-16.34 -43.64,-49.06 -43.64,-49.06 C-43.64,-49.06 -53.82,-56.7 -53.82,-56.7 C-64.6,-64.79 -80,-57.09 -80,-43.61 C-80,-43.61 -80,-29.07 -80,-29.07 C-80,-29.07 -80,49.09 -80,49.09 C-80,55.12 -75.12,60 -69.09,60 C-69.09,60 -43.64,60 -43.64,60 C-43.64,60 -43.64,-1.8 -43.64,-1.8 C-43.64,-1.8 0,30.92 0,30.92 C0,30.92 43.64,-1.8 43.64,-1.8 C43.64,-1.8 43.64,60 43.64,60 C43.64,60 69.09,60 69.09,60 C75.12,60 80,55.12 80,49.09 C80,49.09 80,-29.07 80,-29.07 C80,-29.07 80,-43.61 80,-43.61 C80,-57.09 64.61,-64.79 53.82,-56.7c "/>
+ </group>
+ <group android:name="_R_G_L_4_G" android:translateX="216" android:translateY="216" android:scaleX="1.5" android:scaleY="1.5">
+ <clip-path android:name="mask_x" android:pathData="M53.82 -56.7 C53.82,-56.7 43.64,-49.06 43.64,-49.06 C43.64,-49.06 0,-16.34 0,-16.34 C0,-16.34 -43.64,-49.06 -43.64,-49.06 C-43.64,-49.06 -53.82,-56.7 -53.82,-56.7 C-64.6,-64.79 -80,-57.09 -80,-43.61 C-80,-43.61 -80,-29.07 -80,-29.07 C-80,-29.07 -80,49.09 -80,49.09 C-80,55.12 -75.12,60 -69.09,60 C-69.09,60 -43.64,60 -43.64,60 C-43.64,60 -43.64,-1.8 -43.64,-1.8 C-43.64,-1.8 0,30.92 0,30.92 C0,30.92 43.64,-1.8 43.64,-1.8 C43.64,-1.8 43.64,60 43.64,60 C43.64,60 69.09,60 69.09,60 C75.12,60 80,55.12 80,49.09 C80,49.09 80,-29.07 80,-29.07 C80,-29.07 80,-43.61 80,-43.61 C80,-57.09 64.61,-64.79 53.82,-56.7c"/>
+ <path android:name="_R_G_L_4_G_D_0_P_0" android:fillColor="#2684fc" android:fillAlpha="1" android:fillType="nonZero" android:pathData=" M-80.39 60 C-80.39,60 -105.84,60 -105.84,60 C-111.87,60 -116.75,55.12 -116.75,49.09 C-116.75,49.09 -116.75,-60 -116.75,-60 C-116.75,-60 -80.39,-60 -80.39,-60 C-80.39,-60 -80.39,60 -80.39,60c "/>
+ </group>
+ <group android:name="_R_G_L_3_G" android:translateX="216" android:translateY="216" android:scaleX="1.5" android:scaleY="1.5">
+ <clip-path android:name="mask_x" android:pathData="M53.82 -56.7 C53.82,-56.7 43.64,-49.06 43.64,-49.06 C43.64,-49.06 0,-16.34 0,-16.34 C0,-16.34 -43.64,-49.06 -43.64,-49.06 C-43.64,-49.06 -53.82,-56.7 -53.82,-56.7 C-64.6,-64.79 -80,-57.09 -80,-43.61 C-80,-43.61 -80,-29.07 -80,-29.07 C-80,-29.07 -80,49.09 -80,49.09 C-80,55.12 -75.12,60 -69.09,60 C-69.09,60 -43.64,60 -43.64,60 C-43.64,60 -43.64,-1.8 -43.64,-1.8 C-43.64,-1.8 0,30.92 0,30.92 C0,30.92 43.64,-1.8 43.64,-1.8 C43.64,-1.8 43.64,60 43.64,60 C43.64,60 69.09,60 69.09,60 C75.12,60 80,55.12 80,49.09 C80,49.09 80,-29.07 80,-29.07 C80,-29.07 80,-43.61 80,-43.61 C80,-57.09 64.61,-64.79 53.82,-56.7c"/>
+ <path android:name="_R_G_L_3_G_D_0_P_0" android:fillColor="#00ac47" android:fillAlpha="1" android:fillType="nonZero" android:pathData="M80.64 60 C80.64,60 106.09,60 106.09,60 C112.12,60 117,55.12 117,49.09 C117,49.09 117,-60 117,-60 C117,-60 80.64,-60 80.64,-60 C80.64,-60 80.64,60 80.64,60c "/>
+ </group>
+ <group android:name="_R_G_L_2_G" android:translateX="216" android:translateY="216" android:scaleX="1.5" android:scaleY="1.5">
+ <clip-path android:name="mask_x" android:pathData="M53.82 -56.7 C53.82,-56.7 43.64,-49.06 43.64,-49.06 C43.64,-49.06 0,-16.34 0,-16.34 C0,-16.34 -43.64,-49.06 -43.64,-49.06 C-43.64,-49.06 -53.82,-56.7 -53.82,-56.7 C-64.6,-64.79 -80,-57.09 -80,-43.61 C-80,-43.61 -80,-29.07 -80,-29.07 C-80,-29.07 -80,49.09 -80,49.09 C-80,55.12 -75.12,60 -69.09,60 C-69.09,60 -43.64,60 -43.64,60 C-43.64,60 -43.64,-1.8 -43.64,-1.8 C-43.64,-1.8 0,30.92 0,30.92 C0,30.92 43.64,-1.8 43.64,-1.8 C43.64,-1.8 43.64,60 43.64,60 C43.64,60 69.09,60 69.09,60 C75.12,60 80,55.12 80,49.09 C80,49.09 80,-29.07 80,-29.07 C80,-29.07 80,-43.61 80,-43.61 C80,-57.09 64.61,-64.79 53.82,-56.7c"/>
+ <path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#fe2c25" android:fillAlpha="1" android:fillType="nonZero" android:pathData="M53.82 -104.7 C53.82,-104.7 0,-64.34 0,-64.34 C0,-64.34 -53.82,-104.7 -53.82,-104.7 C-64.6,-112.79 -80,-105.09 -80,-91.61 C-80,-91.61 -80,-77.07 -80,-77.07 C-80,-77.07 0,-17.08 0,-17.08 C0,-17.08 80,-77.07 80,-77.07 C80,-77.07 80,-91.61 80,-91.61 C80,-105.09 64.61,-112.79 53.82,-104.7c "/>
+ </group>
+ <group android:name="_R_G_L_1_G" android:translateX="216" android:translateY="216" android:scaleX="1.5" android:scaleY="1.5">
+ <clip-path android:name="mask_x" android:pathData="M43.64 -1.8 C43.64,-1.8 43.64,-49.06 43.64,-49.06 C43.64,-49.06 53.82,-56.7 53.82,-56.7 C64.61,-64.79 80,-57.09 80,-43.61 C80,-43.61 80,-1.8 80,-1.8 C80,-1.8 43.64,-1.8 43.64,-1.8c"/>
+ <path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="#ffba00" android:fillAlpha="1" android:fillType="nonZero" android:pathData="M80.64 -135 C80.64,-135 117,-135 117,-135 C117,-135 117,-104.07 117,-104.07 C117,-104.07 80.64,-76.8 80.64,-76.8 C80.64,-76.8 80.64,-135 80.64,-135c "/>
+ </group>
+ <group android:name="_R_G_L_0_G" android:translateX="216" android:translateY="216" android:scaleX="1.5" android:scaleY="1.5">
+ <clip-path android:name="mask_x" android:pathData="M-43.64 -1.8 C-43.64,-1.8 -80,-1.8 -80,-1.8 C-80,-1.8 -80,-43.61 -80,-43.61 C-80,-57.09 -64.6,-64.79 -53.82,-56.7 C-53.82,-56.7 -43.64,-49.06 -43.64,-49.06 C-43.64,-49.06 -43.64,-1.8 -43.64,-1.8c"/>
+ <path android:name="_R_G_L_0_G_D_0_P_0" android:fillColor="#d70007" android:fillAlpha="1" android:fillType="nonZero" android:pathData=" M-117 -104.07 C-117,-104.07 -117,-135 -117,-135 C-117,-135 -80.64,-135 -80.64,-135 C-80.64,-135 -80.64,-76.8 -80.64,-76.8 C-80.64,-76.8 -117,-104.07 -117,-104.07c "/>
+ </group>
+ </group>
+ <group android:name="time_group"/>
+ </vector>
+ </aapt:attr>
+ <target android:name="_R_G_L_4_G_D_0_P_0">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="pathData" android:duration="1567" android:startOffset="233" android:valueFrom="M-80.39 60 C-80.39,60 -105.84,60 -105.84,60 C-111.87,60 -116.75,55.12 -116.75,49.09 C-116.75,49.09 -116.75,-60 -116.75,-60 C-116.75,-60 -80.39,-60 -80.39,-60 C-80.39,-60 -80.39,60 -80.39,60c " android:valueTo=" M-43.64 60 C-43.64,60 -69.09,60 -69.09,60 C-75.12,60 -80,55.12 -80,49.09 C-80,49.09 -80,-60 -80,-60 C-80,-60 -43.64,-60 -43.64,-60 C-43.64,-60 -43.64,60 -43.64,60c " android:valueType="pathType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0,1 1.0,1.0"/>
+ </aapt:attr>
+ </objectAnimator>
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="_R_G_L_3_G_D_0_P_0">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="pathData" android:duration="1567" android:startOffset="233" android:valueFrom=" M80.64 60 C80.64,60 106.09,60 106.09,60 C112.12,60 117,55.12 117,49.09 C117,49.09 117,-60 117,-60 C117,-60 80.64,-60 80.64,-60 C80.64,-60 80.64,60 80.64,60c " android:valueTo=" M43.64 60 C43.64,60 69.09,60 69.09,60 C75.12,60 80,55.12 80,49.09 C80,49.09 80,-60 80,-60 C80,-60 43.64,-60 43.64,-60 C43.64,-60 43.64,60 43.64,60c " android:valueType="pathType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0,1 1.0,1.0"/>
+ </aapt:attr>
+ </objectAnimator>
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="_R_G_L_2_G_D_0_P_0">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="pathData" android:duration="1567" android:startOffset="233" android:valueFrom="M53.82 -104.7 C53.82,-104.7 0,-64.34 0,-64.34 C0,-64.34 -53.82,-104.7 -53.82,-104.7 C-64.6,-112.79 -80,-105.09 -80,-91.61 C-80,-91.61 -80,-77.07 -80,-77.07 C-80,-77.07 0,-17.08 0,-17.08 C0,-17.08 80,-77.07 80,-77.07 C80,-77.07 80,-91.61 80,-91.61 C80,-105.09 64.61,-112.79 53.82,-104.7c" android:valueTo="M53.82 -56.7 C53.82,-56.7 0,-16.34 0,-16.34 C0,-16.34 -53.82,-56.7 -53.82,-56.7 C-64.6,-64.79 -80,-57.09 -80,-43.61 C-80,-43.61 -80,-29.07 -80,-29.07 C-80,-29.07 0,30.92 0,30.92 C0,30.92 80,-29.07 80,-29.07 C80,-29.07 80,-43.61 80,-43.61 C80,-57.09 64.61,-64.79 53.82,-56.7c " android:valueType="pathType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0,1 1.0,1.0"/>
+ </aapt:attr>
+ </objectAnimator>
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="_R_G_L_1_G_D_0_P_0">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="pathData" android:duration="1567" android:startOffset="233" android:valueFrom=" M80.64 -135 C80.64,-135 117,-135 117,-135 C117,-135 117,-104.07 117,-104.07 C117,-104.07 80.64,-76.8 80.64,-76.8 C80.64,-76.8 80.64,-135 80.64,-135c " android:valueTo=" M43.64 -60 C43.64,-60 80,-60 80,-60 C80,-60 80,-29.07 80,-29.07 C80,-29.07 43.64,-1.8 43.64,-1.8 C43.64,-1.8 43.64,-60 43.64,-60c " android:valueType="pathType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0,1 1.0,1.0"/>
+ </aapt:attr>
+ </objectAnimator>
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="_R_G_L_0_G_D_0_P_0">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="pathData" android:duration="1567" android:startOffset="233" android:valueFrom=" M-117 -104.07 C-117,-104.07 -117,-135 -117,-135 C-117,-135 -80.64,-135 -80.64,-135 C-80.64,-135 -80.64,-76.8 -80.64,-76.8 C-80.64,-76.8 -117,-104.07 -117,-104.07c " android:valueTo=" M-80 -29.07 C-80,-29.07 -80,-60 -80,-60 C-80,-60 -43.64,-60 -43.64,-60 C-43.64,-60 -43.64,-1.8 -43.64,-1.8 C-43.64,-1.8 -80,-29.07 -80,-29.07c " android:valueType="pathType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0,1 1.0,1.0"/>
+ </aapt:attr>
+ </objectAnimator>
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="time_group">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:propertyName="translateX" android:duration="2017" android:startOffset="0" android:valueFrom="0" android:valueTo="1" android:valueType="floatType"/>
+ </set>
+ </aapt:attr>
+ </target>
+</animated-vector>
diff --git a/samples/StartingWindow/res/drawable/ic_launcher.xml b/samples/StartingWindow/res/drawable/ic_launcher.xml
new file mode 100644
index 0000000..b380473
--- /dev/null
+++ b/samples/StartingWindow/res/drawable/ic_launcher.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+ android:src="@drawable/logo_gmail" />
\ No newline at end of file
diff --git a/samples/StartingWindow/res/layout/main_activity.xml b/samples/StartingWindow/res/layout/main_activity.xml
new file mode 100644
index 0000000..a2a221d
--- /dev/null
+++ b/samples/StartingWindow/res/layout/main_activity.xml
@@ -0,0 +1,109 @@
+<!--
+ ~ Copyright (C) 2021 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="70dp"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="SampleItem" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/samples/StartingWindow/res/values-night/styles.xml b/samples/StartingWindow/res/values-night/styles.xml
new file mode 100644
index 0000000..2707a87
--- /dev/null
+++ b/samples/StartingWindow/res/values-night/styles.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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
+ -->
+
+<resources>
+ <style name="AppTheme" parent="BaseAppTheme">
+ <!-- We make sure our splashscreen dark background matches our window background -->
+ <item name="android:windowSplashScreenBackground">#171717</item>
+ <item name="android:windowBackground">#171717</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/samples/StartingWindow/res/values/colors.xml b/samples/StartingWindow/res/values/colors.xml
new file mode 100644
index 0000000..f082268
--- /dev/null
+++ b/samples/StartingWindow/res/values/colors.xml
@@ -0,0 +1,20 @@
+<!--
+ ~ Copyright (C) 2020 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
+ -->
+
+<resources>
+ <drawable name="red">#ff0000</drawable>
+ <color name="white">#FFFFFF</color>
+</resources>
\ No newline at end of file
diff --git a/samples/StartingWindow/res/values/strings.xml b/samples/StartingWindow/res/values/strings.xml
new file mode 100644
index 0000000..39d4f52
--- /dev/null
+++ b/samples/StartingWindow/res/values/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<resources>
+ <string name="app_name">StartingWindow</string>
+</resources>
\ No newline at end of file
diff --git a/samples/StartingWindow/res/values/styles.xml b/samples/StartingWindow/res/values/styles.xml
new file mode 100644
index 0000000..4a7606c
--- /dev/null
+++ b/samples/StartingWindow/res/values/styles.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<resources>
+
+ <style name="BaseAppTheme" parent="Theme.AppCompat.DayNight">
+ <!-- Splashscreen Attributes -->
+ <item name="android:windowSplashScreenBackground">#ffffff</item>
+ <item name="android:windowSplashScreenAnimatedIcon">@drawable/avd_anim</item>
+
+ <!-- Here we want to match the duration of our AVD -->
+ <item name="android:windowSplashScreenAnimationDuration">900</item>
+
+ <!-- Other -->
+ <item name="android:windowTranslucentStatus">true</item>
+ </style>
+
+ <style name="AppTheme" parent="BaseAppTheme">
+ </style>
+</resources>
\ No newline at end of file
diff --git a/samples/StartingWindow/src/com/example/android/startingwindow/CustomizeExitActivity.java b/samples/StartingWindow/src/com/example/android/startingwindow/CustomizeExitActivity.java
new file mode 100644
index 0000000..c5eb8a8
--- /dev/null
+++ b/samples/StartingWindow/src/com/example/android/startingwindow/CustomizeExitActivity.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+package com.example.android.startingwindow;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.pm.ShortcutInfo;
+import android.content.pm.ShortcutManager;
+import android.content.res.Resources;
+import android.os.Build.VERSION_CODES;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Process;
+import android.os.SystemClock;
+import android.provider.Settings.Global;
+import android.util.TypedValue;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver.OnPreDrawListener;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Interpolator;
+import android.view.animation.PathInterpolator;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.LinearLayout.LayoutParams;
+import android.window.SplashScreen;
+import android.window.SplashScreenView;
+
+import androidx.annotation.RequiresApi;
+
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.Collections;
+
+@RequiresApi(api = VERSION_CODES.S)
+public class CustomizeExitActivity extends Activity {
+
+ public static final Interpolator EASE_IN_OUT = new PathInterpolator(.48f, .11f, .53f, .87f);
+ public static final Interpolator ACCELERATE = new AccelerateInterpolator();
+ public static final int MOCK_DELAY = 200;
+ public static final int MARGIN_ANIMATION_DURATION = 800;
+ public static final int SPLASHSCREEN_ALPHA_ANIMATION_DURATION = 500;
+ public static final int SPLASHSCREEN_TY_ANIMATION_DURATION = 1000;
+ public static final boolean WAIT_FOR_AVD_TO_FINISH = true;
+ public static final boolean DEBUG = false;
+
+ boolean appReady = false;
+ private float animationScale = 1.0f;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main_activity);
+ getWindow().setDecorFitsSystemWindows(false);
+
+ // On Android S, this new method has been added to Activity
+ SplashScreen splashScreen = getSplashScreen();
+
+ // Setting an OnExitAnimationListener on the SplashScreen indicates
+ // to the system that the application will handle the exit animation.
+ // This means that the SplashScreen will be inflated in the application
+ // process once the process has started.
+ // Otherwise, the splashscreen stays in the SystemUI process and will be
+ // dismissed once the first frame of the app is drawn
+ splashScreen.setOnExitAnimationListener(this::onSplashScreenExit);
+
+ animationScale = Global.getFloat(getContentResolver(),
+ Global.ANIMATOR_DURATION_SCALE, 1.0f);
+
+ // Create some artificial delay to simulate some local database fetch for example
+ new Handler(Looper.getMainLooper())
+ .postDelayed(() -> appReady = true, (long) (MOCK_DELAY * animationScale));
+
+ // We use a pre draw listener to delay the removal of the splashscreen
+ // until our app is ready
+ final View content = findViewById(android.R.id.content);
+ content.getViewTreeObserver().addOnPreDrawListener(
+ new OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ if (appReady) {
+ content.getViewTreeObserver().removeOnPreDrawListener(this);
+ return true;
+ }
+ return false;
+ }
+ }
+ );
+ }
+
+ private void onSplashScreenExit(SplashScreenView view) {
+ // At this point the first frame of the application is drawn and
+ // the SplashScreen is ready to be removed.
+
+ // It is now up to the application to animate the provided view
+ // since the listener is registered
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.setDuration(500);
+
+ ObjectAnimator translationY = ObjectAnimator.ofFloat(view, "translationY", 0, view.getHeight());
+ translationY.setInterpolator(ACCELERATE);
+
+ ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1, 0);
+ alpha.setInterpolator(ACCELERATE);
+
+ // To get fancy, we'll also animate our content
+ ValueAnimator marginAnimator = createContentAnimation();
+
+ animatorSet.playTogether(translationY, alpha, marginAnimator);
+ animatorSet.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ view.remove();
+ }
+ });
+
+ // If we want to wait for our Animated Vector Drawable to finish animating, we can compute
+ // the remaining time to delay the start of the exit animation
+ long delayMillis = Instant.now()
+ .until(view.getIconAnimationStart().plus(view.getIconAnimationDuration()),
+ ChronoUnit.MILLIS);
+ view.postDelayed(animatorSet::start, (long) (delayMillis * animationScale));
+ }
+
+ private ValueAnimator createContentAnimation() {
+ Resources r = getResources();
+ float marginStart = TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, 30, r.getDisplayMetrics()
+ );
+
+ float marginEnd = TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, 10, r.getDisplayMetrics()
+ );
+
+ ValueAnimator marginAnimator = ValueAnimator.ofFloat(marginStart, marginEnd);
+ marginAnimator.addUpdateListener(valueAnimator -> {
+ LinearLayout container = findViewById(R.id.container);
+ int marginTop = Math.round((Float) valueAnimator.getAnimatedValue());
+ for (int i = 0; i < container.getChildCount(); i++) {
+ View child = container.getChildAt(i);
+ ((LayoutParams) child.getLayoutParams()).setMargins(0, marginTop, 0, 0);
+ }
+ container.requestLayout();
+ });
+ marginAnimator.setInterpolator(EASE_IN_OUT);
+ return marginAnimator;
+ }
+
+ @SuppressLint("SetTextI18n")
+ private void createShortcutButton() {
+ final Button Button = new Button(this);
+ Button.setText("Create shortcut");
+ Button.setOnClickListener((v) -> createShortcut());
+ addContentView(Button, new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+ }
+
+ private void createShortcut() {
+ ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
+ String shortcutId1 = "shortcutId1";
+ shortcutManager.removeDynamicShortcuts(Collections.singletonList(shortcutId1));
+ final ShortcutInfo.Builder b = new ShortcutInfo.Builder(this, shortcutId1);
+ final ComponentName name = new ComponentName("com.example.android.startingwindow",
+ "com.example.android.startingwindow.SecondActivity");
+ final Intent i = new Intent(Intent.ACTION_MAIN)
+ .setComponent(name);
+ ShortcutInfo shortcut = b.setShortLabel("label")
+ .setLongLabel("Long label")
+ .setIntent(i)
+ .setStartingTheme(android.R.style.Theme_Black_NoTitleBar_Fullscreen)
+ .build();
+ shortcutManager.addDynamicShortcuts(Collections.singletonList(shortcut));
+ }
+
+ @Override
+ protected void onPause() {
+ // For the sake of this demo app, we kill the app on pause so
+ // we see a cold start animation for each launch
+ super.onPause();
+ finishAndRemoveTask();
+ Process.killProcess(Process.myPid());
+ }
+}
\ No newline at end of file
diff --git a/samples/StartingWindow/src/com/example/android/startingwindow/SecondActivity.java b/samples/StartingWindow/src/com/example/android/startingwindow/SecondActivity.java
new file mode 100644
index 0000000..50b454c
--- /dev/null
+++ b/samples/StartingWindow/src/com/example/android/startingwindow/SecondActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+package com.example.android.startingwindow;
+
+import android.app.Activity;
+
+public class SecondActivity extends Activity {
+
+}
\ No newline at end of file