Exemplo n.º 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();
  }
  public void setupDatabase() {
    database = new Database(getActivity());
    database.open();

    cursor = database.getLegislators();
  }