@@ -39,26 +39,30 @@ public abstract class Utils {
3939 *
4040 * @param res
4141 */
42+ @ SuppressWarnings ("deprecation" )
4243 public static void init (Context context ) {
4344
4445 if (context == null ) {
45- //noinspection deprecation
46+ // noinspection deprecation
4647 mMinimumFlingVelocity = ViewConfiguration .getMinimumFlingVelocity ();
47- //noinspection deprecation
48+ // noinspection deprecation
4849 mMaximumFlingVelocity = ViewConfiguration .getMaximumFlingVelocity ();
50+
51+ Log .e ("MPAndroidChart, Utils.init(...)" , "PROVIDED CONTEXT OBJECT IS NULL" );
52+
4953 } else {
5054 ViewConfiguration viewConfiguration = ViewConfiguration .get (context );
5155 mMinimumFlingVelocity = viewConfiguration .getScaledMinimumFlingVelocity ();
5256 mMaximumFlingVelocity = viewConfiguration .getScaledMaximumFlingVelocity ();
57+
58+ Resources res = context .getResources ();
59+ mMetrics = res .getDisplayMetrics ();
5360 }
54-
55- Resources res = context .getResources ();
56- mMetrics = res .getDisplayMetrics ();
5761 }
5862
5963 /**
60- * initialize method, called inside the Chart.init() method.
61- * backwards compatibility - to not break existing code
64+ * initialize method, called inside the Chart.init() method. backwards
65+ * compatibility - to not break existing code
6266 *
6367 * @param res
6468 */
@@ -67,9 +71,9 @@ public static void init(Resources res) {
6771
6872 mMetrics = res .getDisplayMetrics ();
6973
70- //noinspection deprecation
74+ // noinspection deprecation
7175 mMinimumFlingVelocity = ViewConfiguration .getMinimumFlingVelocity ();
72- //noinspection deprecation
76+ // noinspection deprecation
7377 mMaximumFlingVelocity = ViewConfiguration .getMaximumFlingVelocity ();
7478 }
7579
@@ -471,7 +475,8 @@ public static PointF getPosition(PointF center, float dist, float angle) {
471475 return p ;
472476 }
473477
474- public static void velocityTrackerPointerUpCleanUpIfNecessary (MotionEvent ev , VelocityTracker tracker ) {
478+ public static void velocityTrackerPointerUpCleanUpIfNecessary (MotionEvent ev ,
479+ VelocityTracker tracker ) {
475480
476481 // Check the dot product of current velocities.
477482 // If the pointer that left was opposing another velocity vector, clear.
@@ -481,7 +486,8 @@ public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev, Ve
481486 final float x1 = tracker .getXVelocity (id1 );
482487 final float y1 = tracker .getYVelocity (id1 );
483488 for (int i = 0 , count = ev .getPointerCount (); i < count ; i ++) {
484- if (i == upIndex ) continue ;
489+ if (i == upIndex )
490+ continue ;
485491
486492 final int id2 = ev .getPointerId (i );
487493 final float x = x1 * tracker .getXVelocity (id2 );
@@ -496,8 +502,8 @@ public static void velocityTrackerPointerUpCleanUpIfNecessary(MotionEvent ev, Ve
496502 }
497503
498504 /**
499- * Original method view.postInvalidateOnAnimation() only supportd in API >= 16,
500- * This is a replica of the code from ViewCompat.
505+ * Original method view.postInvalidateOnAnimation() only supportd in API >=
506+ * 16, This is a replica of the code from ViewCompat.
501507 *
502508 * @param view
503509 */
0 commit comments