Exemplo n.º 1
0
 @Override
 public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) {
   if (isTouchInDropDownView) {
     isTouchInDropDownView = false;
     if (paramInt == 0) {
       showNewSpriteDialog();
     }
   }
   return spinnerAdapter.getView(paramInt, paramView, paramViewGroup);
 }
Exemplo n.º 2
0
  private void display(Context cx) {
    ArrayList<Block> blocks = new ArrayList<Block>();

    counter = coorX = coorY = 0;
    calculateAllCells(cx);
    pattern = getDisplayPattern();

    for (int i = 0; i < pattern.size(); i++) {

      ArrayList<Cell> boxCells = new ArrayList<Cell>();

      for (int j = 0; j < pattern.get(i).size(); j++) {
        Cell c = cells.get(pattern.get(i).get(j));
        boxCells.add(c);
      }

      Block block = mBlockPattern.getBlock(boxCells);
      block.cells = boxCells;

      blocks.add(block);
    }

    double maxHeightsLocal[] = {0, 0, 0, 0};

    for (int i = 0; i < blocks.size(); i++) {

      CellView cv = new CellView(cx);
      View view = mAdapter.getView(postion, null, frameLayout);
      cv.addView(view);

      FrameLayout.LayoutParams params =
          new FrameLayout.LayoutParams((int) blocks.get(i).width, (int) blocks.get(i).height);
      params.setMargins(
          (int) blocks.get(i).x1,
          (int) blocks.get(i).y1 + (int) blocks.get(i).getHeightShift(maxHeights),
          0,
          0);

      frameLayout.addView(cv, params);
      cells.get(i).setCellView(cv);
      postion++;
      view.setTag(postion);
      setViewListeners(view);

      if (postion >= mAdapter.getCount()) return;

      // Get the max height that the cells of the box occupy
      for (int j = 0; j < blocks.get(i).cells.size(); j++) {
        maxHeightsLocal[blocks.get(i).cells.get(j).coorX] += blocks.get(i).cells.get(j).getHeight();
      }
    }
    for (int i = 0; i < 4; i++) maxHeights[i] += maxHeightsLocal[i];

    cells.clear();
  }
Exemplo n.º 3
0
  private void loadLast() {
    ViewGroup parent = (ViewGroup) viewCollection.get(0);

    int lastIndex = (mNumVisible - 1) + mIndex;
    if (lastIndex > mAdapter.getCount() - 1) {
      parent.setVisibility(View.GONE);
      return;
    }

    View child = mAdapter.getView(lastIndex, getContentView(), parent);
    parent.removeAllViews();
    parent.addView(child);
  }
Exemplo n.º 4
0
 private void loadData() {
   for (int i = mNumVisible - 1; i >= 0; i--) {
     ViewGroup parent = (ViewGroup) viewCollection.get(i);
     int index = (mIndex + mNumVisible - 1) - i;
     if (index > mAdapter.getCount() - 1) {
       parent.setVisibility(View.GONE);
     } else {
       View child = mAdapter.getView(index, getContentView(), this);
       parent.addView(child);
       parent.setVisibility(View.VISIBLE);
     }
   }
 }
Exemplo n.º 5
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      int sectionnum = 0;
      for (Object section : this.sections.keySet()) {
        Adapter adapter = sections.get(section);
        int size = adapter.getCount() + 1;

        if (position == 0) return headers.getView(sectionnum, convertView, parent);
        if (position < size) return adapter.getView(position - 1, convertView, parent);

        position -= size;
        sectionnum++;
      }
      return null;
    }
  // @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    int sectionnum = 0;
    for (Object section : this.sections.keySet()) {
      Adapter adapter = sections.get(section);
      int size = adapter.getCount() + 1;

      // check if position inside this section
      if (position == 0) return headers.getView(sectionnum, convertView, parent);
      if (position < size) return adapter.getView(position - 1, convertView, parent);

      // otherwise jump into next section
      position -= size;
      sectionnum++;
    }
    return null;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    int sectionnum = 0;
    for (Object section : this.sections.keySet()) {
      Adapter adapter = sections.get(section);
      int size = adapter.getCount() + 1;

      // The second argument is null because if it were convertView, things crash.
      if (position == 0) return headers.getView(sectionnum, null, parent);
      if (position < size) return adapter.getView(position - 1, null, parent);

      // otherwise jump into next section
      position -= size;
      sectionnum++;
    }
    return null;
  }
Exemplo n.º 8
0
  /** {@inheritDoc} */
  @Override
  public View getView(int position, final View convertView, final ViewGroup parent) {
    int sectionnum = 0;
    for (final Object section : mSections.keySet()) {
      final Adapter adapter = mSections.get(section);
      final int size = adapter.getCount() + 1;

      // check if position inside this section
      if (position == 0) {
        return mHeaders.getView(sectionnum, convertView, parent);
      }
      if (position < size) {
        return adapter.getView(position - 1, convertView, parent);
      }

      // otherwise jump into next section
      position -= size;
      sectionnum++;
    }
    return null;
  }
Exemplo n.º 9
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    int sectionnum = 0;
    for (int i = 0; i < headers.getCount(); i++) {
      String section = headers.getItem(i);
      Adapter adapter = sections.get(section);

      // skip empty sections
      if (adapter.getCount() > 0) {
        int size = adapter.getCount() + 1;

        // check if position inside this section
        if (position == 0) return headers.getView(sectionnum, convertView, parent);
        if (position < size) return adapter.getView(position - 1, null, parent);

        // otherwise jump into next section
        position -= size;
      }
      sectionnum++;
    }
    return null;
  }