Fix for crashes reported by astrid users

pull/14/head
Tim Su 15 years ago
parent 7ec45dd242
commit 17221f59a2

@ -9,6 +9,7 @@ import android.content.Intent;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.adapter.TaskAdapter; import com.todoroo.astrid.adapter.TaskAdapter;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.data.Metadata; import com.todoroo.astrid.data.Metadata;
@ -17,7 +18,6 @@ import com.todoroo.astrid.producteev.sync.ProducteevDashboard;
import com.todoroo.astrid.producteev.sync.ProducteevDataService; import com.todoroo.astrid.producteev.sync.ProducteevDataService;
import com.todoroo.astrid.producteev.sync.ProducteevNote; import com.todoroo.astrid.producteev.sync.ProducteevNote;
import com.todoroo.astrid.producteev.sync.ProducteevTask; import com.todoroo.astrid.producteev.sync.ProducteevTask;
import com.todoroo.andlib.utility.Preferences;
/** /**
* Exposes Task Details for Producteev: * Exposes Task Details for Producteev:
@ -35,7 +35,12 @@ public class ProducteevDetailExposer extends BroadcastReceiver {
return; return;
boolean extended = intent.getBooleanExtra(AstridApiConstants.EXTRAS_EXTENDED, false); boolean extended = intent.getBooleanExtra(AstridApiConstants.EXTRAS_EXTENDED, false);
String taskDetail = getTaskDetails(context, taskId, extended); String taskDetail;
try {
taskDetail = getTaskDetails(context, taskId, extended);
} catch (Exception e) {
return;
}
if(taskDetail == null) if(taskDetail == null)
return; return;
@ -59,8 +64,9 @@ public class ProducteevDetailExposer extends BroadcastReceiver {
return null; return null;
if(!extended) { if(!extended) {
long dashboardId = -1;
long dashboardId = metadata.getValue(ProducteevTask.DASHBOARD_ID); if(metadata.containsNonNullValue(ProducteevTask.DASHBOARD_ID))
dashboardId = metadata.getValue(ProducteevTask.DASHBOARD_ID);
long responsibleId = -1; long responsibleId = -1;
if(metadata.containsNonNullValue(ProducteevTask.RESPONSIBLE_ID)) if(metadata.containsNonNullValue(ProducteevTask.RESPONSIBLE_ID))
responsibleId = metadata.getValue(ProducteevTask.RESPONSIBLE_ID); responsibleId = metadata.getValue(ProducteevTask.RESPONSIBLE_ID);

@ -28,13 +28,13 @@ import android.widget.TextView;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterCategory; import com.todoroo.astrid.api.FilterCategory;
import com.todoroo.astrid.api.FilterListHeader; import com.todoroo.astrid.api.FilterListHeader;
import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.service.TaskService;
import com.todoroo.andlib.utility.Preferences;
public class FilterAdapter extends BaseExpandableListAdapter { public class FilterAdapter extends BaseExpandableListAdapter {
@ -80,7 +80,7 @@ public class FilterAdapter extends BaseExpandableListAdapter {
// nothing to do (corePoolSize == 0, which makes it available for garbage collection), and will wake itself up // nothing to do (corePoolSize == 0, which makes it available for garbage collection), and will wake itself up
// if new filters are queued (obviously it cannot be garbage collected if it is possible for new filters to // if new filters are queued (obviously it cannot be garbage collected if it is possible for new filters to
// be added). // be added).
private ThreadPoolExecutor filterExecutor = new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); private final ThreadPoolExecutor filterExecutor = new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
public FilterAdapter(Activity activity, ExpandableListView listView, public FilterAdapter(Activity activity, ExpandableListView listView,
int rowLayout, boolean skipIntentFilters) { int rowLayout, boolean skipIntentFilters) {
@ -210,6 +210,8 @@ public class FilterAdapter extends BaseExpandableListAdapter {
* ====================================================================== */ * ====================================================================== */
public Object getGroup(int groupPosition) { public Object getGroup(int groupPosition) {
if(groupPosition >= items.size())
return null;
return items.get(groupPosition); return items.get(groupPosition);
} }

@ -17,18 +17,18 @@ import android.database.Cursor;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.Html; import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.Html.ImageGetter; import android.text.Html.ImageGetter;
import android.text.Html.TagHandler; import android.text.Html.TagHandler;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener; import android.view.View.OnCreateContextMenuListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
@ -610,7 +610,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
@Override @Override
protected void reset(ViewHolder viewHolder, long taskId) { protected void reset(ViewHolder viewHolder, long taskId) {
TextView view = viewHolder.extendedDetails; TextView view = viewHolder.extendedDetails;
view.setVisibility(View.GONE); if(view != null)
view.setVisibility(View.GONE);
} }
} }

@ -220,7 +220,7 @@ public class AddOnService {
// temporary temporary // temporary temporary
AddOn[] list = new AddOn[3]; AddOn[] list = new AddOn[3];
list[0] = new AddOn(false, true, "Astrid Power Pack", null, list[0] = new AddOn(false, true, "Astrid Power Pack", null,
"Support Astrid and get more productive with the Astrid Power Pack. Backup, widgets, no ads, and calendar integration. Power up today!", "Support Astrid and get more productive with the Astrid Power Pack. 4x2 and 4x4 widgets, timer, and voice integration. Power up today!",
POWER_PACK_PACKAGE, "http://www.weloveastrid.com/store", POWER_PACK_PACKAGE, "http://www.weloveastrid.com/store",
((BitmapDrawable)r.getDrawable(R.drawable.icon_pp)).getBitmap()); ((BitmapDrawable)r.getDrawable(R.drawable.icon_pp)).getBitmap());

@ -1,7 +1,6 @@
package com.todoroo.astrid.service; package com.todoroo.astrid.service;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -101,7 +100,7 @@ public final class UpgradeService {
StringBuilder changeLog = new StringBuilder(); StringBuilder changeLog = new StringBuilder();
if(from <= V2_14_4) { if(from <= V2_14_4) {
newVersionString(changeLog, "3.6.0 (11/10/10)", new String[] { newVersionString(changeLog, "3.6.0 (11/12/10)", new String[] {
"Astrid is brand new inside and out! In addition to a new " + "Astrid is brand new inside and out! In addition to a new " +
"look and feel, a new add-on system allows Astrid to become " + "look and feel, a new add-on system allows Astrid to become " +
"more powerful, while other improvements have made it faster " + "more powerful, while other improvements have made it faster " +
@ -111,10 +110,12 @@ public final class UpgradeService {
}); });
} else { } else {
// current message // current message
newVersionString(changeLog, "3.6.0 (11/10/10)", new String[] { newVersionString(changeLog, "3.6.0 (11/12/10)", new String[] {
"Astrid Power Pack is now launched to the Android Market. " + "Astrid Power Pack is now launched to the Android Market. " +
"Power Pack features include 4x2 and 4x4 widgets and voice " + "New Power Pack features include 4x2 and 4x4 widgets and voice " +
"task reminders and creation. Go to the add-ons page to find out more!", "task reminders and creation. Go to the add-ons page to find out more!",
"Fix for Google Tasks: due times got lost on sync",
"Fix for task alarms not always firing if multiple set"
}); });
upgrade3To3_6(context); upgrade3To3_6(context);
@ -125,12 +126,13 @@ public final class UpgradeService {
"Bug fix with RMilk & new tasks not getting synced", "Bug fix with RMilk & new tasks not getting synced",
"Fixed Force Closes and other bugs", "Fixed Force Closes and other bugs",
}); });
if(from >= V3_0_0 && from < V3_4_0) if(from >= V3_0_0 && from < V3_4_0) {
newVersionString(changeLog, "3.4.0 (10/08/10)", new String[] { newVersionString(changeLog, "3.4.0 (10/08/10)", new String[] {
"End User License Agreement", "End User License Agreement",
"Option to disable usage statistics", "Option to disable usage statistics",
"Bug fixes with Producteev", "Bug fixes with Producteev",
}); });
}
if(from >= V3_0_0 && from < V3_3_0) if(from >= V3_0_0 && from < V3_3_0)
newVersionString(changeLog, "3.3.0 (9/17/10)", new String[] { newVersionString(changeLog, "3.3.0 (9/17/10)", new String[] {
"Fixed some RTM duplicated tasks issues", "Fixed some RTM duplicated tasks issues",
@ -186,35 +188,6 @@ public final class UpgradeService {
// --- upgrade functions // --- upgrade functions
@SuppressWarnings({"nls", "unused"})
private void upgrade3To3_4(final Context context) {
// if RTM, store RTM to secondary preferences
if(Preferences.getStringValue("rmilk_token") != null) {
SharedPreferences settings = context.getSharedPreferences("rtm", Context.MODE_WORLD_READABLE);
Editor editor = settings.edit();
editor.putString("rmilk_token", Preferences.getStringValue("rmilk_token"));
editor.putLong("rmilk_last_sync", Preferences.getLong("rmilk_last_sync", 0));
editor.commit();
final String message = "Hi, it looks like you are a Remember the Milk user! " +
"In this version of Astrid, RTM is now a community-supported " +
"add-on. Please go to the Android market to install it!";
if(context instanceof Activity) {
((Activity)context).runOnUiThread(new Runnable() {
@Override
public void run() {
new AlertDialog.Builder(context)
.setTitle(com.todoroo.astrid.api.R.string.DLG_information_title)
.setMessage(message)
.setPositiveButton("Go To Market", new AddOnService.MarketClickListener(context, "org.weloveastrid.rmilk"))
.setNegativeButton("Later", null)
.show();
}
});
}
}
}
/** /**
* Moves sorting prefs to public pref store * Moves sorting prefs to public pref store
* @param context * @param context

Loading…
Cancel
Save