Snap for 7418644 from 0e93c27e6e to tm-release
Change-Id: I03008466755315646a1eda38c6c4b5edffb90c5e
This commit is contained in:
commit
cb11da7fa2
47 files changed
+2212
-148
No files matched your search
@@ -112,6 +112,7 @@ android_library {
|
||||
"androidx.preference_preference",
|
||||
"androidx.slice_slice-view",
|
||||
"androidx.cardview_cardview",
|
||||
"com.google.android.material_material",
|
||||
"iconloader_base",
|
||||
],
|
||||
manifest: "AndroidManifest-common.xml",
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
<activity
|
||||
android:name="com.android.launcher3.settings.SettingsActivity"
|
||||
android:label="@string/settings_button_text"
|
||||
android:theme="@style/HomeSettingsTheme"
|
||||
android:theme="@style/HomeSettings.Theme"
|
||||
android:exported="true"
|
||||
android:autoRemoveFromRecents="true">
|
||||
<intent-filter>
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
<?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.
|
||||
-->
|
||||
<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:name="root"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28.0"
|
||||
android:viewportHeight="28.0">
|
||||
<!-- Use scaleX to flip icon so arrows always point in the direction of motion -->
|
||||
<group android:name="icon" android:pivotX="14" android:pivotY="14"
|
||||
android:scaleX="1">
|
||||
<!-- Tint color to be set directly -->
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12.02,10.83L9.25,8.06l2.77,-2.77l1.12,1.12l-0.85,0.86h5.16c0.72,0 1.31,0.56 1.31,1.26v9.16l-1.58,-1.58V8.85h-4.89l0.86,0.86L12.02,10.83zM15.98,17.17l-1.12,1.12l0.85,0.86h-4.88v-7.26L9.25,10.3v9.17c0,0.7 0.59,1.26 1.31,1.26h5.16v0.01l-0.85,0.85l1.12,1.12l2.77,-2.77L15.98,17.17z"/>
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
|
||||
<!-- Repeat all animations 5 times but don't fade out at the end -->
|
||||
<target android:name="root">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="icon">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="100"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="-90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,187 @@
|
||||
<?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.
|
||||
-->
|
||||
<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:name="root"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28.0"
|
||||
android:viewportHeight="28.0">
|
||||
<!-- Use scaleX to flip icon so arrows always point in the direction of motion -->
|
||||
<group android:name="icon" android:pivotX="14" android:pivotY="14"
|
||||
android:scaleX="1">
|
||||
<!-- Tint color to be set directly -->
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12.02,10.83L9.25,8.06l2.77,-2.77l1.12,1.12l-0.85,0.86h5.16c0.72,0 1.31,0.56 1.31,1.26v9.16l-1.58,-1.58V8.85h-4.89l0.86,0.86L12.02,10.83zM15.98,17.17l-1.12,1.12l0.85,0.86h-4.88v-7.26L9.25,10.3v9.17c0,0.7 0.59,1.26 1.31,1.26h5.16v0.01l-0.85,0.85l1.12,1.12l2.77,-2.77L15.98,17.17z"/>
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
|
||||
<!-- Repeat all animations 5 times but don't fade out at the end -->
|
||||
<target android:name="root">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="icon">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="100"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="0">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="0">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="0">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="0">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="0">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,187 @@
|
||||
<?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.
|
||||
-->
|
||||
<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:name="root"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28.0"
|
||||
android:viewportHeight="28.0">
|
||||
<!-- Use scaleX to flip icon so arrows always point in the direction of motion -->
|
||||
<group android:name="icon" android:pivotX="14" android:pivotY="14"
|
||||
android:scaleX="-1">
|
||||
<!-- Tint color to be set directly -->
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12.02,10.83L9.25,8.06l2.77,-2.77l1.12,1.12l-0.85,0.86h5.16c0.72,0 1.31,0.56 1.31,1.26v9.16l-1.58,-1.58V8.85h-4.89l0.86,0.86L12.02,10.83zM15.98,17.17l-1.12,1.12l0.85,0.86h-4.88v-7.26L9.25,10.3v9.17c0,0.7 0.59,1.26 1.31,1.26h5.16v0.01l-0.85,0.85l1.12,1.12l2.77,-2.77L15.98,17.17z"/>
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
|
||||
<!-- Repeat all animations 5 times but don't fade out at the end -->
|
||||
<target android:name="root">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="icon">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="100"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="0"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="90">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,187 @@
|
||||
<?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.
|
||||
-->
|
||||
<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:name="root"
|
||||
android:width="28dp"
|
||||
android:height="28dp"
|
||||
android:viewportWidth="28.0"
|
||||
android:viewportHeight="28.0">
|
||||
<!-- Use scaleX to flip icon so arrows always point in the direction of motion -->
|
||||
<group android:name="icon" android:pivotX="14" android:pivotY="14"
|
||||
android:scaleX="-1">
|
||||
<!-- Tint color to be set directly -->
|
||||
<path android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12.02,10.83L9.25,8.06l2.77,-2.77l1.12,1.12l-0.85,0.86h5.16c0.72,0 1.31,0.56 1.31,1.26v9.16l-1.58,-1.58V8.85h-4.89l0.86,0.86L12.02,10.83zM15.98,17.17l-1.12,1.12l0.85,0.86h-4.88v-7.26L9.25,10.3v9.17c0,0.7 0.59,1.26 1.31,1.26h5.16v0.01l-0.85,0.85l1.12,1.12l2.77,-2.77L15.98,17.17z"/>
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
|
||||
<!-- Repeat all animations 5 times but don't fade out at the end -->
|
||||
<target android:name="root">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
<!-- Linear fade out -->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="1700"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"/>
|
||||
<!-- Linear fade in-->
|
||||
<objectAnimator android:propertyName="alpha"
|
||||
android:duration="100"
|
||||
android:startOffset="100"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:anim/linear_interpolator" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="icon">
|
||||
<aapt:attr name="android:animation">
|
||||
<set android:ordering="sequentially">
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="100"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="180">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="180">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="180">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="180">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
|
||||
<!-- Reset rotation position for fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:startOffset="1300"
|
||||
android:duration="100"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="90"/>
|
||||
|
||||
<!-- Icon rotation with start timing offset after fade in -->
|
||||
<objectAnimator android:propertyName="rotation"
|
||||
android:duration="600"
|
||||
android:valueFrom="90"
|
||||
android:valueTo="180">
|
||||
<aapt:attr name="android:interpolator">
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.408,1.181 0.674,1.08 1.0,1.0"/>
|
||||
</aapt:attr>
|
||||
</objectAnimator>
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -25,15 +25,15 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_name"
|
||||
android:background="?android:attr/textColorPrimary"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:background="?android:attr/colorPrimary"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:textSize="24sp"/>
|
||||
android:paddingTop="@dimen/task_menu_vertical_padding"
|
||||
android:paddingBottom="@dimen/task_menu_vertical_padding"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_option_layout"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
|
||||
android:background="?android:attr/textColorPrimary"
|
||||
android:background="?android:attr/colorPrimary"
|
||||
android:theme="@style/PopupItem" >
|
||||
|
||||
<View
|
||||
@@ -30,7 +30,7 @@
|
||||
android:layout_height="@dimen/system_shortcut_icon_size"
|
||||
android:layout_marginStart="@dimen/task_menu_option_start_margin"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:backgroundTint="?android:attr/textColorPrimaryInverse"/>
|
||||
android:backgroundTint="?android:attr/textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
style="@style/BaseIcon"
|
||||
@@ -39,7 +39,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/task_menu_option_start_margin"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:focusable="false" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -29,7 +29,7 @@
|
||||
android:layout_gravity="bottom" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/system_button_layout"
|
||||
android:id="@+id/nav_button_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/taskbar_nav_buttons_spacing"
|
||||
@@ -44,6 +44,15 @@
|
||||
android:forceHasOverlappingRendering="false"
|
||||
android:gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contextual_button_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/taskbar_nav_buttons_spacing"
|
||||
android:paddingRight="@dimen/taskbar_nav_buttons_spacing"
|
||||
android:forceHasOverlappingRendering="false"
|
||||
android:gravity="center" />
|
||||
|
||||
</com.android.launcher3.taskbar.TaskbarView>
|
||||
|
||||
<com.android.launcher3.taskbar.ImeBarView
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
|
||||
<!-- Total space (start + end) between the task card and the edge of the screen
|
||||
in various configurations -->
|
||||
<dimen name="task_card_menu_option_vertical_padding">8dp</dimen>
|
||||
<dimen name="task_card_menu_option_vertical_padding">16dp</dimen>
|
||||
<dimen name="task_menu_vertical_padding">8dp</dimen>
|
||||
<dimen name="task_card_margin">8dp</dimen>
|
||||
<dimen name="task_card_menu_shadow_height">3dp</dimen>
|
||||
<dimen name="task_menu_option_start_margin">12dp</dimen>
|
||||
|
||||
@@ -65,7 +65,9 @@ import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Pair;
|
||||
import android.util.Size;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
|
||||
@@ -97,6 +99,7 @@ import com.android.quickstep.views.FloatingWidgetView;
|
||||
import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.system.ActivityCompat;
|
||||
import com.android.systemui.shared.system.ActivityOptionsCompat;
|
||||
import com.android.systemui.shared.system.BlurUtils;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
|
||||
@@ -920,12 +923,39 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
BACKGROUND_APP.getDepth(mLauncher))
|
||||
.setDuration(APP_LAUNCH_DURATION);
|
||||
if (allowBlurringLauncher) {
|
||||
depthController.setSurfaceToApp(RemoteAnimationProvider.findLowestOpaqueLayerTarget(
|
||||
appTargets, MODE_OPENING));
|
||||
final SurfaceControl dimLayer;
|
||||
if (BlurUtils.supportsBlursOnWindows()) {
|
||||
// Create a temporary effect layer, that lives on top of launcher, so we can apply
|
||||
// the blur to it. The EffectLayer will be fullscreen, which will help with caching
|
||||
// optimizations on the SurfaceFlinger side:
|
||||
// - Results would be able to be cached as a texture
|
||||
// - There won't be texture allocation overhead, because EffectLayers don't have
|
||||
// buffers
|
||||
ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl();
|
||||
SurfaceControl parent = viewRootImpl != null
|
||||
? viewRootImpl.getSurfaceControl()
|
||||
: null;
|
||||
dimLayer = new SurfaceControl.Builder()
|
||||
.setName("Blur layer")
|
||||
.setParent(parent)
|
||||
.setOpaque(false)
|
||||
.setHidden(false)
|
||||
.setEffectLayer()
|
||||
.build();
|
||||
} else {
|
||||
dimLayer = null;
|
||||
}
|
||||
|
||||
depthController.setSurface(dimLayer);
|
||||
backgroundRadiusAnim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
depthController.setSurfaceToApp(null);
|
||||
depthController.setSurface(null);
|
||||
if (dimLayer != null) {
|
||||
new SurfaceControl.Transaction()
|
||||
.remove(dimLayer)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1386,14 +1416,14 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
: APP_LAUNCH_ALPHA_DOWN_DURATION;
|
||||
iconAlphaStart = hasSplashScreen && !hasDifferentAppIcon ? 0 : 1f;
|
||||
|
||||
// TOOD: Share value from shell when available.
|
||||
final float windowIconSize = Utilities.pxFromSp(108, r.getDisplayMetrics());
|
||||
final int windowIconSize = ResourceUtils.getDimenByName("starting_surface_icon_size",
|
||||
r, 108);
|
||||
|
||||
cropCenterXStart = windowTargetBounds.centerX();
|
||||
cropCenterYStart = windowTargetBounds.centerY();
|
||||
|
||||
cropWidthStart = (int) windowIconSize;
|
||||
cropHeightStart = (int) windowIconSize;
|
||||
cropWidthStart = windowIconSize;
|
||||
cropHeightStart = windowIconSize;
|
||||
|
||||
cropWidthEnd = windowTargetBounds.width();
|
||||
cropHeightEnd = windowTargetBounds.height();
|
||||
|
||||
@@ -25,7 +25,9 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.os.IBinder;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.View;
|
||||
import android.view.ViewRootImpl;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
@@ -37,9 +39,6 @@ import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.statemanager.StateManager.StateHandler;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.systemui.shared.system.BlurUtils;
|
||||
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
|
||||
import com.android.systemui.shared.system.SurfaceControlCompat;
|
||||
import com.android.systemui.shared.system.TransactionCompat;
|
||||
import com.android.systemui.shared.system.WallpaperManagerCompat;
|
||||
|
||||
/**
|
||||
@@ -91,7 +90,8 @@ public class DepthController implements StateHandler<LauncherState>,
|
||||
@Override
|
||||
public void onDraw() {
|
||||
View view = mLauncher.getDragLayer();
|
||||
setSurface(new SurfaceControlCompat(view));
|
||||
ViewRootImpl viewRootImpl = view.getViewRootImpl();
|
||||
setSurface(viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null);
|
||||
view.post(() -> view.getViewTreeObserver().removeOnDrawListener(this));
|
||||
}
|
||||
};
|
||||
@@ -102,7 +102,7 @@ public class DepthController implements StateHandler<LauncherState>,
|
||||
*/
|
||||
private int mMaxBlurRadius;
|
||||
private WallpaperManagerCompat mWallpaperManager;
|
||||
private SurfaceControlCompat mSurface;
|
||||
private SurfaceControl mSurface;
|
||||
/**
|
||||
* Ratio from 0 to 1, where 0 is fully zoomed out, and 1 is zoomed in.
|
||||
* @see android.service.wallpaper.WallpaperService.Engine#onZoomChanged(float)
|
||||
@@ -157,11 +157,7 @@ public class DepthController implements StateHandler<LauncherState>,
|
||||
/**
|
||||
* Sets the specified app target surface to apply the blur to.
|
||||
*/
|
||||
public void setSurfaceToApp(RemoteAnimationTargetCompat target) {
|
||||
setSurface(target == null ? null : target.leash);
|
||||
}
|
||||
|
||||
private void setSurface(SurfaceControlCompat surface) {
|
||||
public void setSurface(SurfaceControl surface) {
|
||||
if (mSurface != surface) {
|
||||
mSurface = surface;
|
||||
if (surface != null) {
|
||||
@@ -219,7 +215,7 @@ public class DepthController implements StateHandler<LauncherState>,
|
||||
if (supportsBlur) {
|
||||
boolean isOpaque = mLauncher.getScrimView().isFullyOpaque();
|
||||
int blur = isOpaque ? 0 : (int) (mDepth * mMaxBlurRadius);
|
||||
new TransactionCompat()
|
||||
new SurfaceControl.Transaction()
|
||||
.setBackgroundBlurRadius(mSurface, blur)
|
||||
.setOpaque(mSurface, isOpaque)
|
||||
.apply();
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.widget.ImageView;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton;
|
||||
import com.android.launcher3.taskbar.contextual.RotationContextButton;
|
||||
|
||||
/**
|
||||
* Creates Buttons for Taskbar for 3 button nav.
|
||||
@@ -68,6 +69,11 @@ public class ButtonProvider {
|
||||
return getButtonForDrawable(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH);
|
||||
}
|
||||
|
||||
public RotationContextButton getContextualRotation() {
|
||||
// Rotation suggestion button
|
||||
return new RotationContextButton(mContext);
|
||||
}
|
||||
|
||||
private View getButtonForDrawable(@DrawableRes int drawableId, @TaskbarButton int buttonType) {
|
||||
ImageView buttonView = new ImageView(mContext);
|
||||
buttonView.setImageResource(drawableId);
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
public class ImeBarView extends RelativeLayout {
|
||||
|
||||
private ButtonProvider mButtonProvider;
|
||||
private View mImeView;
|
||||
|
||||
public ImeBarView(Context context) {
|
||||
@@ -41,8 +40,8 @@ public class ImeBarView extends RelativeLayout {
|
||||
}
|
||||
|
||||
public void init(ButtonProvider buttonProvider) {
|
||||
mButtonProvider = buttonProvider;
|
||||
|
||||
// TODO (b/187966005), maybe need to replace ime switcher button with
|
||||
// RotationContextButton when device rotates
|
||||
ActivityContext context = getActivityContext();
|
||||
RelativeLayout.LayoutParams imeParams = new RelativeLayout.LayoutParams(
|
||||
context.getDeviceProfile().iconSizePx,
|
||||
@@ -56,13 +55,13 @@ public class ImeBarView extends RelativeLayout {
|
||||
downParams.addRule(ALIGN_PARENT_START);
|
||||
|
||||
// Down Arrow
|
||||
View downView = mButtonProvider.getDown();
|
||||
View downView = buttonProvider.getDown();
|
||||
downView.setLayoutParams(downParams);
|
||||
downView.setRotation(-90);
|
||||
addView(downView);
|
||||
|
||||
// IME switcher button
|
||||
mImeView = mButtonProvider.getImeSwitcher();
|
||||
mImeView = buttonProvider.getImeSwitcher();
|
||||
mImeView.setLayoutParams(imeParams);
|
||||
addView(mImeView);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
|
||||
|
||||
/**
|
||||
* A data source which integrates with a Launcher instance
|
||||
* TODO: Rename to have Launcher prefix
|
||||
@@ -51,6 +50,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
|
||||
private @Nullable Animator mAnimator;
|
||||
private boolean mIsAnimatingToLauncher;
|
||||
private ContextualRotationNotifier mContextualRotationNotifier;
|
||||
|
||||
public LauncherTaskbarUIController(
|
||||
BaseQuickstepLauncher launcher, TaskbarActivityContext context) {
|
||||
@@ -67,7 +67,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
protected void onCreate(ContextualRotationNotifier notifier) {
|
||||
mContextualRotationNotifier = notifier;
|
||||
mTaskbarStateHandler.setAnimationController(mTaskbarAnimationController);
|
||||
mTaskbarAnimationController.init();
|
||||
mHotseatController.init();
|
||||
@@ -82,6 +83,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
// End this first, in case it relies on properties that are about to be cleaned up.
|
||||
mAnimator.end();
|
||||
}
|
||||
mContextualRotationNotifier = null;
|
||||
mTaskbarStateHandler.setAnimationController(null);
|
||||
mTaskbarAnimationController.cleanup();
|
||||
mHotseatController.cleanup();
|
||||
@@ -105,6 +107,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
@Override
|
||||
public void updateTaskbarVisibilityAlpha(float alpha) {
|
||||
mTaskbarView.setAlpha(alpha);
|
||||
if (mContextualRotationNotifier != null) {
|
||||
mContextualRotationNotifier.onTaskbarVisibilityChanged(alpha == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -272,4 +277,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
void updateTaskbarScale(float scale);
|
||||
void updateTaskbarTranslationY(float translationY);
|
||||
}
|
||||
|
||||
public interface ContextualRotationNotifier {
|
||||
void onTaskbarVisibilityChanged(boolean showing);
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton;
|
||||
import com.android.launcher3.taskbar.contextual.RotationButtonController;
|
||||
import com.android.launcher3.touch.ItemClickHandler;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
import com.android.launcher3.util.Themes;
|
||||
@@ -88,7 +89,9 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
private int mLastRequestedNonFullscreenHeight;
|
||||
|
||||
private final SysUINavigationMode.Mode mNavMode;
|
||||
private final SystemTaskbarNotificationManager mSystemTaskbarNotificationManager;
|
||||
private final TaskbarNavButtonController mNavButtonController;
|
||||
private final RotationButtonController mRotationButtonController;
|
||||
|
||||
private final boolean mIsSafeModeEnabled;
|
||||
|
||||
@@ -98,12 +101,43 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
private final View.OnClickListener mOnTaskbarIconClickListener;
|
||||
private final View.OnLongClickListener mOnTaskbarIconLongClickListener;
|
||||
|
||||
private final TaskbarManager.SystemTaskbarNotifier mSystemTaskbarNotifier =
|
||||
new TaskbarManager.SystemTaskbarNotifier() {
|
||||
@Override
|
||||
public void updateImeStatus(int displayId, int vis, int backDisposition,
|
||||
boolean showImeSwitcher) {
|
||||
/*
|
||||
* When in 3 button nav, sysui flags don't get called since we prevent
|
||||
* sysui nav bar from instantiating at all, which is what's responsible for
|
||||
* sending sysui state flags over.
|
||||
*/
|
||||
mIconController.updateImeStatus(displayId, vis, showImeSwitcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
mRotationButtonController.onRotationProposal(rotation, isValid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(int displayId, int state1, int state2, boolean animate) {
|
||||
mRotationButtonController.onDisable2FlagChanged(state2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemBarAttributesChanged(int displayId, int behavior) {
|
||||
mRotationButtonController.onBehaviorChanged(displayId, behavior);
|
||||
}
|
||||
};
|
||||
|
||||
public TaskbarActivityContext(Context windowContext, DeviceProfile dp,
|
||||
TaskbarNavButtonController buttonController) {
|
||||
TaskbarNavButtonController buttonController,
|
||||
SystemTaskbarNotificationManager systemTaskbarNotificationManager) {
|
||||
super(windowContext, Themes.getActivityThemeRes(windowContext));
|
||||
mDeviceProfile = dp;
|
||||
mNavButtonController = buttonController;
|
||||
mNavMode = SysUINavigationMode.getMode(windowContext);
|
||||
mSystemTaskbarNotificationManager = systemTaskbarNotificationManager;
|
||||
mIsSafeModeEnabled = TraceHelper.allowIpcs("isSafeMode",
|
||||
() -> getPackageManager().isSafeMode());
|
||||
|
||||
@@ -118,7 +152,11 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
mLayoutInflater = LayoutInflater.from(this).cloneInContext(this);
|
||||
mDragLayer = (TaskbarDragLayer) mLayoutInflater
|
||||
.inflate(R.layout.taskbar, null, false);
|
||||
mIconController = new TaskbarIconController(this, mDragLayer);
|
||||
|
||||
mRotationButtonController = new RotationButtonController(this,
|
||||
R.color.popup_color_primary_light, R.color.popup_color_primary_light);
|
||||
mIconController = new TaskbarIconController(this, mDragLayer,
|
||||
mRotationButtonController);
|
||||
|
||||
Display display = windowContext.getDisplay();
|
||||
Context c = display.getDisplayId() == Display.DEFAULT_DISPLAY
|
||||
@@ -149,8 +187,13 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
new int[] { ITYPE_EXTRA_NAVIGATION_BAR, ITYPE_BOTTOM_TAPPABLE_ELEMENT }
|
||||
);
|
||||
|
||||
mIconController.init(mOnTaskbarIconClickListener, mOnTaskbarIconLongClickListener);
|
||||
mIconController.init(mOnTaskbarIconClickListener, mOnTaskbarIconLongClickListener,
|
||||
mNavMode);
|
||||
mWindowManager.addView(mDragLayer, mWindowLayoutParams);
|
||||
if (mNavMode == Mode.THREE_BUTTONS) {
|
||||
mSystemTaskbarNotificationManager
|
||||
.registerSystemTaskbarNotifications(mSystemTaskbarNotifier);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canShowNavButtons() {
|
||||
@@ -189,7 +232,10 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
mUIController.onDestroy();
|
||||
mUIController = uiController;
|
||||
mIconController.setUIController(mUIController);
|
||||
mUIController.onCreate();
|
||||
mUIController.onCreate(mRotationButtonController::onTaskBarVisibilityChange);
|
||||
if (mNavMode == Mode.THREE_BUTTONS) {
|
||||
mRotationButtonController.init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,6 +245,11 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
setUIController(TaskbarUIController.DEFAULT);
|
||||
mIconController.onDestroy();
|
||||
mWindowManager.removeViewImmediate(mDragLayer);
|
||||
if (mNavMode == Mode.THREE_BUTTONS) {
|
||||
mSystemTaskbarNotificationManager.removeSystemTaskbarNotifications(
|
||||
mSystemTaskbarNotifier);
|
||||
mRotationButtonController.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
void onNavigationButtonClick(@TaskbarButton int buttonType) {
|
||||
@@ -212,16 +263,6 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
mIconController.setImeIsVisible(isImeVisible);
|
||||
}
|
||||
|
||||
/**
|
||||
* When in 3 button nav, the above doesn't get called since we prevent sysui nav bar from
|
||||
* instantiating at all, which is what's responsible for sending sysui state flags over.
|
||||
*
|
||||
* @param vis IME visibility flag
|
||||
*/
|
||||
public void updateImeStatus(int displayId, int vis, boolean showImeSwitcher) {
|
||||
mIconController.updateImeStatus(displayId, vis, showImeSwitcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the TaskbarContainer to MATCH_PARENT vs original Taskbar size.
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,8 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.AlphaUpdateListener;
|
||||
import com.android.launcher3.taskbar.contextual.RotationButtonController;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
import com.android.systemui.shared.system.ViewTreeObserverWrapper.InsetsInfo;
|
||||
|
||||
/**
|
||||
@@ -45,18 +47,22 @@ public class TaskbarIconController {
|
||||
|
||||
private final TaskbarView mTaskbarView;
|
||||
private final ImeBarView mImeBarView;
|
||||
private final RotationButtonController mRotationButtonController;
|
||||
|
||||
@NonNull
|
||||
private TaskbarUIController mUIController = TaskbarUIController.DEFAULT;
|
||||
|
||||
TaskbarIconController(TaskbarActivityContext activity, TaskbarDragLayer dragLayer) {
|
||||
TaskbarIconController(TaskbarActivityContext activity, TaskbarDragLayer dragLayer,
|
||||
RotationButtonController rotationButtonController) {
|
||||
mActivity = activity;
|
||||
mDragLayer = dragLayer;
|
||||
mTaskbarView = mDragLayer.findViewById(R.id.taskbar_view);
|
||||
mImeBarView = mDragLayer.findViewById(R.id.ime_bar_view);
|
||||
mRotationButtonController = rotationButtonController;
|
||||
}
|
||||
|
||||
public void init(OnClickListener clickListener, OnLongClickListener longClickListener) {
|
||||
public void init(OnClickListener clickListener, OnLongClickListener longClickListener,
|
||||
SysUINavigationMode.Mode navMode) {
|
||||
mDragLayer.addOnLayoutChangeListener((v, a, b, c, d, e, f, g, h) ->
|
||||
mUIController.alignRealHotseatWithTaskbar());
|
||||
|
||||
@@ -67,6 +73,9 @@ public class TaskbarIconController {
|
||||
mTaskbarView.getLayoutParams().height = mActivity.getDeviceProfile().taskbarSize;
|
||||
|
||||
mDragLayer.init(new TaskbarDragLayerCallbacks(), mTaskbarView);
|
||||
if (navMode == SysUINavigationMode.Mode.THREE_BUTTONS) {
|
||||
mRotationButtonController.setRotationButton(mTaskbarView.getContextualRotationButton());
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
@@ -127,6 +136,12 @@ public class TaskbarIconController {
|
||||
mTaskbarView.mSystemButtonContainer, mTempRect);
|
||||
insetsInfo.touchableRegion.set(mTempRect);
|
||||
}
|
||||
if (mTaskbarView.mContextualButtonContainer.getVisibility() == VISIBLE) {
|
||||
mDragLayer.getDescendantRectRelativeToSelf(
|
||||
mTaskbarView.mContextualButtonContainer, mTempRect);
|
||||
insetsInfo.touchableRegion.union(mTempRect);
|
||||
}
|
||||
|
||||
insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,14 @@ import com.android.quickstep.SysUINavigationMode;
|
||||
import com.android.quickstep.SysUINavigationMode.Mode;
|
||||
import com.android.quickstep.TouchInteractionService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class to manager taskbar lifecycle
|
||||
* Class to manage taskbar lifecycle
|
||||
*/
|
||||
public class TaskbarManager implements DisplayController.DisplayInfoChangeListener,
|
||||
SysUINavigationMode.NavigationModeChangeListener {
|
||||
SysUINavigationMode.NavigationModeChangeListener, SystemTaskbarNotificationManager {
|
||||
|
||||
private final Context mContext;
|
||||
private final DisplayController mDisplayController;
|
||||
@@ -59,6 +62,8 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
|
||||
private boolean mUserUnlocked = false;
|
||||
|
||||
private List<SystemTaskbarNotifier> mSystemTaskbarNotifiers = new ArrayList<>();
|
||||
|
||||
public TaskbarManager(TouchInteractionService service) {
|
||||
mDisplayController = DisplayController.INSTANCE.get(service);
|
||||
mSysUINavigationMode = SysUINavigationMode.INSTANCE.get(service);
|
||||
@@ -124,7 +129,7 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
return;
|
||||
}
|
||||
mTaskbarActivityContext = new TaskbarActivityContext(
|
||||
mContext, dp.copy(mContext), mNavButtonController);
|
||||
mContext, dp.copy(mContext), mNavButtonController, this);
|
||||
mTaskbarActivityContext.init();
|
||||
if (mLauncher != null) {
|
||||
mTaskbarActivityContext.setUIController(
|
||||
@@ -132,6 +137,9 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - I don't think this is the best place for these pass through methods,
|
||||
// maybe directly in TaskbarIconController?
|
||||
|
||||
/**
|
||||
* See {@link com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags}
|
||||
* @param systemUiStateFlags The latest SystemUiStateFlags
|
||||
@@ -143,6 +151,16 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
}
|
||||
}
|
||||
|
||||
public void registerSystemTaskbarNotifications(SystemTaskbarNotifier notifier) {
|
||||
if (!mSystemTaskbarNotifiers.contains(notifier)) {
|
||||
mSystemTaskbarNotifiers.add(notifier);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSystemTaskbarNotifications(SystemTaskbarNotifier notifier) {
|
||||
mSystemTaskbarNotifiers.remove(notifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* When in 3 button nav, the above doesn't get called since we prevent sysui nav bar from
|
||||
* instantiating at all, which is what's responsible for sending sysui state flags over.
|
||||
@@ -153,8 +171,26 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
*/
|
||||
public void updateImeStatus(int displayId, int vis, int backDisposition,
|
||||
boolean showImeSwitcher) {
|
||||
if (mTaskbarActivityContext != null) {
|
||||
mTaskbarActivityContext.updateImeStatus(displayId, vis, showImeSwitcher);
|
||||
for (SystemTaskbarNotifier notifier : mSystemTaskbarNotifiers) {
|
||||
notifier.updateImeStatus(displayId, vis, backDisposition, showImeSwitcher);
|
||||
}
|
||||
}
|
||||
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
for (SystemTaskbarNotifier notifier : mSystemTaskbarNotifiers) {
|
||||
notifier.onRotationProposal(rotation, isValid);
|
||||
}
|
||||
}
|
||||
|
||||
public void disable(int displayId, int state1, int state2, boolean animate) {
|
||||
for (SystemTaskbarNotifier notifier : mSystemTaskbarNotifiers) {
|
||||
notifier.disable(displayId, state1, state2, animate);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSystemBarAttributesChanged(int displayId, int behavior) {
|
||||
for (SystemTaskbarNotifier notifier : mSystemTaskbarNotifiers) {
|
||||
notifier.onSystemBarAttributesChanged(displayId, behavior);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,4 +202,18 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||
mDisplayController.removeChangeListener(this);
|
||||
mSysUINavigationMode.removeModeChangeListener(this);
|
||||
}
|
||||
|
||||
public interface SystemTaskbarNotifier {
|
||||
void updateImeStatus(int displayId, int vis, int backDisposition,
|
||||
boolean showImeSwitcher);
|
||||
void onRotationProposal(int rotation, boolean isValid);
|
||||
void disable(int displayId, int state1, int state2, boolean animate);
|
||||
void onSystemBarAttributesChanged(int displayId, int behavior);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface SystemTaskbarNotificationManager {
|
||||
void registerSystemTaskbarNotifications(TaskbarManager.SystemTaskbarNotifier notifier);
|
||||
void removeSystemTaskbarNotifications(TaskbarManager.SystemTaskbarNotifier notifier);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class TaskbarUIController {
|
||||
*/
|
||||
public void alignRealHotseatWithTaskbar() { }
|
||||
|
||||
protected void onCreate() { }
|
||||
protected void onCreate(LauncherTaskbarUIController.ContextualRotationNotifier notifier) { }
|
||||
|
||||
protected void onDestroy() { }
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.taskbar.contextual.RotationContextButton;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
/**
|
||||
@@ -67,6 +68,7 @@ public class TaskbarView extends LinearLayout implements FolderIcon.FolderIconPa
|
||||
|
||||
LinearLayout mSystemButtonContainer;
|
||||
LinearLayout mHotseatIconsContainer;
|
||||
LinearLayout mContextualButtonContainer;
|
||||
|
||||
// Delegate touches to the closest view if within mIconTouchSize.
|
||||
private boolean mDelegateTargeted;
|
||||
@@ -79,6 +81,7 @@ public class TaskbarView extends LinearLayout implements FolderIcon.FolderIconPa
|
||||
|
||||
/** Provider of buttons added to taskbar in 3 button nav */
|
||||
private ButtonProvider mButtonProvider;
|
||||
private RotationContextButton mContextualRotationButton;
|
||||
|
||||
private boolean mDisableRelayout;
|
||||
private boolean mAreHolesAllowed;
|
||||
@@ -112,8 +115,9 @@ public class TaskbarView extends LinearLayout implements FolderIcon.FolderIconPa
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mSystemButtonContainer = findViewById(R.id.system_button_layout);
|
||||
mSystemButtonContainer = findViewById(R.id.nav_button_layout);
|
||||
mHotseatIconsContainer = findViewById(R.id.hotseat_icons_layout);
|
||||
mContextualButtonContainer = findViewById(R.id.contextual_button_layout);
|
||||
}
|
||||
|
||||
protected void init(TaskbarIconController.TaskbarViewCallbacks callbacks,
|
||||
@@ -132,6 +136,10 @@ public class TaskbarView extends LinearLayout implements FolderIcon.FolderIconPa
|
||||
|
||||
int numHotseatIcons = mActivityContext.getDeviceProfile().numShownHotseatIcons;
|
||||
updateHotseatItems(new ItemInfo[numHotseatIcons]);
|
||||
|
||||
if (mActivityContext.canShowNavButtons()) {
|
||||
createContextualRegion();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,6 +386,16 @@ public class TaskbarView extends LinearLayout implements FolderIcon.FolderIconPa
|
||||
}
|
||||
}
|
||||
|
||||
private void createContextualRegion() {
|
||||
mContextualRotationButton = mButtonProvider.getContextualRotation();
|
||||
mContextualRotationButton.setVisibility(GONE);
|
||||
mContextualButtonContainer.addView(mContextualRotationButton);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RotationContextButton getContextualRotationButton() {
|
||||
return mContextualRotationButton;
|
||||
}
|
||||
// FolderIconParent implemented methods.
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 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.android.launcher3.taskbar.contextual;
|
||||
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Interface of a rotation button that interacts {@link RotationButtonController}.
|
||||
* This interface exists because of the two different styles of rotation button in Sysui,
|
||||
* one in contextual for 3 button nav and a floating rotation button for gestural.
|
||||
* Keeping the interface for eventual migration of floating button, so some methods are
|
||||
* pass through to "super" while others are trivially implemented.
|
||||
*
|
||||
* Changes:
|
||||
* * Directly use AnimatedVectorDrawable instead of KeyButtonDrawable
|
||||
*/
|
||||
public interface RotationButton {
|
||||
void setRotationButtonController(RotationButtonController rotationButtonController);
|
||||
View getCurrentView();
|
||||
boolean show();
|
||||
boolean hide();
|
||||
boolean isVisible();
|
||||
void updateIcon(int lightIconColor, int darkIconColor);
|
||||
void setOnClickListener(View.OnClickListener onClickListener);
|
||||
void setOnHoverListener(View.OnHoverListener onHoverListener);
|
||||
AnimatedVectorDrawable getImageDrawable();
|
||||
void setDarkIntensity(float darkIntensity);
|
||||
default boolean acceptRotationProposal() {
|
||||
return getCurrentView() != null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
/*
|
||||
* Copyright 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.android.launcher3.taskbar.contextual;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.internal.view.RotationPolicy.NATURAL_ROTATION;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.ColorInt;
|
||||
import android.annotation.DrawableRes;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.IRotationWatcher;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.view.WindowManagerGlobal;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import com.android.internal.logging.UiEvent;
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.internal.logging.UiEventLoggerImpl;
|
||||
import com.android.internal.view.RotationPolicy;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.systemui.shared.recents.utilities.Utilities;
|
||||
import com.android.systemui.shared.recents.utilities.ViewRippler;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Copied over from the SysUI equivalent class. Known issues/things not ported over
|
||||
* * When rotation button visible and in auto-hide mode, we ask auto-hide controller to
|
||||
* keep the navbar around longer. Will need to implement if we use auto-hide on taskbar
|
||||
*
|
||||
* Contains logic that deals with showing a rotate suggestion button with animation.
|
||||
*/
|
||||
public class RotationButtonController {
|
||||
|
||||
private static final String TAG = "StatusBar/RotationButtonController";
|
||||
private static final int BUTTON_FADE_IN_OUT_DURATION_MS = 100;
|
||||
private static final int NAVBAR_HIDDEN_PENDING_ICON_TIMEOUT_MS = 20000;
|
||||
|
||||
private static final int NUM_ACCEPTED_ROTATION_SUGGESTIONS_FOR_INTRODUCTION = 3;
|
||||
|
||||
private final Context mContext;
|
||||
private final Handler mMainThreadHandler = new Handler(Looper.getMainLooper());
|
||||
private final UiEventLogger mUiEventLogger = new UiEventLoggerImpl();
|
||||
private final ViewRippler mViewRippler = new ViewRippler();
|
||||
private final DisplayController mDisplayController;
|
||||
private RotationButton mRotationButton;
|
||||
|
||||
private int mLastRotationSuggestion;
|
||||
private boolean mPendingRotationSuggestion;
|
||||
private boolean mHoveringRotationSuggestion;
|
||||
private final AccessibilityManager mAccessibilityManager;
|
||||
private final TaskStackListenerImpl mTaskStackListener;
|
||||
private boolean mListenersRegistered = false;
|
||||
private boolean mIsTaskbarShowing;
|
||||
@SuppressLint("InlinedApi")
|
||||
private @WindowInsetsController.Behavior
|
||||
int mBehavior = WindowInsetsController.BEHAVIOR_DEFAULT;
|
||||
private boolean mSkipOverrideUserLockPrefsOnce;
|
||||
private final int mLightIconColor;
|
||||
private final int mDarkIconColor;
|
||||
private int mIconResId = R.drawable.ic_sysbar_rotate_button_ccw_start_90;
|
||||
|
||||
private final Runnable mRemoveRotationProposal =
|
||||
() -> setRotateSuggestionButtonState(false /* visible */);
|
||||
private final Runnable mCancelPendingRotationProposal =
|
||||
() -> mPendingRotationSuggestion = false;
|
||||
private Animator mRotateHideAnimator;
|
||||
|
||||
|
||||
private final IRotationWatcher.Stub mRotationWatcher = new IRotationWatcher.Stub() {
|
||||
@Override
|
||||
public void onRotationChanged(final int rotation) throws RemoteException {
|
||||
// We need this to be scheduled as early as possible to beat the redrawing of
|
||||
// window in response to the orientation change.
|
||||
mMainThreadHandler.postAtFrontOfQueue(() -> {
|
||||
// If the screen rotation changes while locked, potentially update lock to flow with
|
||||
// new screen rotation and hide any showing suggestions.
|
||||
if (isRotationLocked()) {
|
||||
if (shouldOverrideUserLockPrefs(rotation)) {
|
||||
setRotationLockedAtAngle(rotation);
|
||||
}
|
||||
setRotateSuggestionButtonState(false /* visible */, true /* forced */);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines if rotation suggestions disabled2 flag exists in flag
|
||||
* @param disable2Flags see if rotation suggestion flag exists in this flag
|
||||
* @return whether flag exists
|
||||
*/
|
||||
static boolean hasDisable2RotateSuggestionFlag(int disable2Flags) {
|
||||
return (disable2Flags & StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS) != 0;
|
||||
}
|
||||
|
||||
public RotationButtonController(Context context, @ColorInt int lightIconColor,
|
||||
@ColorInt int darkIconColor) {
|
||||
mContext = context;
|
||||
mLightIconColor = lightIconColor;
|
||||
mDarkIconColor = darkIconColor;
|
||||
|
||||
mAccessibilityManager = AccessibilityManager.getInstance(context);
|
||||
mTaskStackListener = new TaskStackListenerImpl();
|
||||
mDisplayController = DisplayController.INSTANCE.getNoCreate();
|
||||
}
|
||||
|
||||
public void setRotationButton(RotationButton rotationButton) {
|
||||
mRotationButton = rotationButton;
|
||||
mRotationButton.setRotationButtonController(this);
|
||||
mRotationButton.setOnClickListener(this::onRotateSuggestionClick);
|
||||
mRotationButton.setOnHoverListener(this::onRotateSuggestionHover);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
registerListeners();
|
||||
if (mDisplayController.getInfo().id != DEFAULT_DISPLAY) {
|
||||
// Currently there is no accelerometer sensor on non-default display, disable fixed
|
||||
// rotation for non-default display
|
||||
onDisable2FlagChanged(StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
unregisterListeners();
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
if (mListenersRegistered) {
|
||||
return;
|
||||
}
|
||||
|
||||
mListenersRegistered = true;
|
||||
try {
|
||||
WindowManagerGlobal.getWindowManagerService()
|
||||
.watchRotation(mRotationWatcher, mDisplayController.getInfo().id);
|
||||
} catch (IllegalArgumentException e) {
|
||||
mListenersRegistered = false;
|
||||
Log.w(TAG, "RegisterListeners for the display failed");
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "RegisterListeners caught a RemoteException", e);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(mTaskStackListener);
|
||||
}
|
||||
|
||||
void unregisterListeners() {
|
||||
if (!mListenersRegistered) {
|
||||
return;
|
||||
}
|
||||
|
||||
mListenersRegistered = false;
|
||||
try {
|
||||
WindowManagerGlobal.getWindowManagerService().removeRotationWatcher(mRotationWatcher);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "UnregisterListeners caught a RemoteException", e);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(mTaskStackListener);
|
||||
}
|
||||
|
||||
void setRotationLockedAtAngle(int rotationSuggestion) {
|
||||
RotationPolicy.setRotationLockAtAngle(mContext, true, rotationSuggestion);
|
||||
}
|
||||
|
||||
public boolean isRotationLocked() {
|
||||
return RotationPolicy.isRotationLocked(mContext);
|
||||
}
|
||||
|
||||
public void setRotateSuggestionButtonState(boolean visible) {
|
||||
setRotateSuggestionButtonState(visible, false /* force */);
|
||||
}
|
||||
|
||||
void setRotateSuggestionButtonState(final boolean visible, final boolean force) {
|
||||
// At any point the button can become invisible because an a11y service became active.
|
||||
// Similarly, a call to make the button visible may be rejected because an a11y service is
|
||||
// active. Must account for this.
|
||||
// Rerun a show animation to indicate change but don't rerun a hide animation
|
||||
if (!visible && !mRotationButton.isVisible()) return;
|
||||
|
||||
final View view = mRotationButton.getCurrentView();
|
||||
if (view == null) return;
|
||||
|
||||
final AnimatedVectorDrawable currentDrawable = mRotationButton.getImageDrawable();
|
||||
if (currentDrawable == null) return;
|
||||
|
||||
// Clear any pending suggestion flag as it has either been nullified or is being shown
|
||||
mPendingRotationSuggestion = false;
|
||||
mMainThreadHandler.removeCallbacks(mCancelPendingRotationProposal);
|
||||
|
||||
// Handle the visibility change and animation
|
||||
if (visible) { // Appear and change (cannot force)
|
||||
// Stop and clear any currently running hide animations
|
||||
if (mRotateHideAnimator != null && mRotateHideAnimator.isRunning()) {
|
||||
mRotateHideAnimator.cancel();
|
||||
}
|
||||
mRotateHideAnimator = null;
|
||||
|
||||
// Reset the alpha if any has changed due to hide animation
|
||||
view.setAlpha(1f);
|
||||
|
||||
// Run the rotate icon's animation if it has one
|
||||
currentDrawable.reset();
|
||||
currentDrawable.start();
|
||||
|
||||
// TODO(b/187754252): No idea why this doesn't work. If we remove the "false"
|
||||
// we see the animation show the pressed state... but it only shows the first time.
|
||||
if (!isRotateSuggestionIntroduced()) mViewRippler.start(view);
|
||||
|
||||
// Set visibility unless a11y service is active.
|
||||
mRotationButton.show();
|
||||
} else { // Hide
|
||||
mViewRippler.stop(); // Prevent any pending ripples, force hide or not
|
||||
|
||||
if (force) {
|
||||
// If a hide animator is running stop it and make invisible
|
||||
if (mRotateHideAnimator != null && mRotateHideAnimator.isRunning()) {
|
||||
mRotateHideAnimator.pause();
|
||||
}
|
||||
mRotationButton.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't start any new hide animations if one is running
|
||||
if (mRotateHideAnimator != null && mRotateHideAnimator.isRunning()) return;
|
||||
|
||||
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha", 0f);
|
||||
fadeOut.setDuration(BUTTON_FADE_IN_OUT_DURATION_MS);
|
||||
fadeOut.setInterpolator(LINEAR);
|
||||
fadeOut.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mRotationButton.hide();
|
||||
}
|
||||
});
|
||||
|
||||
mRotateHideAnimator = fadeOut;
|
||||
fadeOut.start();
|
||||
}
|
||||
}
|
||||
|
||||
void setDarkIntensity(float darkIntensity) {
|
||||
mRotationButton.setDarkIntensity(darkIntensity);
|
||||
}
|
||||
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
int windowRotation = mDisplayController.getInfo().rotation;
|
||||
|
||||
if (!mRotationButton.acceptRotationProposal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// This method will be called on rotation suggestion changes even if the proposed rotation
|
||||
// is not valid for the top app. Use invalid rotation choices as a signal to remove the
|
||||
// rotate button if shown.
|
||||
if (!isValid) {
|
||||
setRotateSuggestionButtonState(false /* visible */);
|
||||
return;
|
||||
}
|
||||
|
||||
// If window rotation matches suggested rotation, remove any current suggestions
|
||||
if (rotation == windowRotation) {
|
||||
mMainThreadHandler.removeCallbacks(mRemoveRotationProposal);
|
||||
setRotateSuggestionButtonState(false /* visible */);
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare to show the navbar icon by updating the icon style to change anim params
|
||||
mLastRotationSuggestion = rotation; // Remember rotation for click
|
||||
final boolean rotationCCW = Utilities.isRotationAnimationCCW(windowRotation, rotation);
|
||||
if (windowRotation == Surface.ROTATION_0 || windowRotation == Surface.ROTATION_180) {
|
||||
mIconResId = rotationCCW
|
||||
? R.drawable.ic_sysbar_rotate_button_ccw_start_90
|
||||
: R.drawable.ic_sysbar_rotate_button_cw_start_90;
|
||||
} else { // 90 or 270
|
||||
mIconResId = rotationCCW
|
||||
? R.drawable.ic_sysbar_rotate_button_ccw_start_0
|
||||
: R.drawable.ic_sysbar_rotate_button_ccw_start_0;
|
||||
}
|
||||
mRotationButton.updateIcon(mLightIconColor, mDarkIconColor);
|
||||
|
||||
if (canShowRotationButton()) {
|
||||
// The navbar is visible / it's in visual immersive mode, so show the icon right away
|
||||
showAndLogRotationSuggestion();
|
||||
} else {
|
||||
// If the navbar isn't shown, flag the rotate icon to be shown should the navbar become
|
||||
// visible given some time limit.
|
||||
mPendingRotationSuggestion = true;
|
||||
mMainThreadHandler.removeCallbacks(mCancelPendingRotationProposal);
|
||||
mMainThreadHandler.postDelayed(mCancelPendingRotationProposal,
|
||||
NAVBAR_HIDDEN_PENDING_ICON_TIMEOUT_MS);
|
||||
}
|
||||
}
|
||||
|
||||
public void onDisable2FlagChanged(int state2) {
|
||||
final boolean rotateSuggestionsDisabled = hasDisable2RotateSuggestionFlag(state2);
|
||||
if (rotateSuggestionsDisabled) onRotationSuggestionsDisabled();
|
||||
}
|
||||
|
||||
public void onBehaviorChanged(int displayId, @WindowInsetsController.Behavior int behavior) {
|
||||
if (mDisplayController.getInfo().id != displayId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mBehavior != behavior) {
|
||||
mBehavior = behavior;
|
||||
showPendingRotationButtonIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
public void onTaskBarVisibilityChange(boolean showing) {
|
||||
if (mIsTaskbarShowing != showing) {
|
||||
mIsTaskbarShowing = showing;
|
||||
showPendingRotationButtonIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
private void showPendingRotationButtonIfNeeded() {
|
||||
if (canShowRotationButton() && mPendingRotationSuggestion) {
|
||||
showAndLogRotationSuggestion();
|
||||
}
|
||||
}
|
||||
|
||||
/** Return true when either the task bar is visible or it's in visual immersive mode. */
|
||||
@SuppressLint("InlinedApi")
|
||||
private boolean canShowRotationButton() {
|
||||
return mIsTaskbarShowing || mBehavior == WindowInsetsController.BEHAVIOR_DEFAULT;
|
||||
}
|
||||
|
||||
public @DrawableRes
|
||||
int getIconResId() {
|
||||
return mIconResId;
|
||||
}
|
||||
|
||||
public @ColorInt int getLightIconColor() {
|
||||
return mLightIconColor;
|
||||
}
|
||||
|
||||
public @ColorInt int getDarkIconColor() {
|
||||
return mDarkIconColor;
|
||||
}
|
||||
|
||||
private void onRotateSuggestionClick(View v) {
|
||||
mUiEventLogger.log(RotationButtonEvent.ROTATION_SUGGESTION_ACCEPTED);
|
||||
incrementNumAcceptedRotationSuggestionsIfNeeded();
|
||||
setRotationLockedAtAngle(mLastRotationSuggestion);
|
||||
}
|
||||
|
||||
private boolean onRotateSuggestionHover(View v, MotionEvent event) {
|
||||
final int action = event.getActionMasked();
|
||||
mHoveringRotationSuggestion = (action == MotionEvent.ACTION_HOVER_ENTER)
|
||||
|| (action == MotionEvent.ACTION_HOVER_MOVE);
|
||||
rescheduleRotationTimeout(true /* reasonHover */);
|
||||
return false; // Must return false so a11y hover events are dispatched correctly.
|
||||
}
|
||||
|
||||
private void onRotationSuggestionsDisabled() {
|
||||
// Immediately hide the rotate button and clear any planned removal
|
||||
setRotateSuggestionButtonState(false /* visible */, true /* force */);
|
||||
mMainThreadHandler.removeCallbacks(mRemoveRotationProposal);
|
||||
}
|
||||
|
||||
private void showAndLogRotationSuggestion() {
|
||||
setRotateSuggestionButtonState(true /* visible */);
|
||||
rescheduleRotationTimeout(false /* reasonHover */);
|
||||
mUiEventLogger.log(RotationButtonEvent.ROTATION_SUGGESTION_SHOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes {@link #shouldOverrideUserLockPrefs} always return {@code false} once. It is used to
|
||||
* avoid losing original user rotation when display rotation is changed by entering the fixed
|
||||
* orientation overview.
|
||||
*/
|
||||
void setSkipOverrideUserLockPrefsOnce() {
|
||||
mSkipOverrideUserLockPrefsOnce = true;
|
||||
}
|
||||
|
||||
private boolean shouldOverrideUserLockPrefs(final int rotation) {
|
||||
if (mSkipOverrideUserLockPrefsOnce) {
|
||||
mSkipOverrideUserLockPrefsOnce = false;
|
||||
return false;
|
||||
}
|
||||
// Only override user prefs when returning to the natural rotation (normally portrait).
|
||||
// Don't let apps that force landscape or 180 alter user lock.
|
||||
return rotation == NATURAL_ROTATION;
|
||||
}
|
||||
|
||||
private void rescheduleRotationTimeout(final boolean reasonHover) {
|
||||
// May be called due to a new rotation proposal or a change in hover state
|
||||
if (reasonHover) {
|
||||
// Don't reschedule if a hide animator is running
|
||||
if (mRotateHideAnimator != null && mRotateHideAnimator.isRunning()) return;
|
||||
// Don't reschedule if not visible
|
||||
if (!mRotationButton.isVisible()) return;
|
||||
}
|
||||
|
||||
// Stop any pending removal
|
||||
mMainThreadHandler.removeCallbacks(mRemoveRotationProposal);
|
||||
// Schedule timeout
|
||||
mMainThreadHandler.postDelayed(mRemoveRotationProposal,
|
||||
computeRotationProposalTimeout());
|
||||
}
|
||||
|
||||
private int computeRotationProposalTimeout() {
|
||||
return mAccessibilityManager.getRecommendedTimeoutMillis(
|
||||
mHoveringRotationSuggestion ? 16000 : 5000,
|
||||
AccessibilityManager.FLAG_CONTENT_CONTROLS);
|
||||
}
|
||||
|
||||
private boolean isRotateSuggestionIntroduced() {
|
||||
ContentResolver cr = mContext.getContentResolver();
|
||||
return Settings.Secure.getInt(cr, Settings.Secure.NUM_ROTATION_SUGGESTIONS_ACCEPTED, 0)
|
||||
>= NUM_ACCEPTED_ROTATION_SUGGESTIONS_FOR_INTRODUCTION;
|
||||
}
|
||||
|
||||
private void incrementNumAcceptedRotationSuggestionsIfNeeded() {
|
||||
// Get the number of accepted suggestions
|
||||
ContentResolver cr = mContext.getContentResolver();
|
||||
final int numSuggestions = Settings.Secure.getInt(cr,
|
||||
Settings.Secure.NUM_ROTATION_SUGGESTIONS_ACCEPTED, 0);
|
||||
|
||||
// Increment the number of accepted suggestions only if it would change intro mode
|
||||
if (numSuggestions < NUM_ACCEPTED_ROTATION_SUGGESTIONS_FOR_INTRODUCTION) {
|
||||
Settings.Secure.putInt(cr, Settings.Secure.NUM_ROTATION_SUGGESTIONS_ACCEPTED,
|
||||
numSuggestions + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private class TaskStackListenerImpl extends TaskStackChangeListener {
|
||||
// Invalidate any rotation suggestion on task change or activity orientation change
|
||||
// Note: all callbacks happen on main thread
|
||||
|
||||
@Override
|
||||
public void onTaskStackChanged() {
|
||||
setRotateSuggestionButtonState(false /* visible */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(int taskId) {
|
||||
setRotateSuggestionButtonState(false /* visible */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskMovedToFront(int taskId) {
|
||||
setRotateSuggestionButtonState(false /* visible */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation) {
|
||||
// Only hide the icon if the top task changes its requestedOrientation
|
||||
// Launcher can alter its requestedOrientation while it's not on top, don't hide on this
|
||||
Optional.ofNullable(ActivityManagerWrapper.getInstance())
|
||||
.map(ActivityManagerWrapper::getRunningTask)
|
||||
.ifPresent(a -> {
|
||||
if (a.id == taskId) setRotateSuggestionButtonState(false /* visible */);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
enum RotationButtonEvent implements UiEventLogger.UiEventEnum {
|
||||
@UiEvent(doc = "The rotation button was shown")
|
||||
ROTATION_SUGGESTION_SHOWN(206),
|
||||
@UiEvent(doc = "The rotation button was clicked")
|
||||
ROTATION_SUGGESTION_ACCEPTED(207);
|
||||
|
||||
private final int mId;
|
||||
RotationButtonEvent(int id) {
|
||||
mId = id;
|
||||
}
|
||||
@Override public int getId() {
|
||||
return mId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 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.android.launcher3.taskbar.contextual;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
/** Containing logic for the rotation button in nav bar. */
|
||||
public class RotationContextButton extends ImageView implements RotationButton {
|
||||
|
||||
private AnimatedVectorDrawable mImageDrawable;
|
||||
|
||||
public RotationContextButton(Context context) {
|
||||
super(context);
|
||||
setBackgroundResource(R.drawable.taskbar_icon_click_feedback_roundrect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationButtonController(RotationButtonController rotationButtonController) {
|
||||
// TODO(b/187754252) UI polish, different icons based on light/dark context, etc
|
||||
mImageDrawable = (AnimatedVectorDrawable) getContext()
|
||||
.getDrawable(rotationButtonController.getIconResId());
|
||||
setImageDrawable(mImageDrawable);
|
||||
mImageDrawable.setCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getCurrentView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean show() {
|
||||
setVisibility(VISIBLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hide() {
|
||||
setVisibility(GONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return getVisibility() == VISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateIcon(int lightIconColor, int darkIconColor) {
|
||||
// TODO(b/187754252): UI Polish
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
||||
super.setOnClickListener(onClickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnHoverListener(View.OnHoverListener onHoverListener) {
|
||||
super.setOnHoverListener(onHoverListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatedVectorDrawable getImageDrawable() {
|
||||
return mImageDrawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDarkIntensity(float darkIntensity) {
|
||||
// TODO(b/187754252) UI polish
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibility(int visibility) {
|
||||
super.setVisibility(visibility);
|
||||
|
||||
if (visibility != View.VISIBLE && mImageDrawable != null) {
|
||||
mImageDrawable.clearAnimationCallbacks();
|
||||
mImageDrawable.reset();
|
||||
}
|
||||
|
||||
// Start the rotation animation once it becomes visible
|
||||
if (visibility == View.VISIBLE && mImageDrawable != null) {
|
||||
mImageDrawable.reset();
|
||||
mImageDrawable.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptRotationProposal() {
|
||||
return isAttachedToWindow();
|
||||
}
|
||||
}
|
||||
@@ -1398,6 +1398,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
mLauncherTransitionController.getNormalController().getAnimationPlayer().end();
|
||||
mLauncherTransitionController = null;
|
||||
}
|
||||
|
||||
if (mRecentsView != null) {
|
||||
mRecentsView.abortScrollerAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1416,7 +1420,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
|
||||
private void resetStateForAnimationCancel() {
|
||||
boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted;
|
||||
mActivityInterface.onTransitionCancelled(wasVisible);
|
||||
mActivityInterface.onTransitionCancelled(wasVisible, mGestureState.getEndTarget());
|
||||
|
||||
// Leave the pending invisible flag, as it may be used by wallpaper open animation.
|
||||
if (mActivity != null) {
|
||||
|
||||
@@ -86,12 +86,22 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
mBackgroundState = backgroundState;
|
||||
}
|
||||
|
||||
public void onTransitionCancelled(boolean activityVisible) {
|
||||
/**
|
||||
* Called when the current gesture transition is cancelled.
|
||||
* @param activityVisible Whether the user can see the changes we make here, so try to animate.
|
||||
* @param endTarget If the gesture ended before we got cancelled, where we were headed.
|
||||
*/
|
||||
public void onTransitionCancelled(boolean activityVisible,
|
||||
@Nullable GestureState.GestureEndTarget endTarget) {
|
||||
ACTIVITY_TYPE activity = getCreatedActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
STATE_TYPE startState = activity.getStateManager().getRestState();
|
||||
if (endTarget != null) {
|
||||
// We were on our way to this state when we got canceled, end there instead.
|
||||
startState = stateFromGestureEndTarget(endTarget);
|
||||
}
|
||||
activity.getStateManager().goToState(startState, activityVisible);
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSplitScreenSecondaryBoundsChanged(Rect bounds, Rect insets) {
|
||||
public void onSplitScreenSecondaryBoundsChanged(Rect bounds, Rect insets) {
|
||||
WindowBounds wb = new WindowBounds(bounds, insets);
|
||||
MAIN_EXECUTOR.execute(() -> SplitScreenBounds.INSTANCE.setSecondaryWindowBounds(wb));
|
||||
}
|
||||
@@ -269,8 +269,34 @@ public class TouchInteractionService extends Service implements PluginListener<O
|
||||
@Override
|
||||
public void onImeWindowStatusChanged(int displayId, IBinder token, int vis,
|
||||
int backDisposition, boolean showImeSwitcher) {
|
||||
MAIN_EXECUTOR.execute(() -> mTaskbarManager.updateImeStatus(
|
||||
displayId, vis, backDisposition, showImeSwitcher));
|
||||
executeForTaskbarManager(() -> mTaskbarManager
|
||||
.updateImeStatus(displayId, vis, backDisposition, showImeSwitcher));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
executeForTaskbarManager(() -> mTaskbarManager.onRotationProposal(rotation, isValid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(int displayId, int state1, int state2, boolean animate) {
|
||||
executeForTaskbarManager(() -> mTaskbarManager
|
||||
.disable(displayId, state1, state2, animate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemBarAttributesChanged(int displayId, int behavior) {
|
||||
executeForTaskbarManager(() -> mTaskbarManager
|
||||
.onSystemBarAttributesChanged(displayId, behavior));
|
||||
}
|
||||
|
||||
private void executeForTaskbarManager(final Runnable r) {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
if (mTaskbarManager == null) {
|
||||
return;
|
||||
}
|
||||
r.run();
|
||||
});
|
||||
}
|
||||
|
||||
public TaskbarManager getTaskbarManager() {
|
||||
|
||||
@@ -78,6 +78,10 @@ public class OverviewToHomeAnim {
|
||||
}
|
||||
|
||||
StateAnimationConfig config = new StateAnimationConfig();
|
||||
if (playWorkspaceRevealAnim) {
|
||||
// WorkspaceRevealAnim handles the depth, so don't interfere.
|
||||
config.animFlags |= StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
|
||||
}
|
||||
config.duration = startState.getTransitionDuration(mLauncher);
|
||||
AnimatorSet stateAnim = stateManager.createAtomicAnimation(
|
||||
startState, NORMAL, config);
|
||||
|
||||
@@ -75,7 +75,6 @@ import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
import android.os.VibrationEffect;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
@@ -132,7 +131,6 @@ import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.util.TranslateEdgeEffect;
|
||||
import com.android.launcher3.util.VibratorWrapper;
|
||||
import com.android.launcher3.util.ViewPool;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.BaseActivityInterface;
|
||||
@@ -344,17 +342,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
private static final float ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET = 0.05f;
|
||||
private static final float ANIMATION_DISMISS_PROGRESS_MIDPOINT = 0.5f;
|
||||
|
||||
private static final int SNAP_TO_PAGE_VIBRATION_PRIMITIVE =
|
||||
Utilities.ATLEAST_S ? VibrationEffect.Composition.PRIMITIVE_LOW_TICK : -1;
|
||||
private static final float SNAP_TO_PAGE_VIBRATION_PRIMITIVE_SCALE = 0.4f;
|
||||
private static final VibrationEffect SNAP_TO_PAGE_VIBRATION_FALLBACK =
|
||||
VibrationEffect.createPredefined(VibrationEffect.EFFECT_TEXTURE_TICK);
|
||||
private static final int EDGE_IMPACT_VIBRATION_PRIMITIVE =
|
||||
Utilities.ATLEAST_R ? VibrationEffect.Composition.PRIMITIVE_TICK : -1;
|
||||
private static final float EDGE_IMPACT_VIBRATION_PRIMITIVE_SCALE = 0.8f;
|
||||
private static final VibrationEffect EDGE_IMPACT_VIBRATION_FALLBACK =
|
||||
VibrationEffect.createPredefined(VibrationEffect.EFFECT_TICK);
|
||||
|
||||
protected final RecentsOrientedState mOrientationState;
|
||||
protected final BaseActivityInterface<STATE_TYPE, ACTIVITY_TYPE> mSizeStrategy;
|
||||
protected RecentsAnimationController mRecentsAnimationController;
|
||||
@@ -979,8 +966,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
@Override
|
||||
protected void onPageEndTransition() {
|
||||
super.onPageEndTransition();
|
||||
VibratorWrapper.INSTANCE.get(mContext).vibrate(SNAP_TO_PAGE_VIBRATION_PRIMITIVE,
|
||||
SNAP_TO_PAGE_VIBRATION_PRIMITIVE_SCALE, SNAP_TO_PAGE_VIBRATION_FALLBACK);
|
||||
if (isClearAllHidden()) {
|
||||
mActionsView.updateDisabledFlags(OverviewActionsView.DISABLED_SCROLLING, false);
|
||||
}
|
||||
@@ -1083,13 +1068,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEdgeAbsorbingScroll() {
|
||||
super.onEdgeAbsorbingScroll();
|
||||
VibratorWrapper.INSTANCE.get(mContext).vibrate(EDGE_IMPACT_VIBRATION_PRIMITIVE,
|
||||
EDGE_IMPACT_VIBRATION_PRIMITIVE_SCALE, EDGE_IMPACT_VIBRATION_FALLBACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) {
|
||||
// Enables swiping to the left or right only if the task overlay is not modal.
|
||||
|
||||
@@ -234,7 +234,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange
|
||||
Rect insets = mActivity.getDragLayer().getInsets();
|
||||
BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
|
||||
int padding = getResources()
|
||||
.getDimensionPixelSize(R.dimen.task_card_menu_option_vertical_padding);
|
||||
.getDimensionPixelSize(R.dimen.task_menu_vertical_padding);
|
||||
params.width = orientationHandler.getTaskMenuWidth(taskView.getThumbnail()) - (2 * padding);
|
||||
// Gravity set to Left instead of Start as sTempRect.left measures Left distance not Start
|
||||
params.gravity = Gravity.LEFT;
|
||||
|
||||
@@ -336,12 +336,20 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
|
||||
if (mOverlayEnabled != overlayEnabled) {
|
||||
mOverlayEnabled = overlayEnabled;
|
||||
|
||||
if (mOverlayEnabled) {
|
||||
getTaskOverlay().initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
|
||||
mPreviewPositionHelper.mIsOrientationChanged);
|
||||
} else {
|
||||
getTaskOverlay().reset();
|
||||
}
|
||||
refreshOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Potentially re-init the task overlay. Be cautious when calling this as the overlay may
|
||||
* do processing on initialization.
|
||||
*/
|
||||
private void refreshOverlay() {
|
||||
if (mOverlayEnabled) {
|
||||
getTaskOverlay().initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
|
||||
mPreviewPositionHelper.mIsOrientationChanged);
|
||||
} else {
|
||||
getTaskOverlay().reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,6 +390,8 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
updateThumbnailMatrix();
|
||||
|
||||
refreshOverlay();
|
||||
}
|
||||
|
||||
private ColorFilter getColorFilter(float dimAmount) {
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 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.android.quickstep;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsetsController;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.launcher3.taskbar.contextual.RotationButton;
|
||||
import com.android.launcher3.taskbar.contextual.RotationButtonController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/** SysUI equivalent */
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class NavigationBarRotationContextTest {
|
||||
private static final int DEFAULT_ROTATE = 0;
|
||||
private static final int DEFAULT_DISPLAY = 0;
|
||||
|
||||
|
||||
private RotationButtonController mRotationButtonController;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
Context mTargetContext = InstrumentationRegistry.getTargetContext();
|
||||
final View view = new View(mTargetContext);
|
||||
RotationButton rotationButton = mock(RotationButton.class);
|
||||
mRotationButtonController = new RotationButtonController(mTargetContext, 0, 0);
|
||||
mRotationButtonController.setRotationButton(rotationButton);
|
||||
// Due to a mockito issue, only spy the object after setting the initial state
|
||||
mRotationButtonController = spy(mRotationButtonController);
|
||||
final AnimatedVectorDrawable kbd = mock(AnimatedVectorDrawable.class);
|
||||
doReturn(view).when(rotationButton).getCurrentView();
|
||||
doReturn(true).when(rotationButton).acceptRotationProposal();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnInvalidRotationProposal() {
|
||||
mRotationButtonController.onRotationProposal(DEFAULT_ROTATE + 1,
|
||||
false /* isValid */);
|
||||
verify(mRotationButtonController, times(1))
|
||||
.setRotateSuggestionButtonState(false /* visible */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnSameRotationProposal() {
|
||||
mRotationButtonController.onRotationProposal(DEFAULT_ROTATE,
|
||||
true /* isValid */);
|
||||
verify(mRotationButtonController, times(1))
|
||||
.setRotateSuggestionButtonState(false /* visible */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnRotationProposalShowButtonShowNav() {
|
||||
// No navigation bar should not call to set visibility state
|
||||
mRotationButtonController.onBehaviorChanged(DEFAULT_DISPLAY,
|
||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
mRotationButtonController.onTaskBarVisibilityChange(false /* showing */);
|
||||
verify(mRotationButtonController, times(0)).setRotateSuggestionButtonState(
|
||||
false /* visible */);
|
||||
verify(mRotationButtonController, times(0)).setRotateSuggestionButtonState(
|
||||
true /* visible */);
|
||||
|
||||
// No navigation bar with rotation change should not call to set visibility state
|
||||
mRotationButtonController.onRotationProposal(DEFAULT_ROTATE + 1,
|
||||
true /* isValid */);
|
||||
verify(mRotationButtonController, times(0)).setRotateSuggestionButtonState(
|
||||
false /* visible */);
|
||||
verify(mRotationButtonController, times(0)).setRotateSuggestionButtonState(
|
||||
true /* visible */);
|
||||
|
||||
// Since rotation has changed rotation should be pending, show mButton when showing nav bar
|
||||
mRotationButtonController.onTaskBarVisibilityChange(true /* showing */);
|
||||
verify(mRotationButtonController, times(1)).setRotateSuggestionButtonState(
|
||||
true /* visible */);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnRotationProposalShowButton() {
|
||||
// Navigation bar being visible should not call to set visibility state
|
||||
mRotationButtonController.onTaskBarVisibilityChange(true /* showing */);
|
||||
verify(mRotationButtonController, times(0))
|
||||
.setRotateSuggestionButtonState(false /* visible */);
|
||||
verify(mRotationButtonController, times(0))
|
||||
.setRotateSuggestionButtonState(true /* visible */);
|
||||
|
||||
// Navigation bar is visible and rotation requested
|
||||
mRotationButtonController.onRotationProposal(DEFAULT_ROTATE + 1,
|
||||
true /* isValid */);
|
||||
verify(mRotationButtonController, times(1))
|
||||
.setRotateSuggestionButtonState(true /* visible */);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Disabled status of thumb -->
|
||||
<item android:state_enabled="false"
|
||||
android:color="@color/home_settings_thumb_off_color" />
|
||||
<!-- Toggle off status of thumb -->
|
||||
<item android:state_checked="false"
|
||||
android:color="@color/home_settings_thumb_off_color" />
|
||||
<!-- Enabled or toggle on status of thumb -->
|
||||
<item android:color="@color/home_settings_state_on_color" />
|
||||
</selector>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- Disabled status of thumb -->
|
||||
<item android:state_enabled="false"
|
||||
android:color="@color/home_settings_track_off_color"
|
||||
android:alpha="?android:attr/disabledAlpha" />
|
||||
<!-- Toggle off status of thumb -->
|
||||
<item android:state_checked="false"
|
||||
android:color="@color/home_settings_track_off_color" />
|
||||
<!-- Enabled or toggle on status of thumb -->
|
||||
<item android:color="@color/home_settings_track_on_color" />
|
||||
</selector>
|
||||
@@ -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.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="4dp"
|
||||
android:left="4dp"
|
||||
android:right="4dp"
|
||||
android:bottom="4dp">
|
||||
<shape android:shape="oval" >
|
||||
<size android:height="20dp" android:width="20dp" />
|
||||
<solid android:color="@color/home_settings_switch_thumb_color" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
android:width="52dp"
|
||||
android:height="28dp">
|
||||
|
||||
<solid android:color="@color/home_settings_switch_track_color" />
|
||||
<corners android:radius="35dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?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.
|
||||
-->
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/content_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorPrimary"
|
||||
android:fitsSystemWindows="true"
|
||||
android:outlineAmbientShadowColor="@android:color/transparent"
|
||||
android:outlineSpotShadowColor="@android:color/transparent"
|
||||
android:theme="@style/HomeSettings.CollapsingToolbar">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="226dp"
|
||||
android:clipToPadding="false"
|
||||
app:collapsedTitleTextAppearance="@style/HomeSettings.CollapsedToolbarTitle"
|
||||
app:contentScrim="@color/home_settings_header_collapsed"
|
||||
app:expandedTitleMarginEnd="24dp"
|
||||
app:expandedTitleMarginStart="24dp"
|
||||
app:expandedTitleTextAppearance="@style/HomeSettings.ExpandedToolbarTitle"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||
app:maxLines="3"
|
||||
app:scrimAnimationDuration="50"
|
||||
app:scrimVisibleHeightTrigger="174dp"
|
||||
app:statusBarScrim="@null"
|
||||
app:titleCollapseMode="fade"
|
||||
app:toolbarId="@id/action_bar">
|
||||
|
||||
<Toolbar
|
||||
android:id="@+id/action_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:theme="?android:attr/actionBarTheme"
|
||||
android:transitionName="shared_element_view"
|
||||
app:layout_collapseMode="pin" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/content_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -25,8 +25,7 @@
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:elevation="4dp">
|
||||
android:background="?android:attr/colorBackground">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_widgets_text"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<color name="home_settings_header_accent">@android:color/system_accent1_100</color>
|
||||
<color name="home_settings_header_collapsed">@android:color/system_neutral1_700</color>
|
||||
<color name="home_settings_header_expanded">@android:color/system_neutral1_900</color>
|
||||
|
||||
<color name="home_settings_thumb_off_color">@android:color/system_neutral2_300</color>
|
||||
<color name="home_settings_track_on_color">@android:color/system_accent2_700</color>
|
||||
<color name="home_settings_track_off_color">@android:color/system_neutral1_700</color>
|
||||
</resources>
|
||||
@@ -37,4 +37,13 @@
|
||||
|
||||
<color name="wallpaper_popup_scrim">@android:color/system_neutral1_900</color>
|
||||
|
||||
<color name="home_settings_header_accent">@android:color/system_accent1_600</color>
|
||||
<color name="home_settings_header_collapsed">@android:color/system_neutral1_100</color>
|
||||
<color name="home_settings_header_expanded">@android:color/system_neutral1_50</color>
|
||||
|
||||
<color name="home_settings_state_on_color">@android:color/system_accent1_100</color>
|
||||
<color name="home_settings_state_off_color">@android:color/system_accent2_100</color>
|
||||
<color name="home_settings_thumb_off_color">@android:color/system_neutral2_100</color>
|
||||
<color name="home_settings_track_on_color">@android:color/system_accent1_600</color>
|
||||
<color name="home_settings_track_off_color">@android:color/system_neutral2_600</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.
|
||||
-->
|
||||
<resources>
|
||||
<bool name="home_settings_icon_space_reserved">false</bool>
|
||||
<bool name="home_settings_allow_divider">false</bool>
|
||||
</resources>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="HomeSettings.Theme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="android:listPreferredItemPaddingEnd">16dp</item>
|
||||
<item name="android:listPreferredItemPaddingStart">24dp</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:switchStyle">@style/HomeSettings.SwitchStyle</item>
|
||||
<item name="android:textAppearanceListItem">@style/HomeSettings.PreferenceTitle</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="preferenceTheme">@style/HomeSettings.PreferenceTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.PreferenceTheme" parent="@style/PreferenceThemeOverlay">
|
||||
<item name="preferenceCategoryStyle">@style/HomeSettings.CategoryStyle</item>
|
||||
<item name="preferenceCategoryTitleTextAppearance">@style/HomeSettings.CategoryTitle</item>
|
||||
<item name="preferenceFragmentCompatStyle">@style/HomeSettings.FragmentCompatStyle</item>
|
||||
<item name="preferenceScreenStyle">@style/HomeSettings.PreferenceScreenStyle</item>
|
||||
<item name="preferenceStyle">@style/HomeSettings.PreferenceStyle</item>
|
||||
<item name="switchPreferenceStyle">@style/HomeSettings.SwitchPreferenceStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.CategoryStyle" parent="@style/Preference.Category.Material">
|
||||
<item name="allowDividerAbove">@bool/home_settings_allow_divider</item>
|
||||
<item name="allowDividerBelow">@bool/home_settings_allow_divider</item>
|
||||
<item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.PreferenceStyle" parent="@style/Preference.Material">
|
||||
<item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.PreferenceScreenStyle"
|
||||
parent="@style/Preference.PreferenceScreen.Material">
|
||||
<item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.SwitchPreferenceStyle"
|
||||
parent="@style/Preference.SwitchPreference.Material">
|
||||
<item name="iconSpaceReserved">@bool/home_settings_icon_space_reserved</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.SwitchStyle"
|
||||
parent="@android:style/Widget.Material.CompoundButton.Switch">
|
||||
<item name="android:switchMinWidth">52dp</item>
|
||||
<item name="android:thumb">@drawable/home_settings_switch_thumb</item>
|
||||
<item name="android:track">@drawable/home_settings_switch_track</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.PreferenceTitle"
|
||||
parent="@android:style/TextAppearance.Material.Subhead">
|
||||
<item name="android:fontFamily">google-sans</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.CategoryTitle" parent="@android:style/TextAppearance.Material.Body2">
|
||||
<item name="android:fontFamily">google-sans-text-medium</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.CollapsingToolbar" parent="@style/Theme.MaterialComponents.DayNight">
|
||||
<item name="colorAccent">@color/home_settings_header_accent</item>
|
||||
<item name="colorPrimary">@color/home_settings_header_expanded</item>
|
||||
<item name="elevationOverlayColor">?attr/colorPrimary</item>
|
||||
<item name="elevationOverlayEnabled">true</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.CollapsedToolbarTitle"
|
||||
parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title">
|
||||
<item name="android:fontFamily">google-sans</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettings.ExpandedToolbarTitle" parent="HomeSettings.CollapsedToolbarTitle">
|
||||
<item name="android:textSize">36sp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -154,18 +154,18 @@
|
||||
<style name="AppTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark.DarkMainColor" />
|
||||
<style name="AppTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark.DarkText" />
|
||||
|
||||
<style name="HomeSettingsTheme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<style name="HomeSettings.Theme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="android:navigationBarColor">?android:colorPrimaryDark</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="preferenceTheme">@style/HomeSettingsPreferenceTheme</item>
|
||||
<item name="preferenceTheme">@style/HomeSettings.PreferenceTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettingsPreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">
|
||||
<item name="preferenceFragmentCompatStyle">@style/HomeSettingsFragmentCompatStyle</item>
|
||||
<style name="HomeSettings.PreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">
|
||||
<item name="preferenceFragmentCompatStyle">@style/HomeSettings.FragmentCompatStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="HomeSettingsFragmentCompatStyle" parent="@style/PreferenceFragment.Material">
|
||||
<style name="HomeSettings.FragmentCompatStyle" parent="@style/PreferenceFragment.Material">
|
||||
<item name="android:layout">@layout/home_settings</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -253,6 +253,15 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
forceFinishScroller(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Immediately finishes any overscroll effect and jumps to the end of the scroller animation.
|
||||
*/
|
||||
public void abortScrollerAnimation() {
|
||||
mEdgeGlowLeft.finish();
|
||||
mEdgeGlowRight.finish();
|
||||
abortScrollerAnimation(true);
|
||||
}
|
||||
|
||||
private void abortScrollerAnimation(boolean resetNextPage) {
|
||||
mScroller.abortAnimation();
|
||||
// We need to clean up the next page here to avoid computeScrollHelper from
|
||||
@@ -506,11 +515,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
if (newPos < mMinScroll && oldPos >= mMinScroll) {
|
||||
mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
|
||||
mScroller.abortAnimation();
|
||||
onEdgeAbsorbingScroll();
|
||||
} else if (newPos > mMaxScroll && oldPos <= mMaxScroll) {
|
||||
mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
|
||||
mScroller.abortAnimation();
|
||||
onEdgeAbsorbingScroll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1361,13 +1368,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
|
||||
protected void onNotSnappingToPageInFreeScroll() { }
|
||||
|
||||
/**
|
||||
* Called when the view edges absorb part of the scroll. Subclasses can override this
|
||||
* to provide custom behavior during animation.
|
||||
*/
|
||||
protected void onEdgeAbsorbingScroll() {
|
||||
}
|
||||
|
||||
protected boolean shouldFlingForVelocity(int velocity) {
|
||||
float threshold = mAllowEasyFling ? mEasyFlingThresholdVelocity : mFlingThresholdVelocity;
|
||||
return Math.abs(velocity) > threshold;
|
||||
|
||||
@@ -106,6 +106,7 @@ import com.android.launcher3.util.IntSparseArrayMap;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.OverlayEdgeEffect;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.util.WallpaperOffsetInterpolator;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHost;
|
||||
@@ -429,10 +430,9 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
// When a accessible drag is started by the folder, we only allow rearranging withing the
|
||||
// folder.
|
||||
boolean addNewPage = !(options.isAccessibleDrag && dragObject.dragSource != this);
|
||||
|
||||
if (addNewPage) {
|
||||
mDeferRemoveExtraEmptyScreen = false;
|
||||
addExtraEmptyScreenOnDrag();
|
||||
addExtraEmptyScreenOnDrag(dragObject);
|
||||
|
||||
if (dragObject.dragInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET
|
||||
&& dragObject.dragSource != this) {
|
||||
@@ -640,12 +640,19 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
return newScreen;
|
||||
}
|
||||
|
||||
public void addExtraEmptyScreenOnDrag() {
|
||||
private void addExtraEmptyScreenOnDrag(DragObject dragObject) {
|
||||
boolean lastChildOnScreen = false;
|
||||
boolean childOnFinalScreen = false;
|
||||
|
||||
if (mDragSourceInternal != null) {
|
||||
if (mDragSourceInternal.getChildCount() == 1) {
|
||||
// When the drag view content is a LauncherAppWidgetHostView, we should increment the
|
||||
// drag source child count by 1 because the widget in drag has been detached from its
|
||||
// original parent, ShortcutAndWidgetContainer, and reattached to the DragView.
|
||||
int dragSourceChildCount =
|
||||
dragObject.dragView.getContentView() instanceof LauncherAppWidgetHostView
|
||||
? mDragSourceInternal.getChildCount() + 1
|
||||
: mDragSourceInternal.getChildCount();
|
||||
if (dragSourceChildCount == 1) {
|
||||
lastChildOnScreen = true;
|
||||
}
|
||||
CellLayout cl = (CellLayout) mDragSourceInternal.getParent();
|
||||
@@ -1925,10 +1932,16 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
if (droppedOnOriginalCellDuringTransition) {
|
||||
// Animate the item to its original position, while simultaneously exiting
|
||||
// spring-loaded mode so the page meets the icon where it was picked up.
|
||||
final RunnableList callbackList = new RunnableList();
|
||||
final Runnable onCompleteCallback = onCompleteRunnable;
|
||||
mLauncher.getDragController().animateDragViewToOriginalPosition(
|
||||
onCompleteRunnable, cell,
|
||||
/* onComplete= */ callbackList::executeAllAndDestroy, cell,
|
||||
SPRING_LOADED.getTransitionDuration(mLauncher));
|
||||
mLauncher.getStateManager().goToState(NORMAL);
|
||||
mLauncher.getStateManager().goToState(NORMAL, /* delay= */ 0,
|
||||
onCompleteCallback == null
|
||||
? null
|
||||
: forSuccessCallback(
|
||||
() -> callbackList.add(onCompleteCallback)));
|
||||
mLauncher.getDropTargetBar().onDragEnd();
|
||||
parent.onDropChild(cell);
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.android.launcher3.graphics;
|
||||
|
||||
import static com.android.launcher3.Utilities.getPrefs;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.Themes.KEY_THEMED_ICONS;
|
||||
import static com.android.launcher3.util.Themes.isThemedIconEnabled;
|
||||
|
||||
@@ -18,7 +19,6 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.IBinder.DeathRecipient;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.util.ArrayMap;
|
||||
@@ -217,7 +217,8 @@ public class GridCustomizationsProvider extends ContentProvider {
|
||||
Bundle result = new Bundle();
|
||||
result.putParcelable(KEY_SURFACE_PACKAGE, renderer.getSurfacePackage());
|
||||
|
||||
Messenger messenger = new Messenger(new Handler(Looper.getMainLooper(), observer));
|
||||
Messenger messenger =
|
||||
new Messenger(new Handler(UI_HELPER_EXECUTOR.getLooper(), observer));
|
||||
Message msg = Message.obtain();
|
||||
msg.replyTo = messenger;
|
||||
result.putParcelable(KEY_CALLBACK, msg);
|
||||
|
||||
@@ -21,19 +21,15 @@ import static android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.ContentObserver;
|
||||
import android.media.AudioAttributes;
|
||||
import android.os.Build;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
/**
|
||||
* Wrapper around {@link Vibrator} to easily perform haptic feedback where necessary.
|
||||
*/
|
||||
@@ -43,11 +39,6 @@ public class VibratorWrapper {
|
||||
public static final MainThreadInitializedObject<VibratorWrapper> INSTANCE =
|
||||
new MainThreadInitializedObject<>(VibratorWrapper::new);
|
||||
|
||||
public static final AudioAttributes VIBRATION_ATTRS = new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.build();
|
||||
|
||||
public static final VibrationEffect EFFECT_CLICK =
|
||||
createPredefined(VibrationEffect.EFFECT_CLICK);
|
||||
|
||||
@@ -90,24 +81,4 @@ public class VibratorWrapper {
|
||||
UI_HELPER_EXECUTOR.execute(() -> mVibrator.vibrate(vibrationEffect));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vibrates with a single primitive, if supported, or use a fallback effect instead. This only
|
||||
* vibrates if haptic feedback is available and enabled.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
public void vibrate(int primitiveId, float primitiveScale, VibrationEffect fallbackEffect) {
|
||||
if (mHasVibrator && mIsHapticFeedbackEnabled) {
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
if (Utilities.ATLEAST_R && primitiveId >= 0
|
||||
&& mVibrator.areAllPrimitivesSupported(primitiveId)) {
|
||||
mVibrator.vibrate(VibrationEffect.startComposition()
|
||||
.addPrimitive(primitiveId, primitiveScale)
|
||||
.compose(), VIBRATION_ATTRS);
|
||||
} else {
|
||||
mVibrator.vibrate(fallbackEffect, VIBRATION_ATTRS);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public final class LauncherInstrumentation {
|
||||
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
|
||||
static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP");
|
||||
private final String mLauncherPackage;
|
||||
private final boolean mIsLauncher3;
|
||||
private Boolean mIsLauncher3;
|
||||
private long mTestStartTime = -1;
|
||||
|
||||
// Types for launcher containers that the user is interacting with. "Background" is a
|
||||
@@ -206,7 +206,6 @@ public final class LauncherInstrumentation {
|
||||
public LauncherInstrumentation(Instrumentation instrumentation) {
|
||||
mInstrumentation = instrumentation;
|
||||
mDevice = UiDevice.getInstance(instrumentation);
|
||||
mIsLauncher3 = "com.android.launcher3".equals(getLauncherPackageName());
|
||||
|
||||
// Launcher should run in test harness so that custom accessibility protocol between
|
||||
// Launcher and TAPL is enabled. In-process tests enable this protocol with a direct call
|
||||
@@ -1422,6 +1421,9 @@ public final class LauncherInstrumentation {
|
||||
}
|
||||
|
||||
boolean isLauncher3() {
|
||||
if (mIsLauncher3 == null) {
|
||||
mIsLauncher3 = "com.android.launcher3".equals(getLauncherPackageName());
|
||||
}
|
||||
return mIsLauncher3;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user