| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,4 +22,10 @@ | |||
| 22 | 22 | android:textColor="@android:color/black" | |
| 23 | 23 | /> | |
| 24 | 24 | ||
| 25 | + <FrameLayout | ||
| 26 | + android:id="@+id/dots" | ||
| 27 | + android:layout_width="fill_parent" | ||
| 28 | + android:layout_height="wrap_content" | ||
| 29 | + /> | ||
| 30 | + | ||
| 25 | 31 | </LinearLayout> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,18 +20,18 @@ public class AsyncTaskDemo extends Activity { | |||
| 20 | 20 | private final class AsyncInitGame | |
| 21 | 21 | extends AsyncTask<String, Void, String> | |
| 22 | 22 | { | |
| 23 | - private final View root; | ||
| 23 | + private final View dots; | ||
| 24 | 24 | private final Game game; | |
| 25 | 25 | private final TextView message; | |
| 26 | 26 | private final Drawable bg; | |
| 27 | 27 | ||
| 28 | 28 | public AsyncInitGame( | |
| 29 | - View root, | ||
| 29 | + View dots, | ||
| 30 | 30 | Drawable bg, | |
| 31 | 31 | Game game, | |
| 32 | 32 | TextView msg) | |
| 33 | 33 | { | |
| 34 | - this.root = root; | ||
| 34 | + this.dots = dots; | ||
| 35 | 35 | this.bg = bg; | |
| 36 | 36 | this.game = game; | |
| 37 | 37 | this.message = msg; | |
@@ -40,16 +40,16 @@ public AsyncInitGame( | |||
| 40 | 40 | // runs on the UI thread | |
| 41 | 41 | @Override protected void onPreExecute() { | |
| 42 | 42 | if (0 >= mInFlight++) { | |
| 43 | - root.setBackgroundResource(R.anim.dots); | ||
| 44 | - ((AnimationDrawable) root.getBackground()).start(); | ||
| 43 | + dots.setBackgroundResource(R.anim.dots); | ||
| 44 | + ((AnimationDrawable) dots.getBackground()).start(); | ||
| 45 | 45 | } | |
| 46 | 46 | } | |
| 47 | 47 | ||
| 48 | 48 | // runs on the UI thread | |
| 49 | 49 | @Override protected void onPostExecute(String msg) { | |
| 50 | 50 | if (0 >= --mInFlight) { | |
| 51 | - ((AnimationDrawable) root.getBackground()).stop(); | ||
| 52 | - root.setBackgroundDrawable(bg); | ||
| 51 | + ((AnimationDrawable) dots.getBackground()).stop(); | ||
| 52 | + dots.setBackgroundDrawable(bg); | ||
| 53 | 53 | } | |
| 54 | 54 | ||
| 55 | 55 | message.setText(msg); | |
@@ -71,9 +71,9 @@ public void onCreate(Bundle state) { | |||
| 71 | 71 | super.onCreate(state); | |
| 72 | 72 | ||
| 73 | 73 | setContentView(R.layout.asyncdemo); | |
| 74 | - | ||
| 75 | - final View root = findViewById(R.id.root); | ||
| 76 | - final Drawable bg = root.getBackground(); | ||
| 74 | + | ||
| 75 | + final View dots = findViewById(R.id.dots); | ||
| 76 | + final Drawable bg = dots.getBackground(); | ||
| 77 | 77 | ||
| 78 | 78 | final TextView msg = ((TextView) findViewById(R.id.msg)); | |
| 79 | 79 | ||
@@ -84,7 +84,7 @@ public void onCreate(Bundle state) { | |||
| 84 | 84 | @Override public void onClick(View v) { | |
| 85 | 85 | //initGame( | |
| 86 | 86 | new AsyncInitGame( | |
| 87 | - root, | ||
| 87 | + dots, | ||
| 88 | 88 | bg, | |
| 89 | 89 | game, | |
| 90 | 90 | //msg, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments