예제 #1
0
  private void createAdapters() {

    // if ( TDSetting.mLevelOverBasic )
    {
      mPointAdapter = new ItemAdapter(mContext, this, R.layout.item, new ArrayList<ItemSymbol>());
      int np = mPointLib.mSymbolNr;
      for (int i = 0; i < np; ++i) {
        SymbolPoint p = (SymbolPoint) mPointLib.getSymbolByIndex(i);
        if (p.isEnabled()) {
          mPointAdapter.add(
              new ItemSymbol(mContext, this, DrawingActivity.SYMBOL_POINT, i, p, mUseText));
        }
      }
      mPointAdapter.setSelectedItem(mParent.mCurrentPoint);
    }

    mLineAdapter = new ItemAdapter(mContext, this, R.layout.item, new ArrayList<ItemSymbol>());
    int nl = mLineLib.mSymbolNr;
    for (int j = 0; j < nl; ++j) {
      SymbolLine l = (SymbolLine) mLineLib.getSymbolByIndex(j);
      if (l.isEnabled()) {
        mLineAdapter.add(
            new ItemSymbol(mContext, this, DrawingActivity.SYMBOL_LINE, j, l, mUseText));
      }
    }
    mLineAdapter.setSelectedItem(mParent.mCurrentLine);

    // if ( TDSetting.mLevelOverBasic )
    {
      mAreaAdapter = new ItemAdapter(mContext, this, R.layout.item, new ArrayList<ItemSymbol>());
      int na = mAreaLib.mSymbolNr;
      for (int k = 0; k < na; ++k) {
        SymbolArea a = (SymbolArea) mAreaLib.getSymbolByIndex(k);
        if (a.isEnabled()) {
          mAreaAdapter.add(
              new ItemSymbol(mContext, this, DrawingActivity.SYMBOL_AREA, k, a, mUseText));
        }
      }
      mAreaAdapter.setSelectedItem(mParent.mCurrentArea);
    }
  }
예제 #2
0
 private void setRecent(int k) {
   Symbol p = null;
   if (mItemType == DrawingActivity.SYMBOL_POINT) {
     p = ItemDrawer.mRecentPoint[k];
   } else if (mItemType == DrawingActivity.SYMBOL_LINE) {
     p = ItemDrawer.mRecentLine[k];
   } else if (mItemType == DrawingActivity.SYMBOL_AREA) {
     p = ItemDrawer.mRecentArea[k];
   }
   if (p != null) {
     if (mAdapter != null) mAdapter.setSelectedItem(p);
   }
 }