Skip to content

Commit

Permalink
add small gradient to bar chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Sep 29, 2024
1 parent e632a2d commit 298bbfa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.LinearGradient
import android.graphics.Paint
import android.graphics.Path
import android.graphics.RectF
import android.graphics.Shader
import android.os.Parcelable
import android.util.AttributeSet
import android.view.MotionEvent
Expand Down Expand Up @@ -339,6 +341,16 @@ class BarChartView @JvmOverloads constructor(
}
}
if (horizontalLegendsSkipCount == 0) horizontalLegendsSkipCount = 1

barPaint.shader = LinearGradient(
0f,
chartHeight,
0f,
chartHeight / 2,
ColorUtils.changeAlpha(barColor, 0.75f),
barColor,
Shader.TileMode.CLAMP,
)
}

private fun drawText(canvas: Canvas, w: Float) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:id="@+id/containerStatisticsDetailContent"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/btnStatisticsDetailToday"
app:layout_constraintBottom_toTopOf="@id/dividerStatisticsDetail"
app:layout_constraintTop_toTopOf="parent">

<com.google.android.material.appbar.AppBarLayout
Expand Down Expand Up @@ -97,6 +97,12 @@

</androidx.coordinatorlayout.widget.CoordinatorLayout>

<View
android:id="@+id/dividerStatisticsDetail"
style="@style/EditScreenDivider"
android:layout_width="match_parent"
app:layout_constraintBottom_toTopOf="@id/btnStatisticsDetailToday" />

<com.google.android.material.button.MaterialButton
android:id="@+id/btnStatisticsDetailPrevious"
style="@style/ContainerRangeButton"
Expand Down

0 comments on commit 298bbfa

Please sign in to comment.