1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 02:52:07 -04:00

optimize some animations

This commit is contained in:
bbedward
2026-05-01 18:37:17 -04:00
committed by purian23
parent 7c9ca60e44
commit 386a2d0469
12 changed files with 79 additions and 110 deletions

View File

@@ -344,11 +344,7 @@ Item {
return I18n.tr("%1 exists but is not included in config. Custom keybinds will not work until this is fixed.").arg(bindsFile);
if (warningBox.showWarning) {
const count = warningBox.status.overriddenBy;
return I18n.ntr(
"%1 DMS bind may be overridden by config binds that come after the include.",
"%1 DMS binds may be overridden by config binds that come after the include.",
count
).arg(count);
return I18n.ntr("%1 DMS bind may be overridden by config binds that come after the include.", "%1 DMS binds may be overridden by config binds that come after the include.", count).arg(count);
}
return "";
}
@@ -543,13 +539,11 @@ Item {
StyledText {
text: {
if (KeybindsService.loading)
return I18n.tr("Shortcuts");
const count = keybindsTab._filteredBinds.length;
return count === 1
? I18n.tr("Shortcut (%1)").arg(count)
: I18n.tr("Shortcuts (%1)").arg(count);
}
if (KeybindsService.loading)
return I18n.tr("Shortcuts");
const count = keybindsTab._filteredBinds.length;
return count === 1 ? I18n.tr("Shortcut (%1)").arg(count) : I18n.tr("Shortcuts (%1)").arg(count);
}
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
@@ -569,7 +563,7 @@ Item {
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
RotationAnimation on rotation {
RotationAnimator on rotation {
from: 0
to: 360
duration: 1000

View File

@@ -36,36 +36,36 @@ Item {
function normalizePinList(value) {
if (Array.isArray(value))
return value.filter(v => v)
return value.filter(v => v);
if (typeof value === "string" && value.length > 0)
return [value]
return []
return [value];
return [];
}
function getPinnedWifiNetworks() {
const pins = SettingsData.wifiNetworkPins || {}
return normalizePinList(pins["preferredWifi"])
const pins = SettingsData.wifiNetworkPins || {};
return normalizePinList(pins["preferredWifi"]);
}
function toggleWifiPin(ssid) {
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}))
let pinnedList = normalizePinList(pins["preferredWifi"])
const pinIndex = pinnedList.indexOf(ssid)
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
let pinnedList = normalizePinList(pins["preferredWifi"]);
const pinIndex = pinnedList.indexOf(ssid);
if (pinIndex !== -1) {
pinnedList.splice(pinIndex, 1)
pinnedList.splice(pinIndex, 1);
} else {
pinnedList.unshift(ssid)
pinnedList.unshift(ssid);
if (pinnedList.length > maxPinnedWifiNetworks)
pinnedList = pinnedList.slice(0, maxPinnedWifiNetworks)
pinnedList = pinnedList.slice(0, maxPinnedWifiNetworks);
}
if (pinnedList.length > 0)
pins["preferredWifi"] = pinnedList
pins["preferredWifi"] = pinnedList;
else
delete pins["preferredWifi"]
delete pins["preferredWifi"];
SettingsData.set("wifiNetworkPins", pins)
SettingsData.set("wifiNetworkPins", pins);
}
LazyLoader {
@@ -340,9 +340,7 @@ Item {
if (devices.length === 0)
return I18n.tr("No adapters");
if (connected === 0)
return devices.length === 1
? I18n.tr("%1 adapter, none connected").arg(devices.length)
: I18n.tr("%1 adapters, none connected").arg(devices.length);
return devices.length === 1 ? I18n.tr("%1 adapter, none connected").arg(devices.length) : I18n.tr("%1 adapters, none connected").arg(devices.length);
return I18n.tr("%1 connected").arg(connected);
}
font.pixelSize: Theme.fontSizeSmall
@@ -658,16 +656,14 @@ Item {
SequentialAnimation {
running: NetworkService.networkWiredInfoLoading
loops: Animation.Infinite
NumberAnimation {
OpacityAnimator {
target: wiredLoadIcon
property: "opacity"
to: 0.3
duration: 400
easing.type: Easing.InOutQuad
}
NumberAnimation {
OpacityAnimator {
target: wiredLoadIcon
property: "opacity"
to: 1.0
duration: 400
easing.type: Easing.InOutQuad
@@ -1046,16 +1042,14 @@ Item {
SequentialAnimation {
running: NetworkService.isScanning
loops: Animation.Infinite
NumberAnimation {
OpacityAnimator {
target: scanningIcon
property: "opacity"
to: 0.3
duration: 400
easing.type: Easing.InOutQuad
}
NumberAnimation {
OpacityAnimator {
target: scanningIcon
property: "opacity"
to: 1.0
duration: 400
easing.type: Easing.InOutQuad
@@ -1087,14 +1081,14 @@ Item {
let sorted = [...networks];
sorted.sort((a, b) => {
const aPinnedIndex = pinnedList.indexOf(a.ssid)
const bPinnedIndex = pinnedList.indexOf(b.ssid)
const aPinnedIndex = pinnedList.indexOf(a.ssid);
const bPinnedIndex = pinnedList.indexOf(b.ssid);
if (aPinnedIndex !== -1 || bPinnedIndex !== -1) {
if (aPinnedIndex === -1)
return 1
return 1;
if (bPinnedIndex === -1)
return -1
return aPinnedIndex - bPinnedIndex
return -1;
return aPinnedIndex - bPinnedIndex;
}
if (a.ssid === ssid)
return -1;
@@ -1297,7 +1291,7 @@ Item {
buttonSize: 28
iconColor: isPinned ? Theme.primary : Theme.surfaceVariantText
onClicked: {
networkTab.toggleWifiPin(modelData.ssid)
networkTab.toggleWifiPin(modelData.ssid);
}
}
@@ -1375,16 +1369,14 @@ Item {
SequentialAnimation {
running: NetworkService.networkInfoLoading
loops: Animation.Infinite
NumberAnimation {
OpacityAnimator {
target: wifiInfoLoadIcon
property: "opacity"
to: 0.3
duration: 400
easing.type: Easing.InOutQuad
}
NumberAnimation {
OpacityAnimator {
target: wifiInfoLoadIcon
property: "opacity"
to: 1.0
duration: 400
easing.type: Easing.InOutQuad
@@ -1866,16 +1858,14 @@ Item {
SequentialAnimation {
running: VPNService.configLoading
loops: Animation.Infinite
NumberAnimation {
OpacityAnimator {
target: vpnLoadIcon
property: "opacity"
to: 0.3
duration: 400
easing.type: Easing.InOutQuad
}
NumberAnimation {
OpacityAnimator {
target: vpnLoadIcon
property: "opacity"
to: 1.0
duration: 400
easing.type: Easing.InOutQuad
@@ -1984,7 +1974,9 @@ Item {
checked: configData ? (configData.autoconnect || false) : false
visible: !VPNService.configLoading && configData !== null
onToggled: checked => {
VPNService.updateConfig(modelData.uuid, {autoconnect: checked});
VPNService.updateConfig(modelData.uuid, {
autoconnect: checked
});
}
}

View File

@@ -458,7 +458,7 @@ Item {
enabled: !CupsService.loadingDevices
onClicked: CupsService.getDevices()
RotationAnimation on rotation {
RotationAnimator on rotation {
running: CupsService.loadingDevices
loops: Animation.Infinite
from: 0
@@ -736,7 +736,7 @@ Item {
enabled: !CupsService.loadingPPDs
onClicked: CupsService.getPPDs()
RotationAnimation on rotation {
RotationAnimator on rotation {
running: CupsService.loadingPPDs
loops: Animation.Infinite
from: 0

View File

@@ -693,7 +693,7 @@ Item {
onTriggered: refreshButton.isRefreshing = false
}
NumberAnimation on rotation {
RotationAnimator on rotation {
running: refreshButton.isRefreshing
from: 0
to: 360