Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the graph zooming issue #88

Merged
merged 1 commit into from
Jul 28, 2024
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
15 changes: 0 additions & 15 deletions android/FucksGiven/.gitignore

This file was deleted.

185 changes: 0 additions & 185 deletions android/FucksGiven/gradlew

This file was deleted.

89 changes: 0 additions & 89 deletions android/FucksGiven/gradlew.bat

This file was deleted.

Binary file removed android/app-release.aab
Binary file not shown.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rocks.poopjournal.fucksgiven
import android.app.LocaleConfig
import android.app.LocaleManager
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.os.LocaleList
import androidx.activity.ComponentActivity
Expand All @@ -29,15 +30,16 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
val localeManager = applicationContext
.getSystemService(LocaleManager::class.java)
localeManager.overrideLocaleConfig = LocaleConfig(
LocaleList.forLanguageTags("en-US,de,ur,fr")
)

val overrideLocaleConfig = localeManager.overrideLocaleConfig
val supportedLocales = overrideLocaleConfig?.supportedLocales
if (SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
val localeManager = applicationContext
.getSystemService(LocaleManager::class.java)
localeManager.overrideLocaleConfig = LocaleConfig(
LocaleList.forLanguageTags("en-US,de,ur,fr")
)

val overrideLocaleConfig = localeManager.overrideLocaleConfig
val supportedLocales = overrideLocaleConfig?.supportedLocales
}
val theme = themeSetting.themeFlow.collectAsState()
val useDarkColors = when (theme.value) {
AppTheme.LIGHT -> false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ fun LineChartComposable(
setCircleColor(FuckGreen.toArgb())
setDrawValues(false)
setPinchZoom(false)
setScaleMinima(2f, 2f)

}

val lineData = LineData(dataSet)
Expand All @@ -88,6 +90,7 @@ fun LineChartComposable(
xAxis.typeface = tf



axisRight.valueFormatter = object : ValueFormatter() {
override fun getFormattedValue(value: Float): String {
return value.toInt().toString()
Expand Down Expand Up @@ -142,7 +145,10 @@ fun LineChartComposable(
// chart.axisRight.axisMaximum = 10f
chart.axisRight.isGranularityEnabled = true
chart.notifyDataSetChanged()

chart.fitScreen()
chart.viewPortHandler.setMaximumScaleX(2f);
chart.viewPortHandler.setMaximumScaleY(2f);
chart.isDoubleTapToZoomEnabled = false
chart.invalidate() // Refresh the chart
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ private fun RadioGroupItems(
Spacer(modifier = modifier.width(5.dp))
Text(
text = items.name,
color = MaterialTheme.colorScheme.onSurface,
style = MaterialTheme.typography.bodySmall
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.bodyLarge
)
}
}
Loading
Loading