From d209678b6f846fd818ea8c88b7bdc92a308da318 Mon Sep 17 00:00:00 2001 From: Hermes Date: Mon, 20 Apr 2026 18:25:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(icon):=20=E7=AE=80=E5=8C=96=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E9=80=89=E6=8B=A9=E5=99=A8=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=80=BB=E8=BE=91=E8=B0=83=E8=AF=95=E6=B8=B2?= =?UTF-8?q?=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:弹窗能打开但网格内容为空。 修复:暂时去掉动态分页/页面大小计算,固定 4 列直接渲染所有图标。 保留搜索和分类标签功能。 --- code/th_14_panels.js | 50 +++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/code/th_14_panels.js b/code/th_14_panels.js index c596849..b14ef26 100644 --- a/code/th_14_panels.js +++ b/code/th_14_panels.js @@ -4036,25 +4036,12 @@ FloatBallAppWM.prototype.showShortXIconPickerPopup = function(opts) { grid.removeAllViews(); var q = String(searchEt.getText() || ""); var matched = filterCatalog(q, popupState.activeTab); - var size = popupState.pageSize; - if (size <= 0) { - grid.post(new java.lang.Runnable({ run: function() { - resolvePageSize(grid.getWidth(), grid.getHeight()); - renderGrid(); - }})); - statusTv.setText("正在计算布局..."); - return; - } - var totalPages = Math.max(1, Math.ceil(matched.length / size)); - if (popupState.currentPage >= totalPages) popupState.currentPage = totalPages - 1; - if (popupState.currentPage < 0) popupState.currentPage = 0; - var start = popupState.currentPage * size; - var pageItems = matched.slice(start, start + size); - - statusTv.setText("共 " + matched.length + " 个,第 " + (popupState.currentPage + 1) + "/" + totalPages + " 页,每页 " + size + " 个"); - pageInfo.setText((popupState.currentPage + 1) + " / " + totalPages); - - if (pageItems.length === 0) { + + // 调试:直接显示所有匹配图标,不分页 + statusTv.setText("共 " + matched.length + " 个图标"); + pageInfo.setText("-"); + + if (matched.length === 0) { var emptyTv = new android.widget.TextView(context); emptyTv.setText("未找到匹配的图标"); emptyTv.setTextColor(subTextColor); @@ -4065,11 +4052,12 @@ FloatBallAppWM.prototype.showShortXIconPickerPopup = function(opts) { return; } - var cols = popupState.pageCols; + // 固定 4 列,不计算动态布局 + var cols = 4; grid.setColumnCount(cols); var idx; - for (idx = 0; idx < pageItems.length; idx++) { + for (idx = 0; idx < matched.length; idx++) { (function(item) { var cell = new android.widget.LinearLayout(context); cell.setOrientation(android.widget.LinearLayout.VERTICAL); @@ -4086,13 +4074,10 @@ FloatBallAppWM.prototype.showShortXIconPickerPopup = function(opts) { if (dr) { iv.setImageDrawable(dr); } else { - // 图\u6807\u83b7\u53d6\u5931\u8d25,\u663e\u793a\u6587\u5b57\u5360\u4f4d\u7b26 - try { - var placeholder = new android.graphics.drawable.GradientDrawable(); - placeholder.setColor(self.withAlpha(subTextColor, 0.1)); - placeholder.setCornerRadius(self.dp(6)); - iv.setBackground(placeholder); - } catch(e) {} + var placeholder = new android.graphics.drawable.GradientDrawable(); + placeholder.setColor(self.withAlpha(subTextColor, 0.1)); + placeholder.setCornerRadius(self.dp(6)); + iv.setBackground(placeholder); } } catch(e) {} cell.addView(iv); @@ -4123,14 +4108,14 @@ FloatBallAppWM.prototype.showShortXIconPickerPopup = function(opts) { })); var cellLp = new android.widget.GridLayout.LayoutParams(); - cellLp.width = popupState.cellWidthPx || self.dp(72); + cellLp.width = self.dp(72); cellLp.height = android.widget.GridLayout.LayoutParams.WRAP_CONTENT; cell.setLayoutParams(cellLp); grid.addView(cell); - })(pageItems[idx]); + })(matched[idx]); } } catch(eRender) { - safeLog(self.L, 'e', "renderShortXIconGrid err=" + String(eRender)); + safeLog(self.L, 'e', "renderGrid err=" + String(eRender)); } } @@ -4144,8 +4129,7 @@ FloatBallAppWM.prototype.showShortXIconPickerPopup = function(opts) { afterTextChanged: function() {} })); - // 直接计算默认页面大小并渲染,不依赖 grid.post - resolvePageSize(self.dp(300), self.dp(360)); + // 直接渲染,不依赖分页 renderGrid(); } });