private void setSeekBarProgress() {
   boolean orientable = false;
   if (mItemType == DrawingActivity.SYMBOL_POINT && mPointAdapter != null) {
     int index = mPointAdapter.getSelectedPos();
     ItemSymbol item = mPointAdapter.get(index);
     if (item != null) {
       SymbolInterface symbol = item.mSymbol;
       if (symbol != null && symbol.isOrientable()) {
         int progress = (180 + symbol.getAngle()) % 360;
         mSeekBar.setProgress(progress);
         // Log.v("DistoX", "set progress " + progress );
         orientable = true;
       }
     }
   }
   mSeekBar.setEnabled(orientable);
 }
示例#2
0
 @Override
 public void onClick(View v) {
   if (mSymbol.getThName().equals("user")) {
     mEnabled = true;
     ((CheckBox) v).setChecked(mEnabled);
   } else {
     mEnabled = !mEnabled;
   }
 }
示例#3
0
  public EnableSymbol(Context context, int type, int index, SymbolInterface symbol) {
    mType = type;
    // mIndex = index;
    // mMustSave = false;
    mSymbol = symbol;
    mEnabled = mSymbol.isEnabled();

    if (mType == DrawingActivity.SYMBOL_POINT) {
      sx = 2.0f;
      sy = 2.0f;
    } else if (mType == DrawingActivity.SYMBOL_AREA) {
      sx = 2.5f;
      sy = 1.7f;
    }
  }
示例#4
0
  public ItemSymbol(
      Context context,
      IItemPicker dialog,
      int type,
      int index,
      SymbolInterface symbol,
      boolean use_text) {
    mType = type;
    mIndex = index;
    mSymbol = symbol;
    mUseText = use_text;

    if (mType == DrawingActivity.SYMBOL_POINT) {
      sx *= 1.5f; // 2.0f;
      sy *= 1.5f; // 2.0f;
    } else { // if ( mType == DrawingActivity.SYMBOL_AREA )
      sx *= 2.2f;
      sy *= 1.7f;
    }
    // Log.v( TopoDroidApp.TAG, "Item " + mType + "/" + mIndex + " " + mSymbol.getName() );

    LinearLayout ll = new LinearLayout(context);
    // ll.setOrientation( LinearLayout.HORIZONTAL );
    int lw = LinearLayout.LayoutParams.WRAP_CONTENT;
    int lh = LinearLayout.LayoutParams.WRAP_CONTENT;
    LinearLayout.LayoutParams lllp = new LinearLayout.LayoutParams(lh, lw);
    if (!mUseText) {
      lllp.gravity = 0x03; // left
    } else {
      mCheckBox = new CheckBox(context);
      mCheckBox.setChecked(false);
      ll.addView(mCheckBox, lllp);
    }

    mButton = new ItemButton(context, mSymbol.getPaint(), mSymbol.getPath(), sx, sy);
    ll.addView(mButton, lllp);

    if (mUseText) {
      mTextView = new TextView(context);
      // mTextView.setBackgroundColor( Color.BLACK );
      mTextView.setText(mSymbol.getName());
      ll.addView(mTextView, new LinearLayout.LayoutParams(lh, lw));
    } else {
      mButton.setClickable(true);
    }

    // FIXME
    // if ( mType == DrawingActivity.SYMBOL_POINT ) {
    //   SymbolPoint point = (SymbolPoint) mSymbol;
    //   if ( point.isOrientable() ) {
    //     Button btn = new Button( context );
    //     btn.setBackgroundResource( R.drawable.ic_turn );
    //     ll.addView( btn, new LinearLayout.LayoutParams(lh,lw) );
    //   }
    // }

    mView = ll;

    // if ( mSymbol.isOrientable() ) {
    //   mView.setOnTouchListener( new OnTouchListener()
    //   {
    //     private float x_old=0f;

    //     @Override
    //     public boolean onTouch(View v, MotionEvent event) {
    //       int action = event.getAction();
    //       int actionCode = action & MotionEvent.ACTION_MASK;
    //       if ( actionCode == MotionEvent.ACTION_DOWN ) {
    //         x_old = event.getX(0);
    //       } else if ( actionCode == MotionEvent.ACTION_MOVE ) {
    //         float x = event.getX(0);
    //         float delta_x = x - x_old;
    //         x_old = x;
    //         notifyListener( delta_x );
    //       }
    //       return true;
    //     }
    //   });
    // }
  }
示例#5
0
 void setAngle(float angle) {
   // Log.v("DistoX", "item symbol set angle " + angle );
   mSymbol.setAngle(angle);
   mButton.resetPath(mSymbol.getPath(), sx, sy);
   mView.invalidate();
 }
示例#6
0
 void rotate(float dx) {
   // Log.v( TopoDroidApp.TAG, "rotate " + dx );
   mSymbol.rotate(dx);
   mButton.resetPath(mSymbol.getPath(), sx, sy);
   mView.invalidate();
 }
示例#7
0
 // String getName()  { return mSymbol.mThName; }
 String getName() {
   return mSymbol.getName();
 }
示例#8
0
 boolean MustSave() {
   return mEnabled != mSymbol.isEnabled();
 }