Skip to content

Commit

Permalink
Remove 'SuppressWarnings("NewApi")'
Browse files Browse the repository at this point in the history
  • Loading branch information
ogaclejapan committed Apr 16, 2016
1 parent 79930ba commit 3df5565
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
6 changes: 4 additions & 2 deletions library/src/main/java/com/ogaclejapan/arclayout/Arc.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.RectF;
import android.os.Build;

import static android.os.Build.VERSION_CODES.LOLLIPOP;

public enum Arc {

Expand Down Expand Up @@ -234,7 +237,6 @@ public float computePerDegrees(int size) {
return ((float) sweepAngle) / size;
}

@SuppressWarnings("NewApi")
public Path computePath(int radius, int l, int t, int r, int b) {
final Point o = computeOrigin(l, t, r, b);
final int ol = o.x - radius;
Expand All @@ -260,7 +262,7 @@ public Path computePath(int radius, int l, int t, int r, int b) {
default:
throw new UnsupportedOperationException();
}
if (Utils.LOLLIPOP_OR_LATER) {
if (Build.VERSION.SDK_INT >= LOLLIPOP) {
path.arcTo(ol, ot, or, ob, startAngle, sweepAngle, true);
} else {
path.arcTo(new RectF(ol, ot, or, ob), startAngle, sweepAngle, true);
Expand Down
11 changes: 5 additions & 6 deletions library/src/main/java/com/ogaclejapan/arclayout/ArcLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

import java.util.WeakHashMap;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;

public class ArcLayout extends ViewGroup {

private static final String TAG = "ArcLayout";
Expand Down Expand Up @@ -67,7 +69,6 @@ public ArcLayout(Context context, AttributeSet attrs, int defStyleAttr, int defS
init(context, attrs, defStyleAttr, defStyleRes);
}

@SuppressWarnings("NewApi")
protected void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
setWillNotDraw(false);

Expand All @@ -87,7 +88,7 @@ protected void init(Context context, AttributeSet attrs, int defStyleAttr, int d
R.styleable.arc_ArcLayout_arc_reverseAngle, DEFAULT_REVERSE_ANGLE);
a.recycle();

if (Utils.JELLY_BEAN_MR1_OR_LATER) {
if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
arcOrigin = ArcOrigin.getAbsoluteOrigin(arcOrigin, getLayoutDirection());
}

Expand Down Expand Up @@ -250,15 +251,14 @@ public int getChildCountWithoutGone() {
return childCount;
}

@SuppressWarnings("NewApi")
protected void childMeasureBy(View child, int x, int y) {
if (Utils.DEBUG) {
Utils.d(TAG, "childMeasureBy: x=%d, y=%d", x, y);
}

final LayoutParams lp = (LayoutParams) child.getLayoutParams();
int origin = lp.origin;
if (Utils.JELLY_BEAN_MR1_OR_LATER) {
if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
origin = ArcOrigin.getAbsoluteOrigin(origin, getLayoutDirection());
}

Expand Down Expand Up @@ -303,15 +303,14 @@ protected void childMeasureBy(View child, int x, int y) {

}

@SuppressWarnings("NewApi")
protected void childLayoutBy(View child, int x, int y) {
if (Utils.DEBUG) {
Utils.d(TAG, "childLayoutBy: x=%d, y=%d", x, y);
}

final LayoutParams lp = (LayoutParams) child.getLayoutParams();
int origin = lp.origin;
if (Utils.JELLY_BEAN_MR1_OR_LATER) {
if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
origin = ArcOrigin.getAbsoluteOrigin(origin, getLayoutDirection());
}

Expand Down
7 changes: 0 additions & 7 deletions library/src/main/java/com/ogaclejapan/arclayout/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,13 @@
*/
package com.ogaclejapan.arclayout;

import android.os.Build;
import android.util.Log;
import android.view.View;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static android.os.Build.VERSION_CODES.LOLLIPOP;

class Utils {

static final boolean DEBUG = false; //Set to true only when developing

static final boolean JELLY_BEAN_MR1_OR_LATER = Build.VERSION.SDK_INT >= JELLY_BEAN_MR1;
static final boolean LOLLIPOP_OR_LATER = Build.VERSION.SDK_INT >= LOLLIPOP;

private Utils() {}

static void d(String tag, String format, Object... args) {
Expand Down

0 comments on commit 3df5565

Please sign in to comment.