Java Code Examples for android.view.View#invalidate()
The following examples show how to use
android.view.View#invalidate() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: AOSP-Kayboard-7.1.2 File: UserDictionarySettings.java License: Apache License 2.0 | 6 votes |
@Override public boolean setViewValue(final View v, final Cursor c, final int columnIndex) { if (!IS_SHORTCUT_API_SUPPORTED) { // just let SimpleCursorAdapter set the view values return false; } if (columnIndex == INDEX_SHORTCUT) { final String shortcut = c.getString(INDEX_SHORTCUT); if (TextUtils.isEmpty(shortcut)) { v.setVisibility(View.GONE); } else { ((TextView)v).setText(shortcut); v.setVisibility(View.VISIBLE); } v.invalidate(); return true; } return false; }
Example 2
Source Project: XPrivacy File: ActivityShare.java License: GNU General Public License v3.0 | 6 votes |
private void blueStreakOfProgress(Integer current, Integer max) { // Set up the progress bar if (mProgressWidth == 0) { final View vShareProgressEmpty = (View) findViewById(R.id.vShareProgressEmpty); mProgressWidth = vShareProgressEmpty.getMeasuredWidth(); } // Display stuff if (max == 0) max = 1; int width = (int) ((float) mProgressWidth) * current / max; View vShareProgressFull = (View) findViewById(R.id.vShareProgressFull); vShareProgressFull.getLayoutParams().width = width; vShareProgressFull.invalidate(); vShareProgressFull.requestLayout(); }
Example 3
Source Project: Telegram-FOSS File: CheckBoxBase.java License: GNU General Public License v2.0 | 5 votes |
private void invalidate() { if (parentView.getParent() != null) { View parent = (View) parentView.getParent(); parent.invalidate(); } parentView.invalidate(); }
Example 4
Source Project: TLint File: LabelViewHelper.java License: Apache License 2.0 | 5 votes |
public void setLabelText(View view, String text) { if (!TextUtils.equals(this.text, text)) { this.text = text; Logger.d("setLabelText:" + text); view.invalidate(); } }
Example 5
Source Project: geopaparazzi File: PointCreateFeatureToolGroup.java License: GNU General Public License v3.0 | 5 votes |
public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { v.getBackground().setColorFilter(buttonSelectionColor, Mode.SRC_ATOP); v.invalidate(); break; } case MotionEvent.ACTION_UP: { v.getBackground().clearColorFilter(); v.invalidate(); break; } } return false; }
Example 6
Source Project: geopaparazzi File: PointOnSelectionToolGroup.java License: GNU General Public License v3.0 | 5 votes |
public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { v.getBackground().setColorFilter(buttonSelectionColor, Mode.SRC_ATOP); v.invalidate(); break; } case MotionEvent.ACTION_UP: { v.getBackground().clearColorFilter(); v.invalidate(); break; } } return false; }
Example 7
Source Project: KJFrameForAndroid File: AnimatorProxy.java License: Apache License 2.0 | 5 votes |
public void setAlpha(float alpha) { if (mAlpha != alpha) { mAlpha = alpha; View view = mView.get(); if (view != null) { view.invalidate(); } } }
Example 8
Source Project: zen4android File: AnimatorProxy.java License: MIT License | 5 votes |
public void setAlpha(float alpha) { if (mAlpha != alpha) { mAlpha = alpha; View view = mView.get(); if (view != null) { view.invalidate(); } } }
Example 9
Source Project: android_tv_metro File: MetroCursorView.java License: Apache License 2.0 | 5 votes |
public void setFocusView(View view){ if(mFocusView != view){ mFocusView = view; //mMirror = mirror; mScaleUp = 1.0f; //anim.setStartDelay(50); anim.start(); animUpdate.start(); if(view instanceof MirrorItemView ){ ((MirrorItemView)view).setReflection(false); view.invalidate(); } } }
Example 10
Source Project: DanDanPlayForAndroid File: LayoutHelper.java License: MIT License | 5 votes |
public void setOuterNormalColor(int color) { mOuterNormalColor = color; View owner = mOwner.get(); if (owner != null) { owner.invalidate(); } }
Example 11
Source Project: Libraries-for-Android-Developers File: AnimatorProxy.java License: MIT License | 5 votes |
public void setAlpha(float alpha) { if (mAlpha != alpha) { mAlpha = alpha; View view = mView.get(); if (view != null) { view.invalidate(); } } }
Example 12
Source Project: SmileEssence File: ListItemClickListener.java License: MIT License | 5 votes |
@Override public void onClick(final View v) { final int currentBgColor = ((ColorDrawable) v.getBackground()).getColor(); v.setBackgroundColor(activity.getResources().getColor(R.color.metro_blue)); v.invalidate(); new UIHandler() { @Override public void run() { v.setBackgroundColor(currentBgColor); callback.run(); } }.post(); }
Example 13
Source Project: TLint File: LabelViewHelper.java License: Apache License 2.0 | 4 votes |
public void setLabelTextColor(View view, int textColor) { if (this.textColor != textColor) { this.textColor = textColor; view.invalidate(); } }
Example 14
Source Project: adt-leanback-support File: ViewCompat.java License: Apache License 2.0 | 4 votes |
public void postInvalidateOnAnimation(View view, int left, int top, int right, int bottom) { view.invalidate(left, top, right, bottom); }
Example 15
Source Project: AndroidAnimationsActions File: ColorUpdateListener.java License: MIT License | 4 votes |
@Override void onAnimationUpdate(View view, ValueAnimator animation) { int currentColor = (int) animation.getAnimatedValue(); paint.setColorFilter(new PorterDuffColorFilter(currentColor, PorterDuff.Mode.MULTIPLY)); view.invalidate(); }
Example 16
Source Project: appinventor-extensions File: ViewUtil.java License: Apache License 2.0 | 4 votes |
public static void setBackgroundDrawable(View view, Drawable drawable) { view.setBackgroundDrawable(drawable); view.invalidate(); }
Example 17
Source Project: DanDanPlayForAndroid File: LayoutHelper.java License: MIT License | 4 votes |
@Override public void setRadiusAndShadow(int radius, @ILayout.HideRadiusSide int hideRadiusSide, int shadowElevation, float shadowAlpha) { View owner = mOwner.get(); if (owner == null) { return; } mRadius = radius; mHideRadiusSide = hideRadiusSide; if (mRadius > 0) { if (hideRadiusSide == HIDE_RADIUS_SIDE_TOP) { mRadiusArray = new float[]{0, 0, 0, 0, mRadius, mRadius, mRadius, mRadius}; } else if (hideRadiusSide == HIDE_RADIUS_SIDE_RIGHT) { mRadiusArray = new float[]{mRadius, mRadius, 0, 0, 0, 0, mRadius, mRadius}; } else if (hideRadiusSide == HIDE_RADIUS_SIDE_BOTTOM) { mRadiusArray = new float[]{mRadius, mRadius, mRadius, mRadius, 0, 0, 0, 0}; } else if (hideRadiusSide == HIDE_RADIUS_SIDE_LEFT) { mRadiusArray = new float[]{0, 0, mRadius, mRadius, mRadius, mRadius, 0, 0}; } else { mRadiusArray = null; } } mShadowElevation = shadowElevation; mShadowAlpha = shadowAlpha; if (useFeature()) { if (mShadowElevation == 0 || isRadiusWithSideHidden()) { owner.setElevation(0); } else { owner.setElevation(mShadowElevation); } owner.setOutlineProvider(new ViewOutlineProvider() { @Override @TargetApi(21) public void getOutline(View view, Outline outline) { int w = view.getWidth(), h = view.getHeight(); if (w == 0 || h == 0) { return; } if (isRadiusWithSideHidden()) { int left = 0, top = 0, right = w, bottom = h; if (mHideRadiusSide == HIDE_RADIUS_SIDE_LEFT) { left -= mRadius; } else if (mHideRadiusSide == HIDE_RADIUS_SIDE_TOP) { top -= mRadius; } else if (mHideRadiusSide == HIDE_RADIUS_SIDE_RIGHT) { right += mRadius; } else if (mHideRadiusSide == HIDE_RADIUS_SIDE_BOTTOM) { bottom += mRadius; } outline.setRoundRect(left, top, right, bottom, mRadius); return; } int top = mOutlineInsetTop, bottom = Math.max(top + 1, h - mOutlineInsetBottom), left = mOutlineInsetLeft, right = w - mOutlineInsetRight; if (mIsOutlineExcludePadding) { left += view.getPaddingLeft(); top += view.getPaddingTop(); right = Math.max(left + 1, right - view.getPaddingRight()); bottom = Math.max(top + 1, bottom - view.getPaddingBottom()); } outline.setAlpha(mShadowAlpha); if (mRadius <= 0) { outline.setRect(left, top, right, bottom); } else { outline.setRoundRect(left, top, right, bottom, mRadius); } } }); owner.setClipToOutline(mRadius > 0); } owner.invalidate(); }
Example 18
Source Project: labelview File: LabelViewHelper.java License: Apache License 2.0 | 4 votes |
public void setLabelBackgroundAlpha(View view, int alpha) { if (this.alpha != alpha) { this.alpha = alpha; view.invalidate(); } }
Example 19
Source Project: Hangar File: ChangeLog.java License: GNU General Public License v3.0 | 4 votes |
@SuppressLint("InflateParams") protected View getView() { LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); View mChangeLog = inflater.inflate(R.layout.changelog, null); LinearLayout mChangeLogRoot = (LinearLayout) mChangeLog.findViewById(R.id.changeParent); String[] versionNumbers = context.getResources().getStringArray(R.array.versionNumbers); String[] versionSummaries = context.getResources().getStringArray(R.array.versionSummaries); for (int i = 0; i < versionNumbers.length; i++) { String version = versionNumbers[i]; String summary = versionSummaries[i]; LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); llp.topMargin = Tools.dpToPx(context, 10); llp.leftMargin = Tools.dpToPx(context, 10); LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); ll.setLayoutParams(llp); LinearLayout.LayoutParams llttv = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1); llttv.bottomMargin = Tools.dpToPx(context, 2); TextView titletv = new TextView(context); titletv.setLayoutParams(llttv); titletv.setText(version); titletv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); titletv.setTypeface(null, Typeface.BOLD); titletv.setGravity(Gravity.CENTER_VERTICAL); titletv.setSingleLine(); LinearLayout.LayoutParams llstv = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1); TextView summarytv = new TextView(context); llstv.bottomMargin = Tools.dpToPx(context, 8); summarytv.setLayoutParams(llstv); summarytv.setGravity(Gravity.CENTER_VERTICAL); summarytv.setText(summary); summarytv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); ll.addView(titletv); ll.addView(summarytv); mChangeLogRoot.addView(ll); } mChangeLog.invalidate(); return mChangeLog; }
Example 20
Source Project: MiBandDecompiled File: ad.java License: Apache License 2.0 | 4 votes |
public void a(View view, Paint paint) { a(view, g(view), paint); view.invalidate(); }