File tree Expand file tree Collapse file tree
app/src/main/java/com/termux/app
termux-x11/src/main/java/com/termux/x11/controller/winhandler Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7171 repo_token : ${{ secrets.GITHUB_TOKEN }}
7272 file : " **/*.apk"
7373 file_glob : true
74- release_name : " v1.0.7 -beta"
75- tag : 1.0.7
74+ release_name : " v1.0.7b1 -beta"
75+ tag : 1.0.7b1
7676 checksums : sha256,sha512,md5
Original file line number Diff line number Diff line change @@ -499,6 +499,22 @@ public List<ProcessInfo> collectProcessorInfo(String tag) {
499499 return processInfoList .isEmpty () ? null : processInfoList ;
500500 }
501501
502+ @ Override
503+ public int readProcessInfoFileANumber () {
504+ String fileAPath = TERMUX_TMP_PREFIX_DIR_PATH + "/a" ; // 更简洁的路径拼接
505+
506+ if (!file .exists () || !file .isFile ()) {
507+ return -1 ;
508+ }
509+
510+ try (BufferedReader reader = new BufferedReader (new FileReader (fileAPath ))) {
511+ String line = reader .readLine (); // 只读取第一行
512+ return line != null ? Integer .parseInt (line .trim ()) : -1 ;
513+ } catch (IOException | NumberFormatException e ) {
514+ return -1 ; // 统一错误返回
515+ }
516+ }
517+
502518 @ Override
503519 public void setFloatBallMenu (boolean enableFloatBallMenu , boolean enableGlobalFloatBallMenu ) {
504520 if (mFloatBallMenuClient != null ) {
Original file line number Diff line number Diff line change @@ -202,7 +202,14 @@ private void updateCPUInfoView() {
202202 int avgClockSpeed = totalClockSpeed / clockSpeeds .length ;
203203 TextView tvCPUTitle = findViewById (R .id .TVCPUTitle );
204204 byte cpuUsagePercent = (byte ) (((float ) avgClockSpeed / maxClockSpeed ) * 100.0f );
205- tvCPUTitle .setText ("CPU (" + cpuUsagePercent + "%)" );
205+ // tvCPUTitle.setText("CPU (" + cpuUsagePercent + "%)");
206+ // 读取文件a的数字
207+ int fileValue = readProcessInfoFileANumber ();
208+
209+ // 设置标题(格式示例:"CPU (42%) [123]")
210+ tvCPUTitle .setText (
211+ "CPU (" + cpuUsagePercent + "%) [" + (fileValue != -1 ? fileValue : "N/A" ) + "]"
212+ );
206213 }
207214
208215 private void updateMemoryInfoView () {
You can’t perform that action at this time.
0 commit comments