diff options
31 files changed, 974 insertions, 49 deletions
diff --git a/packages/SystemUI/res/anim/major_a_b_dot_01_animation.xml b/packages/SystemUI/res/anim/major_a_b_dot_01_animation.xml new file mode 100644 index 000000000000..b5bb4dc63730 --- /dev/null +++ b/packages/SystemUI/res/anim/major_a_b_dot_01_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 3.25,4.0 c 0.79167,0.0 3.95833,0.0 4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_a_b_dot_animation.xml b/packages/SystemUI/res/anim/major_a_b_dot_animation.xml new file mode 100644 index 000000000000..644316734bcd --- /dev/null +++ b/packages/SystemUI/res/anim/major_a_b_dot_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyName="pathData" + android:valueFrom="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueTo="M -4.75,-2.75 l 9.5,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l -9.5,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueType="pathType" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_b_a_dot_01_animation.xml b/packages/SystemUI/res/anim/major_b_a_dot_01_animation.xml new file mode 100644 index 000000000000..2e0a4fa9cbf8 --- /dev/null +++ b/packages/SystemUI/res/anim/major_b_a_dot_01_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 8.0,4.0 c -0.79167,0.0 -3.95833,0.0 -4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_b_a_dot_animation.xml b/packages/SystemUI/res/anim/major_b_a_dot_animation.xml new file mode 100644 index 000000000000..731c87cfe744 --- /dev/null +++ b/packages/SystemUI/res/anim/major_b_a_dot_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyName="pathData" + android:valueFrom="M -4.75,-2.75 l 9.5,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l -9.5,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueTo="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueType="pathType" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_b_c_dot_01_animation.xml b/packages/SystemUI/res/anim/major_b_c_dot_01_animation.xml new file mode 100644 index 000000000000..e8c2687c8e34 --- /dev/null +++ b/packages/SystemUI/res/anim/major_b_c_dot_01_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 8.0,4.0 c 0.79167,0.0 3.95833,0.0 4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_b_c_dot_animation.xml b/packages/SystemUI/res/anim/major_b_c_dot_animation.xml new file mode 100644 index 000000000000..731c87cfe744 --- /dev/null +++ b/packages/SystemUI/res/anim/major_b_c_dot_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyName="pathData" + android:valueFrom="M -4.75,-2.75 l 9.5,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l -9.5,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueTo="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueType="pathType" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_c_b_dot_01_animation.xml b/packages/SystemUI/res/anim/major_c_b_dot_01_animation.xml new file mode 100644 index 000000000000..d0174bced40c --- /dev/null +++ b/packages/SystemUI/res/anim/major_c_b_dot_01_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 12.75,4.0 c -0.79167,0.0 -3.95833,0.0 -4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/major_c_b_dot_animation.xml b/packages/SystemUI/res/anim/major_c_b_dot_animation.xml new file mode 100644 index 000000000000..644316734bcd --- /dev/null +++ b/packages/SystemUI/res/anim/major_c_b_dot_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyName="pathData" + android:valueFrom="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueTo="M -4.75,-2.75 l 9.5,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l -9.5,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" + android:valueType="pathType" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/minor_a_b_dot_02_animation.xml b/packages/SystemUI/res/anim/minor_a_b_dot_02_animation.xml new file mode 100644 index 000000000000..b5bb4dc63730 --- /dev/null +++ b/packages/SystemUI/res/anim/minor_a_b_dot_02_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 3.25,4.0 c 0.79167,0.0 3.95833,0.0 4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/minor_b_a_dot_02_animation.xml b/packages/SystemUI/res/anim/minor_b_a_dot_02_animation.xml new file mode 100644 index 000000000000..2e0a4fa9cbf8 --- /dev/null +++ b/packages/SystemUI/res/anim/minor_b_a_dot_02_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 8.0,4.0 c -0.79167,0.0 -3.95833,0.0 -4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/minor_b_c_dot_02_animation.xml b/packages/SystemUI/res/anim/minor_b_c_dot_02_animation.xml new file mode 100644 index 000000000000..e8c2687c8e34 --- /dev/null +++ b/packages/SystemUI/res/anim/minor_b_c_dot_02_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 8.0,4.0 c 0.79167,0.0 3.95833,0.0 4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/anim/minor_c_b_dot_02_animation.xml b/packages/SystemUI/res/anim/minor_c_b_dot_02_animation.xml new file mode 100644 index 000000000000..d0174bced40c --- /dev/null +++ b/packages/SystemUI/res/anim/minor_c_b_dot_02_animation.xml @@ -0,0 +1,25 @@ +<?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. +--> +<set + xmlns:android="http://schemas.android.com/apk/res/android" > + <objectAnimator + android:duration="250" + android:propertyXName="translateX" + android:propertyYName="translateY" + android:pathData="M 12.75,4.0 c -0.79167,0.0 -3.95833,0.0 -4.75,0.0" + android:interpolator="@android:interpolator/fast_out_slow_in" /> +</set> diff --git a/packages/SystemUI/res/drawable/major_a_b.xml b/packages/SystemUI/res/drawable/major_a_b.xml new file mode 100644 index 000000000000..99000483b852 --- /dev/null +++ b/packages/SystemUI/res/drawable/major_a_b.xml @@ -0,0 +1,36 @@ +<?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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="major_a_b" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_01" + android:translateX="3.25" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/major_a_b_animation.xml b/packages/SystemUI/res/drawable/major_a_b_animation.xml new file mode 100644 index 000000000000..74d7544dcd61 --- /dev/null +++ b/packages/SystemUI/res/drawable/major_a_b_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/major_a_b" > + <target + android:name="dot_01" + android:animation="@anim/major_a_b_dot_01_animation" /> + <target + android:name="dot" + android:animation="@anim/major_a_b_dot_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/major_b_a.xml b/packages/SystemUI/res/drawable/major_b_a.xml new file mode 100644 index 000000000000..3115887167fb --- /dev/null +++ b/packages/SystemUI/res/drawable/major_b_a.xml @@ -0,0 +1,36 @@ +<?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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="major_b_a" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_01" + android:translateX="8" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M -4.75,-2.75 l 9.5,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l -9.5,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/major_b_a_animation.xml b/packages/SystemUI/res/drawable/major_b_a_animation.xml new file mode 100644 index 000000000000..cf446e69c606 --- /dev/null +++ b/packages/SystemUI/res/drawable/major_b_a_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/major_b_a" > + <target + android:name="dot_01" + android:animation="@anim/major_b_a_dot_01_animation" /> + <target + android:name="dot" + android:animation="@anim/major_b_a_dot_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/major_b_c.xml b/packages/SystemUI/res/drawable/major_b_c.xml new file mode 100644 index 000000000000..899109e60b54 --- /dev/null +++ b/packages/SystemUI/res/drawable/major_b_c.xml @@ -0,0 +1,36 @@ +<?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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="major_b_c" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_01" + android:translateX="8" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M -4.75,-2.75 l 9.5,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l -9.5,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/major_b_c_animation.xml b/packages/SystemUI/res/drawable/major_b_c_animation.xml new file mode 100644 index 000000000000..38e12f4724f0 --- /dev/null +++ b/packages/SystemUI/res/drawable/major_b_c_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/major_b_c" > + <target + android:name="dot_01" + android:animation="@anim/major_b_c_dot_01_animation" /> + <target + android:name="dot" + android:animation="@anim/major_b_c_dot_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/major_c_b.xml b/packages/SystemUI/res/drawable/major_c_b.xml new file mode 100644 index 000000000000..cc6c6152fdbf --- /dev/null +++ b/packages/SystemUI/res/drawable/major_c_b.xml @@ -0,0 +1,36 @@ +<?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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="major_c_b" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_01" + android:translateX="12.75" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/major_c_b_animation.xml b/packages/SystemUI/res/drawable/major_c_b_animation.xml new file mode 100644 index 000000000000..7f7850d46536 --- /dev/null +++ b/packages/SystemUI/res/drawable/major_c_b_animation.xml @@ -0,0 +1,26 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/major_c_b" > + <target + android:name="dot_01" + android:animation="@anim/major_c_b_dot_01_animation" /> + <target + android:name="dot" + android:animation="@anim/major_c_b_dot_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/minor_a_b.xml b/packages/SystemUI/res/drawable/minor_a_b.xml new file mode 100644 index 000000000000..c5f5c98bfcdf --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_a_b.xml @@ -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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="minor_a_b" + android:alpha="0.3" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_02" + android:translateX="3.25" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/minor_a_b_animation.xml b/packages/SystemUI/res/drawable/minor_a_b_animation.xml new file mode 100644 index 000000000000..50e20e795f63 --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_a_b_animation.xml @@ -0,0 +1,23 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/minor_a_b" > + <target + android:name="dot_02" + android:animation="@anim/minor_a_b_dot_02_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/minor_b_a.xml b/packages/SystemUI/res/drawable/minor_b_a.xml new file mode 100644 index 000000000000..3bb08c47505b --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_b_a.xml @@ -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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="minor_b_a" + android:alpha="0.3" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_02" + android:translateX="8" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/minor_b_a_animation.xml b/packages/SystemUI/res/drawable/minor_b_a_animation.xml new file mode 100644 index 000000000000..460a2f7361aa --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_b_a_animation.xml @@ -0,0 +1,23 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/minor_b_a" > + <target + android:name="dot_02" + android:animation="@anim/minor_b_a_dot_02_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/minor_b_c.xml b/packages/SystemUI/res/drawable/minor_b_c.xml new file mode 100644 index 000000000000..95c6463753d5 --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_b_c.xml @@ -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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="minor_b_c" + android:alpha="0.3" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_02" + android:translateX="8" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/minor_b_c_animation.xml b/packages/SystemUI/res/drawable/minor_b_c_animation.xml new file mode 100644 index 000000000000..53b8bd6ee4d3 --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_b_c_animation.xml @@ -0,0 +1,23 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/minor_b_c" > + <target + android:name="dot_02" + android:animation="@anim/minor_b_c_dot_02_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/drawable/minor_c_b.xml b/packages/SystemUI/res/drawable/minor_c_b.xml new file mode 100644 index 000000000000..523afaa2e5b9 --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_c_b.xml @@ -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. +--> +<vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:name="minor_c_b" + android:alpha="0.3" + android:width="16dp" + android:viewportWidth="16" + android:height="8dp" + android:viewportHeight="8" > + <group + android:name="dot_02" + android:translateX="12.75" + android:translateY="4" > + <group + android:name="dot_group" > + <path + android:name="dot" + android:fillColor="#FFFFFFFF" + android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" /> + </group> + </group> +</vector> diff --git a/packages/SystemUI/res/drawable/minor_c_b_animation.xml b/packages/SystemUI/res/drawable/minor_c_b_animation.xml new file mode 100644 index 000000000000..bf5e81ecdc33 --- /dev/null +++ b/packages/SystemUI/res/drawable/minor_c_b_animation.xml @@ -0,0 +1,23 @@ +<?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. +--> +<animated-vector + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="@drawable/minor_c_b" > + <target + android:name="dot_02" + android:animation="@anim/minor_c_b_dot_02_animation" /> +</animated-vector> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 88230bce8755..d1faa4a55d96 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -179,7 +179,8 @@ <dimen name="qs_date_collapsed_text_size">14sp</dimen> <dimen name="qs_date_text_size">16sp</dimen> <dimen name="qs_header_gear_translation">16dp</dimen> - <dimen name="qs_page_indicator_size">12dp</dimen> + <dimen name="qs_page_indicator_width">16dp</dimen> + <dimen name="qs_page_indicator_height">8dp</dimen> <dimen name="qs_tile_icon_size">24dp</dimen> <dimen name="qs_tile_text_size">12sp</dimen> <dimen name="qs_tile_divider_height">1dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java b/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java index 120026621564..ba07bf4414c1 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PageIndicator.java @@ -1,86 +1,219 @@ package com.android.systemui.qs; import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Paint; +import android.graphics.drawable.AnimatedVectorDrawable; import android.util.AttributeSet; -import android.view.Gravity; +import android.util.Log; import android.view.View; -import android.widget.LinearLayout; - +import android.view.ViewGroup; +import android.widget.ImageView; import com.android.systemui.R; -public class PageIndicator extends LinearLayout { +import java.util.ArrayList; + +public class PageIndicator extends ViewGroup { + + private static final String TAG = "PageIndicator"; + private static final boolean DEBUG = false; + + private static final long ANIMATION_DURATION = 250; + + // The size of a single dot in relation to the whole animation. + private static final float SINGLE_SCALE = .4f; + + private static final float MINOR_ALPHA = .3f; - private final int mPageIndicatorSize; + private final ArrayList<Integer> mQueuedPositions = new ArrayList<>(); + + private final int mPageIndicatorWidth; + private final int mPageIndicatorHeight; + private final int mPageDotWidth; + + private int mPosition = -1; + private boolean mAnimating; public PageIndicator(Context context, AttributeSet attrs) { super(context, attrs); - setGravity(Gravity.CENTER); - mPageIndicatorSize = - (int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_size); + mPageIndicatorWidth = + (int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_width); + mPageIndicatorHeight = + (int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_height); + mPageDotWidth = (int) (mPageIndicatorWidth * SINGLE_SCALE); } public void setNumPages(int numPages) { + setVisibility(numPages > 1 ? View.VISIBLE : View.INVISIBLE); + if (mAnimating) { + Log.w(TAG, "setNumPages during animation"); + } while (numPages < getChildCount()) { removeViewAt(getChildCount() - 1); } while (numPages > getChildCount()) { - SinglePageIndicator v = new SinglePageIndicator(mContext); - v.setAmount(0); - addView(v, new LayoutParams(mPageIndicatorSize, mPageIndicatorSize)); + ImageView v = new ImageView(mContext); + v.setImageResource(R.drawable.minor_a_b); + addView(v, new LayoutParams(mPageIndicatorWidth, mPageIndicatorHeight)); } + // Refresh state. + setIndex(mPosition >> 1); } public void setLocation(float location) { int index = (int) location; - location -= index; + int position = index << 1 | ((location != index) ? 1 : 0); + if (DEBUG) Log.d(TAG, "setLocation " + location + " " + index + " " + position); + int lastPosition = mPosition; + if (mQueuedPositions.size() != 0) { + lastPosition = mQueuedPositions.get(mQueuedPositions.size() - 1); + } + if (position == lastPosition) return; + if (mAnimating) { + if (DEBUG) Log.d(TAG, "Queueing transition to " + Integer.toHexString(position)); + mQueuedPositions.add(position); + return; + } + + setPosition(position); + } + + private void setPosition(int position) { + if (isVisibleToUser() && Math.abs(mPosition - position) == 1) { + animate(mPosition, position); + } else { + if (DEBUG) Log.d(TAG, "Skipping animation " + isVisibleToUser() + " " + mPosition + + " " + position); + setIndex(position >> 1); + } + mPosition = position; + } + + private void setIndex(int index) { final int N = getChildCount(); for (int i = 0; i < N; i++) { - float amount = 0; - if (i == index) { - amount = 1 - location; - } else if (i == index + 1) { - amount = location; - } - ((SinglePageIndicator) getChildAt(i)).setAmount(amount); + ImageView v = (ImageView) getChildAt(i); + // Clear out any animation positioning. + v.setTranslationX(0); + v.setImageResource(R.drawable.major_a_b); + v.setAlpha(getAlpha(i == index)); + } + } + + private void animate(int from, int to) { + if (DEBUG) Log.d(TAG, "Animating from " + Integer.toHexString(from) + " to " + + Integer.toHexString(to)); + int fromIndex = from >> 1; + int toIndex = to >> 1; + + // Set the position of everything, then we will manually control the two views involved + // in the animation. + setIndex(fromIndex); + + boolean fromTransition = (from & 1) != 0; + boolean isAState = fromTransition ? from > to : from < to; + int firstIndex = Math.min(fromIndex, toIndex); + int secondIndex = Math.max(fromIndex, toIndex); + if (secondIndex == firstIndex) { + secondIndex++; } + ImageView first = (ImageView) getChildAt(firstIndex); + ImageView second = (ImageView) getChildAt(secondIndex); + // Lay the two views on top of each other. + second.setTranslationX(first.getX() - second.getX()); + + playAnimation(first, getTransition(fromTransition, isAState, false)); + first.setAlpha(getAlpha(false)); + + playAnimation(second, getTransition(fromTransition, isAState, true)); + second.setAlpha(getAlpha(true)); + + mAnimating = true; } - // This could be done with a circle drawable and an ImageView, but this seems - // easier for now. - public static class SinglePageIndicator extends View { - private static final int MIN_ALPHA = 0x4d; - private static final int MAX_ALPHA = 0xff; + private float getAlpha(boolean isMajor) { + return isMajor ? 1 : MINOR_ALPHA; + } - private static final float MIN_SIZE = .55f; - private static final float MAX_SIZE = .7f; + private void playAnimation(ImageView imageView, int res) { + final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getContext().getDrawable(res); + imageView.setImageDrawable(avd); + avd.forceAnimationOnUI(); + avd.start(); + // TODO: Figure out how to user an AVD animation callback instead, which doesn't + // seem to be working right now... + postDelayed(mAnimationDone, ANIMATION_DURATION); + } - private final Paint mPaint; - private float mSize; + private int getTransition(boolean fromB, boolean isMajorAState, boolean isMajor) { + if (isMajor) { + if (fromB) { + if (isMajorAState) { + return R.drawable.major_b_a_animation; + } else { + return R.drawable.major_b_c_animation; + } + } else { + if (isMajorAState) { + return R.drawable.major_a_b_animation; + } else { + return R.drawable.major_c_b_animation; + } + } + } else { + if (fromB) { + if (isMajorAState) { + return R.drawable.minor_b_c_animation; + } else { + return R.drawable.minor_b_a_animation; + } + } else { + if (isMajorAState) { + return R.drawable.minor_c_b_animation; + } else { + return R.drawable.minor_a_b_animation; + } + } + } + } - public SinglePageIndicator(Context context) { - super(context); - mPaint = new Paint(); - mPaint.setColor(0xffffffff); - mPaint.setAlpha(MAX_ALPHA); + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + final int N = getChildCount(); + if (N == 0) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + return; + } + final int widthChildSpec = MeasureSpec.makeMeasureSpec(mPageIndicatorWidth, + MeasureSpec.EXACTLY); + final int heightChildSpec = MeasureSpec.makeMeasureSpec(mPageIndicatorHeight, + MeasureSpec.EXACTLY); + for (int i = 0; i < N; i++) { + getChildAt(i).measure(widthChildSpec, heightChildSpec); } + int width = (mPageIndicatorWidth - mPageDotWidth) * N + mPageDotWidth; + setMeasuredDimension(width, mPageIndicatorHeight); + } - public void setAmount(float amount) { - mSize = amount * (MAX_SIZE - MIN_SIZE) + MIN_SIZE; - int alpha = (int) (amount * (MAX_ALPHA - MIN_ALPHA)) + MIN_ALPHA; - mPaint.setAlpha(alpha); - postInvalidate(); + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + final int N = getChildCount(); + if (N == 0) { + return; } + for (int i = 0; i < N; i++) { + int left = (mPageIndicatorWidth - mPageDotWidth) * i; + getChildAt(i).layout(left, 0, mPageIndicatorWidth + left, mPageIndicatorHeight); + } + } + private final Runnable mAnimationDone = new Runnable() { @Override - public void draw(Canvas canvas) { - int minDimen = Math.min(getWidth(), getHeight()) / 2; - float radius = mSize * minDimen; - float x = getWidth() / 2f; - float y = getHeight() / 2f; - canvas.drawCircle(x, y, radius, mPaint); + public void run() { + if (DEBUG) Log.d(TAG, "onAnimationEnd - queued: " + mQueuedPositions.size()); + mAnimating = false; + if (mQueuedPositions.size() != 0) { + setPosition(mQueuedPositions.remove(0)); + } } - } + }; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java index 24b45cc1030b..fd43aa06288a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java @@ -36,7 +36,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout { @Override public void onPageSelected(int position) { if (mPageIndicator == null) return; - mPageIndicator.setLocation(position); if (mPageListener != null) { mPageListener.onPageChanged(position == 0); } |