diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt b/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt index 8cb7216ffa..4e8b123824 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/revamp/data/repository/ModelRepository.kt @@ -8,6 +8,7 @@ import com.example.llama.revamp.data.local.dao.ModelDao import com.example.llama.revamp.data.local.entity.ModelEntity import com.example.llama.revamp.data.model.ModelInfo import com.example.llama.revamp.data.repository.ModelRepository.ImportProgressTracker +import com.example.llama.revamp.monitoring.StorageMetrics import com.example.llama.revamp.util.GgufMetadataReader import com.example.llama.revamp.util.copyWithBuffer import com.example.llama.revamp.util.copyWithChannels @@ -337,7 +338,3 @@ class ModelRepositoryImpl @Inject constructor( } } -data class StorageMetrics( - val usedGB: Float, - val availableGB: Float -) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt b/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt index d3f55b300f..4d1c0b8f61 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/PerformanceMonitor.kt @@ -132,48 +132,3 @@ class PerformanceMonitor(@ApplicationContext private val context: Context) { private const val TEMP_POLLING_INTERVAL = 10000L } } - -/** - * Data class containing memory usage metrics. - */ -data class MemoryMetrics( - val availableMem: Long, - val totalMem: Long, - val percentUsed: Int, - val availableGb: Float, - val totalGb: Float -) - -/** - * Data class containing battery information. - */ -data class BatteryMetrics( - val level: Int, - val isCharging: Boolean -) - -/** - * Warning levels for temperature. - */ -enum class TemperatureWarningLevel { - NORMAL, - MEDIUM, - HIGH -} - -/** - * Data class containing temperature information. - */ -data class TemperatureMetrics( - private val tempCelsiusValue: Float, - val warningLevel: TemperatureWarningLevel -) { - val celsiusDisplay: String - get() = "${tempCelsiusValue.toInt()}°C" - - val fahrenheitDisplay: String - get() = "${(tempCelsiusValue * 9/5 + 32).toInt()}°F" - - fun getDisplay(useFahrenheit: Boolean) = - if (useFahrenheit) fahrenheitDisplay else celsiusDisplay -} diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/SystemMetrics.kt b/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/SystemMetrics.kt new file mode 100644 index 0000000000..b4e4f195ab --- /dev/null +++ b/examples/llama.android/app/src/main/java/com/example/llama/revamp/monitoring/SystemMetrics.kt @@ -0,0 +1,51 @@ +package com.example.llama.revamp.monitoring + +/** + * Data class containing battery information. + */ +data class BatteryMetrics( + val level: Int, + val isCharging: Boolean +) + +/** + * Data class containing memory usage metrics. + */ +data class MemoryMetrics( + val availableMem: Long, + val totalMem: Long, + val percentUsed: Int, + val availableGb: Float, + val totalGb: Float +) + +/** + * Data class containing temperature information. + */ +data class TemperatureMetrics( + private val tempCelsiusValue: Float, + val warningLevel: TemperatureWarningLevel +) { + val celsiusDisplay: String + get() = "${tempCelsiusValue.toInt()}°C" + + val fahrenheitDisplay: String + get() = "${(tempCelsiusValue * 9/5 + 32).toInt()}°F" + + fun getDisplay(useFahrenheit: Boolean) = + if (useFahrenheit) fahrenheitDisplay else celsiusDisplay +} + +enum class TemperatureWarningLevel { + NORMAL, + MEDIUM, + HIGH +} + +/** + * Data class containing storage usage metrics. + */ +data class StorageMetrics( + val usedGB: Float, + val availableGB: Float +) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt b/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt index 2dda5c53de..248753cefe 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/StorageTopBar.kt @@ -18,7 +18,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.example.llama.revamp.data.repository.StorageMetrics +import com.example.llama.revamp.monitoring.StorageMetrics import java.util.Locale @OptIn(ExperimentalMaterial3Api::class) diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt b/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt index fc52c717d9..f870935b7a 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/revamp/ui/scaffold/topbar/TopBarConfig.kt @@ -1,7 +1,7 @@ package com.example.llama.revamp.ui.scaffold.topbar -import com.example.llama.revamp.data.repository.StorageMetrics import com.example.llama.revamp.monitoring.MemoryMetrics +import com.example.llama.revamp.monitoring.StorageMetrics import com.example.llama.revamp.monitoring.TemperatureMetrics /** diff --git a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt b/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt index 3596fbc271..0f42f31956 100644 --- a/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt +++ b/examples/llama.android/app/src/main/java/com/example/llama/revamp/viewmodel/SettingsViewModel.kt @@ -4,10 +4,10 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.example.llama.revamp.data.preferences.UserPreferences import com.example.llama.revamp.data.repository.ModelRepository -import com.example.llama.revamp.data.repository.StorageMetrics import com.example.llama.revamp.monitoring.BatteryMetrics import com.example.llama.revamp.monitoring.MemoryMetrics import com.example.llama.revamp.monitoring.PerformanceMonitor +import com.example.llama.revamp.monitoring.StorageMetrics import com.example.llama.revamp.monitoring.TemperatureMetrics import com.example.llama.revamp.monitoring.TemperatureWarningLevel import dagger.hilt.android.lifecycle.HiltViewModel