@Override
  public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
      // Check to see if the scale is within bounds
      if (scale < mMinScale || scale > mMaxScale) {
        LogManager.getLogger()
            .i(LOG_TAG, "Scale must be within the range of minScale and maxScale");
        return;
      }

      // TODO
      if (scale < ALLOWED_SCALE) {
        // TODO
        isPagingEnabled = true;
        if (viewPagerListener != null) viewPagerListener.setViewPagerEnable(true);
      } else {
        isPagingEnabled = false;
        if (viewPagerListener != null) viewPagerListener.setViewPagerEnable(false);
      }

      if (animate) {
        imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
      } else {
        mSuppMatrix.setScale(scale, scale, focalX, focalY);
        checkAndDisplayMatrix();
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public final void zoomTo(float scale, float focalX, float focalY) {
    ImageView imageView = getImageView();

    if (null != imageView) {
      imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
    }
  }
Ejemplo n.º 3
0
 // Set bitmap to view in UI thread
 private void setBitmapToView(final Bitmap bitmap) {
   mImageView.post(
       new Runnable() {
         @Override
         public void run() {
           mImageView.setImageBitmap(bitmap);
         }
       });
 }
  private void startInstallAnimation() {
    mImageViewFairy.post(
        new Runnable() {

          @Override
          public void run() {
            mFairyAnimation.start();
          }
        });
  }
Ejemplo n.º 5
0
 private void setRegistDialog() {
   imgProgress.setBackgroundResource(R.drawable.progress_chrysanthemum_wordless);
   mAnimation = (AnimationDrawable) imgProgress.getBackground();
   rllayout.setVisibility(View.VISIBLE);
   imgProgress.post(
       new Runnable() {
         @Override
         public void run() {
           mAnimation.start();
         }
       });
 }
  @Override
  public void onBindView(View view) {
    super.onBindView(view);
    ImageView syncActiveView = (ImageView) view.findViewById(R.id.sync_active);
    View syncPendingView = view.findViewById(R.id.sync_pending);
    View syncFailedView = view.findViewById(R.id.sync_failed);

    syncActiveView.setVisibility(mIsActive ? View.VISIBLE : View.GONE);
    final AnimationDrawable anim = (AnimationDrawable) syncActiveView.getDrawable();
    boolean showError;
    boolean showPending;
    if (mIsActive) {
      syncActiveView.post(
          new Runnable() {
            public void run() {
              anim.start();
            }
          });
      showPending = false;
      showError = false;
    } else {
      anim.stop();
      if (mIsPending) {
        showPending = true;
        showError = false;
      } else {
        showPending = false;
        showError = mFailed;
      }
    }

    syncFailedView.setVisibility(showError ? View.VISIBLE : View.GONE);
    syncPendingView.setVisibility((showPending && !mIsActive) ? View.VISIBLE : View.GONE);

    View checkBox = view.findViewById(android.R.id.checkbox);
    if (mOneTimeSyncMode) {
      checkBox.setVisibility(View.GONE);

      /*
       * Override the summary. Fill in the %1$s with the existing summary
       * (what ends up happening is the old summary is shown on the next
       * line).
       */
      TextView summary = (TextView) view.findViewById(android.R.id.summary);
      summary.setText(getContext().getString(R.string.sync_one_time_sync, getSummary()));
    } else {
      checkBox.setVisibility(View.VISIBLE);
    }
  }
Ejemplo n.º 7
0
  @Override
  public final void onFling(float startX, float startY, float velocityX, float velocityY) {
    if (DEBUG) {
      Log.d(
          LOG_TAG,
          "onFling. sX: " + startX + " sY: " + startY + " Vx: " + velocityX + " Vy: " + velocityY);
    }

    ImageView imageView = getImageView();
    if (hasDrawable(imageView)) {
      mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
      mCurrentFlingRunnable.fling(
          imageView.getWidth(), imageView.getHeight(), (int) velocityX, (int) velocityY);
      imageView.post(mCurrentFlingRunnable);
    }
  }
Ejemplo n.º 8
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Splash screen view
    setContentView(R.layout.splash);

    // Start animating the image
    final ImageView splashImageView = (ImageView) findViewById(R.id.SplashImageView);
    splashImageView.setBackgroundResource(R.drawable.flag);
    final AnimationDrawable frameAnimation = (AnimationDrawable) splashImageView.getBackground();
    splashImageView.post(
        new Runnable() {
          @Override
          public void run() {
            frameAnimation.start();
          }
        });

    final SplashScreen sPlashScreen = this;

    // The thread to wait for splash screen events
    mSplashThread =
        new Thread() {
          @Override
          public void run() {
            try {
              synchronized (this) {
                // Wait given period of time or exit on touch
                wait(5000);
              }
            } catch (InterruptedException ex) {
            }

            finish();

            // Run next activity
            Intent intent = new Intent();
            intent.setClass(sPlashScreen, MainActivity.class);
            startActivity(intent);
            // stop();
          }
        };

    mSplashThread.start();
  }
Ejemplo n.º 9
0
  /**
   * @param toMode
   * @param filter - filter to add, can be null
   */
  public void change(Mode toMode, final Filter<? super Tables.Tracks> filter, boolean permanant) {
    if (filter != null) {
      filtersAddWithMode.get(currMode).add(filter);
      addFilter(filter, permanant);
    }

    currMode = toMode;
    for (final Mode aMode : Mode.values()) {
      final ImageView button = getButton(aMode);
      button.post(
          new Runnable() {
            public void run() {
              button.setImageResource(
                  aMode.equals(currMode) ? aMode.drawableActive : aMode.drawable);
            }
          });
    }
    update();
  }
Ejemplo n.º 10
0
  @Override
  public void setScale(float scale, float focalX, float focalY, boolean animate) {
    ImageView imageView = getImageView();

    if (null != imageView) {
      // Check to see if the scale is within bounds
      if (scale < mMinScale || scale > mMaxScale) {
        LogManager.getLogger()
            .i(LOG_TAG, "Scale must be within the range of minScale and maxScale");
        return;
      }

      if (animate) {
        imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY));
      } else {
        mSuppMatrix.setScale(scale, scale, focalX, focalY);
        checkAndDisplayMatrix();
      }
    }
  }
Ejemplo n.º 11
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_valueandtypeanimation);
   ivBall = (ImageView) this.findViewById(R.id.id_ball);
   mScreenWidth = getResources().getDisplayMetrics().widthPixels;
   mScreenHeight = getResources().getDisplayMetrics().heightPixels;
   ivBall.post(
       new Runnable() {
         @Override
         public void run() {
           mX = mScreenWidth - ivBall.getWidth();
           mY =
               mScreenHeight
                   - ivBall.getHeight()
                   //						- DensityUtil.getStatusBarHeight(getApplicationContext());
                   - DensityUtil.getStatusBarHeight2(ValueAndTypeAnimator.this);
         }
       });
 }
Ejemplo n.º 12
0
  /**
   * Sets the {@link DriveImageModel} to the {@link DriveImageView}. This will cause the
   * DriveImageView to redraw its figures and it also recalculates the size of the Canvas, because
   * the size of the image can change.
   *
   * @param driveImageModel the {@link DriveImageModel}
   */
  public void setDriveImageModel(DriveImageModel driveImageModel) {
    this.driveImageModel = driveImageModel;

    // if (driveImageModel.isDrawable()) {
    //    imageView.setImageResource(driveImageModel.getDrawable());
    // } else {
    Log.d("TTTTTTTT", driveImageModel.getImageBitmap() + "");
    imageView.setImageBitmap(driveImageModel.getImageBitmap());
    // }

    imageView.post(
        new Runnable() {
          @Override
          public void run() {
            driveLayout.setImageViewHeight(imageView.getMeasuredHeight());
            driveLayout.setImageViewWidth(imageView.getMeasuredWidth());
          }
        });

    driveLayout.setFolderText(driveImageModel.getFolderTitle());
    driveLayout.setMainText(driveImageModel.getMainTitle());
  }
Ejemplo n.º 13
0
 @Override
 public void onFling(float startX, float startY, float velocityX, float velocityY) {
   if (DEBUG) {
     LogManager.getLogger()
         .d(
             LOG_TAG,
             "onFling. sX: "
                 + startX
                 + " sY: "
                 + startY
                 + " Vx: "
                 + velocityX
                 + " Vy: "
                 + velocityY);
   }
   ImageView imageView = getImageView();
   mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
   mCurrentFlingRunnable.fling(
       getImageViewWidth(imageView),
       getImageViewHeight(imageView),
       (int) velocityX,
       (int) velocityY);
   imageView.post(mCurrentFlingRunnable);
 }
  public void setData(final byte[] data) {
    buffers.setImage(data);
    try {
      for (ImageProcessor imageProcessor : pipeline) {
        imageProcessor.process(buffers);
      }

      if (overlay != null) {
        final Bitmap overlayBitmap = buffers.createOverlayBitmap();
        if (overlayBitmap != null) {
          overlay.post(
              new Runnable() {
                @Override
                public void run() {

                  overlay.setImageBitmap(overlayBitmap);
                }
              });
        }
      }
    } catch (Exception e) {
      Log.e("Detector", e.getMessage(), e);
    }
  }