示例#1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_titled_fastscroll);

    inflater = LayoutInflater.from(this);

    database = new Database(this);
    database.open();
    peopleCursor = database.getLegislators();
    startManagingCursor(peopleCursor);

    Bundle extras = getIntent().getExtras();
    id = extras.getString("id");
    roll = (Roll) extras.getSerializable("roll");

    setupControls();

    RollInfoHolder holder = (RollInfoHolder) getLastNonConfigurationInstance();
    if (holder != null) {
      this.loadRollTask = holder.loadRollTask;
      this.roll = holder.roll;
      this.loadVotersTask = holder.loadVotersTask;
      this.voters = holder.voters;
      this.loadPhotoTasks = holder.loadPhotoTasks;
      this.currentTab = holder.currentTab;
      this.tracked = holder.tracked;

      if (loadPhotoTasks != null) {
        Iterator<LoadPhotoTask> iterator = loadPhotoTasks.values().iterator();
        while (iterator.hasNext()) iterator.next().onScreenLoad(this);
      }
    }

    tracker = Analytics.start(this);
    if (!tracked) {
      Analytics.page(this, tracker, "/vote/roll/" + id);
      tracked = true;
    }

    loadRoll();
  }
    @Override
    public void bindView(View view, Context context, Cursor cursor) {
      Legislator legislator = Database.loadLegislator(cursor);

      TextView name = (TextView) view.findViewById(R.id.name);
      name.setText(nameFor(legislator));
      TextView position = (TextView) view.findViewById(R.id.position);
      position.setText(positionFor(legislator));

      ImageView photo = (ImageView) view.findViewById(R.id.photo);
      LegislatorImage.setImageView(
          legislator.bioguide_id, LegislatorImage.PIC_LARGE, context, photo);

      view.setTag(legislator);
    }
示例#3
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   database.close();
   Analytics.stop(tracker);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   database.close();
 }
  public void setupDatabase() {
    database = new Database(getActivity());
    database.open();

    cursor = database.getLegislators();
  }