예제 #1
0
  private void loadData() {
    // setup list and adapter
    ArrayList<Result> tmpA = status.getTasks();
    if (tmpA
        != null) { // can be null before first monitor status cycle (e.g. when not logged in or
                   // during startup)

      // deep copy, so ArrayList adapter actually recognizes the difference
      updateData(tmpA);

      if (!setup) { // first time we got proper results, setup adapter
        lv = (ListView) findViewById(R.id.tasksList);
        listAdapter = new TasksListAdapter(TasksActivity.this, R.id.tasksList, data);
        lv.setAdapter(listAdapter);
        lv.setOnItemClickListener(itemClickListener);

        setup = true;
      }

      // if(Logging.DEBUG) Log.d(Logging.TAG,"loadData: data set contains " + data.size() + "
      // results.");
      listAdapter.notifyDataSetChanged(); // force list adapter to refresh

    } else {
      if (Logging.WARNING) Log.w(Logging.TAG, "loadData: array is null, rpc failed");
    }
  }
예제 #2
0
 @Override
 public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
   TaskData task = listAdapter.getItem(position);
   task.expanded = !task.expanded;
   listAdapter.notifyDataSetChanged();
 }