6.7.0 - Alpha - 内置 DroidSans 字体 (assets/fonts/droid_sans.ttf)

This commit is contained in:
SuperMonster003
2025-06-09 15:56:17 +08:00
parent dc43641a23
commit 7970445aec
4 changed files with 17 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ ui.layout(
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:format24Hour="HH:mm" android:format24Hour="HH:mm"
android:textSize="36sp"/>, android:textSize="36sp" />,
); );
/* 1 秒钟后应用自定义样式. */ /* 1 秒钟后应用自定义样式. */
@@ -28,9 +28,10 @@ setTimeout(() => {
let textClockView = ui['text_clock']; let textClockView = ui['text_clock'];
textClockView.attr('color', ColorUtils.adjustThemeColorForContrast(themeColor.toInt())); textClockView.attr('color', ColorUtils.adjustThemeColorForContrast(themeColor.toInt()));
textClockView.attr('size', '64'); textClockView.attr('size', calcAutoSp());
textClockView.attr('layout_gravity', 'center'); textClockView.attr('layout_gravity', 'center');
textClockView.attr('format24Hour', 'HH:mm:ss'); textClockView.attr('format24Hour', 'HH:mm:ss');
textClockView.setTypeface(Typeface.createFromAsset(context.assets, 'fonts/droid_sans.ttf'));
let textSizeSp = DisplayUtils.pxToSp(textClockView.getTextSize()); let textSizeSp = DisplayUtils.pxToSp(textClockView.getTextSize());
let detector = new ScaleGestureDetector(context, let detector = new ScaleGestureDetector(context,
@@ -48,4 +49,11 @@ setTimeout(() => {
return detector.onTouchEvent(me); return detector.onTouchEvent(me);
}, },
}); });
}, 1e3); }, 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;
}

Binary file not shown.

View File

@@ -44,6 +44,9 @@ class Classes {
@JvmField @JvmField
val PorterDuff = android.graphics.PorterDuff::class val PorterDuff = android.graphics.PorterDuff::class
@JvmField
val Typeface = android.graphics.Typeface::class
@JvmField @JvmField
val ColorDrawable = android.graphics.drawable.ColorDrawable::class val ColorDrawable = android.graphics.drawable.ColorDrawable::class

View File

@@ -1,5 +1,5 @@
#Sun Jun 08 20:05:46 CST 2025 #Mon Jun 09 15:52:27 CST 2025
BUILD_TIME=1749384346188 BUILD_TIME=1749455547476
COMPILE_SDK_VERSION=35 COMPILE_SDK_VERSION=35
IMAGE_QUANT_CMAKE_VERSION=3.22.1 IMAGE_QUANT_CMAKE_VERSION=3.22.1
IMAGE_QUANT_NDK_VERSION=26.1.10909125 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 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=35 TARGET_SDK_VERSION=35
TARGET_SDK_VERSION_INRT=29 TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3282 VERSION_BUILD=3285
VERSION_NAME=6.7.0 Alpha VERSION_NAME=6.7.0 Alpha
VSCODE_EXT_REQUIRED_VERSION=1.0.8 VSCODE_EXT_REQUIRED_VERSION=1.0.8