diff --git a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/ImageFilterView.java b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/ImageFilterView.java index ebe877f28..6cf7f0acf 100644 --- a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/ImageFilterView.java +++ b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/ImageFilterView.java @@ -482,10 +482,10 @@ private void setMatrix() { ) { return; } - float panX = (Float.isNaN(mPanX)) ? 0 : mPanX; - float panY = (Float.isNaN(mPanY)) ? 0 : mPanY; - float zoom = (Float.isNaN(mZoom)) ? 1 : mZoom; - float rota = (Float.isNaN(mRotate)) ? 0 : mRotate; + float panX = Float.isNaN(mPanX) ? 0 : mPanX; + float panY = Float.isNaN(mPanY) ? 0 : mPanY; + float zoom = Float.isNaN(mZoom) ? 1 : mZoom; + float rota = Float.isNaN(mRotate) ? 0 : mRotate; Matrix imageMatrix = new Matrix(); imageMatrix.reset(); float iw = getDrawable().getIntrinsicWidth(); @@ -660,7 +660,7 @@ public void setCrossfade(float crossfade) { if (!mOverlay) { mLayer.getDrawable(0).setAlpha((int) (255 * (1 - mCrossfade))); } - mLayer.getDrawable(1).setAlpha((int) (255 * (mCrossfade))); + mLayer.getDrawable(1).setAlpha((int) (255 * mCrossfade)); super.setImageDrawable(mLayer); } } diff --git a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/MotionLabel.java b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/MotionLabel.java index 6320972a1..a4c708a28 100644 --- a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/MotionLabel.java +++ b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/utils/widget/MotionLabel.java @@ -231,14 +231,14 @@ private void setupTexture() { if (iw <= 0) { int w = getWidth(); if (w == 0) { - w = ((Float.isNaN(mTextureWidth)) ? 128 : (int) mTextureWidth); + w = (Float.isNaN(mTextureWidth) ? 128 : (int) mTextureWidth); } iw = w; } if (ih <= 0) { int h = getHeight(); if (h == 0) { - h = ((Float.isNaN(mTextureHeight)) ? 128 : (int) mTextureHeight); + h = (Float.isNaN(mTextureHeight) ? 128 : (int) mTextureHeight); } ih = h; } @@ -326,7 +326,7 @@ private float getHorizontalOffset() { float scale = Float.isNaN(mBaseTextSize) ? 1.0f : mTextSize / mBaseTextSize; float textWidth = scale * mPaint.measureText(mText, 0, mText.length()); - float boxWidth = ((Float.isNaN(mFloatWidth)) ? getMeasuredWidth() : mFloatWidth) + float boxWidth = (Float.isNaN(mFloatWidth) ? getMeasuredWidth() : mFloatWidth) - getPaddingLeft() - getPaddingRight(); return (boxWidth - textWidth) * (1 + mTextPanX) / 2.f; @@ -337,7 +337,7 @@ private float getVerticalOffset() { Paint.FontMetrics fm = mPaint.getFontMetrics(); - float boxHeight = ((Float.isNaN(mFloatHeight)) ? getMeasuredHeight() : mFloatHeight) + float boxHeight = (Float.isNaN(mFloatHeight) ? getMeasuredHeight() : mFloatHeight) - getPaddingTop() - getPaddingBottom(); @@ -429,9 +429,9 @@ public void layout(int l, int t, int r, int b) { float vh = mFloatHeight - mPaddingBottom - mPaddingTop; if (normalScale) { if (tw * vh > th * vw) { // width limited tw/vw > th/vh - mPaint.setTextSize((mPaintTextSize * vw) / (tw)); + mPaint.setTextSize(mPaintTextSize * vw / (tw)); } else { // height limited - mPaint.setTextSize((mPaintTextSize * vh) / (th)); + mPaint.setTextSize(mPaintTextSize * vh / (th)); } } else { scaleText = (tw * vh > th * vw) ? vw / (float) tw : vh / (float) th; @@ -475,9 +475,9 @@ public void layout(float l, float t, float r, float b) { float vw = r - l - mPaddingRight - mPaddingLeft; float vh = b - t - mPaddingBottom - mPaddingTop; if (tw * vh > th * vw) { // width limited tw/vw > th/vh - mPaint.setTextSize((mPaintTextSize * vw) / (tw)); + mPaint.setTextSize(mPaintTextSize * vw / (tw)); } else { // height limited - mPaint.setTextSize((mPaintTextSize * vh) / (th)); + mPaint.setTextSize(mPaintTextSize * vh / (th)); } if (mUseOutline || !Float.isNaN(mBaseTextSize)) { buildShape(Float.isNaN(mBaseTextSize) ? 1.0f : mTextSize / mBaseTextSize); @@ -646,7 +646,7 @@ public Typeface getTypeface() { return mPaint.getTypeface(); } - // @Override + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthMode = View.MeasureSpec.getMode(widthMeasureSpec); int heightMode = View.MeasureSpec.getMode(heightMeasureSpec); @@ -946,16 +946,16 @@ public void setTextBackgroundRotate(float rotation) { } private void updateShaderMatrix() { - float panX = (Float.isNaN(mBackgroundPanX)) ? 0 : mBackgroundPanX; - float panY = (Float.isNaN(mBackgroundPanY)) ? 0 : mBackgroundPanY; - float zoom = (Float.isNaN(mZoom)) ? 1 : mZoom; - float rota = (Float.isNaN(mRotate)) ? 0 : mRotate; + float panX = Float.isNaN(mBackgroundPanX) ? 0 : mBackgroundPanX; + float panY = Float.isNaN(mBackgroundPanY) ? 0 : mBackgroundPanY; + float zoom = Float.isNaN(mZoom) ? 1 : mZoom; + float rota = Float.isNaN(mRotate) ? 0 : mRotate; mTextShaderMatrix.reset(); float iw = mTextBackgroundBitmap.getWidth(); float ih = mTextBackgroundBitmap.getHeight(); - float sw = (Float.isNaN(mTextureWidth)) ? mFloatWidth : mTextureWidth; - float sh = (Float.isNaN(mTextureHeight)) ? mFloatHeight : mTextureHeight; + float sw = Float.isNaN(mTextureWidth) ? mFloatWidth : mTextureWidth; + float sh = Float.isNaN(mTextureHeight) ? mFloatHeight : mTextureHeight; float scale = zoom * ((iw * sh < ih * sw) ? sw / iw : sh / ih); mTextShaderMatrix.postScale(scale, scale); @@ -967,8 +967,8 @@ private void updateShaderMatrix() { if (!Float.isNaN(mTextureWidth)) { gapx = mTextureWidth / 2; } - float tx = 0.5f * (panX * (gapx) + sw - (scale * iw)); - float ty = 0.5f * (panY * (gapy) + sh - (scale * ih)); + float tx = 0.5f * (panX * gapx + sw - (scale * iw)); + float ty = 0.5f * (panY * gapy + sh - (scale * ih)); mTextShaderMatrix.postTranslate(tx, ty); mTextShaderMatrix.postRotate(rota, sw / 2, sh / 2); diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayLinkedVariables.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayLinkedVariables.java index 1324dad20..d376be564 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayLinkedVariables.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayLinkedVariables.java @@ -123,6 +123,7 @@ public class ArrayLinkedVariables implements ArrayRow.ArrayRowVariables { * @param variable the variable to add in the list * @param value the value of the variable */ + @Override public final void put(SolverVariable variable, float value) { if (value == 0) { remove(variable, true); @@ -232,6 +233,7 @@ public final void put(SolverVariable variable, float value) { * @param variable the variable we want to add * @param value its value */ + @Override public void add(SolverVariable variable, float value, boolean removeFromDefinition) { if (value > -sEpsilon && value < sEpsilon) { return; @@ -375,6 +377,7 @@ public float use(ArrayRow definition, boolean removeFromDefinition) { * @param variable the variable we want to remove * @return the value of the removed variable */ + @Override public final float remove(SolverVariable variable, boolean removeFromDefinition) { if (mCandidate == variable) { mCandidate = null; @@ -416,6 +419,7 @@ public final float remove(SolverVariable variable, boolean removeFromDefinition) /** * Clear the list of variables */ + @Override public final void clear() { int current = mHead; int counter = 0; @@ -440,6 +444,7 @@ public final void clear() { * @param variable the variable we are looking for * @return return true if we found the variable */ + @Override public boolean contains(SolverVariable variable) { if (mHead == NONE) { return false; @@ -495,6 +500,7 @@ boolean hasAtLeastOnePositiveVariable() { /** * Invert the values of all the variables in the list */ + @Override public void invert() { int current = mHead; int counter = 0; @@ -511,6 +517,7 @@ public void invert() { * * @param amount amount to divide by */ + @Override public void divideByAmount(float amount) { int current = mHead; int counter = 0; @@ -525,6 +532,7 @@ public int getHead() { return mHead; } + @Override public int getCurrentSize() { return mCurrentSize; } @@ -586,6 +594,7 @@ SolverVariable getPivotCandidate() { * @param index the index of the variable we want to return * @return the variable found, or null */ + @Override public SolverVariable getVariable(int index) { int current = mHead; int counter = 0; @@ -605,6 +614,7 @@ public SolverVariable getVariable(int index) { * @param index the index of the variable we want to look up * @return the value of the found variable, or 0 if not found */ + @Override public float getVariableValue(int index) { int current = mHead; int counter = 0; @@ -624,6 +634,7 @@ public float getVariableValue(int index) { * @param v the variable we are looking up * @return the value of the found variable, or 0 if not found */ + @Override public final float get(SolverVariable v) { int current = mHead; int counter = 0; @@ -642,6 +653,7 @@ public final float get(SolverVariable v) { * * @return size in bytes */ + @Override public int sizeInBytes() { int size = 0; size += 3 * (mArrayIndices.length * 4); @@ -652,6 +664,7 @@ public int sizeInBytes() { /** * print out the variables and their values */ + @Override public void display() { int count = mCurrentSize; System.out.print("{ "); diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayRow.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayRow.java index 5b0b1987a..40936be9f 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayRow.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/ArrayRow.java @@ -135,6 +135,7 @@ boolean hasKeyVariable() { /** * @TODO: add description */ + @Override public String toString() { return toReadableString(); } @@ -682,6 +683,7 @@ public void updateFromRow(LinearSystem system, /** * @TODO: add description */ + @Override public void updateFromFinalVariable(LinearSystem system, SolverVariable variable, boolean removeFromDefinition) { diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/Metrics.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/Metrics.java index 87bc26469..63578c932 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/Metrics.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/Metrics.java @@ -68,6 +68,7 @@ public class Metrics { /** * @TODO: add description */ + @Override public String toString() { return "\n*** Metrics ***\n" + "measures: " + measures + "\n" diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/ConstraintWidgetContainer.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/ConstraintWidgetContainer.java index a5ef177a0..bcabfa189 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/ConstraintWidgetContainer.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/ConstraintWidgetContainer.java @@ -449,7 +449,7 @@ public boolean addChildrenToSolver(LinearSystem system) { } } else { Optimizer.checkMatchParent(this, system, widget); - if (!(widget.addFirst())) { + if (!widget.addFirst()) { widget.addToSolver(system, optimize); } } @@ -758,7 +758,7 @@ public void layout() { && !(child instanceof Guideline) && !(child instanceof Barrier) && !(child instanceof VirtualLayout) - && !(child.isInVirtualLayout())) { + && !child.isInVirtualLayout()) { DimensionBehaviour widthBehavior = child.getDimensionBehaviour(HORIZONTAL); DimensionBehaviour heightBehavior = child.getDimensionBehaviour(VERTICAL); @@ -785,7 +785,7 @@ public void layout() { if (count > 2 && (originalHorizontalDimensionBehaviour == WRAP_CONTENT || originalVerticalDimensionBehaviour == WRAP_CONTENT) - && (Optimizer.enabled(mOptimizationLevel, Optimizer.OPTIMIZATION_GROUPING))) { + && Optimizer.enabled(mOptimizationLevel, Optimizer.OPTIMIZATION_GROUPING)) { if (Grouping.simpleSolvingPass(this, getMeasurer())) { if (originalHorizontalDimensionBehaviour == WRAP_CONTENT) { if (preW < getWidth() && preW > 0) { @@ -1147,6 +1147,7 @@ public void setPass(int pass) { /** * @TODO: add description */ + @Override public void getSceneString(StringBuilder ret) { ret.append(stringId + ":{\n"); diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/Guideline.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/Guideline.java index b9e1794c1..a73b23d04 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/Guideline.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/Guideline.java @@ -217,10 +217,12 @@ public void setFinalValue(int position) { mResolved = true; } + @Override public boolean isResolvedHorizontally() { return mResolved; } + @Override public boolean isResolvedVertically() { return mResolved; } diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/ChainRun.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/ChainRun.java index f7c1a1a42..3d1ee982c 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/ChainRun.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/ChainRun.java @@ -65,6 +65,7 @@ boolean supportsWrapComputation() { /** * @TODO: add description */ + @Override public long getWrapDimension() { final int count = mWidgets.size(); long wrapDimension = 0; @@ -491,6 +492,7 @@ public void update(Dependency dependency) { /** * @TODO: add description */ + @Override public void applyToWidget() { for (int i = 0; i < mWidgets.size(); i++) { WidgetRun run = mWidgets.get(i); diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DependencyNode.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DependencyNode.java index 488951d7c..9a2d63c6a 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DependencyNode.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DependencyNode.java @@ -69,6 +69,7 @@ public void resolve(int value) { /** * @TODO: add description */ + @Override public void update(Dependency node) { for (DependencyNode target : mTargets) { if (!target.resolved) { diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DimensionDependency.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DimensionDependency.java index 979b875c3..59669938b 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DimensionDependency.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/DimensionDependency.java @@ -29,6 +29,7 @@ class DimensionDependency extends DependencyNode { } } + @Override public void resolve(int value) { if (resolved) { return; diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/HorizontalWidgetRun.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/HorizontalWidgetRun.java index 570f9ae17..c01424ecf 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/HorizontalWidgetRun.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/HorizontalWidgetRun.java @@ -609,6 +609,7 @@ public void update(Dependency dependency) { /** * @TODO: add description */ + @Override public void applyToWidget() { if (start.resolved) { mWidget.setX(start.value); diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/VerticalWidgetRun.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/VerticalWidgetRun.java index 299bb9628..29536a5ca 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/VerticalWidgetRun.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/VerticalWidgetRun.java @@ -478,6 +478,7 @@ void apply() { /** * @TODO: add description */ + @Override public void applyToWidget() { if (start.resolved) { mWidget.setY(start.value); diff --git a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/WidgetRun.java b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/WidgetRun.java index 6abaa39f4..b5a224d2d 100644 --- a/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/WidgetRun.java +++ b/constraintlayout/core/src/main/java/androidx/constraintlayout/core/widgets/analyzer/WidgetRun.java @@ -260,6 +260,7 @@ protected void updateRunEnd(Dependency dependency) { /** * @TODO: add description */ + @Override public void update(Dependency dependency) { }