Added Nullity Annotations
This commit is contained in:
parent
1dcc447e52
commit
5317c51400
102 changed files with 772 additions and 404 deletions
|
|
@ -9,6 +9,8 @@ import android.graphics.Matrix;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
|
|
@ -18,20 +20,23 @@ import com.kabouzeid.gramophone.util.Util;
|
|||
public class ColorView extends FrameLayout {
|
||||
|
||||
private final Bitmap mCheck;
|
||||
@NonNull
|
||||
private final Paint paint;
|
||||
@NonNull
|
||||
private final Paint paintBorder;
|
||||
@Nullable
|
||||
private Paint paintCheck;
|
||||
private final int borderWidth;
|
||||
|
||||
public ColorView(Context context) {
|
||||
public ColorView(@NonNull Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public ColorView(Context context, AttributeSet attrs) {
|
||||
public ColorView(@NonNull Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public ColorView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public ColorView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
final int checkSize = (int) context.getResources().getDimension(R.dimen.circle_view_check);
|
||||
mCheck = getResizedBitmap(BitmapFactory.decodeResource(context.getResources(),
|
||||
|
|
@ -47,7 +52,7 @@ public class ColorView extends FrameLayout {
|
|||
setWillNotDraw(false);
|
||||
}
|
||||
|
||||
private static Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) {
|
||||
private static Bitmap getResizedBitmap(@NonNull Bitmap bm, int newHeight, int newWidth) {
|
||||
int width = bm.getWidth();
|
||||
int height = bm.getHeight();
|
||||
float scaleWidth = ((float) newWidth) / width;
|
||||
|
|
@ -88,7 +93,7 @@ public class ColorView extends FrameLayout {
|
|||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
protected void onDraw(@NonNull Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
int canvasSize = canvas.getWidth();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import android.content.res.ColorStateList;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.ColorUtils;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
|
|
@ -25,17 +26,17 @@ public class DynamicSwitch extends SwitchCompat {
|
|||
static final int[] CHECKED_STATE_SET = new int[]{android.R.attr.state_checked};
|
||||
static final int[] EMPTY_STATE_SET = new int[0];
|
||||
|
||||
public DynamicSwitch(Context context) {
|
||||
public DynamicSwitch(@NonNull Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public DynamicSwitch(Context context, AttributeSet attrs) {
|
||||
public DynamicSwitch(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public DynamicSwitch(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public DynamicSwitch(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
|
@ -45,7 +46,7 @@ public class DynamicSwitch extends SwitchCompat {
|
|||
setTint(this, color);
|
||||
}
|
||||
|
||||
public static void setTint(SwitchCompat switchCompat, int color) {
|
||||
public static void setTint(@NonNull SwitchCompat switchCompat, int color) {
|
||||
ColorStateList trackColorSl = createSwitchTrackColorStateList(switchCompat.getContext(), color);
|
||||
ColorStateList thumbColorSl = createSwitchThumbColorStateList(switchCompat.getContext(), color);
|
||||
|
||||
|
|
@ -59,7 +60,8 @@ public class DynamicSwitch extends SwitchCompat {
|
|||
switchCompat.setTrackDrawable(trackDrawable);
|
||||
}
|
||||
|
||||
private static ColorStateList createSwitchTrackColorStateList(Context context, int colorActivated) {
|
||||
@NonNull
|
||||
private static ColorStateList createSwitchTrackColorStateList(@NonNull Context context, int colorActivated) {
|
||||
final int[][] states = new int[3][];
|
||||
final int[] colors = new int[3];
|
||||
int i = 0;
|
||||
|
|
@ -80,7 +82,8 @@ public class DynamicSwitch extends SwitchCompat {
|
|||
return new ColorStateList(states, colors);
|
||||
}
|
||||
|
||||
private static ColorStateList createSwitchThumbColorStateList(Context context, int colorActivated) {
|
||||
@NonNull
|
||||
private static ColorStateList createSwitchThumbColorStateList(@NonNull Context context, int colorActivated) {
|
||||
final int[][] states = new int[3][];
|
||||
final int[] colors = new int[3];
|
||||
int i = 0;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
|
@ -36,19 +37,20 @@ public class FastScroller extends FrameLayout {
|
|||
private boolean isHidden;
|
||||
private int hideTranslationX;
|
||||
|
||||
@Nullable
|
||||
private ViewPropertyAnimator currentAnimator = null;
|
||||
|
||||
public FastScroller(Context context, AttributeSet attrs) {
|
||||
public FastScroller(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialise(context);
|
||||
}
|
||||
|
||||
public FastScroller(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public FastScroller(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initialise(context);
|
||||
}
|
||||
|
||||
private void initialise(Context context) {
|
||||
private void initialise(@NonNull Context context) {
|
||||
hideTranslationX = getContext().getResources().getDimensionPixelSize(R.dimen.scrollbar_width) * (Util.isRTL(context) ? -1 : 1);
|
||||
setClipChildren(false);
|
||||
inflate(context, R.layout.vertical_recycler_fast_scroller_layout, this);
|
||||
|
|
@ -76,7 +78,7 @@ public class FastScroller extends FrameLayout {
|
|||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
public void setRecyclerView(RecyclerView recyclerView) {
|
||||
public void setRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||
this.recyclerView = recyclerView;
|
||||
recyclerView.addOnScrollListener(scrollListener);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
|
@ -13,11 +14,11 @@ public class HeightFitSquareImageView extends ImageView {
|
|||
super(context);
|
||||
}
|
||||
|
||||
public HeightFitSquareImageView(Context context, AttributeSet attrs) {
|
||||
public HeightFitSquareImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public HeightFitSquareImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
public HeightFitSquareImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
|
@ -13,11 +14,11 @@ public class HeightWidthFitSquareImageView extends ImageView {
|
|||
super(context);
|
||||
}
|
||||
|
||||
public HeightWidthFitSquareImageView(Context context, AttributeSet attrs) {
|
||||
public HeightWidthFitSquareImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public HeightWidthFitSquareImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
public HeightWidthFitSquareImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import android.graphics.Path;
|
|||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Property;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
|
|
@ -25,12 +26,12 @@ public class PlayPauseDrawable extends Drawable {
|
|||
private static final Property<PlayPauseDrawable, Float> PROGRESS =
|
||||
new Property<PlayPauseDrawable, Float>(Float.class, "progress") {
|
||||
@Override
|
||||
public Float get(PlayPauseDrawable d) {
|
||||
public Float get(@NonNull PlayPauseDrawable d) {
|
||||
return d.getProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(PlayPauseDrawable d, Float value) {
|
||||
public void set(@NonNull PlayPauseDrawable d, Float value) {
|
||||
d.setProgress(value);
|
||||
}
|
||||
};
|
||||
|
|
@ -51,7 +52,7 @@ public class PlayPauseDrawable extends Drawable {
|
|||
|
||||
private AnimatorSet animatorSet;
|
||||
|
||||
public PlayPauseDrawable(Context context) {
|
||||
public PlayPauseDrawable(@NonNull Context context) {
|
||||
final Resources res = context.getResources();
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
|
|
@ -62,7 +63,7 @@ public class PlayPauseDrawable extends Drawable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(final Rect bounds) {
|
||||
protected void onBoundsChange(@NonNull final Rect bounds) {
|
||||
super.onBoundsChange(bounds);
|
||||
if (bounds.width() > 0 && bounds.height() > 0) {
|
||||
width = bounds.width();
|
||||
|
|
@ -71,7 +72,7 @@ public class PlayPauseDrawable extends Drawable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
public void draw(@NonNull Canvas canvas) {
|
||||
leftPauseBar.rewind();
|
||||
rightPauseBar.rewind();
|
||||
|
||||
|
|
@ -126,6 +127,7 @@ public class PlayPauseDrawable extends Drawable {
|
|||
canvas.restore();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private Animator getPausePlayAnimator() {
|
||||
isPlaySet = !isPlaySet;
|
||||
final Animator anim = ObjectAnimator.ofFloat(this, PROGRESS, isPlay ? 1 : 0, isPlay ? 0 : 1);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
|
@ -15,11 +16,11 @@ public class SquareIfPlaceImageView extends ImageView {
|
|||
super(context);
|
||||
}
|
||||
|
||||
public SquareIfPlaceImageView(Context context, AttributeSet attrs) {
|
||||
public SquareIfPlaceImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SquareIfPlaceImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
public SquareIfPlaceImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
|
@ -13,11 +14,11 @@ public class WidthFitSquareImageView extends ImageView {
|
|||
super(context);
|
||||
}
|
||||
|
||||
public WidthFitSquareImageView(Context context, AttributeSet attrs) {
|
||||
public WidthFitSquareImageView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public WidthFitSquareImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
public WidthFitSquareImageView(@NonNull Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue