|
|
|
@ -17,6 +17,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
@ -588,13 +589,16 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
requestNewDetails(task);
|
|
|
|
requestNewDetails(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(taskDetailLoader.size() > 0) {
|
|
|
|
if(taskDetailLoader.size() > 0) {
|
|
|
|
fragment.getActivity().runOnUiThread(new Runnable() {
|
|
|
|
Activity activity = fragment.getActivity();
|
|
|
|
|
|
|
|
if (activity != null) {
|
|
|
|
|
|
|
|
activity.runOnUiThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
notifyDataSetChanged();
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
// suppress silently
|
|
|
|
// suppress silently
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
@ -615,7 +619,9 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
private void requestNewDetails(Task task) {
|
|
|
|
private void requestNewDetails(Task task) {
|
|
|
|
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_DETAILS);
|
|
|
|
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_DETAILS);
|
|
|
|
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
|
|
|
|
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
|
|
|
|
fragment.getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
|
|
|
|
Activity activity = fragment.getActivity();
|
|
|
|
|
|
|
|
if (activity != null)
|
|
|
|
|
|
|
|
activity.sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -642,13 +648,16 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
taskService.save(task);
|
|
|
|
taskService.save(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fragment.getActivity().runOnUiThread(new Runnable() {
|
|
|
|
Activity activity = fragment.getActivity();
|
|
|
|
|
|
|
|
if (activity != null) {
|
|
|
|
|
|
|
|
activity.runOnUiThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
notifyDataSetChanged();
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private final ImageGetter detailImageGetter = new ImageGetter() {
|
|
|
|
private final ImageGetter detailImageGetter = new ImageGetter() {
|
|
|
|
private final HashMap<Integer, Drawable> cache =
|
|
|
|
private final HashMap<Integer, Drawable> cache =
|
|
|
|
@ -849,7 +858,9 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
|
|
|
|
|
|
|
|
if(myHolder != null) {
|
|
|
|
if(myHolder != null) {
|
|
|
|
final ViewHolder viewHolder = myHolder;
|
|
|
|
final ViewHolder viewHolder = myHolder;
|
|
|
|
fragment.getActivity().runOnUiThread(new Runnable() {
|
|
|
|
Activity activity = fragment.getActivity();
|
|
|
|
|
|
|
|
if (activity != null) {
|
|
|
|
|
|
|
|
activity.runOnUiThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
mBarListener.addWithAction(item);
|
|
|
|
mBarListener.addWithAction(item);
|
|
|
|
@ -860,6 +871,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Collection<TaskAction> get(long taskId) {
|
|
|
|
public Collection<TaskAction> get(long taskId) {
|
|
|
|
@ -1037,7 +1049,9 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fragment.getActivity().unregisterReceiver(this);
|
|
|
|
Activity activity = fragment.getActivity();
|
|
|
|
|
|
|
|
if (activity != null)
|
|
|
|
|
|
|
|
activity.unregisterReceiver(this);
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
} catch (IllegalArgumentException e) {
|
|
|
|
// ignore
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|