/** * Called by the task when no more data is available. We store the list of items into the cache * and stop the spinner. * * @param stask the source task * @param items all the itmes published * @param ok set if everything went smoothly */ private void done(Task stask, List<Item> allItems, boolean ok) { if (ok) citems = allItems; if (stask == task) { task = null; itemf.noMoreData(this, ok); itemf.selectOtherFilter(this, false); } }
/** * Requests information, according to the {@link Filter} pattern. If data is already available, it * is pushed immediately to the fragment. If a task is alreay running, we wait for it to complete, * republishing the data collected so far. Otherwise a new task is created, and data will be * published as soon as possible. * * @param conn a WKLib Connection */ @Override public void select(Connection.Meter meter, Connection conn, int level) { itemf.enableSorting(false, true, false, false); if (citems != null) { itemf.setData(this, citems, true); itemf.selectOtherFilter(this, false); } else if (task != null) { itemf.clearData(this); itemf.selectOtherFilter(this, true); task.reissue(); } else { itemf.clearData(this); itemf.selectOtherFilter(this, true); task = new Task(meter, conn); task.execute(); } }