Skip to content

Commit

Permalink
Removed deprecated public API. Cleaned up deprecation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvasilkov committed Nov 24, 2020
1 parent a659d1f commit e439d20
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 573 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ allprojects {
}
}
}

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,6 @@ public void removeOnStateChangeListener(@NonNull OnStateChangeListener listener)
stateListeners.remove(listener);
}

/**
* @param enabled Whether long press should be enabled or not
* @deprecated In order to enable long clicks you should either set
* {@link View#setOnLongClickListener(View.OnLongClickListener)} or use
* {@link View#setLongClickable(boolean)}.
*/
@SuppressWarnings({ "unused", "WeakerAccess" }) // Public API
@Deprecated
public void setLongPressEnabled(boolean enabled) {
targetView.setLongClickable(true);
}

/**
* Returns settings that can be updated.
* <p>
Expand Down
16 changes: 0 additions & 16 deletions library/src/main/java/com/alexvasilkov/gestures/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -601,22 +601,6 @@ public Settings enableBounds() {
return this;
}

/**
* @param restrict Whether image bounds should be restricted or not
* @return Current settings object for calls chaining
* @deprecated Use {@link #disableBounds()} and {@link #enableBounds()} methods instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
@NonNull
public Settings setRestrictBounds(boolean restrict) {
boundsDisableCount += restrict ? -1 : 1;
if (boundsDisableCount < 0) { // In case someone explicitly used this method during setup
boundsDisableCount = 0;
}
return this;
}

/**
* Duration of animations.
*
Expand Down
109 changes: 0 additions & 109 deletions library/src/main/java/com/alexvasilkov/gestures/StateController.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.alexvasilkov.gestures.internal.MovementBounds;
import com.alexvasilkov.gestures.internal.ZoomBounds;
import com.alexvasilkov.gestures.utils.GravityUtils;
import com.alexvasilkov.gestures.utils.MathUtils;

/**
* Helper class that holds reference to {@link Settings} object and controls some aspects of view
Expand Down Expand Up @@ -324,112 +323,4 @@ public void getMovementArea(@NonNull State state, @NonNull RectF out) {
movBounds.set(state).getExternalBounds(out);
}


/*
* Deprecated methods.
*/

/**
* @return Min zoom level
* @deprecated Use {@link #getMinZoom(State)} instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public float getEffectiveMinZoom() {
return zoomBounds.getMinZoom();
}

/**
* @return Max zoom level
* @deprecated Use {@link #getMaxZoom(State)} instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public float getEffectiveMaxZoom() {
return zoomBounds.getMaxZoom();
}

/**
* @param out Output movement area rectangle
* @param state Current state
* @deprecated User {@link #getMovementArea(State, RectF)} instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public void getEffectiveMovementArea(RectF out, State state) {
getMovementArea(state, out);
}

/**
* @param value Value to be restricted
* @param minValue Min value
* @param maxValue Max value
* @return Restricted value
* @deprecated Use {@link MathUtils#restrict(float, float, float)}.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public static float restrict(float value, float minValue, float maxValue) {
return Math.max(minValue, Math.min(value, maxValue));
}

/**
* @param out Interpolated state (output)
* @param start Start state
* @param end End state
* @param factor Factor
* @deprecated Use {@link MathUtils#interpolate(State, State, State, float)}.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public static void interpolate(State out, State start, State end, float factor) {
MathUtils.interpolate(out, start, end, factor);
}

/**
* @param out Interpolated state (output)
* @param start Start state
* @param startPivotX Pivot point's X coordinate in start state coordinates
* @param startPivotY Pivot point's Y coordinate in start state coordinates
* @param end End state
* @param endPivotX Pivot point's X coordinate in end state coordinates
* @param endPivotY Pivot point's Y coordinate in end state coordinates
* @param factor Factor
* @deprecated Use
* {@link MathUtils#interpolate(State, State, float, float, State, float, float, float)}.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public static void interpolate(State out, State start, float startPivotX, float startPivotY,
State end, float endPivotX, float endPivotY, float factor) {
MathUtils.interpolate(out, start, startPivotX, startPivotY,
end, endPivotX, endPivotY, factor);
}

/**
* @param start Start value
* @param end End value
* @param factor Factor
* @return Interpolated value
* @deprecated Use {@link MathUtils#interpolate(float, float, float)}.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public static float interpolate(float start, float end, float factor) {
return MathUtils.interpolate(start, end, factor);
}

/**
* @param out Interpolated rectangle (output)
* @param start Start rectangle
* @param end End rectangle
* @param factor Factor
* @deprecated Use {@link MathUtils#interpolate(RectF, RectF, RectF, float)},
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public static void interpolate(RectF out, RectF start, RectF end, float factor) {
MathUtils.interpolate(out, start, end, factor);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -385,27 +385,6 @@ private void ensurePositionUpdateListenersRemoved() {
listenersToRemove.clear();
}

/**
* @return Animation duration
* @deprecated Use {@link Settings#getAnimationsDuration()} instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public long getDuration() {
return toController.getSettings().getAnimationsDuration();
}

/**
* @param duration Animation duration
* @deprecated Use {@link Settings#setAnimationsDuration(long)} instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public void setDuration(long duration) {
toController.getSettings().setAnimationsDuration(duration);
}


/**
* @return Target (to) position as set by {@link #setToState(State, float)}.
* Maybe useful to determine real animation position during exit gesture.
Expand All @@ -430,16 +409,6 @@ public float getPosition() {
return position;
}

/**
* @return Current position
* @deprecated Use {@link #getPosition()} method instead.
*/
@SuppressWarnings("unused") // Public API
@Deprecated
public float getPositionState() {
return position;
}

/**
* @return Whether animator is in leaving state. Means that animation direction is
* from final (to) position back to initial (from) position.
Expand Down Expand Up @@ -785,10 +754,13 @@ private float compareAndSetClipBound(float origBound, int viewPos, int visiblePo
}


@SuppressWarnings("deprecation")
private static void getDisplaySize(Context context, Rect rect) {
WindowManager wm = getActivity(context).getWindowManager();
DisplayMetrics metrics = new DisplayMetrics();
if (Build.VERSION.SDK_INT >= 17) {
if (Build.VERSION.SDK_INT >= 30) {
context.getDisplay().getRealMetrics(metrics);
} else if (Build.VERSION.SDK_INT >= 17) {
wm.getDefaultDisplay().getRealMetrics(metrics);
} else {
wm.getDefaultDisplay().getMetrics(metrics);
Expand Down
Loading

0 comments on commit e439d20

Please sign in to comment.