From 9dd7d958e63819a7931a4ca2d2679bae4c3bb9e4 Mon Sep 17 00:00:00 2001 From: Tomek Zebrowski Date: Thu, 16 Nov 2023 13:24:47 +0100 Subject: [PATCH] refactor: Rename vehicle_profile module to profile --- app/build.gradle | 4 ++-- .../{VehicleProfileTest.kt => ProfileTest.kt} | 18 +++++++++--------- .../org/obd/graphs/activity/MainActivity.kt | 8 ++++---- .../org/obd/graphs/activity/StatusPanel.kt | 4 ++-- ...eExportAction.kt => ProfileExportAction.kt} | 6 +++--- ...eImportAction.kt => ProfileImportAction.kt} | 6 +++--- ...tPreference.kt => ProfileListPreference.kt} | 10 +++++----- ...ePreference.kt => ProfileNamePreference.kt} | 8 ++++---- ...tion.kt => ProfileResetPreferenceAction.kt} | 6 +++--- ...ction.kt => ProfileSavePreferenceAction.kt} | 6 +++--- .../preferences/trips/TripsViewAdapter.kt | 4 ++-- app/src/main/res/xml/preferences.xml | 12 ++++++------ automotive/build.gradle | 2 +- datalogger/build.gradle | 2 +- .../obd/graphs/bl/trip/DefaultTripManager.kt | 14 +++++++------- gradle.properties | 2 +- {vehicle_profile => profile}/.gitignore | 0 {vehicle_profile => profile}/build.gradle | 0 .../proguard-rules.pro | 0 .../src/main/AndroidManifest.xml | 0 .../obd/graphs/profile/PreferencesProfile.kt | 6 +++--- .../java/org/obd/graphs/profile/Profile.kt | 4 ++-- .../java/org/obd/graphs/profile/StringExt.kt | 0 screen_renderer/build.gradle | 2 +- .../org/obd/graphs/renderer/AbstractDrawer.kt | 4 ++-- settings.gradle | 2 +- 26 files changed, 65 insertions(+), 65 deletions(-) rename app/src/androidTest/java/org/obd/graphs/{VehicleProfileTest.kt => ProfileTest.kt} (89%) rename app/src/main/java/org/obd/graphs/preferences/profile/{VehicleProfileExportAction.kt => ProfileExportAction.kt} (90%) rename app/src/main/java/org/obd/graphs/preferences/profile/{VehicleProfileImportAction.kt => ProfileImportAction.kt} (90%) rename app/src/main/java/org/obd/graphs/preferences/profile/{VehicleProfileListPreference.kt => ProfileListPreference.kt} (89%) rename app/src/main/java/org/obd/graphs/preferences/profile/{VehicleProfileNamePreference.kt => ProfileNamePreference.kt} (87%) rename app/src/main/java/org/obd/graphs/preferences/profile/{VehicleProfileResetPreferenceAction.kt => ProfileResetPreferenceAction.kt} (91%) rename app/src/main/java/org/obd/graphs/preferences/profile/{VehicleProfileSavePreferenceAction.kt => ProfileSavePreferenceAction.kt} (89%) rename {vehicle_profile => profile}/.gitignore (100%) rename {vehicle_profile => profile}/build.gradle (100%) rename {vehicle_profile => profile}/proguard-rules.pro (100%) rename {vehicle_profile => profile}/src/main/AndroidManifest.xml (100%) rename vehicle_profile/src/main/java/org/obd/graphs/profile/InPreferencesVehicleProfile.kt => profile/src/main/java/org/obd/graphs/profile/PreferencesProfile.kt (98%) rename vehicle_profile/src/main/java/org/obd/graphs/profile/VehicleProfile.kt => profile/src/main/java/org/obd/graphs/profile/Profile.kt (83%) rename {vehicle_profile => profile}/src/main/java/org/obd/graphs/profile/StringExt.kt (100%) diff --git a/app/build.gradle b/app/build.gradle index c6612ef2..6ffbea4e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -65,7 +65,7 @@ android { dimension "version" resValue "string", "DEFAULT_PROFILE", "profile_8" applicationId "org.obd.graphs.my.giulia.performance_monitor" - versionCode 33 + versionCode 34 } giulia { @@ -134,7 +134,7 @@ dependencies { implementation project(':screen_renderer') implementation project(":datalogger") implementation project(":common") - implementation project(":vehicle_profile") + implementation project(':profile') debugImplementation project(":automotive") releaseImplementation project(":automotive") diff --git a/app/src/androidTest/java/org/obd/graphs/VehicleProfileTest.kt b/app/src/androidTest/java/org/obd/graphs/ProfileTest.kt similarity index 89% rename from app/src/androidTest/java/org/obd/graphs/VehicleProfileTest.kt rename to app/src/androidTest/java/org/obd/graphs/ProfileTest.kt index f0d42e85..0270d848 100644 --- a/app/src/androidTest/java/org/obd/graphs/VehicleProfileTest.kt +++ b/app/src/androidTest/java/org/obd/graphs/ProfileTest.kt @@ -31,10 +31,10 @@ import org.junit.runner.RunWith import org.obd.graphs.activity.MainActivity import org.obd.graphs.preferences.Prefs import org.obd.graphs.preferences.updateBoolean -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile @RunWith(AndroidJUnit4ClassRunner::class) -class VehicleProfileTest { +class ProfileTest { @Test fun resetProfileTest() { @@ -42,7 +42,7 @@ class VehicleProfileTest { launchActivity().use { // lets use this profiles as default - vehicleProfile.loadProfile("profile_5") + profile.loadProfile("profile_5") val propName = "pref.adapter.batch.enabled" assertEquals(Prefs.getBoolean(propName, true), true) @@ -52,7 +52,7 @@ class VehicleProfileTest { assertEquals(Prefs.getBoolean(propName, false), false) // resetting profiles - vehicleProfile.reset() + profile.reset() assertEquals(Prefs.getBoolean(propName, true), true) } } @@ -72,7 +72,7 @@ class VehicleProfileTest { assertTrue(Prefs.getBoolean(setupProfilesKey, true)) Prefs.updateBoolean(setupProfilesKey, false) - vehicleProfile.setupProfiles() + profile.setupProfiles() assertTrue(Prefs.getBoolean(setupProfilesKey, true)) @@ -85,7 +85,7 @@ class VehicleProfileTest { launchActivity().use { val expected = getExpectedProfileList() - val given = vehicleProfile.getAvailableProfiles() + val given = profile.getAvailableProfiles() assertTrue("Default profiles does not match", expected == given) } @@ -93,16 +93,16 @@ class VehicleProfileTest { private fun assertProfilesExists() { val expected = getExpectedProfileList() - val given = vehicleProfile.getAvailableProfiles() + val given = profile.getAvailableProfiles() Log.e("assertProfilesExists", "Given profiles: $given") Log.e("assertProfilesExists", "Expected profiles: $expected") assertTrue("Default profiles does not match", expected == given) given.forEach { - vehicleProfile.loadProfile(it.key) + profile.loadProfile(it.key) - assertTrue("Loaded profiles does not match", vehicleProfile.getCurrentProfile() == it.key) + assertTrue("Loaded profiles does not match", profile.getCurrentProfile() == it.key) val txt = if (it.value!!.startsWith("Profile")) it.value!! else "Profile ${it.value}" diff --git a/app/src/main/java/org/obd/graphs/activity/MainActivity.kt b/app/src/main/java/org/obd/graphs/activity/MainActivity.kt index 4c0e6f52..4003ebea 100644 --- a/app/src/main/java/org/obd/graphs/activity/MainActivity.kt +++ b/app/src/main/java/org/obd/graphs/activity/MainActivity.kt @@ -37,7 +37,7 @@ import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.floatingactionbutton.FloatingActionButton import org.obd.graphs.* import org.obd.graphs.preferences.* -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile import pub.devrel.easypermissions.AppSettingsDialog import pub.devrel.easypermissions.EasyPermissions @@ -201,13 +201,13 @@ class MainActivity : AppCompatActivity(), EasyPermissions.PermissionCallbacks { } private fun setupVehicleProfiles() { - vehicleProfile.init( + profile.init( versionCode = BuildConfig.VERSION_CODE, defaultProfile = resources.getString(R.string.DEFAULT_PROFILE), versionName = BuildConfig.VERSION_NAME ) - Prefs.registerOnSharedPreferenceChangeListener(vehicleProfile) - vehicleProfile.setupProfiles(forceOverrideRecommendation = false) + Prefs.registerOnSharedPreferenceChangeListener(profile) + profile.setupProfiles(forceOverrideRecommendation = false) } } diff --git a/app/src/main/java/org/obd/graphs/activity/StatusPanel.kt b/app/src/main/java/org/obd/graphs/activity/StatusPanel.kt index 017c65f3..3c7ea81b 100644 --- a/app/src/main/java/org/obd/graphs/activity/StatusPanel.kt +++ b/app/src/main/java/org/obd/graphs/activity/StatusPanel.kt @@ -23,7 +23,7 @@ import android.widget.ImageView import android.widget.TextView import org.obd.graphs.R import org.obd.graphs.bl.datalogger.dataLoggerPreferences -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile import org.obd.graphs.sendBroadcastEvent import org.obd.graphs.ui.common.COLOR_PHILIPPINE_GREEN import org.obd.graphs.ui.common.COLOR_RAINBOW_INDIGO @@ -68,7 +68,7 @@ internal fun MainActivity.updateVehicleProfile() { updateTextField( R.id.vehicle_profile, resources.getString(R.string.vehicle_profile), - vehicleProfile.getCurrentProfileName(), + profile.getCurrentProfileName(), COLOR_RAINBOW_INDIGO, 1.0f ) diff --git a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileExportAction.kt b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileExportAction.kt similarity index 90% rename from app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileExportAction.kt rename to app/src/main/java/org/obd/graphs/preferences/profile/ProfileExportAction.kt index 02188f93..368ad09e 100644 --- a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileExportAction.kt +++ b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileExportAction.kt @@ -21,16 +21,16 @@ package org.obd.graphs.preferences.profile import android.content.Context import android.util.AttributeSet import androidx.preference.Preference -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile -class VehicleProfileExportAction( +class ProfileExportAction( context: Context, attrs: AttributeSet? ) : Preference(context, attrs) { init { setOnPreferenceClickListener { - vehicleProfile.exportBackup() + profile.exportBackup() true } } diff --git a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileImportAction.kt b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileImportAction.kt similarity index 90% rename from app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileImportAction.kt rename to app/src/main/java/org/obd/graphs/preferences/profile/ProfileImportAction.kt index 7ceefd92..4f7b2308 100644 --- a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileImportAction.kt +++ b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileImportAction.kt @@ -21,16 +21,16 @@ package org.obd.graphs.preferences.profile import android.content.Context import android.util.AttributeSet import androidx.preference.Preference -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile -class VehicleProfileImportAction( +class ProfileImportAction( context: Context, attrs: AttributeSet? ) : Preference(context, attrs) { init { setOnPreferenceClickListener { - vehicleProfile.importBackup() + profile.importBackup() true } } diff --git a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileListPreference.kt b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileListPreference.kt similarity index 89% rename from app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileListPreference.kt rename to app/src/main/java/org/obd/graphs/preferences/profile/ProfileListPreference.kt index fbbb20d2..6a7aa17b 100644 --- a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileListPreference.kt +++ b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileListPreference.kt @@ -25,18 +25,18 @@ import androidx.preference.ListPreference import androidx.preference.Preference.OnPreferenceChangeListener import org.obd.graphs.activity.navigateToPreferencesScreen import org.obd.graphs.profile.PROFILES_PREF -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile import org.obd.graphs.ui.common.COLOR_PHILIPPINE_GREEN import org.obd.graphs.ui.common.colorize -class VehicleProfileListPreference( +class ProfileListPreference( context: Context, attrs: AttributeSet? ) : ListPreference(context, attrs) { init { - vehicleProfile.getAvailableProfiles() + profile.getAvailableProfiles() .let { entries = it.values.toTypedArray() entryValues = it.keys.toTypedArray() @@ -47,8 +47,8 @@ class VehicleProfileListPreference( onPreferenceChangeListener = OnPreferenceChangeListener { _, newValue -> - vehicleProfile.saveCurrentProfile() - vehicleProfile.loadProfile(newValue.toString()) + profile.saveCurrentProfile() + profile.loadProfile(newValue.toString()) navigateToPreferencesScreen(PROFILES_PREF) true } diff --git a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileNamePreference.kt b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileNamePreference.kt similarity index 87% rename from app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileNamePreference.kt rename to app/src/main/java/org/obd/graphs/preferences/profile/ProfileNamePreference.kt index a42fc388..39d8e257 100644 --- a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileNamePreference.kt +++ b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileNamePreference.kt @@ -25,9 +25,9 @@ import androidx.preference.EditTextPreference import androidx.preference.Preference.OnPreferenceChangeListener import org.obd.graphs.activity.navigateToPreferencesScreen import org.obd.graphs.profile.PROFILES_PREF -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile -class VehicleProfileNamePreference( +class ProfileNamePreference( context: Context, attrs: AttributeSet? ): @@ -35,9 +35,9 @@ class VehicleProfileNamePreference( init { onPreferenceChangeListener = OnPreferenceChangeListener { _, newValue -> - Log.d("VehicleProfileNamePreference", "Updating profile value: ${vehicleProfile.getCurrentProfile()}=$newValue") + Log.d("VehicleProfileNamePreference", "Updating profile value: ${profile.getCurrentProfile()}=$newValue") - vehicleProfile.updateCurrentProfileName(newName = newValue.toString()) + profile.updateCurrentProfileName(newName = newValue.toString()) navigateToPreferencesScreen(PROFILES_PREF) true diff --git a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileResetPreferenceAction.kt b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileResetPreferenceAction.kt similarity index 91% rename from app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileResetPreferenceAction.kt rename to app/src/main/java/org/obd/graphs/preferences/profile/ProfileResetPreferenceAction.kt index e281b183..88b538d5 100644 --- a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileResetPreferenceAction.kt +++ b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileResetPreferenceAction.kt @@ -22,16 +22,16 @@ import android.content.Context import android.util.AttributeSet import androidx.preference.Preference import org.obd.graphs.activity.navigateToPreferencesScreen -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile -class VehicleProfileResetPreferenceAction( +class ProfileResetPreferenceAction( context: Context, attrs: AttributeSet? ) : Preference(context, attrs) { init { setOnPreferenceClickListener { - vehicleProfile.reset() + profile.reset() navigateToPreferencesScreen("pref.profiles") true } diff --git a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileSavePreferenceAction.kt b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileSavePreferenceAction.kt similarity index 89% rename from app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileSavePreferenceAction.kt rename to app/src/main/java/org/obd/graphs/preferences/profile/ProfileSavePreferenceAction.kt index 9fe7fd29..98004d99 100644 --- a/app/src/main/java/org/obd/graphs/preferences/profile/VehicleProfileSavePreferenceAction.kt +++ b/app/src/main/java/org/obd/graphs/preferences/profile/ProfileSavePreferenceAction.kt @@ -21,16 +21,16 @@ package org.obd.graphs.preferences.profile import android.content.Context import android.util.AttributeSet import androidx.preference.Preference -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile -class VehicleProfileSavePreferenceAction( +class ProfileSavePreferenceAction( context: Context, attrs: AttributeSet? ) : Preference(context, attrs) { init { setOnPreferenceClickListener { - vehicleProfile.saveCurrentProfile() + profile.saveCurrentProfile() true } } diff --git a/app/src/main/java/org/obd/graphs/preferences/trips/TripsViewAdapter.kt b/app/src/main/java/org/obd/graphs/preferences/trips/TripsViewAdapter.kt index 53049542..ca6f7169 100644 --- a/app/src/main/java/org/obd/graphs/preferences/trips/TripsViewAdapter.kt +++ b/app/src/main/java/org/obd/graphs/preferences/trips/TripsViewAdapter.kt @@ -32,7 +32,7 @@ import androidx.recyclerview.widget.RecyclerView import org.obd.graphs.* import org.obd.graphs.bl.trip.TripFileDesc import org.obd.graphs.bl.trip.tripManager -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile import org.obd.graphs.ui.common.Colors import org.obd.graphs.ui.common.setText import java.text.SimpleDateFormat @@ -51,7 +51,7 @@ class TripsViewAdapter internal constructor( private val profileColors = mutableMapOf().apply { val colors = Colors().generate() - vehicleProfile.getAvailableProfiles().forEach { (s, _) -> + profile.getAvailableProfiles().forEach { (s, _) -> put(s, colors.nextInt()) } } diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 41df6bcd..5b3ad759 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -339,22 +339,22 @@ android:title="@string/pref.settings" app:singleLineTitle="false"> - - - - - - MIN_TRIP_LENGTH) { val tripStartTs = trip.startTs - val filter = "$TRIP_FILE_PREFIX-${vehicleProfile.getCurrentProfile()}-${tripStartTs}" + val filter = "$TRIP_FILE_PREFIX-${profile.getCurrentProfile()}-${tripStartTs}" val alreadySaved = findAllTripsBy(filter) if (alreadySaved.isNotEmpty()) { @@ -139,7 +139,7 @@ internal class DefaultTripManager : TripManager { tripModelSerializer.serializer.writeValueAsString(trip) val fileName = - "$TRIP_FILE_PREFIX-${vehicleProfile.getCurrentProfile()}-${tripStartTs}-${tripLength}.json" + "$TRIP_FILE_PREFIX-${profile.getCurrentProfile()}-${tripStartTs}-${tripLength}.json" Log.i( LOGGER_TAG, "Saving the trip to the file: '$fileName'. Length: ${tripLength}s" @@ -160,9 +160,9 @@ internal class DefaultTripManager : TripManager { } override fun findAllTripsBy(filter: String): MutableCollection { - Log.i(LOGGER_TAG, "Finds all trips by filter: '$filter' and profile=${vehicleProfile.getCurrentProfile()}") + Log.i(LOGGER_TAG, "Finds all trips by filter: '$filter' and profile=${profile.getCurrentProfile()}") - val profiles = vehicleProfile.getAvailableProfiles() + val profiles = profile.getAvailableProfiles() val files = File(getTripsDirectory(getContext()!!)).list() if (files == null) { Log.i(LOGGER_TAG, "No files were found in the trips directory.") @@ -172,7 +172,7 @@ internal class DefaultTripManager : TripManager { .filter { if (filter.isNotEmpty()) it.startsWith(filter) else true } .filter { it.startsWith("${TRIP_FILE_PREFIX}_") || it.startsWith("$TRIP_FILE_PREFIX-") } .filter { - it.contains("${vehicleProfile.getCurrentProfile()}-") } + it.contains("${profile.getCurrentProfile()}-") } .filter { try { decodeTripName(it).size > 3 @@ -196,7 +196,7 @@ internal class DefaultTripManager : TripManager { } .sortedByDescending { it.startTime.toLongOrNull() } .toMutableList() - Log.i(LOGGER_TAG, "Found trips by filter: '${filter}' for profile=${vehicleProfile.getCurrentProfile()}. Result size: ${result.size}") + Log.i(LOGGER_TAG, "Found trips by filter: '${filter}' for profile=${profile.getCurrentProfile()}. Result size: ${result.size}") return result } } diff --git a/gradle.properties b/gradle.properties index fbfb3ddd..771bce01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,5 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -obdMetricVersion=9.23.1-SNAPSHOT +obdMetricVersion=9.23.3-SNAPSHOT build_version_code=27 \ No newline at end of file diff --git a/vehicle_profile/.gitignore b/profile/.gitignore similarity index 100% rename from vehicle_profile/.gitignore rename to profile/.gitignore diff --git a/vehicle_profile/build.gradle b/profile/build.gradle similarity index 100% rename from vehicle_profile/build.gradle rename to profile/build.gradle diff --git a/vehicle_profile/proguard-rules.pro b/profile/proguard-rules.pro similarity index 100% rename from vehicle_profile/proguard-rules.pro rename to profile/proguard-rules.pro diff --git a/vehicle_profile/src/main/AndroidManifest.xml b/profile/src/main/AndroidManifest.xml similarity index 100% rename from vehicle_profile/src/main/AndroidManifest.xml rename to profile/src/main/AndroidManifest.xml diff --git a/vehicle_profile/src/main/java/org/obd/graphs/profile/InPreferencesVehicleProfile.kt b/profile/src/main/java/org/obd/graphs/profile/PreferencesProfile.kt similarity index 98% rename from vehicle_profile/src/main/java/org/obd/graphs/profile/InPreferencesVehicleProfile.kt rename to profile/src/main/java/org/obd/graphs/profile/PreferencesProfile.kt index 4a686932..9e755ef8 100644 --- a/vehicle_profile/src/main/java/org/obd/graphs/profile/InPreferencesVehicleProfile.kt +++ b/profile/src/main/java/org/obd/graphs/profile/PreferencesProfile.kt @@ -39,11 +39,11 @@ private const val DEFAULT_MAX_PROFILES = 13 private const val BACKUP_FILE_NAME = "obd_graphs.backup" private const val DEFAULT_PROFILE = "profile_1" -internal class InPreferencesVehicleProfile : VehicleProfile { +internal class PreferencesProfile : Profile { private var versionCode: Int = 0 private var defaultProfile: String? = null - private var versionName: String? = null + private lateinit var versionName: String @Volatile private var bulkActionEnabled = false @@ -146,7 +146,7 @@ internal class InPreferencesVehicleProfile : VehicleProfile { } override fun init(versionCode: Int, defaultProfile: String, versionName: String) { - Log.i(LOG_TAG,"Profile init, versionCode: $versionCode, defaultProfile: $defaultProfile ") + Log.i(LOG_TAG,"Profile init, versionCode: $versionCode, defaultProfile: $defaultProfile, versionName: $versionName") this.versionCode = versionCode this.defaultProfile = defaultProfile this.versionName = versionName diff --git a/vehicle_profile/src/main/java/org/obd/graphs/profile/VehicleProfile.kt b/profile/src/main/java/org/obd/graphs/profile/Profile.kt similarity index 83% rename from vehicle_profile/src/main/java/org/obd/graphs/profile/VehicleProfile.kt rename to profile/src/main/java/org/obd/graphs/profile/Profile.kt index 0044900d..a03eabd0 100644 --- a/vehicle_profile/src/main/java/org/obd/graphs/profile/VehicleProfile.kt +++ b/profile/src/main/java/org/obd/graphs/profile/Profile.kt @@ -7,9 +7,9 @@ const val PROFILE_RESET_EVENT = "data.logger.profile.reset.event" const val PROFILES_PREF = "pref.profiles" const val PROFILE_ID_PREF = "pref.profile.id" -val vehicleProfile: VehicleProfile = InPreferencesVehicleProfile() +val profile: Profile = PreferencesProfile() -interface VehicleProfile : SharedPreferences.OnSharedPreferenceChangeListener { +interface Profile : SharedPreferences.OnSharedPreferenceChangeListener { fun updateCurrentProfileName(newName: String) fun getAvailableProfiles(): Map diff --git a/vehicle_profile/src/main/java/org/obd/graphs/profile/StringExt.kt b/profile/src/main/java/org/obd/graphs/profile/StringExt.kt similarity index 100% rename from vehicle_profile/src/main/java/org/obd/graphs/profile/StringExt.kt rename to profile/src/main/java/org/obd/graphs/profile/StringExt.kt diff --git a/screen_renderer/build.gradle b/screen_renderer/build.gradle index a2d57634..ac29695b 100644 --- a/screen_renderer/build.gradle +++ b/screen_renderer/build.gradle @@ -39,7 +39,7 @@ android { dependencies { implementation project(":common") - implementation project(":vehicle_profile") + implementation project(':profile') implementation project(":datalogger") implementation project(":dragracing") diff --git a/screen_renderer/src/main/java/org/obd/graphs/renderer/AbstractDrawer.kt b/screen_renderer/src/main/java/org/obd/graphs/renderer/AbstractDrawer.kt index b45dfe85..594c2ece 100644 --- a/screen_renderer/src/main/java/org/obd/graphs/renderer/AbstractDrawer.kt +++ b/screen_renderer/src/main/java/org/obd/graphs/renderer/AbstractDrawer.kt @@ -24,7 +24,7 @@ import org.obd.graphs.ValueScaler import org.obd.graphs.bl.datalogger.WorkflowStatus import org.obd.graphs.bl.datalogger.dataLogger import org.obd.graphs.commons.R -import org.obd.graphs.profile.vehicleProfile +import org.obd.graphs.profile.profile import org.obd.graphs.renderer.drag.MARGIN_END internal abstract class AbstractDrawer (context: Context, protected val settings: ScreenSettings) { @@ -171,7 +171,7 @@ internal abstract class AbstractDrawer (context: Context, protected val settings ) marginLeft += getTextWidth(text, statusPaint) + 4F - text = vehicleProfile.getCurrentProfileName() + text = profile.getCurrentProfileName() drawText( canvas, diff --git a/settings.gradle b/settings.gradle index 396aeab3..54093f1e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,7 +9,7 @@ pluginManagement { rootProject.name = "ObdGraphs" include ':common' -include ':vehicle_profile' +include ':profile' include ':datalogger' include ':dragracing' include ':screen_renderer'