private void rotate() {
    if (background != null)
      if (!parent.get_is_pinned_childs()) background.setRotation(rotation_angle % 360);
      else background.setRotation(parent.get_pinnded_childs_rotation_angle());

    if (forground != null)
      if (!parent.get_is_pinned_childs()) forground.setRotation(rotation_angle % 360);
      else forground.setRotation(parent.get_pinnded_childs_rotation_angle());
  }
  private void rotateHands(int hour, int minute, int second) {
    int rotHr = (int) (30 * hour + 0.5f * minute);
    int rotMin = 6 * minute;
    int rotSec = 6 * second;

    handHour.setRotation(rotHr);
    handMinute.setRotation(rotMin);
    handSecond.setRotation(rotSec);
  }
Example #3
0
  public void add_car(int x, int y, int rotation, int state) {

    ImageView car = new ImageView(getActivity());

    carList.add(car);
    switch (state) {
      case 0:
        car.setBackground(getResources().getDrawable(R.drawable.ic_launcher0));
        break;
      case 1:
        car.setBackground(getResources().getDrawable(R.drawable.ic_launcher1));
        break;
      case 2:
        car.setBackground(getResources().getDrawable(R.drawable.ic_launcher2));
        break;
      default:
        break;
    }

    RelativeLayout.LayoutParams layoutParams =
        new LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(x, y, 10, 10); // 150-1650/50-950
    car.setRotation(rotation);
    layout.addView(car, layoutParams);
  }
  @Override
  public void setIsHeaderOrFooter(boolean isHead) {

    if (!isHead) {

      ivArrow.setRotation(180);
    }
  }
 private void setDirection(ImageView ivDirection, String direction) {
   int pos = 0;
   try {
     pos = Integer.valueOf(direction);
   } catch (NumberFormatException e) {
   }
   ivDirection.setRotation(45 * pos);
 }
 /** 根据当前手机方向,旋转各个按钮的方向 */
 private void setViewRotation() {
   int orientation = (360 - current_orientation) % 360;
   mBtnCancel.setRotation(orientation);
   mBtnHandler.setRotation(orientation);
   mBtnTakePic.setRotation(orientation);
   mBtnChangeFacing.setRotation(orientation);
   mBtnFlash1.setRotation(orientation);
   mBtnFlash2.setRotation(orientation);
   mBtnFlash3.setRotation(orientation);
   mIvPreShow.setRotation(orientation);
 }
  public void onStartPostProcessing() {
    LayoutInflater inflator = ApplicationScreen.instance.getLayoutInflater();
    postProcessingView =
        inflator.inflate(R.layout.plugin_processing_sequence_postprocessing, null, false);

    mImgView = ((ImageView) postProcessingView.findViewById(R.id.sequenceImageHolder));

    if (PreviewBmp != null) {
      PreviewBmp.recycle();
    }

    paint = new Paint();
    paint.setColor(0xFF00AAEA);
    paint.setStrokeWidth(5);
    paint.setPathEffect(new DashPathEffect(new float[] {5, 5}, 0));

    PreviewBmp = mAlmaCLRShot.getPreviewBitmap();

    if (PreviewBmp != null) {
      Matrix matrix = new Matrix();
      matrix.postRotate(90);
      Bitmap rotated =
          Bitmap.createBitmap(
              PreviewBmp, 0, 0, PreviewBmp.getWidth(), PreviewBmp.getHeight(), matrix, true);
      mImgView.setImageBitmap(rotated);
      mImgView.setRotation(
          mCameraMirrored
              ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 0 : 180)
              : 0);
    }

    sequenceView = ((OrderControl) postProcessingView.findViewById(R.id.seqView));
    final Bitmap[] thumbnailsArray = new Bitmap[thumbnails.size()];
    for (int i = 0; i < thumbnailsArray.length; i++) {
      Bitmap bmp = thumbnails.get(i);
      Matrix matrix = new Matrix();
      matrix.postRotate(
          mCameraMirrored
              ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 270 : 90)
              : 90);
      Bitmap rotated =
          Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
      thumbnailsArray[i] = rotated;
    }
    sequenceView.setContent(thumbnailsArray, this);
    LayoutParams lp = (LayoutParams) sequenceView.getLayoutParams();
    lp.height = thumbnailsArray[0].getHeight();
    sequenceView.setLayoutParams(lp);

    sequenceView.setRotation(mCameraMirrored ? 180 : 0);

    mHandler.sendEmptyMessage(MSG_END_OF_LOADING);
  }
Example #8
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View InputFragmentView = inflater.inflate(R.layout.sensor, container, false);

    // Bluetooth in Android 4.3 is accessed via the BluetoothManager, rather than
    // the old static bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    BluetoothManager manager =
        (BluetoothManager) getActivity().getSystemService(Context.BLUETOOTH_SERVICE);
    bluetoothAdapter = manager.getAdapter();
    // TODO (jos | tariq) if bluetoothAdapter is null here, there's no need to continue with the
    // fragment.
    // There's a method enable_bluetooth later in the file. This should be consistent.

    // 3d Cube
    FragmentManager fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    if (savedInstanceState == null) {
      newFragment = new _3D_object();
      ft.replace(R.id.container_3D, newFragment);
      ft.commit();
    }

    // TextViews
    deviceInfoText = (TextView) InputFragmentView.findViewById(R.id.d_Info);
    timestamp = (TextView) InputFragmentView.findViewById(R.id.timestamp);
    packetnumber = (TextView) InputFragmentView.findViewById(R.id.packetnumber);
    accelData = (TextView) InputFragmentView.findViewById(R.id.accelData);
    batteryVoltage = (TextView) InputFragmentView.findViewById(R.id.batteryVoltage);
    gyroData = (TextView) InputFragmentView.findViewById(R.id.gyroData);

    arrow_nw = (ImageView) InputFragmentView.findViewById(R.id.arrow_nw);
    arrow_n = (ImageView) InputFragmentView.findViewById(R.id.arrow_n);
    arrow_ne = (ImageView) InputFragmentView.findViewById(R.id.arrow_ne);
    arrow_w = (ImageView) InputFragmentView.findViewById(R.id.arrow_w);
    arrow_center = (ImageView) InputFragmentView.findViewById(R.id.arrow_center);
    arrow_e = (ImageView) InputFragmentView.findViewById(R.id.arrow_e);
    arrow_sw = (ImageView) InputFragmentView.findViewById(R.id.arrow_sw);
    arrow_s = (ImageView) InputFragmentView.findViewById(R.id.arrow_s);
    arrow_se = (ImageView) InputFragmentView.findViewById(R.id.arrow_se);

    arrow_nw.setRotation(-45);
    arrow_ne.setRotation(45);
    arrow_w.setRotation(-90);
    arrow_e.setRotation(90);
    arrow_sw.setRotation(-135);
    arrow_s.setRotation(180);
    arrow_se.setRotation(135);

    return InputFragmentView;
  }
  @Override
  public boolean handleMessage(Message msg) {
    switch (msg.what) {
      case MSG_END_OF_LOADING:
        setupSaveButton();
        postProcessingRun = true;
        break;
      case MSG_LEAVING:
        ApplicationScreen.getMessageHandler()
            .sendEmptyMessage(ApplicationInterface.MSG_POSTPROCESSING_FINISHED);

        PluginManager.getInstance()
            .sendMessage(
                ApplicationInterface.MSG_BROADCAST, ApplicationInterface.MSG_CONTROL_UNLOCKED);

        ApplicationScreen.getGUIManager().lockControls = false;

        postProcessingRun = false;
        return false;

      case MSG_REDRAW:
        if (PreviewBmp != null) PreviewBmp.recycle();
        if (finishing) return true;
        PreviewBmp = mAlmaCLRShot.getPreviewBitmap();
        if (PreviewBmp != null) {
          Matrix matrix = new Matrix();
          matrix.postRotate(90);
          Bitmap rotated =
              Bitmap.createBitmap(
                  PreviewBmp, 0, 0, PreviewBmp.getWidth(), PreviewBmp.getHeight(), matrix, true);
          mImgView.setImageBitmap(rotated);
          mImgView.setRotation(
              CameraController.isFrontCamera()
                  ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 0 : 180)
                  : 0);
        }

        sequenceView.setEnabled(true);
        break;
      default:
        break;
    }
    return true;
  }
  @Override
  public boolean handleMessage(Message msg) {
    switch (msg.what) {
      case MSG_END_OF_LOADING:
        setupSaveButton();
        postProcessingRun = true;
        break;
      case MSG_LEAVING:
        MainScreen.H.sendEmptyMessage(PluginManager.MSG_POSTPROCESSING_FINISHED);
        mJpegBufferList.clear();

        Message msg2 = new Message();
        msg2.arg1 = PluginManager.MSG_CONTROL_UNLOCKED;
        msg2.what = PluginManager.MSG_BROADCAST;
        MainScreen.H.sendMessage(msg2);

        MainScreen.guiManager.lockControls = false;

        postProcessingRun = false;
        return false;

      case MSG_REDRAW:
        if (PreviewBmp != null) PreviewBmp.recycle();
        if (finishing == true) return true;
        PreviewBmp = mAlmaCLRShot.getPreviewBitmap();
        if (PreviewBmp != null) {
          Matrix matrix = new Matrix();
          matrix.postRotate(90);
          Bitmap rotated =
              Bitmap.createBitmap(
                  PreviewBmp, 0, 0, PreviewBmp.getWidth(), PreviewBmp.getHeight(), matrix, true);
          mImgView.setImageBitmap(rotated);
          mImgView.setRotation(
              MainScreen.getCameraMirrored()
                  ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 0 : 180)
                  : 0);
        }

        sequenceView.setEnabled(true);
        break;
    }
    return true;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set the Activity's user interface
    setContentView(R.layout.activity_hello_android_with_image_view);

    // Get a reference to the android image
    ImageView androidImage = (ImageView) findViewById(R.id.android);

    // Rotate androidImage by 45 degrees
    androidImage.setRotation(ROTATION);

    // Get a reference to the hello world text.
    TextView helloText = (TextView) findViewById(R.id.hello_text);

    // Set the text
    helloText.setText(R.string.hello_world);

    // Add a shadow to the TextView
    helloText.setShadowLayer(RADIUS, DX, DY, COLOR);
  }
Example #12
0
 /** 重置动画 */
 @SuppressLint("NewApi")
 private void resetRotation() {
   mArrowImageView.clearAnimation();
   mArrowImageView.setRotation(0);
 }
  public void rotate(float angle) {
    Log.i(ImageViewActivity.class.toString(), "rotate image in imageview by angle " + angle);
    ImageView imageView = (ImageView) findViewById(R.id.fullScreenImageView);

    imageView.setRotation(angle);
  }
 /** 重置动画 */
 private void resetRotation() {
   mArrowImageView.clearAnimation();
   mArrowImageView.setRotation(0);
 }
 @Override
 public void onPull(float scale) {
   float angle = scale * 180f; // SUPPRESS CHECKSTYLE
   mArrowImageView.setRotation(angle);
 }
Example #16
0
 public void collapse() {
   mTitle.setTextColor(ThemeManager.getTextOnBackgroundSecondary());
   mFavorites.setVisibility(View.GONE);
   mIndicator.setRotation(90f);
 }
Example #17
0
 public void expand() {
   mTitle.setTextColor(ThemeManager.getTextOnBackgroundPrimary());
   mFavorites.setVisibility(View.VISIBLE);
   mIndicator.setRotation(0f);
 }
 /**
  * Notifies the occurrence of another frame of the animation.
  *
  * @param animation The animation which was repeated.
  */
 @Override
 public void onAnimationUpdate(ValueAnimator animation) {
   expand.setRotation((Float) animation.getAnimatedValue());
 }