Upload modified plugin files that correct .svg rendering issue as well as adding feature for auto-enter on correct PIN
This commit is contained in:
15
pinpadlockscreen.koplugin/ui/pinpadbuttondialog.lua
Normal file → Executable file
15
pinpadlockscreen.koplugin/ui/pinpadbuttondialog.lua
Normal file → Executable file
@@ -24,6 +24,7 @@ local VerticalGroup = require("ui/widget/verticalgroup")
|
||||
local VerticalSpan = require("ui/widget/verticalspan")
|
||||
local Screen = Device.screen
|
||||
local util = require("util")
|
||||
local RenderImage = require("ui/renderimage")
|
||||
|
||||
local DGENERIC_ICON_SIZE = G_defaults:readSetting("DGENERIC_ICON_SIZE")
|
||||
|
||||
@@ -83,14 +84,23 @@ function PinpadButtonDialog:init()
|
||||
}
|
||||
|
||||
local aesthetic_space = VerticalSpan:new { width = Size.margin.default + Size.padding.default }
|
||||
-- Pre-render the SVG to an image to avoid inconsistent caching/rasterization across multiple shows.
|
||||
local icon_image = nil
|
||||
local icon_path = plugin_dir and (plugin_dir .. "/icons/lock.svg") or nil
|
||||
if icon_path and util.getFileNameSuffix(icon_path) == "svg" then
|
||||
icon_image = RenderImage:renderSVGImageFile(icon_path, nil, nil, 1)
|
||||
end
|
||||
local text_pin_content = VerticalGroup:new {
|
||||
align = "center",
|
||||
ImageWidget:new {
|
||||
file = plugin_dir .. "/icons/lock.svg",
|
||||
-- Prefer a pre-rendered image object when available; fallback to file path so existing behavior is preserved.
|
||||
image = icon_image,
|
||||
file = icon_image and nil or (plugin_dir .. "/icons/lock.svg"),
|
||||
alpha = true,
|
||||
width = Screen:scaleBySize(DGENERIC_ICON_SIZE) * 1.25,
|
||||
height = Screen:scaleBySize(DGENERIC_ICON_SIZE) * 1.25,
|
||||
scale_factor = 0,
|
||||
-- don't force raster scaling for SVGs; let renderer handle vector scaling for crisp output
|
||||
scale_factor = nil,
|
||||
original_in_nightmode = false,
|
||||
},
|
||||
aesthetic_space,
|
||||
@@ -204,6 +214,7 @@ function PinpadButtonDialog:init()
|
||||
alpha = self.alpha,
|
||||
anchor = self.anchor,
|
||||
FrameContainer:new {
|
||||
-- Restore original white window background so the dialog has a proper window appearance.
|
||||
background = Blitbuffer.COLOR_WHITE,
|
||||
bordersize = Size.border.window,
|
||||
radius = Size.radius.window,
|
||||
|
||||
Reference in New Issue
Block a user