Added fail safes

pull/178/head
M66B 5 years ago
parent 58ad6b0465
commit d89c6fe433

@ -699,6 +699,7 @@ public class FragmentCompose extends FragmentBase {
@Override
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
try {
int id = view.getId();
if (id == R.id.tvName) {
if (colName < 0)
@ -733,6 +734,9 @@ public class FragmentCompose extends FragmentBase {
}
return true;
}
} catch (Throwable ex) {
Log.e(ex);
}
return false;
}
});
@ -742,6 +746,7 @@ public class FragmentCompose extends FragmentBase {
private int colEmail = -1;
public CharSequence convertToString(Cursor cursor) {
try {
if (colName < 0)
colName = cursor.getColumnIndex("name");
if (colEmail < 0)
@ -757,14 +762,19 @@ public class FragmentCompose extends FragmentBase {
sb.append("<").append(email).append(">");
}
return sb.toString();
} catch (Throwable ex) {
Log.e(ex);
return ex.toString();
}
}
});
cadapter.setFilterQueryProvider(new FilterQueryProvider() {
public Cursor runQuery(CharSequence typed) {
Log.i("Suggest contact=" + typed);
MatrixCursor result = new MatrixCursor(new String[]{"_id", "name", "email", "photo", "local"});
try {
Log.i("Suggest contact=" + typed);
if (typed == null)
return result;
@ -867,7 +877,11 @@ public class FragmentCompose extends FragmentBase {
.add(item.avatar)
.add(item.id == 0 ? 0 : 1);
}
} catch (Throwable ex) {
Log.e(ex);
}
Log.i("Suggesting contacts=" + result.getCount());
return result;
}
});

Loading…
Cancel
Save