Gradient for VectorDrawable's fill and stroke
Add ComplexColor interface for both GradientColor and ColorStateList. Set up constant state, factory, theme attrs for GradientColor, while refactoring the ColorStateList's similar code. (Functionality in CSL should be the same). Support themeing in both the root and item level in GradientColor. For example, both startColor in <gradient> tag or color in <item> tag can have theme color. Add tests for both simple and complex cases with themeing etc. Hook up the native VectorDrawable implementation using 2 extra JNI calls for simplicity. Such calls only happen at inflate and applyTheme call. b/22564318 Change-Id: Ibdc564ddb4a7ee0133c6141c4784782f0c93ce0e
This commit is contained in:
29
tests/VectorDrawableTest/res/color/fill_gradient_linear.xml
Normal file
29
tests/VectorDrawableTest/res/color/fill_gradient_linear.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:angle="90"
|
||||
android:startColor="?android:attr/colorPrimary"
|
||||
android:endColor="?android:attr/colorControlActivated"
|
||||
android:centerColor="#00ff0000"
|
||||
android:startX="0"
|
||||
android:startY="0"
|
||||
android:endX="100"
|
||||
android:endY="100"
|
||||
android:type="linear">
|
||||
</gradient>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:angle="90"
|
||||
android:startColor="?android:attr/colorPrimary"
|
||||
android:endColor="?android:attr/colorControlActivated"
|
||||
android:centerColor="#f00"
|
||||
android:startX="0"
|
||||
android:startY="0"
|
||||
android:endX="100"
|
||||
android:endY="100"
|
||||
android:type="linear">
|
||||
<item android:offset="0.1" android:color="?android:attr/colorPrimary"/>
|
||||
<item android:offset="0.4" android:color="#fff"/>
|
||||
<item android:offset="0.9" android:color="?android:attr/colorControlActivated"/>
|
||||
</gradient>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:angle="90"
|
||||
android:startColor="?android:attr/colorPrimary"
|
||||
android:endColor="?android:attr/colorControlActivated"
|
||||
android:centerColor="#f00"
|
||||
android:startX="0"
|
||||
android:startY="0"
|
||||
android:endX="100"
|
||||
android:endY="100"
|
||||
android:type="linear">
|
||||
<item android:offset="0.1" android:color="?android:attr/colorPrimary"/>
|
||||
<item android:offset="0.4" android:color="#f00"/>
|
||||
<item android:offset="0.4" android:color="#fff"/>
|
||||
<item android:offset="0.9" android:color="?android:attr/colorControlActivated"/>
|
||||
</gradient>
|
||||
27
tests/VectorDrawableTest/res/color/fill_gradient_radial.xml
Normal file
27
tests/VectorDrawableTest/res/color/fill_gradient_radial.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:centerColor="#ff0000"
|
||||
android:endColor="?android:attr/colorControlActivated"
|
||||
android:centerX="300"
|
||||
android:centerY="300"
|
||||
android:gradientRadius="100"
|
||||
android:startColor="?android:attr/colorPrimary"
|
||||
android:type="radial">
|
||||
</gradient>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:centerColor="#ff0000"
|
||||
android:endColor="#ff0000ff"
|
||||
android:centerX="300"
|
||||
android:centerY="300"
|
||||
android:gradientRadius="100"
|
||||
android:startColor="#ffffffff"
|
||||
android:type="radial">
|
||||
<item android:offset="0.1" android:color="?android:attr/colorPrimary"/>
|
||||
<item android:offset="0.4" android:color="#fff"/>
|
||||
<item android:offset="0.9" android:color="?android:attr/colorControlActivated"/>
|
||||
</gradient>
|
||||
@@ -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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:centerX="300"
|
||||
android:centerY="300"
|
||||
android:gradientRadius="100"
|
||||
android:type="radial">
|
||||
<item android:offset="0.1" android:color="?android:attr/colorPrimary"/>
|
||||
<item android:offset="0.9" android:color="?android:attr/colorControlActivated"/>
|
||||
</gradient>
|
||||
27
tests/VectorDrawableTest/res/color/fill_gradient_sweep.xml
Normal file
27
tests/VectorDrawableTest/res/color/fill_gradient_sweep.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:centerColor="#ff0000"
|
||||
android:endColor="#ff0000ff"
|
||||
android:centerX="500"
|
||||
android:centerY="500"
|
||||
android:gradientRadius="10"
|
||||
android:startColor="#ffffffff"
|
||||
android:type="sweep">
|
||||
</gradient>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:centerColor="#ff0000"
|
||||
android:endColor="#ff0000ff"
|
||||
android:centerX="500"
|
||||
android:centerY="500"
|
||||
android:gradientRadius="10"
|
||||
android:startColor="#ffffffff"
|
||||
android:type="sweep">
|
||||
<item android:offset="0.1" android:color="?android:attr/colorPrimary"/>
|
||||
<item android:offset="0.4" android:color="#fff"/>
|
||||
<item android:offset="0.9" android:color="?android:attr/colorControlActivated"/>
|
||||
</gradient>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:centerX="500"
|
||||
android:centerY="500"
|
||||
android:gradientRadius="10"
|
||||
android:type="sweep">
|
||||
<item android:offset="-0.3" android:color="#f00"/>
|
||||
<item android:offset="0.1" android:color="?android:attr/colorPrimary"/>
|
||||
<item android:offset="0.4" android:color="#0f0"/>
|
||||
<item android:offset="0.6" android:color="#00f"/>
|
||||
<item android:offset="0.7" android:color="?android:attr/colorControlActivated"/>
|
||||
<item android:offset="1.5" android:color="#00f"/>
|
||||
</gradient>
|
||||
29
tests/VectorDrawableTest/res/color/stroke_gradient.xml
Normal file
29
tests/VectorDrawableTest/res/color/stroke_gradient.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:angle="90"
|
||||
android:centerColor="#7f7f7f"
|
||||
android:endColor="#ffffff"
|
||||
android:startColor="#000000"
|
||||
android:startX="0"
|
||||
android:endX="100"
|
||||
android:startY="0"
|
||||
android:endY="0"
|
||||
android:type="linear">
|
||||
</gradient>
|
||||
32
tests/VectorDrawableTest/res/color/stroke_gradient_item.xml
Normal file
32
tests/VectorDrawableTest/res/color/stroke_gradient_item.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:angle="90"
|
||||
android:centerColor="#7f7f7f"
|
||||
android:endColor="#ffffff"
|
||||
android:startColor="#000000"
|
||||
android:startX="0"
|
||||
android:endX="100"
|
||||
android:startY="0"
|
||||
android:endY="0"
|
||||
android:type="linear">
|
||||
<item android:offset="0.1" android:color="#f00"/>
|
||||
<item android:offset="0.2" android:color="#f0f"/>
|
||||
<item android:offset="0.9" android:color="#f00f"/>
|
||||
</gradient>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<gradient xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:startX="0"
|
||||
android:endX="100"
|
||||
android:startY="0"
|
||||
android:endY="0"
|
||||
android:type="linear">
|
||||
<item android:offset="0.1" android:color="#f00"/>
|
||||
<item android:offset="0.2" android:color="#2f0f"/>
|
||||
<item android:offset="0.9" android:color="#f00f"/>
|
||||
</gradient>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?android:attr/colorPrimary" android:state_pressed="true" />
|
||||
<item android:color="?android:attr/colorControlActivated" />
|
||||
</selector>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.
|
||||
*/
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?android:attr/colorControlActivated" android:state_pressed="true" />
|
||||
<item android:color="?android:attr/colorPrimary" />
|
||||
</selector>
|
||||
@@ -27,8 +27,8 @@
|
||||
<path
|
||||
android:name="box1"
|
||||
android:pathData="m20,200l100,90l180-180l-35-35l-145,145l-60-60l-40,40z"
|
||||
android:fillColor="?android:attr/colorControlNormal"
|
||||
android:strokeColor="?android:attr/colorControlNormal"
|
||||
android:fillColor="?android:attr/colorPrimary"
|
||||
android:strokeColor="?android:attr/colorPrimary"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</group>
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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:height="64dp"
|
||||
android:width="64dp"
|
||||
android:viewportHeight="400"
|
||||
android:viewportWidth="400" >
|
||||
|
||||
<group android:name="backgroundGroup"
|
||||
android:scaleX="0.5"
|
||||
android:scaleY="0.5">
|
||||
<path
|
||||
android:name="background1"
|
||||
android:fillColor="@color/fill_gradient_linear"
|
||||
android:pathData="M 0,0 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
<path
|
||||
android:name="background2"
|
||||
android:fillColor="@color/fill_gradient_radial"
|
||||
android:pathData="M 200,200 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
<path
|
||||
android:name="background3"
|
||||
android:fillColor="@color/fill_gradient_sweep"
|
||||
android:pathData="M 400,400 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
</group>
|
||||
<group
|
||||
android:name="translateToCenterGroup"
|
||||
android:translateX="50.0"
|
||||
android:translateY="90.0" >
|
||||
<path
|
||||
android:name="twoLines"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient"
|
||||
android:strokeWidth="20" />
|
||||
|
||||
<group
|
||||
android:name="rotationGroup"
|
||||
android:pivotX="0.0"
|
||||
android:pivotY="0.0"
|
||||
android:rotation="-45.0">
|
||||
<path
|
||||
android:name="twoLines1"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient"
|
||||
android:strokeWidth="20" />
|
||||
|
||||
<group
|
||||
android:name="translateGroup"
|
||||
android:translateX="130.0"
|
||||
android:translateY="160.0">
|
||||
<group android:name="scaleGroup" >
|
||||
<path
|
||||
android:name="twoLines3"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient"
|
||||
android:strokeWidth="20" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group
|
||||
android:name="translateGroupHalf"
|
||||
android:translateX="65.0"
|
||||
android:translateY="80.0">
|
||||
<group android:name="scaleGroup" >
|
||||
<path
|
||||
android:name="twoLines2"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:fillColor="@color/fill_gradient_linear"
|
||||
android:strokeColor="@color/stroke_gradient"
|
||||
android:strokeWidth="20" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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:height="64dp"
|
||||
android:width="64dp"
|
||||
android:viewportHeight="400"
|
||||
android:viewportWidth="400" >
|
||||
|
||||
<group android:name="backgroundGroup"
|
||||
android:scaleX="0.5"
|
||||
android:scaleY="0.5">
|
||||
<path
|
||||
android:name="background1"
|
||||
android:fillColor="@color/fill_gradient_linear_item"
|
||||
android:pathData="M 0,0 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
<path
|
||||
android:name="background2"
|
||||
android:fillColor="@color/fill_gradient_radial_item"
|
||||
android:pathData="M 200,200 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
<path
|
||||
android:name="background3"
|
||||
android:fillColor="@color/fill_gradient_sweep_item"
|
||||
android:pathData="M 400,400 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
</group>
|
||||
<group
|
||||
android:name="translateToCenterGroup"
|
||||
android:translateX="50.0"
|
||||
android:translateY="90.0" >
|
||||
<path
|
||||
android:name="twoLines"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item"
|
||||
android:strokeWidth="20" />
|
||||
|
||||
<group
|
||||
android:name="rotationGroup"
|
||||
android:pivotX="0.0"
|
||||
android:pivotY="0.0"
|
||||
android:rotation="-45.0">
|
||||
<path
|
||||
android:name="twoLines1"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item"
|
||||
android:strokeWidth="20" />
|
||||
|
||||
<group
|
||||
android:name="translateGroup"
|
||||
android:translateX="130.0"
|
||||
android:translateY="160.0">
|
||||
<group android:name="scaleGroup" >
|
||||
<path
|
||||
android:name="twoLines3"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item"
|
||||
android:strokeWidth="20" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group
|
||||
android:name="translateGroupHalf"
|
||||
android:translateX="65.0"
|
||||
android:translateY="80.0">
|
||||
<group android:name="scaleGroup" >
|
||||
<path
|
||||
android:name="twoLines2"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item"
|
||||
android:strokeWidth="20" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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:height="64dp"
|
||||
android:width="64dp"
|
||||
android:viewportHeight="400"
|
||||
android:viewportWidth="400" >
|
||||
|
||||
<group android:name="backgroundGroup"
|
||||
android:scaleX="0.5"
|
||||
android:scaleY="0.5">
|
||||
<path
|
||||
android:name="background1"
|
||||
android:fillColor="@color/fill_gradient_linear_item_overlap"
|
||||
android:pathData="M 0,0 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
<path
|
||||
android:name="background2"
|
||||
android:fillColor="@color/fill_gradient_radial_item_short"
|
||||
android:pathData="M 200,200 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
<path
|
||||
android:name="background3"
|
||||
android:fillColor="@color/fill_gradient_sweep_item_long"
|
||||
android:pathData="M 400,400 l 200,0 l 0, 200 l -200, 0 z" />
|
||||
</group>
|
||||
<group
|
||||
android:name="translateToCenterGroup"
|
||||
android:translateX="50.0"
|
||||
android:translateY="90.0" >
|
||||
<path
|
||||
android:name="twoLines"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item_alpha"
|
||||
android:strokeWidth="20" />
|
||||
|
||||
<group
|
||||
android:name="rotationGroup"
|
||||
android:pivotX="0.0"
|
||||
android:pivotY="0.0"
|
||||
android:rotation="-45.0">
|
||||
<path
|
||||
android:name="twoLines1"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item_alpha"
|
||||
android:strokeWidth="20" />
|
||||
|
||||
<group
|
||||
android:name="translateGroup"
|
||||
android:translateX="130.0"
|
||||
android:translateY="160.0">
|
||||
<group android:name="scaleGroup" >
|
||||
<path
|
||||
android:name="twoLines3"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item_alpha"
|
||||
android:strokeWidth="20" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<group
|
||||
android:name="translateGroupHalf"
|
||||
android:translateX="65.0"
|
||||
android:translateY="80.0">
|
||||
<group android:name="scaleGroup" >
|
||||
<path
|
||||
android:name="twoLines2"
|
||||
android:pathData="@string/twoLinePathData"
|
||||
android:strokeColor="@color/stroke_gradient_item_alpha"
|
||||
android:strokeWidth="20" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</vector>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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:height="64dp"
|
||||
android:width="64dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24" >
|
||||
|
||||
<path
|
||||
android:fillColor="@color/vector_icon_fill_state_list"
|
||||
android:strokeColor="@color/vector_icon_stroke_state_list"
|
||||
android:strokeWidth="3"
|
||||
android:pathData="M16.0,5.0c-1.955.0 -3.83,1.268 -4.5,3.0c-0.67-1.732 -2.547-3.0 -4.5-3.0C4.4570007,5.0 2.5,6.931999 2.5,9.5c0.0,3.529 3.793,6.258 9.0,11.5c5.207-5.242 9.0-7.971 9.0-11.5C20.5,6.931999 18.543,5.0 16.0,5.0z"/>
|
||||
|
||||
</vector>
|
||||
@@ -35,6 +35,10 @@ import java.text.DecimalFormat;
|
||||
public class VectorDrawablePerformance extends Activity {
|
||||
private static final String LOGCAT = "VectorDrawable1";
|
||||
protected int[] icon = {
|
||||
R.drawable.vector_icon_gradient_1,
|
||||
R.drawable.vector_icon_gradient_2,
|
||||
R.drawable.vector_icon_gradient_3,
|
||||
R.drawable.vector_icon_state_list,
|
||||
R.drawable.vector_drawable01,
|
||||
R.drawable.vector_drawable02,
|
||||
R.drawable.vector_drawable03,
|
||||
@@ -102,7 +106,7 @@ public class VectorDrawablePerformance extends Activity {
|
||||
ScrollView scrollView = new ScrollView(this);
|
||||
GridLayout container = new GridLayout(this);
|
||||
scrollView.addView(container);
|
||||
container.setColumnCount(5);
|
||||
container.setColumnCount(4);
|
||||
Resources res = this.getResources();
|
||||
container.setBackgroundColor(0xFF888888);
|
||||
VectorDrawable []d = new VectorDrawable[icon.length];
|
||||
|
||||
Reference in New Issue
Block a user