Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("com.google.android.material:material:1.13.0")
implementation(project(":MPChartLib"))
implementation("androidx.window:window:1.5.1")

// Compose BOM
val composeBom = platform("androidx.compose:compose-bom:2025.12.00")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.github.mikephil.charting.utils.ColorTemplate
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.notimportant.DemoBase
import androidx.core.net.toUri
import androidx.window.layout.WindowMetricsCalculator

class HalfPieChartActivity : DemoBase() {
private var chart: PieChart? = null
Expand Down Expand Up @@ -117,15 +118,12 @@ class HalfPieChartActivity : DemoBase() {
}

private fun moveOffScreen() {
val displayMetrics = DisplayMetrics()
windowManager.defaultDisplay.getMetrics(displayMetrics)

val height = displayMetrics.heightPixels
val windowMetrics = WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(this)
val height = windowMetrics.bounds.height()

val offset = (height * 0.65).toInt() /* percent to move */

val rlParams =
chart!!.layoutParams as RelativeLayout.LayoutParams
val rlParams = chart!!.layoutParams as RelativeLayout.LayoutParams
rlParams.setMargins(0, 0, 0, -offset)
chart!!.layoutParams = rlParams
}
Expand Down
Loading