Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Added Sending results among activities + few enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
DevBinnooh committed May 21, 2012
1 parent a6a9963 commit 0cb1d22
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/org/mixare/MixMap.java
Expand Up @@ -122,6 +122,18 @@ public void onCreate(Bundle savedInstanceState) {
}
}


/**
* Closes MapView Activity and returns that request to NOT refresh screen.
*/

private void closeMapViewActivity() {
Intent closeMapView = new Intent();
closeMapView.putExtra("RefreshScreen", false);
setResult(RESULT_OK, closeMapView);
finish();
}

public void setStartPoint() {
Location location = mixContext.getLocationFinder().getCurrentLocation();
MapController controller;
Expand Down Expand Up @@ -212,17 +224,19 @@ public boolean onOptionsItemSelected(MenuItem item){
/*List View*/
case 4:
createListView();
finish();
//finish(); don't close map if list view created
break;
/*back to Camera View*/
case 5:
finish();
//finish();
closeMapViewActivity();
break;
case 6:
togglePath();
//refresh:
startActivity(getIntent());
finish();
//finish();
closeMapViewActivity();
}
return true;
}
Expand Down
55 changes: 55 additions & 0 deletions src/org/mixare/MixView.java
Expand Up @@ -190,6 +190,29 @@ protected void onPause() {
}
}

/**
* {@inheritDoc}
* Mixare - Receives results from other launched activities
* Base on the result returned, it either refreshes screen or not.
*/
protected void onActivityResult(final int requestCode,
final int resultCode, Intent data) {
Log.d(TAG + " WorkFlow", "MixView - onActivityResult Called");
// check if the returned is request to refresh screen (setting might be
// changed)
try {
if (data.getBooleanExtra("RefreshScreen", false)) {
Log.d(TAG + " WorkFlow",
"MixView - Received Refresh Screen Request .. about to refresh");
repaint();
refreshDownload();
}

} catch (Exception ex) {
// do nothing do to mix of return results.
}
}

@Override
protected void onResume() {
super.onResume();
Expand Down Expand Up @@ -753,6 +776,38 @@ public boolean onTouch(View v, MotionEvent event) {

/* ************ Handlers ************ */

// /**
// * Refreshes Download
// * Under Construction --
// */
private void refreshDownload() {
//
// try {
// if (mixViewData.getDownloadThread() != null) {
// if (!mixViewData.getDownloadThread().isInterrupted()) {
// mixViewData.getDownloadThread().interrupt();
// mixViewData.getMixContext().getDownloadManager().restart();
// }
//
// } else { // if no download thread found
// Log.w(TAG + " WorkFlow",
// "MixView - refreshDownload - ops DownloadManager was not created, check workflow.");
//
// ((Object) mixViewData).setDownloadThread(new Thread(mixViewData
// .getMixContext().getDownloadManager()));
//
// // @TODO Syncronize DownloadManager, call Start instead of run.
//
// mixViewData.getMixContext().getDownloadManager().run();
// }
//
// } catch (Exception ex) {
// Log.e(TAG,
// "MixView - refreshDownload - Error refreshing DownloadManager");
// }
}


public void doError(Exception ex1) {
if (!fError) {
fError = true;
Expand Down

0 comments on commit 0cb1d22

Please sign in to comment.