diff --git a/app/src/main/assets-app/sample/布局/简单 Android 布局 [v6.6.3+].js b/app/src/main/assets-app/sample/布局/简单 Android 布局 [v6.7.0+].js similarity index 77% rename from app/src/main/assets-app/sample/布局/简单 Android 布局 [v6.6.3+].js rename to app/src/main/assets-app/sample/布局/简单 Android 布局 [v6.7.0+].js index 874af973..ea5b82cf 100644 --- a/app/src/main/assets-app/sample/布局/简单 Android 布局 [v6.6.3+].js +++ b/app/src/main/assets-app/sample/布局/简单 Android 布局 [v6.7.0+].js @@ -9,7 +9,7 @@ ui.layout( android:layout_width="wrap_content" android:layout_height="wrap_content" android:format24Hour="HH:mm" - android:textSize="36sp"/>, + android:textSize="36sp" />, ); /* 1 秒钟后应用自定义样式. */ @@ -28,9 +28,10 @@ setTimeout(() => { let textClockView = ui['text_clock']; textClockView.attr('color', ColorUtils.adjustThemeColorForContrast(themeColor.toInt())); - textClockView.attr('size', '64'); + textClockView.attr('size', calcAutoSp()); textClockView.attr('layout_gravity', 'center'); textClockView.attr('format24Hour', 'HH:mm:ss'); + textClockView.setTypeface(Typeface.createFromAsset(context.assets, 'fonts/droid_sans.ttf')); let textSizeSp = DisplayUtils.pxToSp(textClockView.getTextSize()); let detector = new ScaleGestureDetector(context, @@ -48,4 +49,11 @@ setTimeout(() => { return detector.onTouchEvent(me); }, }); -}, 1e3); \ No newline at end of file +}, 1e3); + +function calcAutoSp(percent = 0.16) { + let dm = context.getResources().getDisplayMetrics(); + let shortEdgePx = Math.min(dm.widthPixels, dm.heightPixels); + let sizePx = shortEdgePx * percent; + return sizePx / dm.scaledDensity; +} diff --git a/app/src/main/assets/fonts/droid_sans.ttf b/app/src/main/assets/fonts/droid_sans.ttf new file mode 100644 index 00000000..ad1efca8 Binary files /dev/null and b/app/src/main/assets/fonts/droid_sans.ttf differ diff --git a/app/src/main/java/org/autojs/autojs/runtime/api/augment/global/Classes.kt b/app/src/main/java/org/autojs/autojs/runtime/api/augment/global/Classes.kt index 7108c423..548c1d0c 100644 --- a/app/src/main/java/org/autojs/autojs/runtime/api/augment/global/Classes.kt +++ b/app/src/main/java/org/autojs/autojs/runtime/api/augment/global/Classes.kt @@ -44,6 +44,9 @@ class Classes { @JvmField val PorterDuff = android.graphics.PorterDuff::class + @JvmField + val Typeface = android.graphics.Typeface::class + @JvmField val ColorDrawable = android.graphics.drawable.ColorDrawable::class diff --git a/version.properties b/version.properties index 9ecb5287..487537e5 100644 --- a/version.properties +++ b/version.properties @@ -1,5 +1,5 @@ -#Sun Jun 08 20:05:46 CST 2025 -BUILD_TIME=1749384346188 +#Mon Jun 09 15:52:27 CST 2025 +BUILD_TIME=1749455547476 COMPILE_SDK_VERSION=35 IMAGE_QUANT_CMAKE_VERSION=3.22.1 IMAGE_QUANT_NDK_VERSION=26.1.10909125 @@ -19,6 +19,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 TARGET_SDK_VERSION=35 TARGET_SDK_VERSION_INRT=29 -VERSION_BUILD=3282 +VERSION_BUILD=3285 VERSION_NAME=6.7.0 Alpha VSCODE_EXT_REQUIRED_VERSION=1.0.8