Removing singleton usage: moving all send and save logic out of the MyTracks class.

This is a non-trivial step: I decentralized dialog creation (since it made no sense to have a single place creating a lot of completely unrelated dialogs), made invisible activities just for sending/saving, and changed menu handling a bit, all to decentralize those functions from MyTracks.

There's still a TODO to handle GET_LOGIN more nicely instead of returning from the depths of auth management into the current activity.
This commit is contained in:
Rodrigo Damazio
2011-05-25 04:50:21 -03:00
parent 16b0d4eb24
commit eeaa50ddcb
16 changed files with 978 additions and 863 deletions
@@ -38,13 +38,6 @@ public class DialogManagerTest
assertNull(MyTracks.getInstance());
}
public void test_onCreateChartSettings() {
Dialog d =
getActivity().onCreateDialog(DialogManager.DIALOG_CHART_SETTINGS, null);
assertNotNull(d);
assertTrue(d instanceof ChartSettingsDialog);
}
public void test_onCreateImportProgress() {
Dialog d =
getActivity().onCreateDialog(
@@ -62,11 +55,4 @@ public class DialogManagerTest
assertEquals(100, pd.getMax());
assertEquals(10, pd.getProgress());
}
public void test_onCreateSendToGoogle() {
Dialog d =
getActivity().onCreateDialog(DialogManager.DIALOG_SEND_TO_GOOGLE, null);
assertNotNull(d);
assertTrue(d instanceof SendDialog);
}
}
@@ -13,10 +13,11 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
package com.google.android.apps.mytracks.io.file;
import com.google.android.apps.mytracks.io.file.MockTrackWriter;
import com.google.android.apps.mytracks.MyTracks;
import com.google.android.apps.mytracks.io.file.TrackWriter;
import com.google.android.apps.mytracks.io.file.WriteProgressController;
import android.app.ProgressDialog;
import android.test.ActivityInstrumentationTestCase2;
@@ -60,7 +61,7 @@ public class WriteProgressControllerTest extends ActivityInstrumentationTestCase
getActivity(), mockWriter);
controller.setOnCompletionListener(new WriteProgressController.OnCompletionListener() {
@Override
public void onComplete(TrackWriter writer) {
public void onComplete() {
controllerDoneRef.set(true);
}
});