mirror of
https://github.com/dzeiocom/OpenHealth.git
synced 2025-06-07 07:19:54 +00:00
feat: Integrate the Custom Lib
This commit is contained in:
parent
1f72b68a13
commit
04911dcd23
@ -97,6 +97,9 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// Dzeio Charts
|
||||||
|
implementation project(path: ":charts")
|
||||||
|
|
||||||
// Core dependencies
|
// Core dependencies
|
||||||
implementation 'androidx.core:core-ktx:1.8.0'
|
implementation 'androidx.core:core-ktx:1.8.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||||
@ -135,6 +138,9 @@ dependencies {
|
|||||||
// Graph
|
// Graph
|
||||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||||
|
|
||||||
|
// Graphs test 2
|
||||||
|
implementation 'com.github.HackPlan:AndroidCharts:1.0.4'
|
||||||
|
|
||||||
// Hilt
|
// Hilt
|
||||||
implementation 'com.google.dagger:hilt-android:2.42'
|
implementation 'com.google.dagger:hilt-android:2.42'
|
||||||
kapt 'com.google.dagger:hilt-compiler:2.42'
|
kapt 'com.google.dagger:hilt-compiler:2.42'
|
||||||
|
@ -41,7 +41,6 @@ class OpenHealthService : Service() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private var mNM: NotificationManager? = null
|
private var mNM: NotificationManager? = null
|
||||||
private lateinit var notification: Notification
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displayed steps in the notification panel
|
* Displayed steps in the notification panel
|
||||||
@ -63,9 +62,7 @@ class OpenHealthService : Service() {
|
|||||||
mNM = getSystemService(NOTIFICATION_SERVICE) as NotificationManager?
|
mNM = getSystemService(NOTIFICATION_SERVICE) as NotificationManager?
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
Log.i("LocalService", "Received start id $startId: $intent")
|
|
||||||
|
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val source = StepSource(this@OpenHealthService)
|
val source = StepSource(this@OpenHealthService)
|
||||||
source.events.receiveAsFlow().collectLatest {
|
source.events.receiveAsFlow().collectLatest {
|
||||||
@ -130,7 +127,7 @@ class OpenHealthService : Service() {
|
|||||||
.getPendingIntent(0, flag)
|
.getPendingIntent(0, flag)
|
||||||
|
|
||||||
// Set the info for the views that show in the notification panel.
|
// Set the info for the views that show in the notification panel.
|
||||||
this.notification = NotificationCompat.Builder(
|
val notification = NotificationCompat.Builder(
|
||||||
this,
|
this,
|
||||||
NotificationChannels.SERVICE.id
|
NotificationChannels.SERVICE.id
|
||||||
)
|
)
|
||||||
|
@ -8,11 +8,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import com.dzeio.openhealth.adapters.StepsAdapter
|
import com.dzeio.openhealth.adapters.StepsAdapter
|
||||||
import com.dzeio.openhealth.core.BaseFragment
|
import com.dzeio.openhealth.core.BaseFragment
|
||||||
import com.dzeio.openhealth.databinding.FragmentStepsHomeBinding
|
import com.dzeio.openhealth.databinding.FragmentStepsHomeBinding
|
||||||
import com.dzeio.openhealth.utils.GraphUtils
|
|
||||||
import com.github.mikephil.charting.data.BarData
|
|
||||||
import com.github.mikephil.charting.data.BarDataSet
|
|
||||||
import com.github.mikephil.charting.data.BarEntry
|
|
||||||
import com.google.android.material.color.MaterialColors
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
@ -44,35 +39,21 @@ class StepsHomeFragment :
|
|||||||
|
|
||||||
val chart = binding.chart
|
val chart = binding.chart
|
||||||
|
|
||||||
GraphUtils.barChartSetup(
|
|
||||||
chart,
|
|
||||||
MaterialColors.getColor(
|
|
||||||
requireView(),
|
|
||||||
com.google.android.material.R.attr.colorPrimary
|
|
||||||
),
|
|
||||||
MaterialColors.getColor(
|
|
||||||
requireView(),
|
|
||||||
com.google.android.material.R.attr.colorOnBackground
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
chart.xAxis.valueFormatter = GraphUtils.DateTimeValueFormatter()
|
|
||||||
|
|
||||||
viewModel.items.observe(viewLifecycleOwner) { list ->
|
viewModel.items.observe(viewLifecycleOwner) { list ->
|
||||||
adapter.set(list)
|
adapter.set(list)
|
||||||
|
|
||||||
val dataset = BarDataSet(
|
val strings = ArrayList<String>()
|
||||||
list.map {
|
val values = ArrayList<Int>()
|
||||||
return@map BarEntry(
|
|
||||||
(it.timestamp).toFloat(),
|
|
||||||
it.value.toFloat()
|
|
||||||
)
|
|
||||||
},
|
|
||||||
""
|
|
||||||
)
|
|
||||||
|
|
||||||
chart.data = BarData(dataset)
|
list.forEach {
|
||||||
chart.invalidate()
|
strings.add(it.formatTimestamp())
|
||||||
|
values.add(it.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
chart.setBottomTextList(strings)
|
||||||
|
chart.setDataList(
|
||||||
|
values
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:padding="16dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<view
|
||||||
|
class="com.dzeio.charts.BarView"
|
||||||
<com.github.mikephil.charting.charts.BarChart
|
|
||||||
android:id="@+id/chart"
|
android:id="@+id/chart"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
|
@ -1,26 +1,18 @@
|
|||||||
# Project-wide Gradle settings.
|
## For more details on how to configure your build environment visit
|
||||||
# IDE (e.g. Android Studio) users:
|
|
||||||
# Gradle settings configured through the IDE *will override*
|
|
||||||
# any settings specified in this file.
|
|
||||||
# For more details on how to configure your build environment visit
|
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
#
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
#
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
#Tue Jul 19 18:42:00 CEST 2022
|
||||||
# Android operating system, and which are packaged with your app"s APK
|
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
||||||
android.useAndroidX=true
|
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
|
||||||
kotlin.code.style=official
|
|
||||||
# Enables namespacing of each library's R class so that its R class includes only the
|
|
||||||
# resources declared in the library itself and none from the library's dependencies,
|
|
||||||
# thereby reducing the size of the R class for that library
|
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
kotlin.code.style=official
|
||||||
android.enableJetifier=false
|
android.useAndroidX=true
|
||||||
org.gradle.unsafe.configuration-cache=true
|
android.enableJetifier=true
|
||||||
|
org.gradle.unsafe.configuration-cache=true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user