Debian Codegraph @

tests/HwAccelerationTest/src/com/android/test/hwui/PathOffsetActivity.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.test.hwui;
18
19 import android.app.Activity;
20 import android.content.Context;
21 import android.graphics.Canvas;
22 import android.graphics.Color;
23 import android.graphics.Paint;
24 import android.graphics.Path;
25 import android.os.Bundle;
26 import android.view.MotionEvent;
27 import android.view.View;
28
29 @SuppressWarnings({"UnusedDeclaration"})
30 public class PathOffsetActivity extends Activity {
31 @Override
32 protected void onCreate(Bundle savedInstanceState) {
33 super.onCreate(savedInstanceState);
34 final PathsView view = new PathsView(this);
35 setContentView(view);
36 }
37
38 public class PathsView extends View {
39 private Path mPath;
40 private Paint mPaint;
41
42 public PathsView(Context context) {
43 super(context);
44
45 mPaint = new Paint();
46 mPaint.setStyle(Paint.Style.STROKE);
47 mPaint.setStrokeWidth(3);
48
49 mPath = new Path();
50 mPath.lineTo(100, 100);
51 mPath.lineTo(200, 300);
52 }
53
54 @Override
55 protected void onDraw(Canvas canvas) {
56 mPath.offset(1, 1);
57 mPaint.setColor(Color.RED);
58 canvas.drawPath(mPath, mPaint);
59 }
60
61 @Override
62 public boolean onTouchEvent(MotionEvent event) {
63 invalidate();
64 return super.onTouchEvent(event);
65 }
66 }
67 }