Add pixel theme

cm-14.1
Rashed Abdel-Tawab 7 years ago
parent 91bc24d991
commit ce9f8e4460
  1. 5
      overlay/frameworks/base/core/res/res/values/config.xml
  2. 26
      pixel-theme/Android.mk
  3. 11
      pixel-theme/AndroidManifest.xml
  4. 25
      pixel-theme/res/drawable-land-v26/ic_sysbar_docked.xml
  5. 25
      pixel-theme/res/drawable-ldrtl-v26/ic_sysbar_back.xml
  6. 6
      pixel-theme/res/drawable-v26/halo.xml
  7. 25
      pixel-theme/res/drawable-v26/ic_sysbar_back.xml
  8. 24
      pixel-theme/res/drawable-v26/ic_sysbar_back_dark.xml
  9. 25
      pixel-theme/res/drawable-v26/ic_sysbar_back_ime.xml
  10. 24
      pixel-theme/res/drawable-v26/ic_sysbar_back_ime_dark.xml
  11. 25
      pixel-theme/res/drawable-v26/ic_sysbar_docked.xml
  12. 27
      pixel-theme/res/drawable-v26/ic_sysbar_docked_dark.xml
  13. 25
      pixel-theme/res/drawable-v26/ic_sysbar_home.xml
  14. 27
      pixel-theme/res/drawable-v26/ic_sysbar_home_dark.xml
  15. 6
      pixel-theme/res/drawable-v26/ic_sysbar_opa_blue.xml
  16. 6
      pixel-theme/res/drawable-v26/ic_sysbar_opa_green.xml
  17. 6
      pixel-theme/res/drawable-v26/ic_sysbar_opa_red.xml
  18. 6
      pixel-theme/res/drawable-v26/ic_sysbar_opa_yellow.xml
  19. 25
      pixel-theme/res/drawable-v26/ic_sysbar_recent.xml
  20. 24
      pixel-theme/res/drawable-v26/ic_sysbar_recent_dark.xml
  21. 37
      pixel-theme/res/layout/home.xml
  22. 23
      pixel-theme/res/values/colors.xml
  23. 6
      pixel-theme/res/values/config.xml
  24. 20
      pixel-theme/res/values/dimens.xml
  25. 4
      pixel-theme/res/values/strings.xml
  26. 9
      pixel-theme/res/values/styles.xml
  27. 583
      pixel-theme/src/com/google/android/systemui/OpaLayout.java
  28. 7
      product.mk

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="config_useRoundIcon">true</bool>
<string name="config_icon_mask">M50 0C77.6 0 100 22.4 100 50C100 77.6 77.6 100 50 100C22.4 100 0 77.6 0 50C0 22.4 22.4 0 50 0Z</string>
</resources>

@ -0,0 +1,26 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := PixelTheme
LOCAL_SDK_VERSION := current
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := false
#LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
#LOCAL_STATIC_JAVA_LIBRARIES := \
# android-support-v7-recyclerview \
# android-support-v7-preference \
# android-support-v7-appcompat \
# android-support-v14-preference \
# android-support-v17-leanback \
# android-support-v7-palette \
# android-support-v4 \
# SystemUI-proto \
# SystemUI-tags \
# uicommon
include $(BUILD_PACKAGE)

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.theme.pixel"
platformBuildVersionCode="26"
platformBuildVersionName="8.0.0">
<overlay android:priority="1" android:targetPackage="android" />
<application android:hasCode="false"
android:label="Pixel" />
</manifest>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M38.26 16.43C40.31 18.84 40 23.01 40 26 40 26 40 63 40 63 39.93 75.65 34.62 74.14 24 74 20.66 73.95 17.15 74 15.17 70.77 13.51 68.05 14 60.4 14 57c0 0 0 -31 0 -31 0.01 -5.2 -0.7 -8.21 4.11 -11.26 4.31 -1.09 17.09 -1.91 20.15 1.69zm34 0C74.31 18.84 74 23.01 74 26 74 26 74 63 74 63 73.93 75.65 68.62 74.14 58 74 54.66 73.95 51.15 74 49.17 70.77 47.51 68.05 48 60.4 48 57c0 0 0 -31 0 -31 0.01 -5.2 -0.7 -8.21 4.11 -11.26 4.31 -1.09 17.09 -1.91 20.15 1.69z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M23 12.88c2.44 0.35 15.9 8.47 19 10.32 0 0 24 14.26 24 14.26 2.87 1.84 6.53 4.55 5.34 8.5 -1.17 3.9 -8.87 7.47 -12.34 9.46 0 0 -27 15.43 -27 15.43 -3.03 1.73 -8.34 5.32 -11.89 4.62C15.66 74.59 16.02 69.48 16 66c0 0 0 -38 0 -38 0 -5.49 -1.3 -11.1 3.15 -15.12 1.83 -0.28 1.7 -0.64 3.85 0z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="ring" android:useLevel="false" android:innerRadius="@dimen/halo_inner_radius" android:thickness="@dimen/halo_thickness"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<size android:height="@dimen/halo_diameter" android:width="@dimen/halo_diameter" />
</shape>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M72 21c0 0 0 44 0 44 -0.01 3.31 0.56 8.72 -3.23 10.22C65.01 76.71 59.2 72.67 56 70.85 56 70.85 27 54.28 27 54.28 23.21 52.13 15.01 48.55 16.66 43.04c1 -3.39 5.48 -5.67 8.34 -7.32 0 0 20 -11.92 20 -11.92 4.8 -2.87 15.31 -9.36 20 -11.1 6.16 -0.36 6.9 2.9 7 8.3z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 CypherOS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="88"
android:viewportHeight="88"
android:tint="#7a000000">
<path
android:fillColor="@android:color/white"
android:pathData="M64.55,12.62C67.66,10.72 72.05,13.33 71.99,16.94C72.12,35 72.01,53.07 72.05,71.13C71.97,73.99 69.63,75.84 67.01,76.34C64.39,75.81 62.34,74.16 60.02,72.95C46.32,65.08 32.64,57.17 18.9,49.36C15.15,47.63 15.09,41.57 18.78,39.72C34.03,30.68 49.26,21.61 64.55,12.62Z"/>
</vector>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M33 16c0 0 33 0 33 0 3.48 0.02 8.59 -0.34 9.47 4.11 0.73 3.7 -3.37 9.69 -5.19 12.89 0 0 -16 28 -16 28C52.13 64.79 48.55 72.99 43.04 71.34 39.23 70.21 35.8 63.33 33.8 60 33.8 60 16.01 30 16.01 30 13.37 25.46 9.91 20.59 15.23 16.74 20.2 15.42 27.67 16 33 16Z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 CypherOS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="88"
android:viewportHeight="88"
android:tint="#7a000000">
<path
android:fillColor="@android:color/white"
android:pathData="M16.11,16.11C34.41,15.87 52.74,16.05 71.05,16.02C74.76,15.94 77.25,20.45 75.4,23.61C66.61,39.03 57.76,54.44 48.87,69.8C46.91,72.92 42.05,72.85 39.97,69.88C30.84,54.46 21.66,39.05 12.58,23.61C10.99,20.69 12.76,16.63 16.11,16.11Z"/>
</vector>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M35 14c0 0 28 0 28 0 2.79 0.02 6.32 -0.18 8.57 1.74 3.61 3.07 3.61 19.45 0 22.52C69.16 40.31 64.99 40 62 40c0 0 -37 0 -37 0 -3.16 -0.02 -7 0.23 -9.26 -2.43 -2.32 -2.72 -2.41 -16.19 -1 -19.46 0.93 -2.18 1.58 -2.23 3.37 -3.37C23.2 13.45 29.67 14 35 14Zm0 34c0 0 28 0 28 0 2.79 0.02 6.32 -0.18 8.57 1.74 3.55 3.02 3.55 19.5 0 22.52C69.16 74.31 64.99 74 62 74c0 0 -37 0 -37 0 -3.16 -0.02 -7 0.23 -9.26 -2.43 -2.32 -2.72 -2.41 -16.19 -1 -19.46 0.93 -2.18 1.58 -2.23 3.37 -3.37C23.2 47.45 29.67 48 35 48Z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 CypherOS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="88"
android:viewportHeight="88"
android:tint="#7a000000">
<path
android:fillColor="@android:color/white"
android:pathData="M15.79,15.82C17.36,14.06 19.84,13.97 22.03,13.98C37.02,14.03 52.03,13.97 67.02,14.01C70.11,13.68 73.39,15.78 73.86,18.95C74.25,22.61 73.95,26.3 74.07,29.97C74,32.58 74.31,35.42 72.94,37.77C71.26,39.11 69.3,40.16 67.08,39.99C51.7,40.01 36.32,40.01 20.94,39.99C18.7,40.17 16.72,39.1 15.04,37.72C13.19,34.11 14.19,29.86 13.95,25.97C14.17,22.59 13.1,18.48 15.79,15.82Z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M15.75,49.85C17.31,48.08 19.8,47.96 21.99,47.98C37.02,48.03 52.05,47.97 67.07,48.01C70.14,47.69 73.38,49.79 73.85,52.92C74.26,56.92 73.94,60.95 74.08,64.97C74,67.25 74.18,69.74 72.92,71.77C71.25,73.13 69.27,74.14 67.06,73.99C53.35,74.04 39.64,73.95 25.94,74.02C22.22,74 17.98,74.6 15.05,71.76C13.19,68.14 14.19,63.89 13.95,59.99C14.17,56.62 13.11,52.52 15.75,49.85Z"/>
</vector>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M55 13.95C86.37 25.66 81.13 71.07 49 75.7 22.41 79.54 3.43 52.71 15.79 29c1.96 -3.77 3.9 -6.76 7.25 -9.47 4.7 -3.81 10.09 -5.95 15.96 -7.09 5.54 -0.71 10.71 -0.47 16 1.51z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 CypherOS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="88"
android:viewportHeight="88"
android:tint="#7a000000">
<path
android:fillColor="@android:color/white"
android:pathData="M36.51,4.74C45.95,2.92 56.04,4.65 64.3,9.59C72.73,14.55 79.23,22.7 82.14,32.05C85.29,41.99 84.33,53.16 79.47,62.4C74.78,71.46 66.52,78.59 56.84,81.84C46.91,85.26 35.63,84.52 26.24,79.8C16.87,75.16 9.46,66.72 6.14,56.8C2.49,46.17 3.63,34.02 9.25,24.28C14.92,14.22 25.14,6.85 36.51,4.74M37.44,8.62C30.81,9.84 24.55,12.99 19.61,17.58C7.96,27.98 4.61,46.27 11.84,60.12C18.84,74.62 36.3,82.95 51.97,79.08C68.67,75.61 81.26,58.97 79.91,41.93C79.36,30.58 72.96,19.77 63.38,13.7C55.79,8.78 46.32,6.96 37.44,8.62Z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M37.52,14.72C52.83,10.93 69.67,21.43 73.1,36.79C77.18,51.67 67.65,68.43 52.85,72.65C39.2,77.17 23.08,70.15 17.05,57.12C10.56,44.46 14.86,27.62 26.6,19.59C29.86,17.25 33.6,15.59 37.52,14.72Z"/>
</vector>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#ff4285f4" />
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#ff34a853" />
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#ffea4335" />
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/opa_dot_diam" android:width="@dimen/opa_dot_diam" />
<solid android:color="#fffbbc05" />
</shape>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Pure Nexus 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="88"
android:viewportHeight="88"
android:width="24.0dp"
android:height="24.0dp">
<path
android:pathData="M34 14c0 0 31 0 31 0 8.7 0.16 8.98 3.34 9 11 0 0 0 33 0 33 0 3.55 0.67 11 -1.6 13.69 -2.27 2.69 -6.22 2.3 -9.4 2.31 0 0 -40 0 -40 0 -7.07 -0.13 -8.87 -1.93 -9 -9 0 0 0 -35 0 -35C14 24.45 12.7 18.96 17.15 15.02 22.21 13.22 28.61 14 34 14Z"
android:fillColor="#ffffffff" />
</vector>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 CypherOS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="88"
android:viewportHeight="88"
android:tint="#7a000000">
<path
android:fillColor="@android:color/white"
android:pathData="M14.01,19.99C13.73,16.72 16.63,13.75 19.92,14.03C35.29,13.94 50.66,14.06 66.03,13.97C68.2,14.01 70.73,13.86 72.33,15.61C74.13,17.21 74.01,19.77 74.06,21.97C74.03,36.98 74.05,52 74.06,67.02C73.99,68.58 73.87,70.18 73.32,71.65C71.62,73.28 69.39,74.21 67.01,74.02C51.66,73.99 36.3,73.99 20.95,74.02C18.54,74.22 16.33,73.23 14.61,71.59C13.88,69.13 13.9,66.54 13.93,64.01C14.03,49.34 13.86,34.66 14.01,19.99Z"/>
</vector>

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<com.google.android.systemui.OpaLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/home"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_width="@dimen/navigation_key_width"
android:layout_height="fill_parent"
android:layout_weight="0"
android:paddingStart="@dimen/navigation_key_padding"
android:paddingEnd="@dimen/navigation_key_padding"
>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/red" android:src="@drawable/ic_sysbar_opa_red" android:importantForAccessibility="no" style="@style/DotStyle" />
<ImageView android:id="@+id/blue" android:src="@drawable/ic_sysbar_opa_blue" android:importantForAccessibility="no" style="@style/DotStyle" />
<ImageView android:id="@+id/green" android:src="@drawable/ic_sysbar_opa_green" android:importantForAccessibility="no" style="@style/DotStyle" />
<ImageView android:id="@+id/yellow" android:src="@drawable/ic_sysbar_opa_yellow" android:importantForAccessibility="no" style="@style/DotStyle" />
</RelativeLayout>
<ImageView android:layout_gravity="center" android:id="@+id/white" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sysbar_home" android:importantForAccessibility="no" />
<com.android.systemui.statusbar.policy.KeyButtonView android:layout_gravity="center" android:id="@+id/home_button" android:layout_width="@dimen/navigation_key_width" android:layout_height="fill_parent" android:scaleType="center" android:contentDescription="@string/accessibility_home" />
<ImageView android:layout_gravity="center" android:id="@+id/halo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/halo" android:importantForAccessibility="no" />
</com.google.android.systemui.OpaLayout>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="user_icon_1">#ff5e97f6</color>
<color name="user_icon_2">#ff5c6bc0</color>
<color name="user_icon_3">#ff26a69a</color>
<color name="user_icon_4">#ffec407a</color>
<color name="user_icon_5">#ff33ac71</color>
<color name="user_icon_6">#ff8bc34a</color>
<color name="user_icon_7">#ffff9800</color>
<color name="user_icon_8">#ffff7043</color>
<color name="system_error">#ffea4335</color>
<color name="primary_device_default_dark">#ff2d2d2d</color>
<color name="primary_device_default_settings">#ff2d2d2d</color>
<color name="primary_dark_device_default_dark">#ff242424</color>
<color name="primary_dark_device_default_settings">#ff242424</color>
<color name="secondary_device_default_settings">#ff3a3a3a</color>
<color name="tertiary_device_default_settings">#ff616161</color>
<color name="quaternary_device_default_settings">#ff9e9e9e</color>
<color name="accent_device_default_700">#ff3367d6</color>
<color name="accent_device_default_light">#ff4285f4</color>
<color name="accent_device_default_dark">#ff5e97f6</color>
<color name="accent_device_default_50">#ffe8f0fe</color>
</resources>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="config_useRoundIcon">true</bool>
<string name="config_icon_mask">M50 0C77.6 0 100 22.4 100 50C100 77.6 77.6 100 50 100C22.4 100 0 77.6 0 50C0 22.4 22.4 0 50 0Z</string>
<bool name="config_allowOpaLayout">true</bool>
</resources>

@ -0,0 +1,20 @@
<resources>
<!-- The width of the view containing navigation buttons -->
<dimen name="navigation_key_width">70dp</dimen>
<dimen name="navigation_key_padding">0dp</dimen>
<!-- OPA home dimens -->
<dimen name="halo_inner_radius">10.0dip</dimen>
<dimen name="halo_thickness">1.0dip</dimen>
<dimen name="halo_diameter">22.0dip</dimen>
<dimen name="opa_dot_diam">10.0dip</dimen>
<dimen name="opa_diamond_translation">16.0dip</dimen>
<dimen name="opa_line_y_translation">16.0dip</dimen>
<dimen name="opa_line_x_trans_ry">15.0dip</dimen>
<dimen name="opa_line_x_trans_bg">30.0dip</dimen>
<dimen name="opa_line_x_collapse_bg">46.0dip</dimen>
<dimen name="opa_line_x_collapse_ry">15.0dip</dimen>
<dimen name="opa_overshoot_translation">8.0dip</dimen>
<dimen name="opa_return_translation">-1.0dip</dimen>
<dimen name="opa_rest_to_collapse">7.0dip</dimen>
</resources>

@ -0,0 +1,4 @@
<resources>
<!-- Content description of the home button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_home">Home</string>
</resources>

@ -0,0 +1,9 @@
<resources>
<!-- Pixel home dot style -->
<style name="DotStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_centerVertical">true</item>
</style>
</resources>

@ -0,0 +1,583 @@
package com.google.android.systemui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.util.ArraySet;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.RenderNodeAnimator;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.ButtonDispatcher;
import com.android.systemui.statusbar.policy.KeyButtonView;
public class OpaLayout extends FrameLayout implements ButtonDispatcher.ButtonInterface{
private static final int ANIMATION_STATE_NONE = 0;
private static final int ANIMATION_STATE_DIAMOND = 1;
private static final int ANIMATION_STATE_RETRACT = 2;
private static final int ANIMATION_STATE_OTHER = 3;
private static final int MIN_DIAMOND_DURATION = 100;
private static final int COLLAPSE_ANIMATION_DURATION_RY = 83;
private static final int COLLAPSE_ANIMATION_DURATION_BG = 100;
private static final int LINE_ANIMATION_DURATION_Y = 275;
private static final int LINE_ANIMATION_DURATION_X = 133;
private static final int RETRACT_ANIMATION_DURATION = 300;
private static final int DIAMOND_ANIMATION_DURATION = 200;
private static final int HALO_ANIMATION_DURATION = 100;
private static final int DOTS_RESIZE_DURATION = 200;
private static final int HOME_RESIZE_DURATION = 83;
private static final int HOME_REAPPEAR_ANIMATION_OFFSET = 33;
private static final int HOME_REAPPEAR_DURATION = 150;
private static final float DIAMOND_DOTS_SCALE_FACTOR = 0.8f;
private static final float DIAMOND_HOME_SCALE_FACTOR = 0.625f;
private static final float HALO_SCALE_FACTOR = 0.47619048f;
private KeyButtonView mHome;
private int mAnimationState;
private final ArraySet<Animator> mCurrentAnimators;
private boolean mIsLandscape;
private boolean mIsPressed;
private boolean mLongClicked;
private boolean mOpaEnabled;
private long mStartTime;
private View mRed;
private View mBlue;
private View mGreen;
private View mYellow;
private View mWhite;
private View mHalo;
private View mTop;
private View mRight;
private View mLeft;
private View mBottom;
private final Runnable mCheckLongPress;
private final Runnable mRetract;
private final Interpolator mRetractInterpolator;
private final Interpolator mCollapseInterpolator;
private final Interpolator mDiamondInterpolator;
private final Interpolator mDotsFullSizeInterpolator;
private final Interpolator mFastOutSlowInInterpolator;
private final Interpolator mHomeDisappearInterpolator;
public OpaLayout(Context context) {
super(context);
mFastOutSlowInInterpolator = Interpolators.FAST_OUT_SLOW_IN;
mHomeDisappearInterpolator = new PathInterpolator(0.8f, 0f, 1f, 1f);
mCollapseInterpolator = Interpolators.FAST_OUT_LINEAR_IN;
mDotsFullSizeInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mRetractInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mDiamondInterpolator = new PathInterpolator(0.2f, 0f, 0.2f, 1f);
mCheckLongPress = new Runnable() {
@Override
public void run() {
if (mIsPressed) {
mLongClicked = true;
}
}
};
mRetract = new Runnable() {
@Override
public void run() {
cancelCurrentAnimation();
startRetractAnimation();
}
};
mAnimationState = ANIMATION_STATE_NONE;
mCurrentAnimators = new ArraySet<Animator>();
}
public OpaLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mFastOutSlowInInterpolator = Interpolators.FAST_OUT_SLOW_IN;
mHomeDisappearInterpolator = new PathInterpolator(0.8f, 0f, 1f, 1f);
mCollapseInterpolator = Interpolators.FAST_OUT_LINEAR_IN;
mDotsFullSizeInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mRetractInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mDiamondInterpolator = new PathInterpolator(0.2f, 0f, 0.2f, 1f);
mCheckLongPress = new Runnable() {
@Override
public void run() {
if (mIsPressed) {
mLongClicked = true;
}
}
};
mRetract = new Runnable() {
@Override
public void run() {
cancelCurrentAnimation();
startRetractAnimation();
}
};
mAnimationState = ANIMATION_STATE_NONE;
mCurrentAnimators = new ArraySet<Animator>();
}
public OpaLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mFastOutSlowInInterpolator = Interpolators.FAST_OUT_SLOW_IN;
mHomeDisappearInterpolator = new PathInterpolator(0.8f, 0f, 1f, 1f);
mCollapseInterpolator = Interpolators.FAST_OUT_LINEAR_IN;
mDotsFullSizeInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mRetractInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mDiamondInterpolator = new PathInterpolator(0.2f, 0f, 0.2f, 1f);
mCheckLongPress = new Runnable() {
@Override
public void run() {
if (mIsPressed) {
mLongClicked = true;
}
}
};
mRetract = new Runnable() {
@Override
public void run() {
cancelCurrentAnimation();
startRetractAnimation();
}
};
mAnimationState = ANIMATION_STATE_NONE;
mCurrentAnimators = new ArraySet<Animator>();
}
public OpaLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mFastOutSlowInInterpolator = Interpolators.FAST_OUT_SLOW_IN;
mHomeDisappearInterpolator = new PathInterpolator(0.8f, 0f, 1f, 1f);
mCollapseInterpolator = Interpolators.FAST_OUT_LINEAR_IN;
mDotsFullSizeInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mRetractInterpolator = new PathInterpolator(0.4f, 0f, 0f, 1f);
mDiamondInterpolator = new PathInterpolator(0.2f, 0f, 0.2f, 1f);
mCheckLongPress = new Runnable() {
@Override
public void run() {
if (mIsPressed) {
mLongClicked = true;
}
}
};
mRetract = new Runnable() {
@Override
public void run() {
cancelCurrentAnimation();
startRetractAnimation();
}
};
mAnimationState = ANIMATION_STATE_NONE;
mCurrentAnimators = new ArraySet<Animator>();
}
private void startAll(ArraySet<Animator> animators) {
for(int i=0; i < animators.size(); i++) {
Animator curAnim = (Animator) mCurrentAnimators.valueAt(i);
curAnim.start();
}
}
private void startCollapseAnimation() {
mCurrentAnimators.clear();
mCurrentAnimators.addAll(getCollapseAnimatorSet());
mAnimationState = ANIMATION_STATE_OTHER;
startAll(mCurrentAnimators);
}
private void startDiamondAnimation() {
mCurrentAnimators.clear();
mCurrentAnimators.addAll(getDiamondAnimatorSet());
mAnimationState = ANIMATION_STATE_DIAMOND;
startAll(mCurrentAnimators);
}
private void startLineAnimation() {
mCurrentAnimators.clear();
mCurrentAnimators.addAll(getLineAnimatorSet());
mAnimationState = ANIMATION_STATE_OTHER;
startAll(mCurrentAnimators);
}
private void startRetractAnimation() {
mCurrentAnimators.clear();
mCurrentAnimators.addAll(getRetractAnimatorSet());
mAnimationState = ANIMATION_STATE_RETRACT;
startAll(mCurrentAnimators);
}
private void cancelCurrentAnimation() {
if(mCurrentAnimators.isEmpty())
return;
for(int i=0; i < mCurrentAnimators.size(); i++) {
Animator curAnim = (Animator) mCurrentAnimators.valueAt(i);
curAnim.removeAllListeners();
curAnim.cancel();
}
mCurrentAnimators.clear();
mAnimationState = ANIMATION_STATE_NONE;
}
private void endCurrentAnimation() {
if(mCurrentAnimators.isEmpty())
return;
for(int i=0; i < mCurrentAnimators.size(); i++) {
Animator curAnim = (Animator) mCurrentAnimators.valueAt(i);
curAnim.removeAllListeners();
curAnim.end();
}
mCurrentAnimators.clear();
mAnimationState = ANIMATION_STATE_NONE;
}
private ArraySet<Animator> getCollapseAnimatorSet() {
final ArraySet<Animator> set = new ArraySet<Animator>();
Animator animator;
if (mIsLandscape) {
animator = getDeltaAnimatorY(mRed, mCollapseInterpolator, -getPxVal(R.dimen.opa_line_x_collapse_ry), COLLAPSE_ANIMATION_DURATION_RY);
} else {
animator = getDeltaAnimatorX(mRed, mCollapseInterpolator, getPxVal(R.dimen.opa_line_x_collapse_ry), COLLAPSE_ANIMATION_DURATION_RY);
}
set.add(animator);
set.add(getScaleAnimatorX(mRed, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
set.add(getScaleAnimatorY(mRed, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
Animator animator2;
if (mIsLandscape) {
animator2 = getDeltaAnimatorY(mBlue, mCollapseInterpolator, -getPxVal(R.dimen.opa_line_x_collapse_bg), COLLAPSE_ANIMATION_DURATION_BG);
} else {
animator2 = getDeltaAnimatorX(mBlue, mCollapseInterpolator, getPxVal(R.dimen.opa_line_x_collapse_bg), COLLAPSE_ANIMATION_DURATION_BG);
}
set.add(animator2);
set.add(getScaleAnimatorX(mBlue, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
set.add(getScaleAnimatorY(mBlue, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
Animator animator3;
if (mIsLandscape) {
animator3 = getDeltaAnimatorY(mYellow, mCollapseInterpolator, getPxVal(R.dimen.opa_line_x_collapse_ry), COLLAPSE_ANIMATION_DURATION_RY);
} else {
animator3 = getDeltaAnimatorX(mYellow, mCollapseInterpolator, -getPxVal(R.dimen.opa_line_x_collapse_ry), COLLAPSE_ANIMATION_DURATION_RY);
}
set.add(animator3);
set.add(getScaleAnimatorX(mYellow, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
set.add(getScaleAnimatorY(mYellow, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
Animator animator4;
if (mIsLandscape) {
animator4 = getDeltaAnimatorY(mGreen, mCollapseInterpolator, getPxVal(R.dimen.opa_line_x_collapse_bg), COLLAPSE_ANIMATION_DURATION_BG);
} else {
animator4 = getDeltaAnimatorX(mGreen, mCollapseInterpolator, -getPxVal(R.dimen.opa_line_x_collapse_bg), COLLAPSE_ANIMATION_DURATION_BG);
}
set.add(animator4);
set.add(getScaleAnimatorX(mGreen, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
set.add(getScaleAnimatorY(mGreen, 1.0f, DOTS_RESIZE_DURATION, mDotsFullSizeInterpolator));
final Animator scaleAnimatorX = getScaleAnimatorX(mWhite, 1.0f, HOME_REAPPEAR_DURATION, mFastOutSlowInInterpolator);
final Animator scaleAnimatorY = getScaleAnimatorY(mWhite, 1.0f, HOME_REAPPEAR_DURATION, mFastOutSlowInInterpolator);
final Animator scaleAnimatorX2 = getScaleAnimatorX(mHalo, 1.0f, HOME_REAPPEAR_DURATION, mFastOutSlowInInterpolator);
final Animator scaleAnimatorY2 = getScaleAnimatorY(mHalo, 1.0f, HOME_REAPPEAR_DURATION, mFastOutSlowInInterpolator);
scaleAnimatorX.setStartDelay(HOME_REAPPEAR_ANIMATION_OFFSET);
scaleAnimatorY.setStartDelay(HOME_REAPPEAR_ANIMATION_OFFSET);
scaleAnimatorX2.setStartDelay(HOME_REAPPEAR_ANIMATION_OFFSET);
scaleAnimatorY2.setStartDelay(HOME_REAPPEAR_ANIMATION_OFFSET);
set.add(scaleAnimatorX);
set.add(scaleAnimatorY);
set.add(scaleAnimatorX2);
set.add(scaleAnimatorY2);
getLongestAnim((set)).addListener((Animator.AnimatorListener)new AnimatorListenerAdapter() {
public void onAnimationEnd(final Animator animator) {
mCurrentAnimators.clear();
mAnimationState = ANIMATION_STATE_NONE;
}
});
return set;
}
private ArraySet<Animator> getDiamondAnimatorSet() {
final ArraySet<Animator> set = new ArraySet<Animator>();
set.add(getDeltaAnimatorY(mTop, mDiamondInterpolator, -getPxVal(R.dimen.opa_diamond_translation), DIAMOND_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mTop, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mTop, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getDeltaAnimatorY(mBottom, mDiamondInterpolator, getPxVal(R.dimen.opa_diamond_translation), DIAMOND_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mBottom, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mBottom, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getDeltaAnimatorX(mLeft, mDiamondInterpolator, -getPxVal(R.dimen.opa_diamond_translation), DIAMOND_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mLeft, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mLeft, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getDeltaAnimatorX(mRight, mDiamondInterpolator, getPxVal(R.dimen.opa_diamond_translation), DIAMOND_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mRight, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mRight, DIAMOND_DOTS_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorX(mWhite, DIAMOND_HOME_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mWhite, DIAMOND_HOME_SCALE_FACTOR, DIAMOND_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorX(mHalo, HALO_SCALE_FACTOR, MIN_DIAMOND_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mHalo, HALO_SCALE_FACTOR, MIN_DIAMOND_DURATION, mFastOutSlowInInterpolator));
getLongestAnim(set).addListener((Animator.AnimatorListener)new AnimatorListenerAdapter() {
public void onAnimationCancel(final Animator animator) {
mCurrentAnimators.clear();
}
public void onAnimationEnd(final Animator animator) {
startLineAnimation();
}
});
return set;
}
private ArraySet<Animator> getLineAnimatorSet() {
final ArraySet<Animator> set = new ArraySet<Animator>();
if (mIsLandscape) {
set.add(getDeltaAnimatorY(mRed, mFastOutSlowInInterpolator, getPxVal(R.dimen.opa_line_x_trans_ry), LINE_ANIMATION_DURATION_Y));
set.add(getDeltaAnimatorX(mRed, mFastOutSlowInInterpolator, getPxVal(R.dimen.opa_line_y_translation), LINE_ANIMATION_DURATION_X));
set.add(getDeltaAnimatorY(mBlue, mFastOutSlowInInterpolator, getPxVal(R.dimen.opa_line_x_trans_bg), LINE_ANIMATION_DURATION_Y));
set.add(getDeltaAnimatorY(mYellow, mFastOutSlowInInterpolator, -getPxVal(R.dimen.opa_line_x_trans_ry), LINE_ANIMATION_DURATION_Y));
set.add(getDeltaAnimatorX(mYellow, mFastOutSlowInInterpolator, -getPxVal(R.dimen.opa_line_y_translation), LINE_ANIMATION_DURATION_X));
set.add(getDeltaAnimatorY(mGreen, mFastOutSlowInInterpolator, -getPxVal(R.dimen.opa_line_x_trans_bg), LINE_ANIMATION_DURATION_Y));
} else {
set.add(getDeltaAnimatorX(mRed, mFastOutSlowInInterpolator, -getPxVal(R.dimen.opa_line_x_trans_ry), LINE_ANIMATION_DURATION_Y));
set.add(getDeltaAnimatorY(mRed, mFastOutSlowInInterpolator, getPxVal(R.dimen.opa_line_y_translation), LINE_ANIMATION_DURATION_X));
set.add(getDeltaAnimatorX(mBlue, mFastOutSlowInInterpolator, -getPxVal(R.dimen.opa_line_x_trans_bg), LINE_ANIMATION_DURATION_Y));
set.add(getDeltaAnimatorX(mYellow, mFastOutSlowInInterpolator, getPxVal(R.dimen.opa_line_x_trans_ry), LINE_ANIMATION_DURATION_Y));
set.add(getDeltaAnimatorY(mYellow, mFastOutSlowInInterpolator, -getPxVal(R.dimen.opa_line_y_translation), LINE_ANIMATION_DURATION_X));
set.add(getDeltaAnimatorX(mGreen, mFastOutSlowInInterpolator, getPxVal(R.dimen.opa_line_x_trans_bg), LINE_ANIMATION_DURATION_Y));
}
set.add(getScaleAnimatorX(mWhite, 0.0f, HOME_RESIZE_DURATION, mHomeDisappearInterpolator));
set.add(getScaleAnimatorY(mWhite, 0.0f, HOME_RESIZE_DURATION, mHomeDisappearInterpolator));
set.add(getScaleAnimatorX(mHalo, 0.0f, HOME_RESIZE_DURATION, mHomeDisappearInterpolator));
set.add(getScaleAnimatorY(mHalo, 0.0f, HOME_RESIZE_DURATION, mHomeDisappearInterpolator));
getLongestAnim(set).addListener((Animator.AnimatorListener)new AnimatorListenerAdapter() {
public void onAnimationCancel(final Animator animator) {
mCurrentAnimators.clear();
}
public void onAnimationEnd(final Animator animator) {
startCollapseAnimation();
}
});
return set;
}
private ArraySet<Animator> getRetractAnimatorSet() {
final ArraySet<Animator> set = new ArraySet<Animator>();
set.add(getTranslationAnimatorX(mRed, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getTranslationAnimatorY(mRed, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mRed, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorY(mRed, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getTranslationAnimatorX(mBlue, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getTranslationAnimatorY(mBlue, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mBlue, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorY(mBlue, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getTranslationAnimatorX(mGreen, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getTranslationAnimatorY(mGreen, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mGreen, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorY(mGreen, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getTranslationAnimatorX(mYellow, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getTranslationAnimatorY(mYellow, mRetractInterpolator, RETRACT_ANIMATION_DURATION));
set.add(getScaleAnimatorX(mYellow, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorY(mYellow, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorX(mWhite, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorY(mWhite, 1.0f, RETRACT_ANIMATION_DURATION, mRetractInterpolator));
set.add(getScaleAnimatorX(mHalo, 1.0f, RETRACT_ANIMATION_DURATION, mFastOutSlowInInterpolator));
set.add(getScaleAnimatorY(mHalo, 1.0f, RETRACT_ANIMATION_DURATION, mFastOutSlowInInterpolator));
getLongestAnim(set).addListener((Animator.AnimatorListener)new AnimatorListenerAdapter() {
public void onAnimationEnd(final Animator animator) {
mCurrentAnimators.clear();
mAnimationState = ANIMATION_STATE_NONE;
}
});
return set;
}
private float getPxVal(int id) {
return getResources().getDimensionPixelOffset(id);
}
private Animator getDeltaAnimatorX(View v, Interpolator interpolator, float deltaX, int duration) {
RenderNodeAnimator anim = new RenderNodeAnimator(8, (int) (v.getX() + deltaX));
anim.setTarget(v);
anim.setInterpolator(interpolator);
anim.setDuration(duration);
return anim;
}
private Animator getDeltaAnimatorY(View v, Interpolator interpolator, float deltaY, int duration) {
RenderNodeAnimator anim = new RenderNodeAnimator(9, (int) (v.getY() + deltaY));
anim.setTarget(v);
anim.setInterpolator(interpolator);
anim.setDuration(duration);
return anim;
}
private Animator getScaleAnimatorX(View v, float factor, int duration, Interpolator interpolator) {
RenderNodeAnimator anim = new RenderNodeAnimator(3, factor);
anim.setTarget(v);
anim.setInterpolator(interpolator);
anim.setDuration(duration);
return anim;
}
private Animator getScaleAnimatorY(View v, float factor, int duration, Interpolator interpolator) {
RenderNodeAnimator anim = new RenderNodeAnimator(4, factor);
anim.setTarget(v);
anim.setInterpolator(interpolator);
anim.setDuration(duration);
return anim;
}
private Animator getTranslationAnimatorX(View v, Interpolator interpolator, int duration) {
RenderNodeAnimator anim = new RenderNodeAnimator(0, 0);
anim.setTarget(v);
anim.setInterpolator(interpolator);
anim.setDuration(duration);
return anim;
}
private Animator getTranslationAnimatorY(View v, Interpolator interpolator, int duration) {
RenderNodeAnimator anim = new RenderNodeAnimator(1, 0);
anim.setTarget(v);
anim.setInterpolator(interpolator);
anim.setDuration(duration);
return anim;
}
private Animator getLongestAnim(ArraySet<Animator> animators) {
long longestDuration = -1;
Animator longestAnim = null;
for(int i=0; i < animators.size(); i++) {
Animator a = (Animator) animators.valueAt(i);
if(a.getTotalDuration() > longestDuration) {
longestDuration = a.getTotalDuration();
longestAnim = a;
}
}
return longestAnim;
}
public void abortCurrentGesture() {
mHome.abortCurrentGesture();
}
protected void onFinishInflate() {
super.onFinishInflate();
mRed = findViewById(R.id.red);
mBlue = findViewById(R.id.blue);
mYellow = findViewById(R.id.yellow);
mGreen = findViewById(R.id.green);
mWhite = findViewById(R.id.white);
mHalo = findViewById(R.id.halo);
mHome = (KeyButtonView) findViewById(R.id.home_button);
setOpaEnabled(true);
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (!mOpaEnabled) {
return false;
}
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN: {
if (!mCurrentAnimators.isEmpty()) {
if (mAnimationState != ANIMATION_STATE_RETRACT) {
return false;
}
endCurrentAnimation();
}
mStartTime = SystemClock.elapsedRealtime();
mLongClicked = false;
mIsPressed = true;
startDiamondAnimation();
removeCallbacks(mCheckLongPress);
postDelayed(mCheckLongPress, (long)ViewConfiguration.getLongPressTimeout());
return false;
}
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: {
if (mAnimationState == ANIMATION_STATE_DIAMOND) {
final long elapsedRealtime = SystemClock.elapsedRealtime();
removeCallbacks(mRetract);
postDelayed(mRetract, 100L - (elapsedRealtime - mStartTime));
removeCallbacks(mCheckLongPress);
return false;
}
int n;
if (!mIsPressed || mLongClicked) {
n = 0;
} else {
n = 1;
}
mIsPressed = false;
if (n != 0) {
mRetract.run();
return false;
}
break;
}
}
return false;
}
public void setCarMode(boolean carMode) {
setOpaEnabled(!carMode);
}
public void setImageDrawable(Drawable drawable) {
((ImageView) mWhite).setImageDrawable(drawable);
}
public void setImageResource(int resId) {
((ImageView) mWhite).setImageResource(resId);
}
public void setVertical(boolean landscape) {
mIsLandscape = landscape;
if (mIsLandscape) {
mTop = mGreen;
mBottom = mBlue;
mRight = mYellow;
mLeft = mRed;
return;
}
mTop = mRed;
mBottom = mYellow;
mLeft = mBlue;
mRight = mGreen;
}
public void setOnLongClickListener(View.OnLongClickListener l) {
mHome.setOnLongClickListener(l);
}
public void setOnTouchListener(View.OnTouchListener l) {
mHome.setOnTouchListener(l);
}
public void setOpaEnabled(boolean enabled) {
visibility = View.VISIBLE;
mBlue.setVisibility(visibility);
mRed.setVisibility(visibility);
mYellow.setVisibility(visibility);
mGreen.setVisibility(visibility);
mHalo.setVisibility(visibility);
}
}

@ -22,4 +22,11 @@ PRODUCT_PACKAGES += auditd
PRODUCT_PROPERTY_OVERRIDES += ro.opa.eligible_device=true
# Themes
DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
PRODUCT_PROPERTY_OVERRIDES += ro.boot.vendor.overlay.theme=com.google.android.theme.pixel
PRODUCT_PROPERTY_OVERRIDES += ro.com.google.ime.theme_id=5
PRODUCT_PACKAGES += \
PixelTheme
$(call prepend-product-if-exists, vendor/rashed/product.mk)

Loading…
Cancel
Save