More timing fixes

pull/14/head
Sam Bosley 13 years ago
parent 2cb3c9c27c
commit 51b33a3c9b

@ -52,6 +52,7 @@ public class PersonViewFragment extends TaskListFragment {
private AsyncImageView userImage; private AsyncImageView userImage;
private TextView userSubtitle; private TextView userSubtitle;
private TextView userStatusButton; private TextView userStatusButton;
private TextView emptyView;
private User user; private User user;
@ -61,7 +62,8 @@ public class PersonViewFragment extends TaskListFragment {
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) getView().findViewById(android.R.id.empty)).setText(getEmptyDisplayString()); emptyView = ((TextView) getView().findViewById(android.R.id.empty));
emptyView.setText(getEmptyDisplayString());
setupUserHeader(); setupUserHeader();
} }
@ -89,7 +91,7 @@ public class PersonViewFragment extends TaskListFragment {
quickAddBar.setVisibility(View.GONE); quickAddBar.setVisibility(View.GONE);
// set listener for astrid icon // set listener for astrid icon
((TextView) getView().findViewById(android.R.id.empty)).setOnClickListener(null); emptyView.setOnClickListener(null);
} }
@ -197,7 +199,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) getView().findViewById(android.R.id.empty)).setText(R.string.DLG_loading); emptyView.setText(R.string.DLG_loading);
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
@ -207,15 +209,19 @@ public class PersonViewFragment extends TaskListFragment {
} }
SyncResultCallback callback; SyncResultCallback callback;
try { try {
if (getActivity() == null)
throw new NullPointerException("Person view activity is null"); //$NON-NLS-1$
callback = new ProgressBarSyncResultCallback(getActivity(), PersonViewFragment.this, callback = new ProgressBarSyncResultCallback(getActivity(), PersonViewFragment.this,
R.id.progressBar, new Runnable() { R.id.progressBar, new Runnable() {
@Override @Override
public void run() { public void run() {
if (manual) if (getActivity() != null) {
ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH)); if (manual)
else ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH));
refresh(); else
((TextView) getView().findViewById(android.R.id.empty)).setText(getEmptyDisplayString()); refresh();
emptyView.setText(getEmptyDisplayString());
}
} }
}); });
} catch (Exception e) { // Fragment no longer attached, but sync and refresh anyways } catch (Exception e) { // Fragment no longer attached, but sync and refresh anyways

Loading…
Cancel
Save