Skip to content

Commit 4a96a6a

Browse files
authored
Merge pull request #671 from AppDevNext/Cosmetic
Cosmetic
2 parents 5ba2573 + aed0d3e commit 4a96a6a

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

app/src/main/kotlin/info/appdev/chartexample/CombinedChartActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class CombinedChartActivity : DemoBase() {
4949
binding.chart1.setDrawGridBackground(false)
5050
binding.chart1.isDrawBarShadow = false
5151
binding.chart1.isHighlightFullBar = false
52+
binding.chart1.isLogging = true
5253

5354
// draw bars behind lines
5455
binding.chart1.drawOrder = mutableListOf(

chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import android.util.AttributeSet
1515
import android.view.View
1616
import android.view.ViewGroup
1717
import android.view.accessibility.AccessibilityEvent
18+
import androidx.core.graphics.createBitmap
1819
import info.appdev.charting.animation.ChartAnimator
1920
import info.appdev.charting.animation.Easing.EasingFunction
2021
import info.appdev.charting.components.Description
@@ -1058,23 +1059,20 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
10581059
*/
10591060
get() = this.center
10601061

1062+
/**
1063+
* Returns the bitmap that represents the chart.
1064+
*/
10611065
val chartBitmap: Bitmap
1062-
/**
1063-
* Returns the bitmap that represents the chart.
1064-
*/
10651066
get() {
10661067
// Define a bitmap with the same size as the view
1067-
val returnedBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565)
1068+
val returnedBitmap = createBitmap(width, height, Bitmap.Config.RGB_565)
10681069
// Bind a canvas to it
10691070
val canvas = Canvas(returnedBitmap)
10701071
// Get the view's background
10711072
val bgDrawable = background
1072-
if (bgDrawable != null) // has background drawable, then draw it on the canvas
1073-
{
1073+
if (bgDrawable != null) { // has background drawable, then draw it on the canvas
10741074
bgDrawable.draw(canvas)
1075-
} else // does not have background drawable, then draw white background on
1076-
// the canvas
1077-
{
1075+
} else { // does not have background drawable, then draw white background on the canvas
10781076
canvas.drawColor(Color.WHITE)
10791077
}
10801078
// draw the view on the canvas
@@ -1132,11 +1130,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
11321130
}
11331131

11341132
/**
1135-
* Returns all jobs that are scheduled to be executed after
1136-
* onSizeChanged(...).
1137-
*/
1138-
/**
1139-
* tasks to be done after the view is setup
1133+
* Returns all jobs that are scheduled to be executed after onSizeChanged(...).
11401134
*/
11411135
var jobs: ArrayList<Runnable> = ArrayList()
11421136
protected set
@@ -1259,7 +1253,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
12591253

12601254
// region accessibility
12611255
/**
1262-
*
12631256
* @return accessibility description must be created for each chart
12641257
*/
12651258
abstract val accessibilityDescription: String?
@@ -1285,8 +1278,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>> : ViewGroup, IBaseP
12851278
const val PAINT_GRID_BACKGROUND: Int = 4
12861279

12871280
/**
1288-
* paint for the info text that is displayed when there are no values in the
1289-
* chart
1281+
* paint for the info text that is displayed when there are no values in the 3chart
12901282
*/
12911283
const val PAINT_INFO: Int = 7
12921284

chartLib/src/main/kotlin/info/appdev/charting/highlight/Highlight.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,6 @@ class Highlight : Serializable {
144144
}
145145

146146
override fun toString(): String {
147-
return "Highlight, x:$x y:$y dataSetIndex:$dataSetIndex stackIndex (only stacked bar entry): $stackIndex"
147+
return "Highlight, x:$x y:$y dataSetIndex:$dataSetIndex stackIndex:$stackIndex (only stacked bar entry)"
148148
}
149149
}

chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ class BarLineChartTouchListener(
533533
return false
534534
}
535535

536-
val h = chart.getHighlightByTouchPoint(e.x, e.y)
537-
performHighlight(h)
536+
val highlight = chart.getHighlightByTouchPoint(e.x, e.y)
537+
performHighlight(highlight)
538538

539539
return super.onSingleTapUp(e)
540540
}

0 commit comments

Comments
 (0)