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 @@ -25,6 +25,7 @@ import com.udfsoft.androidinfo.lib.command.cpu.GetCpuInformationCommand
import com.udfsoft.androidinfo.lib.command.design.GetNetworkDesignInformationCommand
import com.udfsoft.androidinfo.lib.command.display.GetDisplayInformationCommand
import com.udfsoft.androidinfo.lib.command.general.GetGeneralInformationCommand
import com.udfsoft.androidinfo.lib.command.gpu.GetGPUInformationCommand
import com.udfsoft.androidinfo.lib.command.network.GetNetworkTechnologiesInformationCommand
import com.udfsoft.androidinfo.lib.command.os.GetOSInformationCommand
import com.udfsoft.androidinfo.lib.command.sim.GetSIMCardInformationCommand
Expand Down Expand Up @@ -68,9 +69,7 @@ object DeviceInformationFactory : DeviceInformation {
return getCpuInformationCommand(Unit)
}

override fun getGPUInformation(): GPUInformation {
TODO("Not yet implemented")
}
override fun getGPUInformation() = GetGPUInformationCommand(api).invoke(Unit)

override fun getRAMInformation(context: Context): RAMInformation {
val getRAMInformationCommand = GetRAMInformationCommand(context)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.udfsoft.androidinfo.lib.command.entity.gpu

enum class GPUIds(val id: Int) {
GPUName(29280)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.udfsoft.androidinfo.lib.command.entity.gpu

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

data class MutableGPUInformation(
var name: String? = null
) : MutableEntity<GPUInformation> {

override fun build() = GPUInformation(name)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.gpu

import com.udfsoft.androidinfo.lib.command.BaseGetCloudInformationCommand
import com.udfsoft.androidinfo.lib.command.entity.MenuIds
import com.udfsoft.androidinfo.lib.command.entity.gpu.GPUIds
import com.udfsoft.androidinfo.lib.command.entity.gpu.MutableGPUInformation
import com.udfsoft.androidinfo.lib.network.AndroidInfoApi
import com.udfsoft.androidinfo.lib.network.entity.DeviceInformationItemNetwork

class GetCloudGPUInformation(
val api: AndroidInfoApi
) : BaseGetCloudInformationCommand<MutableGPUInformation>(api, MenuIds.MENU_ID_GPU) {

override fun processInfo(
item: DeviceInformationItemNetwork,
entity: MutableGPUInformation
) {
when (item.id) {
GPUIds.GPUName.id -> entity.name = item.value
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.udfsoft.androidinfo.lib.command.gpu

import com.udfsoft.androidinfo.lib.command.CommandInterface
import com.udfsoft.androidinfo.lib.command.entity.gpu.MutableGPUInformation
import com.udfsoft.androidinfo.lib.entity.GPUInformation
import com.udfsoft.androidinfo.lib.network.AndroidInfoApi

class GetGPUInformationCommand(
val api: AndroidInfoApi
) : CommandInterface<Unit, GPUInformation> {

override fun invoke(param: Unit): GPUInformation {
val mutableEntity = MutableGPUInformation()
GetCloudGPUInformation(api).invoke(mutableEntity)
return mutableEntity.build()
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.udfsoft.androidinfo.lib.entity

class GPUInformation {

}
data class GPUInformation(
val name: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ class MainFragment : Fragment(R.layout.fragment_main) {
viewModel.getStorageInformationLiveData().observe(viewLifecycleOwner) {
Log.d(TAG, it.toString())
}

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

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

private val storageInformationLiveData = MutableLiveData<StorageInformation>()

private val gpuInformationLiveData = MutableLiveData<GPUInformation>()

@RequiresPermission(
allOf = [Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_SMS, "android.permission.READ_PHONE_NUMBERS"]
)
Expand All @@ -66,6 +68,7 @@ class MainViewModel : ViewModel() {
)
designInformationLiveData.postValue(DeviceInformationFactory.getDesignInformation())
storageInformationLiveData.postValue(DeviceInformationFactory.getStorageInformation())
gpuInformationLiveData.postValue(DeviceInformationFactory.getGPUInformation())
}

fun getGeneralInformationLiveData() = generalInformationLiveData.toLiveData()
Expand All @@ -86,4 +89,6 @@ class MainViewModel : ViewModel() {
fun getDesignInformationLiveData() = designInformationLiveData.toLiveData()

fun getStorageInformationLiveData() = storageInformationLiveData.toLiveData()

fun getGPUInformationLiveData() = gpuInformationLiveData.toLiveData()
}