Fixed some bugs to get Astrid launching, basic synchronization stuff. Still don't work, because of the crazy multi-db join we're doing...

pull/14/head
Tim Su 16 years ago
parent b66e28dfb8
commit cf75d057c1

@ -230,6 +230,27 @@
</receiver>
<activity android:name="com.todoroo.astrid.reminders.NotificationActivity"
android:taskAffinity="" />
<!-- rmilk -->
<receiver android:name="com.todoroo.astrid.rmilk.FilterExposer">
<intent-filter>
<action android:name="com.todoroo.astrid.REQUEST_FILTERS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:name="com.todoroo.astrid.rmilk.MilkLoginActivity"
android:theme="@style/Theme" />
<activity android:name="com.todoroo.astrid.rmilk.MilkPreferences"
android:label="@string/rmilk_MPr_header">
<intent-filter>
<action android:name="com.todoroo.astrid.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>

@ -4,7 +4,7 @@
<booleanAttribute key="ch.zork.quicklaunch" value="true"/>
<stringAttribute key="ch.zork.quicklaunch.icon" value="14.gif"/>
<intAttribute key="ch.zork.quicklaunch.index" value="0"/>
<stringAttribute key="ch.zork.quicklaunch.mode" value="run"/>
<stringAttribute key="ch.zork.quicklaunch.mode" value="debug"/>
<intAttribute key="com.android.ide.eclipse.adt.action" value="0"/>
<stringAttribute key="com.android.ide.eclipse.adt.avd" value="android-22"/>
<stringAttribute key="com.android.ide.eclipse.adt.commandline" value="-scale 0.7"/>

@ -18,7 +18,7 @@ public abstract class Criterion {
public static Criterion all = new Criterion(Operator.exists) {
@Override
protected void populate(StringBuilder sb) {
sb.append(true);
sb.append(1);
}
};

@ -38,6 +38,7 @@ public class MilkPreferences extends PreferenceActivity {
initializePreference(screen);
// status
boolean loggedIn = Utilities.isLoggedIn();
final String status = "Please Log In To RTM!"; //$NON-NLS-1$
final int statusColor = Color.RED;
@ -65,8 +66,12 @@ public class MilkPreferences extends PreferenceActivity {
return true;
}
});
/*Preference clearDataPreference = screen.getPreferenceManager().findPreference(
getString(R.string.rmilk_MPr_forget_key));*/
Preference clearDataPreference = screen.getPreferenceManager().findPreference(
getString(R.string.rmilk_MPr_forget_key));
if(!loggedIn) {
syncAction.setTitle(R.string.rmilk_MPr_sync_log_in);
clearDataPreference.setEnabled(false);
}
}
private void initializePreference(Preference preference) {

@ -36,7 +36,8 @@ public class MilkDatabase extends AbstractDatabase {
* also make sure that our SQLite helper does the right thing.
*/
public static final Table[] TABLES = new Table[] {
MilkList.TABLE
MilkList.TABLE,
MilkTask.TABLE
};
// --- implementation

@ -7,6 +7,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@ -24,6 +26,7 @@ import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.api.SynchronizationProvider;
import com.todoroo.astrid.model.Task;
import com.todoroo.astrid.rmilk.MilkLoginActivity;
@ -46,9 +49,10 @@ import com.todoroo.astrid.service.AstridDependencyInjector;
public class RTMSyncProvider extends SynchronizationProvider {
protected ServiceImpl rtmService = null;
protected String timeline = null;
protected MilkDataService dataService = null;
private ServiceImpl rtmService = null;
private String timeline = null;
private MilkDataService dataService = null;
private ProgressDialog progressDialog = null;
static {
AstridDependencyInjector.initialize();
@ -57,6 +61,9 @@ public class RTMSyncProvider extends SynchronizationProvider {
@Autowired
protected ExceptionService exceptionService;
@Autowired
protected DialogUtilities dialogUtilities;
public RTMSyncProvider() {
super();
DependencyInjectionService.getInstance().inject(this);
@ -71,6 +78,12 @@ public class RTMSyncProvider extends SynchronizationProvider {
Context context = ContextManager.getContext();
dataService = new MilkDataService(context);
if(context instanceof Activity) {
progressDialog = dialogUtilities.progressDialog(context,
context.getString(R.string.DLG_communicating_text));
progressDialog.show();
}
// authenticate the user. this will automatically call the next step
authenticate(context);
}
@ -125,9 +138,19 @@ public class RTMSyncProvider extends SynchronizationProvider {
}
}
/** Perform authentication with RTM. Will open the SyncBrowser if necessary */
@SuppressWarnings("nls")
private void authenticate(final Context context) {
new Thread(new Runnable() {
public void run() {
authenticateInNewThread(context);
}
}).start();
}
/**
* Perform authentication with RTM. Will open the SyncBrowser if necessary
*/
@SuppressWarnings("nls")
private void authenticateInNewThread(final Context context) {
final Resources r = context.getResources();
FlurryAgent.onEvent("rtm-started");
@ -174,6 +197,7 @@ public class RTMSyncProvider extends SynchronizationProvider {
try {
String token = rtmService.completeAuthorization();
Utilities.setToken(token);
// TODO proceed with sync
return null;
} catch (Exception e) {
// didn't work
@ -202,15 +226,7 @@ public class RTMSyncProvider extends SynchronizationProvider {
// ----------------------------------------------------- synchronization!
// ----------------------------------------------------------------------
private void performSync(final Context context) {
new Thread(new Runnable() {
public void run() {
performSyncInNewThread(context);
}
}).start();
}
protected void performSyncInNewThread(final Context context) {
protected void performSync(final Context context) {
try {
// get RTM timeline
timeline = rtmService.timelines_create();

@ -87,13 +87,15 @@
<!-- Synchronize Now Button -->
<string name="rmilk_MPr_sync">Synchronize Now!</string>
<!-- Synchronize Now Button if not logged in-->
<string name="rmilk_MPr_sync_log_in">Log In &amp; Synchronize!</string>
<!-- Preference Key (do not translate) -->
<string name="rmilk_MPr_sync_key">rmilk_sync</string>
<!-- Clear Data Title -->
<string name="rmilk_MPr_forget">Clear Personal Data</string>
<string name="rmilk_MPr_forget">Log Out</string>
<!-- Clear Data Description -->
<string name="rmilk_MPr_forget_description">Log out of Remember the Milk</string>
<string name="rmilk_MPr_forget_description">Clears all RTM synchronization data</string>
<!-- Preference Key (do not translate) -->
<string name="rmilk_MPr_forget_key">rmilk_forget</string>
Loading…
Cancel
Save