22
33import android .animation .ValueAnimator ;
44import android .animation .ValueAnimator .AnimatorUpdateListener ;
5- import android .content .ContentValues ;
65import android .content .Context ;
76import android .graphics .Bitmap ;
8- import android .graphics .Bitmap .CompressFormat ;
97import android .graphics .Canvas ;
108import android .graphics .Color ;
119import android .graphics .Paint ;
1210import android .graphics .Paint .Align ;
1311import android .graphics .RectF ;
1412import android .graphics .Typeface ;
1513import android .graphics .drawable .Drawable ;
16- import android .os .Environment ;
17- import android .provider .MediaStore .Images ;
1814import android .text .TextUtils ;
1915import android .util .AttributeSet ;
2016import android .util .Log ;
4844import com .github .mikephil .charting .utils .Utils ;
4945import com .github .mikephil .charting .utils .ViewPortHandler ;
5046
51- import java .io .File ;
52- import java .io .FileOutputStream ;
53- import java .io .IOException ;
54- import java .io .OutputStream ;
5547import java .util .ArrayList ;
5648import java .util .Collections ;
5749import java .util .List ;
5850
51+ import androidx .annotation .NonNull ;
52+
5953/**
6054 * Baseclass of all Chart-Views.
6155 *
@@ -210,13 +204,9 @@ protected void init() {
210204 setWillNotDraw (false );
211205 // setLayerType(View.LAYER_TYPE_HARDWARE, null);
212206
213- mAnimator = new ChartAnimator (new AnimatorUpdateListener () {
214-
215- @ Override
216- public void onAnimationUpdate (ValueAnimator animation ) {
217- // ViewCompat.postInvalidateOnAnimation(Chart.this);
218- postInvalidate ();
219- }
207+ mAnimator = new ChartAnimator (animation -> {
208+ // ViewCompat.postInvalidateOnAnimation(Chart.this);
209+ postInvalidate ();
220210 });
221211
222212 // initialize the utils
@@ -387,7 +377,7 @@ protected void setupDefaultFormatter(float min, float max) {
387377 private boolean mOffsetsCalculated = false ;
388378
389379 @ Override
390- protected void onDraw (Canvas canvas ) {
380+ protected void onDraw (@ NonNull Canvas canvas ) {
391381 // super.onDraw(canvas);
392382
393383 if (mData == null ) {
@@ -404,7 +394,7 @@ protected void onDraw(Canvas canvas) {
404394 break ;
405395
406396 case RIGHT :
407- pt .x *= 2.0 ;
397+ pt .x *= 2.0F ;
408398 canvas .drawText (mNoDataText , pt .x , pt .y , mInfoPaint );
409399 break ;
410400
@@ -1289,14 +1279,12 @@ public void setPaint(Paint p, int which) {
12891279 * @param which e.g. Chart.PAINT_LEGEND_LABEL
12901280 */
12911281 public Paint getPaint (int which ) {
1292- switch (which ) {
1293- case PAINT_INFO :
1294- return mInfoPaint ;
1295- case PAINT_DESCRIPTION :
1296- return mDescPaint ;
1297- }
1282+ return switch (which ) {
1283+ case PAINT_INFO -> mInfoPaint ;
1284+ case PAINT_DESCRIPTION -> mDescPaint ;
1285+ default -> null ;
1286+ };
12981287
1299- return null ;
13001288 }
13011289
13021290 @ Deprecated
0 commit comments