View invalidate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for View invalidate method.

This code example shows how to use the following methods:getTag, invalidate, setImageBitmap
    return(result);
  } 
 
  @Override 
  protected void onPostExecute(Bitmap bitmap) {
      if (path.equals(image.getTag())) {
        image.setImageBitmap(bitmap);
        image.invalidate();
      } 
       
      if (ex!=null) {
        Log.e("ImageLoadTask", "Exception loading image", ex);
      } 
  } 
} 
8
CodeRank
This code example shows how to use the following methods:getLeft, invalidate, offsetLeftAndRight
This code example shows how to use the following methods:getTag, invalidate, setImageBitmap
    return(result);
  } 
 
  @Override 
  protected void onPostExecute(Bitmap bitmap) {
      if (path.equals(image.getTag())) {
        image.setImageBitmap(bitmap);
        image.invalidate();
      } 
       
      if (ex!=null) {
        Log.e("ImageLoadTask", "Exception loading image", ex);
      } 
  } 
} 
8
CodeRank
This code example shows how to use the following methods:getLayoutParams, invalidate, setLayoutParams
	@Override 
	public void computeScroll() { 
		if (scroller.computeScrollOffset()) {
			int i = this.scroller.getCurrY();
			LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) this.refreshView
					.getLayoutParams();
			int k = Math.max(i, refreshTargetTop);
			lp.topMargin = k;
			this.refreshView.setLayoutParams(lp);
			this.refreshView.invalidate();
			invalidate();
		} 
	} 
 
	/** 
	 * 下拉move事件处理 
	 *  
	 * @param moveY 
	 */ 
	public void doMovement(int moveY) {
7
CodeRank
This code example shows how to use the following methods:invalidate, setMax, setVisibility
            mimetype.setVisibility(View.VISIBLE);
            size.setText("(" + currentValue.getString("length") + " bytes )");
            mimetype.setText("[" + currentValue.getString("mime-type") + "]");
        } 
        if (mode != LayoutMode.VIEW) { 
            progressBar.setVisibility(View.VISIBLE);
        } 
        filename.invalidate();
        size.invalidate();
        mimetype.invalidate();
        if (progressBar != null) {
            progressBar.invalidate();
        } 
        layoutWidget.invalidate();
    } 
 
    @Override 
    public View buildView(LayoutContext context, LayoutMode mode, Document doc,
            List<String> attributeNames, WidgetDefinition widgetDef) {
        super.buildView(context, mode, doc, attributeNames, widgetDef); 

7
CodeRank
This code example shows how to use the following methods:invalidate, postDelayed
 
	@Override 
	public void run() { 
		if (!(view instanceof ProgressBar)) return;
		if (((ProgressBar) view).isIndeterminate()) {
			view.invalidate();
		} 
		view.postDelayed(this, 16);
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:getBackground, invalidate
		setKey(key);
	} 
 
	public static void applyBackground(final View view, final int color) {
		if (view == null) return;
		final Drawable bg = view.getBackground();
		if (bg == null) return;
		bg.mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
		view.invalidate();
	} 
 
	public static int getThemeColor(final Context context) {
		final Resources res = context.getResources();
		final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
		final boolean dark_theme = prefs.getBoolean(PREFERENCE_KEY_DARK_THEME, false);
		final int def = res.getColor(dark_theme ? R.color.holo_blue_dark : R.color.holo_blue_light);
		final String key = dark_theme ? PREFERENCE_KEY_DARK_THEME_COLOR : PREFERENCE_KEY_LIGHT_THEME_COLOR;
		return prefs.getInt(key, def);
	} 
} 
7
CodeRank
This code example shows how to use the following methods:invalidate
      InetAddress address = InetAddress.getByAddress(MediaNames.STREAM_SERVER);
      return address.isReachable(10000);
  } 
 
  public static void testInvalidateOverlay() { 
      mOverlayView.invalidate();
  } 
 
} 
7
CodeRank
This code example shows how to use the following methods:getPaddingBottom, getPaddingLeft, getPaddingRight, invalidate, setPadding
                }   
                 
                // 更新headView的size    
                if (state == PULL_To_REFRESH) { 
                	int topPadding = ((-1 * headContentHeight + (tempY - startY)));
                	headView.setPadding(headView.getPaddingLeft(), topPadding, headView.getPaddingRight(), headView.getPaddingBottom());   
                    headView.invalidate();  
                    //System.out.println("当前-下拉刷新PULL_To_REFRESH-TopPad:"+topPadding); 
                }   
   
                // 更新headView的paddingTop    
                if (state == RELEASE_To_REFRESH) {  
                	int topPadding = ((tempY - startY - headContentHeight));
                	headView.setPadding(headView.getPaddingLeft(), topPadding, headView.getPaddingRight(), headView.getPaddingBottom());    
                    headView.invalidate();  
                    //System.out.println("当前-释放刷新RELEASE_To_REFRESH-TopPad:"+topPadding); 
                }   
            }   
            break;   
        }   
7
CodeRank
This code example shows how to use the following methods:invalidate, setPadding, setImageDrawable
			ShapeDrawable rectangle = new ShapeDrawable ();
	        rectangle.setShape(new RectShape());
	        rectangle.setIntrinsicHeight(100);
	        rectangle.setIntrinsicWidth(200);
	        rectangle.getPaint().setColor(Color.GREEN);
	        iView = new ImageView(this);
	        iView.setImageDrawable(rectangle); 
	         
			layout.addView(iView, params);
		} 
		if (me.getAction() == MotionEvent.ACTION_UP) {
			status = STOP_DRAGGING;
			 
		} else if (me.getAction() == MotionEvent.ACTION_MOVE) {
			if (status == START_DRAGGING) {
				System.out.println("Dragging");
				iView.setPadding((int) me.getRawX(), (int) me.getRawY(), 0, 0);
				iView.invalidate();
			} 
		} 

7
CodeRank

Related View invalidate Questions & Answers:

invalidate Method Overview
Mark the area defined by dirty as needing to be drawn.
See Code Examples for other Android View Methods: