Fixed a bug introduced in dd6a3fa where people and featured list adapters wouldn't be populated

pull/14/head
Sam Bosley 12 years ago
parent 01858ac016
commit 96594f07e1

@ -40,4 +40,9 @@ public class PeopleFilterAdapter extends FilterAdapter {
public void unregisterRecevier() {
activity.unregisterReceiver(filterReceiver);
}
@Override
protected boolean shouldDirectlyPopulateFilters() {
return false;
}
}

@ -37,6 +37,11 @@ public class FeaturedListFilterAdapter extends FilterAdapter {
activity.unregisterReceiver(filterReceiver);
}
@Override
protected boolean shouldDirectlyPopulateFilters() {
return false;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);

@ -357,6 +357,10 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
return selection;
}
protected boolean shouldDirectlyPopulateFilters() {
return true;
}
/* ======================================================================
* ============================================================= receiver
* ====================================================================== */
@ -381,13 +385,26 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
@Override
public void onReceive(Context context, Intent intent) {
try {
for (ResolveInfo filterExposerInfo : filterExposerList) {
String className = filterExposerInfo.activityInfo.name;
AstridFilterExposer filterExposer = null;
filterExposer = (AstridFilterExposer) Class.forName(className, true, FilterAdapter.class.getClassLoader()).newInstance();
if (filterExposer != null) {
populateFiltersToAdapter(filterExposer.getFilters());
if (shouldDirectlyPopulateFilters()) {
for (ResolveInfo filterExposerInfo : filterExposerList) {
String className = filterExposerInfo.activityInfo.name;
AstridFilterExposer filterExposer = null;
filterExposer = (AstridFilterExposer) Class.forName(className, true, FilterAdapter.class.getClassLoader()).newInstance();
if (filterExposer != null) {
populateFiltersToAdapter(filterExposer.getFilters());
}
}
} else {
try {
Bundle extras = intent.getExtras();
extras.setClassLoader(FilterListHeader.class.getClassLoader());
final Parcelable[] filters = extras.getParcelableArray(AstridApiConstants.EXTRAS_RESPONSE);
populateFiltersToAdapter(filters);
} catch (Exception e) {
Log.e("receive-filter-" + //$NON-NLS-1$
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON),
e.toString(), e);
}
}
} catch (Exception e) {

Loading…
Cancel
Save