Improving intent handling so each activity receives its data type.

This commit is contained in:
Rodrigo Damazio
2011-05-25 19:17:34 -03:00
parent eeaa50ddcb
commit e8a872d351
3 changed files with 87 additions and 12 deletions
@@ -1,3 +1,18 @@
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.file;
import com.google.android.apps.mytracks.Constants;
@@ -17,6 +32,11 @@ import android.os.Bundle;
import java.io.File;
/**
* Activity for saving a track to a file (and optionally sending that file).
*
* @author Rodrigo Damazio
*/
public class SaveActivity extends Activity {
public static final String EXTRA_TRACK_ID = "track_id";
public static final String EXTRA_SHARE_FILE = "share_file";
@@ -146,7 +166,6 @@ public class SaveActivity extends Activity {
intent.putExtra(EXTRA_TRACK_ID, trackId);
intent.putExtra(EXTRA_FILE_FORMAT, exportFormat.ordinal());
intent.putExtra(EXTRA_SHARE_FILE, shareFile);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
ctx.startActivity(intent);
}
}
@@ -1,3 +1,18 @@
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.sendtogoogle;
import static com.google.android.apps.mytracks.Constants.TAG;
@@ -39,7 +54,7 @@ import java.util.HashMap;
import java.util.List;
/**
* Helper for managing the sending of tracks to Google services.
* Helper activity for managing the sending of tracks to Google services.
*
* @author Rodrigo Damazio
*/
@@ -242,7 +257,7 @@ public class SendActivity extends Activity implements ProgressIndicator {
}
};
final SendToFusionTables sender = new SendToFusionTables(this, lastAuth,
sendTrackId, this/*progressIndicator*/, onCompletion);
sendTrackId, this /*progressIndicator*/, onCompletion);
HandlerThread handlerThread = new HandlerThread("SendToFusionTables");
handlerThread.start();
@@ -613,7 +628,6 @@ public class SendActivity extends Activity implements ProgressIndicator {
Intent intent = new Intent(ctx, SendActivity.class);
intent.putExtra(SendActivity.EXTRA_TRACK_ID, trackId);
intent.putExtra(SendActivity.EXTRA_SHARE_LINK, shareLink);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
ctx.startActivity(intent);
}
}