Skip to content

Commit

Permalink
sampleApp : display deviceInfo in section
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil-musale committed Mar 27, 2024
1 parent 960816a commit 3f38a36
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
4 changes: 2 additions & 2 deletions sampleApp/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ kotlin {
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.material3)
implementation(libs.kDeviceinfo)
// implementation(projects.kDeviceInfo)
// implementation(libs.kDeviceinfo)
implementation(projects.kDeviceInfo)
}

androidMain.dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.devx.kdeviceinfo.sample

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand All @@ -11,7 +14,9 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.devx.kdeviceinfo.DeviceInfoXState
import com.devx.kdeviceinfo.model.android.AndroidInfo
import com.devx.kdeviceinfo.model.ios.IosInfo
Expand Down Expand Up @@ -47,21 +52,32 @@ private fun ShowAndroidDeviceInfo(androidInfo: AndroidInfo) {
val verticalScrollState = rememberScrollState()

Column(modifier = Modifier.verticalScroll(state = verticalScrollState)) {
Text(text = "Language Code : ${androidInfo.locale.languageCode}")
Text(text = "Region : ${androidInfo.locale.region}")
// App Info
Text(text = "App Info", style = TextStyle(fontSize = 20.sp))
Text(text = "App Name : ${androidInfo.appName}")
Text(text = "Version Code : ${androidInfo.versionCode}")
Text(text = "Version Name : ${androidInfo.versionName}")
Text(text = "Package Name : ${androidInfo.packageName}")
Spacer(modifier = Modifier.fillMaxWidth().height(height = 20.dp))

// Device Info
Text(text = "Device Info", style = TextStyle(fontSize = 20.sp))
Text(text = "Device : ${androidInfo.device}")
Text(text = "SdkInt : ${androidInfo.version.sdkInt}")
Text(text = "Release : ${androidInfo.version.release}")
Text(text = "App Name : ${androidInfo.appName}")
Text(text = "Package Name : ${androidInfo.packageName}")
Text(text = "CodeName : ${androidInfo.version.codeName}")
Text(text = "Board : ${androidInfo.board}")
Text(text = "IsPhysicalDevice : ${androidInfo.isPhysicalDevice}")
Text(text = "Manufacturer : ${androidInfo.manufacturer}")
Text(text = "Model : ${androidInfo.model}")
Text(text = "Orientation : ${androidInfo.deviceOrientation.getDeviceOrientation()}")
Spacer(modifier = Modifier.fillMaxWidth().height(height = 20.dp))

// Locale
Text(text = "Locale Info", style = TextStyle(fontSize = 20.sp))
Text(text = "Language Code : ${androidInfo.locale.languageCode}")
Text(text = "Region : ${androidInfo.locale.region}")
Spacer(modifier = Modifier.fillMaxWidth().height(height = 20.dp))
}
}

Expand All @@ -70,18 +86,30 @@ private fun ShowIosDeviceInfo(iosInfo: IosInfo) {
val verticalScrollState = rememberScrollState()

Column(modifier = Modifier.verticalScroll(state = verticalScrollState)) {
Text(text = "Language Code : ${iosInfo.locale.languageCode}")
Text(text = "Region : ${iosInfo.locale.region}")

// App Info
Text(text = "App Info", style = TextStyle(fontSize = 20.sp))
Text(text = "App Name : ${iosInfo.appName}")
Text(text = "Bundle Id : ${iosInfo.bundleId}")
Text(text = "App Version : ${iosInfo.appVersion}")
Text(text = "App Short Version : ${iosInfo.appShortVersion}")
Text(text = "Bundle Id : ${iosInfo.bundleId}")
Spacer(modifier = Modifier.fillMaxWidth().height(height = 20.dp))

// Device Info
Text(text = "Device Info", style = TextStyle(fontSize = 20.sp))
Text(text = "Name : ${iosInfo.name}")
Text(text = "Model : ${iosInfo.model}")
Text(text = "SystemName : ${iosInfo.systemName}")
Text(text = "SystemVersion : ${iosInfo.systemVersion}")
Text(text = "LocalizedModel : ${iosInfo.localizedModel}")
Text(text = "IsPhysicalDevice : ${iosInfo.isPhysicalDevice}")
Text(text = "DeviceOrientation : ${iosInfo.deviceOrientation.getDeviceOrientation()}")
Text(text = "Orientation : ${iosInfo.deviceOrientation.getDeviceOrientation()}")
Spacer(modifier = Modifier.fillMaxWidth().height(height = 20.dp))

// Locale Info
Text(text = "Locale Info", style = TextStyle(fontSize = 20.sp))
Text(text = "Language Code : ${iosInfo.locale.languageCode}")
Text(text = "Region : ${iosInfo.locale.region}")
Spacer(modifier = Modifier.fillMaxWidth().height(height = 20.dp))
}
}

0 comments on commit 3f38a36

Please sign in to comment.