Skip to content

Commit

Permalink
Migrate from object to data object, and bump versions in build gradle…
Browse files Browse the repository at this point in the history
… files
  • Loading branch information
shubhamsinghmutualmobile committed Jul 29, 2023
1 parent 7c8115e commit 5186653
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ local.properties
/.idea/
/.secrets
/.env
/keystore.properties
/keystore/keystore.jks
10 changes: 4 additions & 6 deletions composesensors/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("UnstableApiUsage")

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
Expand All @@ -8,7 +6,7 @@ plugins {

android {
namespace = "com.mutualmobile.composesensors"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 21
Expand All @@ -27,11 +25,11 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
buildFeatures {
compose = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext

sealed class SensorType(val name: String) {
object Accelerometer : SensorType(name = "Accelerometer")
object MagneticField : SensorType(name = "MagneticField")
object Gyroscope : SensorType(name = "Gyroscope")
object Light : SensorType(name = "Light")
object Pressure : SensorType(name = "Pressure")
object Proximity : SensorType(name = "Proximity")
object Gravity : SensorType(name = "Gravity")
object LinearAcceleration : SensorType(name = "LinearAcceleration")
object RotationVector : SensorType(name = "RotationVector")
object RelativeHumidity : SensorType(name = "RelativeHumidity")
object AmbientTemperature : SensorType(name = "AmbientTemperature")
object MagneticFieldUncalibrated : SensorType(name = "MagneticFieldUncalibrated")
object GameRotationVector : SensorType(name = "GameRotationVector")
object GyroscopeUncalibrated : SensorType(name = "GyroscopeUncalibrated")
object SignificantMotion : SensorType(name = "SignificantMotion")
object StepDetector : SensorType(name = "StepDetector")
object StepCounter : SensorType(name = "StepCounter")
object GeomagneticRotationVector : SensorType(name = "GeomagneticRotationVector")
object HeartRate : SensorType(name = "HeartRate")
object Pose6DOF : SensorType(name = "Pose6DOF")
object StationaryDetect : SensorType(name = "StationaryDetect")
object MotionDetect : SensorType(name = "MotionDetect")
object HeartBeat : SensorType(name = "HeartBeat")
object LowLatencyOffBodyDetect : SensorType(name = "LowLatencyOffBodyDetect")
object AccelerometerUncalibrated : SensorType(name = "AccelerometerUncalibrated")
object HingeAngle : SensorType(name = "HingeAngle")
object HeadTracker : SensorType(name = "HeadTracker")
object AccelerometerLimitedAxes : SensorType(name = "AccelerometerLimitedAxes")
object GyroscopeLimitedAxes : SensorType(name = "GyroscopeLimitedAxes")
object AccelerometerLimitedAxesUncalibrated :
data object Accelerometer : SensorType(name = "Accelerometer")
data object MagneticField : SensorType(name = "MagneticField")
data object Gyroscope : SensorType(name = "Gyroscope")
data object Light : SensorType(name = "Light")
data object Pressure : SensorType(name = "Pressure")
data object Proximity : SensorType(name = "Proximity")
data object Gravity : SensorType(name = "Gravity")
data object LinearAcceleration : SensorType(name = "LinearAcceleration")
data object RotationVector : SensorType(name = "RotationVector")
data object RelativeHumidity : SensorType(name = "RelativeHumidity")
data object AmbientTemperature : SensorType(name = "AmbientTemperature")
data object MagneticFieldUncalibrated : SensorType(name = "MagneticFieldUncalibrated")
data object GameRotationVector : SensorType(name = "GameRotationVector")
data object GyroscopeUncalibrated : SensorType(name = "GyroscopeUncalibrated")
data object SignificantMotion : SensorType(name = "SignificantMotion")
data object StepDetector : SensorType(name = "StepDetector")
data object StepCounter : SensorType(name = "StepCounter")
data object GeomagneticRotationVector : SensorType(name = "GeomagneticRotationVector")
data object HeartRate : SensorType(name = "HeartRate")
data object Pose6DOF : SensorType(name = "Pose6DOF")
data object StationaryDetect : SensorType(name = "StationaryDetect")
data object MotionDetect : SensorType(name = "MotionDetect")
data object HeartBeat : SensorType(name = "HeartBeat")
data object LowLatencyOffBodyDetect : SensorType(name = "LowLatencyOffBodyDetect")
data object AccelerometerUncalibrated : SensorType(name = "AccelerometerUncalibrated")
data object HingeAngle : SensorType(name = "HingeAngle")
data object HeadTracker : SensorType(name = "HeadTracker")
data object AccelerometerLimitedAxes : SensorType(name = "AccelerometerLimitedAxes")
data object GyroscopeLimitedAxes : SensorType(name = "GyroscopeLimitedAxes")
data object AccelerometerLimitedAxesUncalibrated :
SensorType(name = "AccelerometerLimitedAxesUncalibrated")

object GyroscopeLimitedAxesUncalibrated : SensorType(name = "GyroscopeLimitedAxesUncalibrated")
object Heading : SensorType(name = "Heading")
data object GyroscopeLimitedAxesUncalibrated : SensorType(name = "GyroscopeLimitedAxesUncalibrated")
data object Heading : SensorType(name = "Heading")

fun toAndroidSensorType(): Int {
return when (this) {
Expand Down Expand Up @@ -123,5 +123,5 @@ private inline fun <T> checkApi(expectedApi: Int, block: () -> T): T {
private class OldApiException(currentApi: Int, expectedApi: Int) :
Exception(
"The current API ($currentApi) is too low. At least API ($expectedApi) is required to use" +
"this sensor."
" this sensor."
)
28 changes: 21 additions & 7 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:Suppress("UnstableApiUsage")
import java.util.Properties

plugins {
id("com.android.application")
Expand All @@ -7,12 +7,12 @@ plugins {

android {
namespace = "com.mutualmobile.sample"
compileSdk = 33
compileSdk = 34

defaultConfig {
applicationId = "com.mutualmobile.sample"
minSdk = 21
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"

Expand All @@ -22,29 +22,43 @@ android {
}
}

signingConfigs {
create("release") {
// Load keystore
val keystoreProperties = Properties().apply{
load(File("keystore.properties").reader())
}
storeFile = File(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword= keystoreProperties.getProperty("keyPassword")
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packagingOptions {
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
Expand Down
30 changes: 23 additions & 7 deletions wearablesample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,46 +1,62 @@
import java.util.Properties

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

android {
namespace = "com.mutualmobile.wearablesample"
compileSdk = 33
compileSdk = 34

defaultConfig {
applicationId = "com.mutualmobile.wearablesample"
minSdk = 26
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"
vectorDrawables {
useSupportLibrary = true
}
}

signingConfigs {
create("release") {
// Load keystore
val keystoreProperties = Properties().apply{
load(File("keystore.properties").reader())
}
storeFile = File(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword= keystoreProperties.getProperty("keyPassword")
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packagingOptions {
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
Expand Down

0 comments on commit 5186653

Please sign in to comment.