1abb7d134c02ac60091108c491dafb00877093170John Hoford/*
2abb7d134c02ac60091108c491dafb00877093170John Hoford * Copyright (C) 2014 The Android Open Source Project
3abb7d134c02ac60091108c491dafb00877093170John Hoford *
4abb7d134c02ac60091108c491dafb00877093170John Hoford * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5abb7d134c02ac60091108c491dafb00877093170John Hoford * in compliance with the License. You may obtain a copy of the License at
6abb7d134c02ac60091108c491dafb00877093170John Hoford *
7abb7d134c02ac60091108c491dafb00877093170John Hoford * http://www.apache.org/licenses/LICENSE-2.0
8abb7d134c02ac60091108c491dafb00877093170John Hoford *
9abb7d134c02ac60091108c491dafb00877093170John Hoford * Unless required by applicable law or agreed to in writing, software distributed under the License
10abb7d134c02ac60091108c491dafb00877093170John Hoford * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11abb7d134c02ac60091108c491dafb00877093170John Hoford * or implied. See the License for the specific language governing permissions and limitations under
12abb7d134c02ac60091108c491dafb00877093170John Hoford * the License.
13abb7d134c02ac60091108c491dafb00877093170John Hoford */
14abb7d134c02ac60091108c491dafb00877093170John Hofordpackage com.android.test.dynamic;
15abb7d134c02ac60091108c491dafb00877093170John Hoford
16abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.app.Activity;
17abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.graphics.drawable.VectorDrawable;
18abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.os.Bundle;
19abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.util.Log;
20abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.view.View;
21abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.widget.Button;
22abb7d134c02ac60091108c491dafb00877093170John Hofordimport android.widget.GridLayout;
23abb7d134c02ac60091108c491dafb00877093170John Hoford
24abb7d134c02ac60091108c491dafb00877093170John Hoford@SuppressWarnings({"UnusedDeclaration"})
25498213a265e05134b4a4fbf93dce69de1a47973cztenghuipublic class VectorDrawable01 extends Activity {
26abb7d134c02ac60091108c491dafb00877093170John Hoford    private static final String LOGCAT = "VectorDrawable1";
27abb7d134c02ac60091108c491dafb00877093170John Hoford    int[] icon = {
28abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable01,
29abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable02,
30abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable03,
31abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable04,
32abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable05,
33abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable06,
34abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable07,
35abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable08,
36abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable09,
37abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable10,
38abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable11,
39abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable12,
40abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable13,
41abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable14,
42abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable15,
43abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable16,
44abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable17,
45abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable18,
46abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable19,
47abb7d134c02ac60091108c491dafb00877093170John Hoford            R.drawable.vector_drawable20
48abb7d134c02ac60091108c491dafb00877093170John Hoford    };
49abb7d134c02ac60091108c491dafb00877093170John Hoford
50abb7d134c02ac60091108c491dafb00877093170John Hoford    @Override
51abb7d134c02ac60091108c491dafb00877093170John Hoford    protected void onCreate(Bundle savedInstanceState) {
52abb7d134c02ac60091108c491dafb00877093170John Hoford        super.onCreate(savedInstanceState);
53abb7d134c02ac60091108c491dafb00877093170John Hoford        GridLayout container = new GridLayout(this);
54abb7d134c02ac60091108c491dafb00877093170John Hoford        container.setColumnCount(5);
55abb7d134c02ac60091108c491dafb00877093170John Hoford        container.setBackgroundColor(0xFF888888);
56abb7d134c02ac60091108c491dafb00877093170John Hoford        final Button []bArray = new Button[icon.length];
57abb7d134c02ac60091108c491dafb00877093170John Hoford
58abb7d134c02ac60091108c491dafb00877093170John Hoford        for (int i = 0; i < icon.length; i++) {
59abb7d134c02ac60091108c491dafb00877093170John Hoford            Button button = new Button(this);
60abb7d134c02ac60091108c491dafb00877093170John Hoford            bArray[i] = button;
61abb7d134c02ac60091108c491dafb00877093170John Hoford            button.setWidth(200);
62abb7d134c02ac60091108c491dafb00877093170John Hoford            button.setBackgroundResource(icon[i]);
63abb7d134c02ac60091108c491dafb00877093170John Hoford            container.addView(button);
642af745b56cf4bdfdd9c05d90a4ccc740bf77a4feztenghui            VectorDrawable vd = (VectorDrawable) button.getBackground();
652af745b56cf4bdfdd9c05d90a4ccc740bf77a4feztenghui            vd.setAlpha((i + 1) * (0xFF / (icon.length + 1)));
66abb7d134c02ac60091108c491dafb00877093170John Hoford        }
67abb7d134c02ac60091108c491dafb00877093170John Hoford
68abb7d134c02ac60091108c491dafb00877093170John Hoford        setContentView(container);
69abb7d134c02ac60091108c491dafb00877093170John Hoford
70abb7d134c02ac60091108c491dafb00877093170John Hoford    }
71abb7d134c02ac60091108c491dafb00877093170John Hoford
72abb7d134c02ac60091108c491dafb00877093170John Hoford}
73