@Override public void run() { ImageView imageView = getImageView(); if (null != imageView && mScroller.computeScrollOffset()) { final int newX = mScroller.getCurrX(); final int newY = mScroller.getCurrY(); if (DEBUG) { Log.d( LOG_TAG, "fling run(). CurrentX:" + mCurrentX + " CurrentY:" + mCurrentY + " NewX:" + newX + " NewY:" + newY); } mSuppMatrix.postTranslate(mCurrentX - newX, mCurrentY - newY); setImageViewMatrix(getDisplayMatrix()); mCurrentX = newX; mCurrentY = newY; // Post On animation Compat.postOnAnimation(imageView, this); } }
private static boolean register(Class clazz) { if (clazz.isAnnotationPresent(Compat.class)) { Compat annotation = (Compat) clazz.getAnnotation(Compat.class); if (Loader.isModLoaded(annotation.value())) { modules.add(clazz); return true; } else { MOLog.log( Level.INFO, "The mod %s was not loaded, skipping compatibility module.", annotation.value()); return false; } } MOLog.log(Level.ERROR, "There was a problem register a compatibility module!"); return false; }
public static void init(FMLInitializationEvent event) { MOLog.log( Level.INFO, "Attempting to run initialization methods for all registered compatibility modules."); for (Class clazz : modules) { for (Method m : clazz.getMethods()) { if (m.isAnnotationPresent(Compat.Init.class) && Modifier.isStatic(m.getModifiers())) { try { m.invoke(null, event); } catch (ReflectiveOperationException e) { Compat annotation = (Compat) clazz.getAnnotation(Compat.class); MOLog.log( Level.ERROR, e, "There was an error trying to invoke the initialization method of the compatibility module for %1$s", annotation.value()); e.printStackTrace(); } } } } }
@Override public void run() { ImageView imageView = getImageView(); if (imageView == null) { return; } float t = interpolate(); float scale = mZoomStart + t * (mZoomEnd - mZoomStart); float deltaScale = scale / getScale(); onScale(deltaScale, mFocalX, mFocalY); // We haven't hit our target scale yet, so post ourselves again if (t < 1f) { Compat.postOnAnimation(imageView, this); } }
@Override public void run() { if (mScroller.isFinished()) { return; // remaining post that should not be handled } ImageView imageView = getImageView(); if (null != imageView && mScroller.computeScrollOffset()) { final int newX = mScroller.getCurrX(); final int newY = mScroller.getCurrY(); if (DEBUG) { LogManager.getLogger() .d( LOG_TAG, "fling run(). CurrentX:" + mCurrentX + " CurrentY:" + mCurrentY + " NewX:" + newX + " NewY:" + newY); } mSuppMatrix.postTranslate(mCurrentX - newX, mCurrentY - newY); setImageViewMatrix(getDrawMatrix()); mCurrentX = newX; mCurrentY = newY; // Post On animation Compat.postOnAnimation(imageView, this); } }
public void run() { ImageView imageView = getImageView(); if (null != imageView) { mSuppMatrix.postScale(mDeltaScale, mDeltaScale, mFocalX, mFocalY); checkAndDisplayMatrix(); final float currentScale = getScale(); if ((mDeltaScale > 1f && currentScale < mTargetZoom) || (mDeltaScale < 1f && mTargetZoom < currentScale)) { // We haven't hit our target scale yet, so post ourselves // again Compat.postOnAnimation(imageView, this); } else { // We've scaled past our target zoom, so calculate the // necessary scale so we're back at target zoom final float delta = mTargetZoom / currentScale; mSuppMatrix.postScale(delta, delta, mFocalX, mFocalY); checkAndDisplayMatrix(); } } }