view: Resolve and supress deprecations where applicable
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.graphics.drawable.Animatable;
|
import android.graphics.drawable.Animatable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -149,12 +148,10 @@ public class AuroraProgressView extends View {
|
|||||||
drawableClassName.append(indicatorName);
|
drawableClassName.append(indicatorName);
|
||||||
try {
|
try {
|
||||||
Class<?> drawableClass = Class.forName(drawableClassName.toString());
|
Class<?> drawableClass = Class.forName(drawableClassName.toString());
|
||||||
Indicator indicator = (Indicator) drawableClass.newInstance();
|
Indicator indicator = (Indicator) drawableClass.getDeclaredConstructor().newInstance();
|
||||||
setIndicator(indicator);
|
setIndicator(indicator);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (Exception exception) {
|
||||||
Log.e(TAG, "Didn't find your class , check the name again !");
|
Log.e(TAG, "Failed to set indicator!", exception);
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,12 +246,7 @@ public class AuroraProgressView extends View {
|
|||||||
@Override
|
@Override
|
||||||
public void invalidateDrawable(Drawable dr) {
|
public void invalidateDrawable(Drawable dr) {
|
||||||
if (verifyDrawable(dr)) {
|
if (verifyDrawable(dr)) {
|
||||||
final Rect dirty = dr.getBounds();
|
invalidate();
|
||||||
final int scrollX = getScrollX() + getPaddingLeft();
|
|
||||||
final int scrollY = getScrollY() + getPaddingTop();
|
|
||||||
|
|
||||||
invalidate(dirty.left + scrollX, dirty.top + scrollY,
|
|
||||||
dirty.right + scrollX, dirty.bottom + scrollY);
|
|
||||||
} else {
|
} else {
|
||||||
super.invalidateDrawable(dr);
|
super.invalidateDrawable(dr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public abstract class Indicator extends Drawable implements Animatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"RedundantSuppression", "deprecation"})
|
||||||
public int getOpacity() {
|
public int getOpacity() {
|
||||||
return PixelFormat.OPAQUE;
|
return PixelFormat.OPAQUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user