예제 #1
0
  public void loadViewForTaskID(long t) {
    try {
      fetchTask(t);
    } catch (SQLiteException e) {
      StartupService.handleSQLiteError(ContextManager.getContext(), e);
    }
    if (task == null) {
      return;
    }
    setUpInterface();
    setUpListAdapter();

    if (actFmPreferenceService.isLoggedIn()) {
      long pushedAt = task.getValue(Task.USER_ACTIVITIES_PUSHED_AT);
      if (DateUtilities.now() - pushedAt > DateUtilities.ONE_HOUR / 2) {
        refreshData();
      } else {
        loadingText.setText(R.string.ENA_no_comments);
        if (items.size() == 0) loadingText.setVisibility(View.VISIBLE);
      }
    }
  }
예제 #2
0
  /**
   * Fill in the Task List with current items
   *
   * @param withCustomId force task with given custom id to be part of list
   */
  protected void setUpTaskList() {
    if (filter == null) return;

    // TODO: For now, we'll modify the query to join and include the task rabbit data here.
    // Eventually, we might consider restructuring things so that this query is constructed
    // elsewhere.
    String joinedTaskRabbitQuery =
        Join.left(
                Metadata.TABLE.as(TR_METADATA_JOIN),
                Criterion.and(
                    Field.field(TR_METADATA_JOIN + "." + Metadata.KEY.name)
                        .eq(TaskRabbitMetadata.METADATA_KEY), // $NON-NLS-1$
                    Task.ID.eq(
                        Field.field(TR_METADATA_JOIN) + "." + Metadata.TASK.name))) // $NON-NLS-1$
            + filter.getSqlQuery();

    sqlQueryTemplate.set(
        SortHelper.adjustQueryForFlagsAndSort(joinedTaskRabbitQuery, sortFlags, sortSort));

    // perform query
    TodorooCursor<Task> currentCursor;
    try {
      currentCursor = taskService.fetchFiltered(sqlQueryTemplate.get(), null, taskProperties());
    } catch (SQLiteException e) {
      StartupService.handleSQLiteColumnMissing(getActivity(), e);
      return;
    }

    // set up list adapters
    taskAdapter = createTaskAdapter(currentCursor);

    setListAdapter(taskAdapter);
    getListView().setOnScrollListener(this);
    registerForContextMenu(getListView());

    loadTaskListContent(true);
  }