Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.content.Context
import androidx.annotation.RequiresPermission
import androidx.annotation.WorkerThread
import com.udfsoft.androidinfo.lib.command.GetRAMInformationCommand
import com.udfsoft.androidinfo.lib.command.camera.front.GetFrontCameraInformationCommand
import com.udfsoft.androidinfo.lib.command.camera.rear.GetRearCameraInformationCommand
import com.udfsoft.androidinfo.lib.command.cpu.GetCpuInformationCommand
import com.udfsoft.androidinfo.lib.command.design.GetNetworkDesignInformationCommand
Expand Down Expand Up @@ -87,9 +88,7 @@ object DeviceInformationFactory : DeviceInformation {

override fun getRearCameraInformation() = GetRearCameraInformationCommand(api).invoke(Unit)

override fun getFrontCameraInformation(): FrontCameraInformation {
TODO("Not yet implemented")
}
override fun getFrontCameraInformation() = GetFrontCameraInformationCommand(api).invoke(Unit)

override fun getAudioInformation(): AudioInformation {
TODO("Not yet implemented")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2022 Javavirys
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.udfsoft.androidinfo.lib.command.camera.front

import com.udfsoft.androidinfo.lib.command.BaseGetCloudInformationCommand
import com.udfsoft.androidinfo.lib.command.entity.MenuIds
import com.udfsoft.androidinfo.lib.command.entity.camera.FrontCameraIds
import com.udfsoft.androidinfo.lib.command.entity.camera.MutableFrontCameraInformation
import com.udfsoft.androidinfo.lib.network.AndroidInfoApi
import com.udfsoft.androidinfo.lib.network.entity.DeviceInformationItemNetwork

class GetCloudFrontCameraInformationCommand(
val api: AndroidInfoApi
) : BaseGetCloudInformationCommand<MutableFrontCameraInformation>(
api,
MenuIds.MENU_ID_FRONT_CAMERA
) {

override fun processInfo(
item: DeviceInformationItemNetwork,
entity: MutableFrontCameraInformation
) {
when (item.id) {
FrontCameraIds.SensorModel.id -> entity.sensorModel = item.value
FrontCameraIds.SensorType.id -> entity.sensorType = item.value
FrontCameraIds.Aperture.id -> entity.aperture = item.value
FrontCameraIds.FocalLength.id -> entity.focalLength = item.value
FrontCameraIds.ImageResolution.id -> entity.imageResolution = item.value
FrontCameraIds.VideoResolution.id -> entity.videoResolution = item.value
FrontCameraIds.VideoFPS.id -> entity.videoFPS = item.value
FrontCameraIds.Features.id -> entity.features = item.value
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2022 Javavirys
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.udfsoft.androidinfo.lib.command.camera.front

import com.udfsoft.androidinfo.lib.command.CommandInterface
import com.udfsoft.androidinfo.lib.command.entity.camera.MutableFrontCameraInformation
import com.udfsoft.androidinfo.lib.entity.FrontCameraInformation
import com.udfsoft.androidinfo.lib.network.AndroidInfoApi

class GetFrontCameraInformationCommand(
private val api: AndroidInfoApi
) : CommandInterface<Unit, FrontCameraInformation> {

override fun invoke(param: Unit) = MutableFrontCameraInformation().also {
GetCloudFrontCameraInformationCommand(api).invoke(it)
}.build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package com.udfsoft.androidinfo.lib.command.camera.rear

import com.udfsoft.androidinfo.lib.command.BaseGetCloudInformationCommand
import com.udfsoft.androidinfo.lib.command.entity.MenuIds
import com.udfsoft.androidinfo.lib.command.entity.camera.CameraIds
import com.udfsoft.androidinfo.lib.command.entity.camera.MutableRearCameraInformation
import com.udfsoft.androidinfo.lib.command.entity.camera.RearCameraIds
import com.udfsoft.androidinfo.lib.network.AndroidInfoApi
import com.udfsoft.androidinfo.lib.network.entity.DeviceInformationItemNetwork

Expand All @@ -31,16 +31,16 @@ class GetCloudRearCameraInformation(
item: DeviceInformationItemNetwork, entity: MutableRearCameraInformation
) {
when (item.id) {
CameraIds.SensorModel.id -> entity.sensorModel = item.value
CameraIds.SensorFormat.id -> entity.sensorFormat = item.value
CameraIds.PixelSize.id -> entity.pixelSize = item.value
CameraIds.Aperture.id -> entity.aperture = item.value
CameraIds.FocalLength.id -> entity.focalLength = item.value
CameraIds.FlashType.id -> entity.flashType = item.value
CameraIds.ImageResolution.id -> entity.imageResolution = item.value
CameraIds.VideoResolution.id -> entity.videoResolution = item.value
CameraIds.VideoFPS.id -> entity.videoFPS = item.value
CameraIds.Features.id -> entity.features = item.value
RearCameraIds.SensorModel.id -> entity.sensorModel = item.value
RearCameraIds.SensorFormat.id -> entity.sensorFormat = item.value
RearCameraIds.PixelSize.id -> entity.pixelSize = item.value
RearCameraIds.Aperture.id -> entity.aperture = item.value
RearCameraIds.FocalLength.id -> entity.focalLength = item.value
RearCameraIds.FlashType.id -> entity.flashType = item.value
RearCameraIds.ImageResolution.id -> entity.imageResolution = item.value
RearCameraIds.VideoResolution.id -> entity.videoResolution = item.value
RearCameraIds.VideoFPS.id -> entity.videoFPS = item.value
RearCameraIds.Features.id -> entity.features = item.value
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.udfsoft.androidinfo.lib.command.entity.camera

enum class FrontCameraIds(val id: Int) {
SensorModel(13600),
SensorType(13610),
Aperture(13620),
FocalLength(13630),
ImageResolution(13640),
VideoResolution(13650),
VideoFPS(13660),
Features(13670)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.udfsoft.androidinfo.lib.command.entity.camera

import com.udfsoft.androidinfo.lib.command.entity.MutableEntity
import com.udfsoft.androidinfo.lib.entity.FrontCameraInformation

data class MutableFrontCameraInformation(
var sensorModel: String? = null,
var sensorType: String? = null,
var aperture: String? = null,
var focalLength: String? = null,
var imageResolution: String? = null,
var videoResolution: String? = null,
var videoFPS: String? = null,
var features: String? = null
) : MutableEntity<FrontCameraInformation> {

override fun build() = FrontCameraInformation(
sensorModel,
sensorType,
aperture,
focalLength,
imageResolution,
videoResolution,
videoFPS,
features
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2022 Javavirys
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.udfsoft.androidinfo.lib.command.entity.camera

enum class RearCameraIds(val id: Int) {
SensorModel(12460),
SensorFormat(12490),
PixelSize(12500),
Aperture(12520),
FocalLength(12530),
FlashType(12550),
ImageResolution(12560),
VideoResolution(12570),
VideoFPS(12580),
Features(12590)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package com.udfsoft.androidinfo.lib.entity

class FrontCameraInformation {

}
data class FrontCameraInformation(
val sensorModel: String?,
val sensorType: String?,
val aperture: String?,
val focalLength: String?,
val imageResolution: String?,
val videoResolution: String?,
val videoFPS: String?,
val features: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ class MainFragment : Fragment(R.layout.fragment_main) {
viewModel.getRearCameraInformationLiveData().observe(viewLifecycleOwner) {
Log.d(TAG, it.toString())
}

viewModel.getFrontCameraInformationLiveData().observe(viewLifecycleOwner) {
Log.d(TAG, it.toString())
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class MainViewModel : ViewModel() {

private val rearCameraInformationLiveData = MutableLiveData<RearCameraInformation>()

private val frontCameraInformationLiveData = MutableLiveData<FrontCameraInformation>()

@RequiresPermission(
allOf = [Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_SMS, "android.permission.READ_PHONE_NUMBERS"]
)
Expand All @@ -75,6 +77,7 @@ class MainViewModel : ViewModel() {
gpuInformationLiveData.postValue(DeviceInformationFactory.getGPUInformation())
sensorsInformationLiveData.postValue(DeviceInformationFactory.getSensorsInformation())
rearCameraInformationLiveData.postValue(DeviceInformationFactory.getRearCameraInformation())
frontCameraInformationLiveData.postValue(DeviceInformationFactory.getFrontCameraInformation())
}

fun getGeneralInformationLiveData() = generalInformationLiveData.toLiveData()
Expand All @@ -101,4 +104,6 @@ class MainViewModel : ViewModel() {
fun getSensorsInformationLiveData() = sensorsInformationLiveData.toLiveData()

fun getRearCameraInformationLiveData() = rearCameraInformationLiveData.toLiveData()

fun getFrontCameraInformationLiveData() = frontCameraInformationLiveData.toLiveData()
}