Skip to content

Commit a9aa728

Browse files
committed
Correct comments and fix silly variable name
1 parent 7b3b2f7 commit a9aa728

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

06/AsyncTaskDemo/src/com/oreilly/demo/android/ch06/AsyncTaskDemoWithProgress.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ private final class AsyncInit
2121
extends AsyncTask<String, Integer, String>
2222
implements Game.InitProgressListener
2323
{
24-
private final View dots;
24+
private final View root;
2525
private final Game game;
2626
private final TextView message;
2727
private final Drawable bg;
2828

2929
public AsyncInit(
30-
View dots,
30+
View root,
3131
Drawable bg,
3232
Game game,
3333
TextView msg)
3434
{
35-
this.dots = dots;
35+
this.root = root;
3636
this.bg = bg;
3737
this.game = game;
3838
this.message = msg;
@@ -41,16 +41,16 @@ public AsyncInit(
4141
// runs on the UI thread
4242
@Override protected void onPreExecute() {
4343
if (0 >= mInFlight++) {
44-
dots.setBackgroundResource(R.anim.dots);
45-
((AnimationDrawable) dots.getBackground()).start();
44+
root.setBackgroundResource(R.anim.dots);
45+
((AnimationDrawable) root.getBackground()).start();
4646
}
4747
}
4848

4949
// runs on the UI thread
5050
@Override protected void onPostExecute(String msg) {
5151
if (0 >= --mInFlight) {
52-
((AnimationDrawable) dots.getBackground()).stop();
53-
dots.setBackgroundDrawable(bg);
52+
((AnimationDrawable) root.getBackground()).stop();
53+
root.setBackgroundDrawable(bg);
5454
}
5555

5656
message.setText(msg);
@@ -63,10 +63,12 @@ public AsyncInit(
6363
: game.initialize(args[0], this);
6464
}
6565

66+
// runs on the UI thread
6667
@Override protected void onProgressUpdate(Integer... vals) {
6768
updateProgressBar(vals[0].intValue());
6869
}
6970

71+
// runs on its own thread
7072
@Override public void onInitProgress(int pctComplete) {
7173
publishProgress(Integer.valueOf(pctComplete));
7274
}

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Welcome to the ProgrammingAndroidExamples wiki!
33
This repo contains working code for the example in O'Reilly's
44

55
_Programming Android_; Mednieks, Dornin, Meike, Nakamura
6-
http://www.amazon.com/Programming-Android-Zigurd-Mednieks/dp/1449389694/ref=sr_1_1?ie=UTF8&qid=1311005055&sr=8-1
6+
http://shop.oreilly.com/product/0636920010364.do
77

88
The projects are organized by the primary chapter in which the examples appears.
99

0 commit comments

Comments
 (0)