Fixed a layout bug with the person fragment, use a custom icon for the my shared tasks filter

pull/14/head
Sam Bosley 13 years ago
parent 6b56710dc8
commit 375de2ffca

@ -8,6 +8,7 @@ import android.content.ComponentName;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle; import android.os.Bundle;
import com.timsu.astrid.R; import com.timsu.astrid.R;
@ -19,6 +20,7 @@ import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.sql.Order; import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.sql.QueryTemplate; import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.actfm.sync.ActFmSyncService; import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
@ -30,6 +32,7 @@ import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.User; import com.todoroo.astrid.data.User;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.tags.TagService;
public class PeopleFilterExposer extends BroadcastReceiver { public class PeopleFilterExposer extends BroadcastReceiver {
@ -120,13 +123,16 @@ public class PeopleFilterExposer extends BroadcastReceiver {
tagsWithMembers.close(); tagsWithMembers.close();
} }
boolean isTablet = AndroidUtilities.isTabletSized(context);
int themeFlags = isTablet ? ThemeService.FLAG_FORCE_LIGHT : 0;
String title = context.getString(R.string.actfm_my_shared_tasks_title); String title = context.getString(R.string.actfm_my_shared_tasks_title);
QueryTemplate template = new QueryTemplate().join(Join.inner(Metadata.TABLE.as("mtags"), QueryTemplate template = new QueryTemplate().join(Join.inner(Metadata.TABLE.as("mtags"),
Criterion.and(Task.ID.eq(Field.field("mtags." + Metadata.TASK.name)), Criterion.and(Task.ID.eq(Field.field("mtags." + Metadata.TASK.name)),
Field.field("mtags." + Metadata.KEY.name).eq(TagService.KEY), Field.field("mtags." + Metadata.KEY.name).eq(TagService.KEY),
Field.field("mtags." + TagService.TAG.name).in(names)))); Field.field("mtags." + TagService.TAG.name).in(names))));
FilterWithUpdate filter = new FilterWithUpdate(title, title, template, null); FilterWithCustomIntent filter = new FilterWithCustomIntent(title, title, template, null);
filter.customTaskList = new ComponentName(ContextManager.getContext(), PersonViewFragment.class); filter.customTaskList = new ComponentName(ContextManager.getContext(), PersonViewFragment.class);
@ -134,6 +140,9 @@ public class PeopleFilterExposer extends BroadcastReceiver {
extras.putBoolean(PersonViewFragment.EXTRA_HIDE_QUICK_ADD, true); extras.putBoolean(PersonViewFragment.EXTRA_HIDE_QUICK_ADD, true);
filter.customExtras = extras; filter.customExtras = extras;
filter.listingIcon = ((BitmapDrawable)context.getResources().getDrawable(
ThemeService.getDrawable(R.drawable.icn_menu_friends, themeFlags))).getBitmap();
return filter; return filter;
} }
} }

@ -4,7 +4,6 @@ import android.content.Intent;
import android.support.v4.view.Menu; import android.support.v4.view.Menu;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.timsu.astrid.R; import com.timsu.astrid.R;
@ -37,27 +36,15 @@ public class PersonViewFragment extends TaskListFragment {
@Autowired ActFmPreferenceService actFmPreferenceService; @Autowired ActFmPreferenceService actFmPreferenceService;
protected View taskListView;
private User user; private User user;
@Override
protected View getListBody(ViewGroup root) {
ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_person, root, false);
taskListView = super.getListBody(parent);
parent.addView(taskListView);
return parent;
}
@Override @Override
protected void initializeData() { protected void initializeData() {
super.initializeData(); super.initializeData();
if (extras.containsKey(EXTRA_USER_ID_LOCAL)) { if (extras.containsKey(EXTRA_USER_ID_LOCAL)) {
user = userDao.fetch(extras.getLong(EXTRA_USER_ID_LOCAL), User.PROPERTIES); user = userDao.fetch(extras.getLong(EXTRA_USER_ID_LOCAL), User.PROPERTIES);
} }
((TextView)taskListView.findViewById(android.R.id.empty)).setText(getEmptyDisplayString()); ((TextView) getView().findViewById(android.R.id.empty)).setText(getEmptyDisplayString());
} }
@Override @Override
@ -105,7 +92,7 @@ public class PersonViewFragment extends TaskListFragment {
private void refreshData(final boolean manual) { private void refreshData(final boolean manual) {
if (user != null) { if (user != null) {
((TextView)taskListView.findViewById(android.R.id.empty)).setText(R.string.DLG_loading); ((TextView) getView().findViewById(android.R.id.empty)).setText(R.string.DLG_loading);
syncService.synchronizeList(user, manual, new ProgressBarSyncResultCallback(getActivity(), this, syncService.synchronizeList(user, manual, new ProgressBarSyncResultCallback(getActivity(), this,
R.id.progressBar, new Runnable() { R.id.progressBar, new Runnable() {
@ -115,7 +102,7 @@ public class PersonViewFragment extends TaskListFragment {
ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH)); ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH));
else else
refresh(); refresh();
((TextView)taskListView.findViewById(android.R.id.empty)).setText(getEmptyDisplayString()); ((TextView) getView().findViewById(android.R.id.empty)).setText(getEmptyDisplayString());
} }
})); }));
} }

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100">
<!-- List body goes here -->
</LinearLayout>
Loading…
Cancel
Save