Skip to content

Commit

Permalink
Fix redrawing on top - v0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubNeukirch committed Oct 24, 2018
1 parent 6d60078 commit ce41066
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ Available xml attributes
## Changelog

### 0.5.2
- Improved appearance
- Improved appearance

### 0.5.3
- Fixed redrawing on top
6 changes: 6 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
android:layout_height="match_parent"
tools:context=".MainActivity">

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<pl.jakubneukirch.webchart.WebChartView
android:id="@+id/webChart"
android:padding="10dp"
android:layout_marginTop="50dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
4 changes: 2 additions & 2 deletions webchart/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 3
versionName "0.5.2"
versionCode 4
versionName "0.5.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
14 changes: 9 additions & 5 deletions webchart/src/main/java/pl/jakubneukirch/webchart/WebChartView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ class WebChartView : View {

private fun redraw() {
invalidateData()
canvas.drawPath(scalePath, scalePaint)
canvas.drawPath(webPath, webPaint)
canvas.drawPath(pointsPath, pointsShadowPaint)
canvas.drawPath(pointsPath, pointsPaintFill)
canvas.drawPath(pointsPath, pointsPaintStroke)
with(canvas) {
drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR)
drawPath(scalePath, scalePaint)
drawPath(webPath, webPaint)
drawPath(pointsPath, pointsShadowPaint)
drawPath(pointsPath, pointsPaintFill)
drawPath(pointsPath, pointsPaintStroke)
}
drawText()
invalidate()
}
Expand Down Expand Up @@ -276,6 +279,7 @@ class WebChartView : View {
private fun getCanvasCenter() = Pair(canvasBitmap.width / 2f, canvasBitmap.height / 2f)

override fun onDraw(canvas: Canvas) {
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR)
canvas.drawBitmap(canvasBitmap, bitmapMatrix, bitmapPaint)
}

Expand Down

0 comments on commit ce41066

Please sign in to comment.