android.widget.ImageView#invalidate ( )源码实例Demo

下面列出了android.widget.ImageView#invalidate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: PinchToZoom   文件: FlingAnimatorHandler.java
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    ImageMatrixCorrector corrector = getCorrector();
    ImageView imageView = corrector.getImageView();
    Matrix matrix = imageView.getImageMatrix();
    float[] values = getValues();
    matrix.getValues(values);

    float dx = (float) animation.getAnimatedValue(PROPERTY_TRANSLATE_X);
    dx = corrector.correctAbsolute(Matrix.MTRANS_X, dx) - values[Matrix.MTRANS_X];

    float dy = (float) animation.getAnimatedValue(PROPERTY_TRANSLATE_Y);
    dy = corrector.correctAbsolute(Matrix.MTRANS_Y, dy) - values[Matrix.MTRANS_Y];

    matrix.postTranslate(dx, dy);
    imageView.invalidate();
}
 
源代码2 项目: PinchToZoom   文件: ScaleAnimatorHandler.java
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    ImageMatrixCorrector corrector = getCorrector();
    ImageView imageView = corrector.getImageView();
    if(imageView.getDrawable() != null) {
        Matrix matrix = imageView.getImageMatrix();
        float[] values = getValues();
        matrix.getValues(values);

        float sx = (float) animation.getAnimatedValue();
        sx = corrector.correctAbsolute(Matrix.MSCALE_X, sx) / values[Matrix.MSCALE_X];

        if (translate) {
            matrix.postScale(sx, sx, px, py);
        } else {
            matrix.postScale(sx, sx);
        }
        corrector.performAbsoluteCorrections();
        imageView.invalidate();
    }
}
 
源代码3 项目: droid-stealth   文件: ContentAdapter.java
/**
 * Sets the thumbnail of given file, but only if there is a view for it at the moment
 *
 * @param file the file to display the thumbnail of
 */
private void displayThumbnail(IndexedFile file) {
	// Get the view associated with this file. However, note that the view might be assigned to
	// some other item already... so let's also check if the information is still up to date
	View v = mItemToView.get(file);
	int i = mViewToPositions.get(v);
	if (mContentItems.get(i) != file) {
		return; // information was out of date
	}

	if (file.getThumbnail() != null) {
		v.findViewById(R.id.content_texts).setVisibility(View.INVISIBLE);
		ImageView thumbImage = (ImageView) v.findViewById(R.id.file_preview);
		thumbImage.setImageBitmap(file.getThumbnail());
		thumbImage.invalidate();
	}
	else {
		Utils.d("We failed to get the bitmap :(");
	}
}
 
源代码4 项目: catnut   文件: CatnutUtils.java
/**
 * inject a image touch overley
 * @param v
 * @param event
 */
public static boolean imageOverlay(View v, MotionEvent event) {
	ImageView view = (ImageView) v;
	switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			// overlay is black with transparency of 0x77 (119)
			view.getDrawable().setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
			view.invalidate();
			break;
		case MotionEvent.ACTION_UP:
		case MotionEvent.ACTION_CANCEL: {
			// clear the overlay
			view.getDrawable().clearColorFilter();
			view.invalidate();
			break;
		}
	}
	return false;
}
 
源代码5 项目: TelePlus-Android   文件: VoIPActivity.java
@Override
public void didReceivedNotification(int id, int account, Object... args){
    if(id==NotificationCenter.emojiDidLoaded){
        for(ImageView iv:keyEmojiViews){
            iv.invalidate();
        }
    }
    if(id==NotificationCenter.closeInCallActivity){
        finish();
    }
}
 
源代码6 项目: TelePlus-Android   文件: VoIPActivity.java
@Override
public void didReceivedNotification(int id, int account, Object... args){
    if(id==NotificationCenter.emojiDidLoaded){
        for(ImageView iv:keyEmojiViews){
            iv.invalidate();
        }
    }
    if(id==NotificationCenter.closeInCallActivity){
        finish();
    }
}
 
源代码7 项目: AndroidWM   文件: WatermarkBuilder.java
/**
 * load a bitmap as background image from a ImageView.
 *
 * @param imageView the {@link ImageView} we need to use.
 */
private void backgroundFromImageView(ImageView imageView) {
    imageView.invalidate();
    if (imageView.getDrawable() != null) {
        BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable();
        if (resizeBackgroundImg) {
            backgroundImg = resizeBitmap(drawable.getBitmap(), MAX_IMAGE_SIZE);
        } else {
            backgroundImg = drawable.getBitmap();
        }
    }
}
 
源代码8 项目: AndroidWM   文件: WatermarkImage.java
/**
 * load a bitmap as watermark image from a ImageView.
 *
 * @param imageView the ImageView we need to use.
 */
private void watermarkFromImageView(ImageView imageView) {
    imageView.invalidate();
    BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable();
    // set the limitation of input bitmap.
    this.image = resizeBitmap(drawable.getBitmap(), MAX_IMAGE_SIZE);
}
 
源代码9 项目: belvedere   文件: Utils.java
static void internalSetTint(ImageView imageView, int color) {
    if(imageView == null) {
        return;
    }

    Drawable d = DrawableCompat.wrap(imageView.getDrawable());
    if(d != null) {
        DrawableCompat.setTint(d.mutate(), color);
    }

    imageView.invalidate();
}
 
源代码10 项目: TurboLauncher   文件: HolographicViewHelper.java
/**
 * Invalidates the pressed/focused states.
 */
void invalidatePressedFocusedStates(ImageView v) {
    mStatesUpdated = false;
    if (v != null) {
        v.invalidate();
    }
}
 
源代码11 项目: android_maplibui   文件: StyleFragment.java
private static void setColor(ImageView image, TextView text, int color) {
    // set color
    GradientDrawable sd = (GradientDrawable) image.getDrawable();
    sd.setColor(color);
    image.invalidate();

    // set color name
    text.setText(getColorName(color));
}
 
源代码12 项目: catnut   文件: ZhihuItemFragment.java
@Override
public void onClick(View v) {
	ImageView image = (ImageView) v;
	((ImageView) v).getDrawable().clearColorFilter();
	image.invalidate();
	Integer index = (Integer) v.getTag();
	Intent intent = SingleFragmentActivity.getIntent(getActivity(), SingleFragmentActivity.GALLERY);
	intent.putExtra(GalleryPagerFragment.CUR_INDEX, index);
	intent.putExtra(GalleryPagerFragment.URLS, mImageUrls);
	intent.putExtra(GalleryPagerFragment.TITLE, getString(R.string.view_photos));
	startActivity(intent);
}
 
源代码13 项目: Telegram-FOSS   文件: VoIPActivity.java
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.emojiDidLoad) {
        for (ImageView iv : keyEmojiViews) {
            iv.invalidate();
        }
    }
    if (id == NotificationCenter.closeInCallActivity) {
        finish();
    }
}
 
源代码14 项目: CrossBow   文件: CrossbowImage.java
public void load() {
    ImageView imageView = this.imageView.get();
    if (imageView != null) {

        if(inProgressLoads.containsKey(imageView)) {
            inProgressLoads.get(imageView).cancelRequest();
            inProgressLoads.remove(imageView);
        }

        inProgressLoads.put(imageView, this);

        imageView.getViewTreeObserver().addOnPreDrawListener(this);
        imageView.invalidate(dirtyRect);
    }
}
 
源代码15 项目: Telegram   文件: VoIPActivity.java
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.emojiDidLoad) {
        for (ImageView iv : keyEmojiViews) {
            iv.invalidate();
        }
    }
    if (id == NotificationCenter.closeInCallActivity) {
        finish();
    }
}
 
源代码16 项目: microbit   文件: CameraActivity_OldAPI.java
public void onShutter() {
    ImageView blinkRect = (ImageView) findViewById(R.id.blink_rectangle);
    blinkRect.setVisibility(View.VISIBLE);
    blinkRect.bringToFront();
    blinkRect.invalidate();
}
 
源代码17 项目: microbit   文件: CameraActivity_OldAPI.java
void DrawBlink() {
    SystemClock.sleep(500);
    ImageView blinkRect = (ImageView) findViewById(R.id.blink_rectangle);
    blinkRect.setVisibility(View.INVISIBLE);
    blinkRect.invalidate();
}
 
源代码18 项目: floatingsearchview   文件: Util.java
public static void setIconColor(ImageView iconHolder, int color) {
    Drawable wrappedDrawable = DrawableCompat.wrap(iconHolder.getDrawable());
    DrawableCompat.setTint(wrappedDrawable, color);
    iconHolder.setImageDrawable(wrappedDrawable);
    iconHolder.invalidate();
}
 
源代码19 项目: sketch   文件: ScrollBarHelper.java
private void invalidateView() {
    ImageView imageView = imageZoomer.getImageView();
    if (imageView != null) {
        imageView.invalidate();
    }
}