Handle crashes reported from Android Market

pull/14/head
Tim Su 13 years ago
parent efc7d22592
commit 5d105e4df4

@ -184,6 +184,7 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
"Model Error: Did not read property " + property.name); //$NON-NLS-1$ "Model Error: Did not read property " + property.name); //$NON-NLS-1$
// resolve properties that were retrieved with a different type than accessed // resolve properties that were retrieved with a different type than accessed
try {
if(value instanceof String && property instanceof LongProperty) if(value instanceof String && property instanceof LongProperty)
return (TYPE) Long.valueOf((String)value); return (TYPE) Long.valueOf((String)value);
else if(value instanceof String && property instanceof IntegerProperty) else if(value instanceof String && property instanceof IntegerProperty)
@ -193,6 +194,9 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
else if(value instanceof Integer && property instanceof LongProperty) else if(value instanceof Integer && property instanceof LongProperty)
return (TYPE) Long.valueOf(((Number)value).longValue()); return (TYPE) Long.valueOf(((Number)value).longValue());
return (TYPE) value; return (TYPE) value;
} catch (NumberFormatException e) {
return (TYPE) getDefaultValues().get(property.name);
}
} }
/** /**

@ -180,7 +180,7 @@ public class TouchListView extends ListView {
for (int i = 0;; i++) { for (int i = 0;; i++) {
View v = getChildAt(i); View v = getChildAt(i);
if (v == null) { if (v == null) {
if (deletion) { if (deletion && getCount() > 0) {
// HACK force update of mItemCount // HACK force update of mItemCount
int position = getFirstVisiblePosition(); int position = getFirstVisiblePosition();
int y = getChildAt(0).getTop(); int y = getChildAt(0).getTop();

@ -371,10 +371,10 @@ public class EditPeopleControlSet implements TaskEditControlSet {
saveToast = toast; saveToast = toast;
boolean dirty = false; boolean dirty = false;
try { try {
JSONObject userJson; JSONObject userJson = null;
if(assignedCustom.getVisibility() == View.VISIBLE) if(assignedCustom.getVisibility() == View.VISIBLE)
userJson = PeopleContainer.createUserJson(assignedCustom); userJson = PeopleContainer.createUserJson(assignedCustom);
else else if(assignedSpinner.getSelectedItem() != null)
userJson = ((AssignedToUser) assignedSpinner.getSelectedItem()).user; userJson = ((AssignedToUser) assignedSpinner.getSelectedItem()).user;
if(userJson == null || userJson.optLong("id", -1) == 0) { if(userJson == null || userJson.optLong("id", -1) == 0) {

@ -73,7 +73,7 @@ public class DefaultsPreferences extends TodorooPreferenceActivity {
setting)); setting));
// if user changed the value, refresh task defaults // if user changed the value, refresh task defaults
if(!value.equals(Preferences.getStringValue(preference.getKey()))) { if(!AndroidUtilities.equals(value, Preferences.getStringValue(preference.getKey()))) {
Editor editor = Preferences.getPrefs(this).edit(); Editor editor = Preferences.getPrefs(this).edit();
editor.putString(preference.getKey(), (String)value); editor.putString(preference.getKey(), (String)value);
editor.commit(); editor.commit();

@ -86,7 +86,7 @@ public class FilterListActivity extends ExpandableListActivity {
@Autowired ActFmPreferenceService actFmPreferenceService; @Autowired ActFmPreferenceService actFmPreferenceService;
@Autowired ActFmSyncService actFmSyncService; @Autowired ActFmSyncService actFmSyncService;
FilterAdapter adapter = null; protected FilterAdapter adapter = null;
/* ====================================================================== /* ======================================================================
* ======================================================= initialization * ======================================================= initialization

@ -146,6 +146,7 @@ public class FilterAdapter extends BaseExpandableListAdapter {
public void clear() { public void clear() {
items.clear(); items.clear();
notifyDataSetInvalidated();
} }
/** /**

Loading…
Cancel
Save