@@ -14,6 +14,7 @@ import cn.tongdun.android.adapters.DeviceInfoItemAdapter
14
14
import cn.tongdun.android.base.BaseFragment
15
15
import cn.tongdun.mobrisk.TDRisk
16
16
import cn.tongdun.mobrisk.providers.DeviceInfoProvider
17
+ import com.trustdevice.android.R
17
18
import com.trustdevice.android.databinding.FragmentDeviceInfoBinding
18
19
import java.math.BigDecimal
19
20
import java.math.RoundingMode
@@ -94,10 +95,11 @@ class DeviceInfoFragment : BaseFragment<FragmentDeviceInfoBinding>() {
94
95
val availableStorage =
95
96
deviceInfoProvider.getMemoryInfo().availableStorage / Math .pow(1024.0 , 3.0 )
96
97
val useStorage = totalStorage - availableStorage
98
+ val freeText = getString(R .string.free_text)
97
99
val internalStorageInfo =
98
100
String .format(Locale .US , " %.2fGB" , useStorage) + " / " + String .format(
99
101
Locale .US , " %.2fGB" , totalStorage
100
- ) + " , Free : " + String .format(Locale .US , " %.2fGB" , availableStorage)
102
+ ) + " , ${freeText} : " + String .format(Locale .US , " %.2fGB" , availableStorage)
101
103
102
104
tvInternalStorageInfo.text = internalStorageInfo
103
105
val scale = 100 / totalStorage
@@ -110,15 +112,16 @@ class DeviceInfoFragment : BaseFragment<FragmentDeviceInfoBinding>() {
110
112
111
113
private fun initRAMView () {
112
114
binding.memoryInfoLayout.apply {
113
- tvRamPath.text = " The state at the time of collection "
115
+ tvRamPath.text = getString( R .string.memory_desc)
114
116
val totalMemory = deviceInfoProvider.getMemoryInfo().totalMemory / Math .pow(1024.0 , 3.0 )
115
117
val availableMemory =
116
118
deviceInfoProvider.getMemoryInfo().availableMemory / Math .pow(1024.0 , 3.0 )
117
119
val useMemory = totalMemory - availableMemory
120
+ val freeText = getString(R .string.free_text)
118
121
val internalStorageInfo =
119
122
String .format(Locale .US , " %.2fGB" , useMemory) + " / " + String .format(
120
123
Locale .US , " %.2fGB" , totalMemory
121
- ) + " , Free : " + String .format(Locale .US , " %.2fGB" , availableMemory)
124
+ ) + " , ${freeText} : " + String .format(Locale .US , " %.2fGB" , availableMemory)
122
125
tvRamInfo.text = internalStorageInfo
123
126
val scale = 100 / totalMemory
124
127
ramProgress.progress = (useMemory * scale).toInt()
@@ -130,17 +133,20 @@ class DeviceInfoFragment : BaseFragment<FragmentDeviceInfoBinding>() {
130
133
private fun initBatteryView () {
131
134
binding.batteryInfoLayout.apply {
132
135
tvBatteryStatus.text = " (" + deviceInfoProvider.getBatteryInfo().status + " )"
136
+ val totalCapacityText = getString(R .string.total_capacity_text)
133
137
tvBatteryHealth.text =
134
- " total capacity : " + deviceInfoProvider.getBatteryInfo().TotalCapacity + " mAh"
138
+ " ${totalCapacityText} : " + deviceInfoProvider.getBatteryInfo().TotalCapacity + " mAh"
135
139
val power = deviceInfoProvider.getBatteryInfo().level
136
140
137
141
batteryProgress.progress = power
138
142
tvBatteryPower.text = " $power %"
139
143
val temp = deviceInfoProvider.getBatteryInfo().temp
140
144
val temperature = BigDecimal .valueOf((temp.toFloat() / 10 ).toDouble())
141
145
.setScale(2 , RoundingMode .HALF_UP ).toDouble()
146
+ val healthText = getString(R .string.health_text)
147
+ val temperatureText = getString(R .string.temperature_text)
142
148
tvBatteryInfo.text =
143
- " health : " + deviceInfoProvider.getBatteryInfo().health + " , temperature : " + temperature + " ℃"
149
+ " ${healthText} : " + deviceInfoProvider.getBatteryInfo().health + " , ${temperatureText} : " + temperature + " ℃"
144
150
}
145
151
146
152
}
0 commit comments