Skip to content

Commit 4b77a37

Browse files
committed
JAX updates from the Android presetation
1 parent 5a9cfce commit 4b77a37

File tree

33 files changed

+67
-48
lines changed

33 files changed

+67
-48
lines changed

com.vogella.android.actionbar.navigationdrawer/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.animation.views/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-17
11+
target=android-19

com.vogella.android.customview.canvas/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.customview.canvas/res/layout/activity_main.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
android:layout_height="match_parent"
55
tools:context=".MainActivity" >
66

7-
<TextView
7+
<com.vogella.android.customview.canvas.DrawingView
8+
android:id="@+id/drawingView1"
9+
android:background="@drawable/splash1"
810
android:layout_width="wrap_content"
911
android:layout_height="wrap_content"
1012
android:layout_centerHorizontal="true"
11-
android:layout_centerVertical="true"
12-
android:text="@string/hello_world" />
13+
android:layout_centerVertical="true" />
1314

1415
</RelativeLayout>

com.vogella.android.customview.canvas/src/com/vogella/android/customview/canvas/DrawingView.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.vogella.android.customview.canvas;
22

33
import java.util.ArrayList;
4+
import java.util.Iterator;
45
import java.util.List;
56
import java.util.Random;
67

@@ -21,7 +22,6 @@ public class DrawingView extends View {
2122
/** Need to track this so the dirty region can accommodate the stroke. **/
2223
private static final float HALF_STROKE_WIDTH = STROKE_WIDTH / 2;
2324

24-
private Paint paint = new Paint();
2525
private List<Path> paths = new ArrayList<Path>();
2626
private List<Paint> paints = new ArrayList<Paint>();
2727

@@ -34,7 +34,7 @@ public class DrawingView extends View {
3434

3535
private int[] colors;
3636

37-
private Path path;
37+
private Path path = new Path();
3838

3939
private int nextColor;
4040

@@ -45,13 +45,19 @@ public DrawingView(Context context, AttributeSet attrs) {
4545

4646
colors = new int[] { Color.BLUE, Color.CYAN, Color.GREEN,
4747
Color.MAGENTA, Color.YELLOW, Color.RED, Color.WHITE };
48+
4849
random = new Random();
4950
nextColor = random.nextInt(colors.length);
50-
paint.setAntiAlias(true);
51-
paint.setColor(Color.WHITE);
52-
paint.setStyle(Paint.Style.STROKE);
53-
paint.setStrokeJoin(Paint.Join.ROUND);
54-
paint.setStrokeWidth(STROKE_WIDTH);
51+
for (int i = 0; i < colors.length; i++) {
52+
Paint paint = new Paint();
53+
paint.setAntiAlias(true);
54+
paint.setColor(colors[i]);
55+
paint.setStyle(Paint.Style.STROKE);
56+
paint.setStrokeJoin(Paint.Join.ROUND);
57+
paint.setStrokeWidth(STROKE_WIDTH);
58+
paints.add(paint);
59+
}
60+
5561
}
5662

5763
/**
@@ -67,10 +73,16 @@ public void clear() {
6773

6874
@Override
6975
protected void onDraw(Canvas canvas) {
70-
canvas.drawARGB(50, 255, 0, 0);
76+
if (isInEditMode()) {
77+
canvas.drawARGB(255, 255, 0, 0);
78+
}
79+
super.onDraw(canvas);
7180
int i = 0;
7281
for (Path path : paths) {
7382
canvas.drawPath(path, paints.get(i++));
83+
if (i == paints.size()) {
84+
i = 0;
85+
}
7486
}
7587
}
7688

@@ -81,16 +93,15 @@ public boolean onTouchEvent(MotionEvent event) {
8193

8294
switch (event.getAction()) {
8395
case MotionEvent.ACTION_DOWN:
96+
path = new Path();
97+
paths.add(path);
8498
path.moveTo(eventX, eventY);
8599
return true;
86100

87101
case MotionEvent.ACTION_MOVE:
102+
path.lineTo(eventX, eventY);
88103
case MotionEvent.ACTION_UP:
89-
90-
path.lineTo(x, y);
91-
92104
// After replaying history, connect the line to the touch point.
93-
path.lineTo(eventX, eventY);
94105
break;
95106

96107
default:

com.vogella.android.customview.canvas/src/com/vogella/android/customview/canvas/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class MainActivity extends Activity {
99
@Override
1010
protected void onCreate(Bundle savedInstanceState) {
1111
super.onCreate(savedInstanceState);
12-
setContentView(new SignatureView(this, null));
12+
setContentView(R.layout.activity_main);
1313
}
1414

1515
@Override
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3+
org.eclipse.jdt.core.compiler.compliance=1.6
4+
org.eclipse.jdt.core.compiler.source=1.6

com.vogella.android.customview.compoundview/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.customview.compoundview/src/com/vogella/android/customview/compoundview/ColorOptionsView.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
public class ColorOptionsView extends LinearLayout {
1616

1717
private View mValue;
18-
private ImageView mImage;
1918

2019
public ColorOptionsView(Context context, AttributeSet attrs) {
2120
super(context, attrs);
@@ -50,8 +49,5 @@ public void setValueColor(int color) {
5049
mValue.setBackgroundColor(color);
5150
}
5251

53-
public void setImageVisible(boolean visible) {
54-
mImage.setVisibility(visible ? View.VISIBLE : View.GONE);
55-
}
5652

5753
}

com.vogella.android.customview.persistence/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.customview.spotlight/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.customview.surfaceviewball/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.drawables.custom.inlist/src/com/example/roundrectshader/StreamActivity.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ protected void onCreate(Bundle savedInstanceState) {
3737
((ListView) findViewById(R.id.main_list)).setAdapter(adapter);
3838

3939
adapter.add(new StreamItem(this, R.drawable.splash1, "voclipse", "Custom Eclipse IDE"));
40-
adapter.add(new StreamItem(this, R.drawable.photo2, "Starry night", "Lake Powell, AZ"));
41-
adapter.add(new StreamItem(this, R.drawable.photo3, "Racetrack playa", "Death Valley, CA"));
42-
adapter.add(new StreamItem(this, R.drawable.photo4, "Napali coast", "Kauai, HI"));
43-
adapter.add(new StreamItem(this, R.drawable.photo5, "Delicate Arch", "Arches, UT"));
44-
adapter.add(new StreamItem(this, R.drawable.photo6, "Sierra sunset", "Lone Pine, CA"));
45-
adapter.add(new StreamItem(this, R.drawable.photo7, "Majestic", "Grand Teton, WY"));
40+
adapter.add(new StreamItem(this, R.drawable.splash2, "Wizard", "vogella"));
41+
adapter.add(new StreamItem(this, R.drawable.splash3, "Lars Vogel", "vogella GmbH"));
42+
adapter.add(new StreamItem(this, R.drawable.splash4, "Example ", "More"));
43+
adapter.add(new StreamItem(this, R.drawable.splash5, "Testing", "Help"));
44+
adapter.add(new StreamItem(this, R.drawable.splash6, "Test ", "Testing, "));
4645
}
4746

4847
class StreamItem {

com.vogella.android.drawables.custom/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-16
14+
target=android-19

com.vogella.android.drawables.custom/res/layout/activity_main.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
<ImageView
88
android:id="@+id/image"
9-
android:layout_width="fill_parent"
10-
android:layout_height="fill_parent"
9+
android:layout_width="400dp"
10+
android:layout_height="400dp"
11+
android:scaleType="fitXY"
1112
android:layout_centerHorizontal="true"
1213
android:layout_centerVertical="true"
1314
android:contentDescription="TODO" />

com.vogella.android.drawables.custom/src/com/vogella/android/drawables/custom/MyRoundCornerDrawable.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.graphics.Canvas;
66
import android.graphics.ColorFilter;
77
import android.graphics.Paint;
8+
import android.graphics.PixelFormat;
89
import android.graphics.RectF;
910
import android.graphics.Shader;
1011
import android.graphics.drawable.Drawable;
@@ -33,17 +34,17 @@ public void draw(Canvas canvas) {
3334

3435
@Override
3536
public void setAlpha(int alpha) {
36-
37+
paint.setAlpha(alpha);
3738
}
3839

3940
@Override
4041
public void setColorFilter(ColorFilter cf) {
41-
42+
paint.setColorFilter(cf);
4243
}
4344

4445
@Override
4546
public int getOpacity() {
46-
return 255;
47+
return PixelFormat.TRANSLUCENT;
4748
}
4849

4950
}

com.vogella.android.list.swipetodismiss/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-17
14+
target=android-19

com.vogella.android.listview3d/src/com/vogella/android/listview3d/ListView3d.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import android.view.View;
1313
import android.widget.ListView;
1414

15+
// See the original example at https://github.com/renard314/ListView3d
16+
1517
public class ListView3d extends ListView {
1618

1719
/** Ambient light intensity */

com.vogella.android.touch.single/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-16
14+
target=android-19

com.vogella.android.touch.single/src/com/vogella/android/touch/single/SingleTouchEventView.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
import android.graphics.Path;
77
import android.util.AttributeSet;
88
import android.view.MotionEvent;
9+
import android.view.VelocityTracker;
910
import android.view.View;
1011

1112
public class SingleTouchEventView extends View {
1213
private Paint paint = new Paint();
1314
private Path path = new Path();
15+
private VelocityTracker mVelocityTracker;
1416

1517
public SingleTouchEventView(Context context, AttributeSet attrs) {
1618
super(context, attrs);
@@ -35,12 +37,15 @@ public boolean onTouchEvent(MotionEvent event) {
3537
switch (event.getAction()) {
3638
case MotionEvent.ACTION_DOWN:
3739
path.moveTo(eventX, eventY);
40+
mVelocityTracker = VelocityTracker.obtain();
41+
mVelocityTracker.addMovement(event);
3842
return true;
3943
case MotionEvent.ACTION_MOVE:
44+
4045
path.lineTo(eventX, eventY);
4146
break;
4247
case MotionEvent.ACTION_UP:
43-
// nothing to do
48+
4449
break;
4550
default:
4651
return false;

com.vogella.android.userinterface.undo/res/layout/activity_main.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
android:background="#808080"
2020
android:dividerPadding="11dp"
2121
android:padding="4dp"
22-
android:visibility="gone"
2322
>
2423

2524
<TextView

de.vogella.android.drawables.shapes/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-15
11+
target=android-19

de.vogella.android.handler.looper/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=Google Inc.:Google APIs:15
14+
target=Google Inc.:Google APIs:19

de.vogella.android.handler/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-16
11+
target=android-18

de.vogella.android.kidsdrawing/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-17
11+
target=android-19

de.vogella.android.listview/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# project structure.
99

1010
# Project target.
11-
target=Google Inc.:Google APIs:17
11+
target=Google Inc.:Google APIs:19

0 commit comments

Comments
 (0)