Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 6_21_2014 #78

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public void begin()
{
/** (Re)initialize the CountDownLatch. */
// TODO - You fill in here.
/// simple. same as for console platform strategy.
mLatch = new CountDownLatch(NUMBER_OF_THREADS);
}

/** Print the outputString to the display. */
Expand All @@ -57,20 +59,40 @@ public void print(final String outputString)
* and appends the outputString to a TextView.
*/
// TODO - You fill in here.
/// this one is different. can't have background android threads printing to console.
/// create runnable. use activity weak reference to post runnable to runonui thread.
Runnable myRunnable = new Runnable() {
@Override
public void run() {
mTextViewOutput.append(outputString);
}
};
mActivity.get().runOnUiThread(myRunnable);
}

/** Indicate that a game thread has finished running. */
public void done()
{
// TODO - You fill in here.
/// simple. same as for console platform strategy.
/// can do 2 ways... 1) call runonui thread and pass a runnable that decrements the count.
/// or 2) call countdownlatch directly.

mLatch.countDown();
}

/** Barrier that waits for all the game threads to finish. */
public void awaitDone()
{
// TODO - You fill in here.
/// simple. same as for console platform strategy.
try {
mLatch.await();
}
catch(java.lang.InterruptedException e) {
}
}

/**
* Error log formats the message and displays it for the
* debugging purposes.
Expand Down
2 changes: 1 addition & 1 deletion ex/DownloadApplication/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
Expand Down
2 changes: 1 addition & 1 deletion ex/ThreadedDownload/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
Expand Down