-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
bug-fix/#17/In-app-review
- Loading branch information
Showing
8 changed files
with
90 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
app/src/main/java/com/akshayAshokCode/androidsensors/adapter/SensorAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/akshayAshokCode/androidsensors/data/SensorRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.akshayAshokCode.androidsensors.data | ||
|
||
import android.hardware.Sensor | ||
import com.akshayAshokCode.androidsensors.R | ||
|
||
class SensorRepository { | ||
fun getSensors(): List<SensorModel> { | ||
return listOf( | ||
SensorModel( | ||
"Metal detector", | ||
R.drawable.metal_icon, | ||
Sensor.TYPE_MAGNETIC_FIELD | ||
), | ||
SensorModel( | ||
"Gravity meter", | ||
R.drawable.gravity_icon, | ||
Sensor.TYPE_GRAVITY | ||
), | ||
SensorModel( | ||
"Heart rate meter", | ||
R.drawable.heart_icon, | ||
Sensor.TYPE_HEART_RATE | ||
), | ||
SensorModel( | ||
"Pressure meter", | ||
R.drawable.pressure_icon, | ||
Sensor.TYPE_PRESSURE | ||
), | ||
SensorModel( | ||
"Relative Humidity", | ||
R.drawable.humidity_icon, | ||
Sensor.TYPE_RELATIVE_HUMIDITY | ||
) | ||
) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/akshayAshokCode/androidsensors/presentation/AllSensorsViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.akshayAshokCode.androidsensors.presentation | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.liveData | ||
import com.akshayAshokCode.androidsensors.data.SensorRepository | ||
import kotlinx.coroutines.Dispatchers | ||
|
||
class AllSensorsViewModel :ViewModel() { | ||
private var sensorRepository=SensorRepository() | ||
var sensors= liveData(Dispatchers.IO){ | ||
val result=sensorRepository.getSensors() | ||
emit(result) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters