mirror of
https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation.git
synced 2026-08-23 05:54:20 +02:00
Merge pull request #1196 from iamanaws/deps/iced-14
chore(deps): bump iced from 0.13.1 to 0.14.0
This commit is contained in:
commit
c90bd4cdd7
13 changed files with 1277 additions and 1020 deletions
1900
Cargo.lock
generated
1900
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -31,7 +31,8 @@ toml = "^0"
|
|||
dirs = "^6"
|
||||
ureq = { version = "3", features = ["json"] }
|
||||
retry = "^2.0.0"
|
||||
iced = { version = "=0.13.1", features = ["advanced", "image"] }
|
||||
iced = { version = "=0.14.0", features = ["advanced", "image"] }
|
||||
image = "0.25"
|
||||
rfd = "^0.15"
|
||||
csv = "^1.3"
|
||||
|
||||
|
|
|
|||
10
flake.lock
generated
10
flake.lock
generated
|
|
@ -2,15 +2,15 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1761236834,
|
||||
"narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=",
|
||||
"owner": "nixos",
|
||||
"lastModified": 1765270179,
|
||||
"narHash": "sha256-g2a4MhRKu4ymR4xwo+I+auTknXt/+j37Lnf0Mvfl1rE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1",
|
||||
"rev": "677fbe97984e7af3175b6c121f3c39ee5c8d62c9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
|
|
|
|||
85
flake.nix
85
flake.nix
|
|
@ -1,55 +1,68 @@
|
|||
{
|
||||
description = "devshell for uad-ng";
|
||||
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, ... }:
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
forSystems =
|
||||
f:
|
||||
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
|
||||
system: f { pkgs = import nixpkgs { inherit system; }; }
|
||||
system: f (import nixpkgs { inherit system; })
|
||||
);
|
||||
in
|
||||
{
|
||||
formatter = forSystems ({ pkgs }: pkgs.nixfmt-tree);
|
||||
formatter = forSystems (pkgs: pkgs.nixfmt-tree);
|
||||
|
||||
devShells = forSystems (
|
||||
{ pkgs }:
|
||||
pkgs:
|
||||
let
|
||||
inherit (pkgs) lib stdenv;
|
||||
runtimeLibs = [
|
||||
pkgs.fontconfig
|
||||
pkgs.freetype
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux (
|
||||
with pkgs;
|
||||
[
|
||||
libglvnd
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXrandr
|
||||
libxkbcommon
|
||||
wayland
|
||||
]
|
||||
);
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
clang
|
||||
default = pkgs.mkShell (
|
||||
{
|
||||
nativeBuildInputs = with pkgs; [
|
||||
clang
|
||||
pkg-config
|
||||
];
|
||||
buildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
rustc
|
||||
cargo
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
android-tools
|
||||
]
|
||||
++ runtimeLibs;
|
||||
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
|
||||
pkg-config
|
||||
android-tools
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}/lib/rustlib/src/rust";
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
||||
|
||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (
|
||||
with pkgs;
|
||||
[
|
||||
fontconfig
|
||||
freetype
|
||||
libglvnd
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXrandr
|
||||
libxkbcommon
|
||||
wayland
|
||||
]
|
||||
)}";
|
||||
};
|
||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}/lib/rustlib/src/rust";
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
||||
}
|
||||
// lib.optionalAttrs stdenv.isLinux { LD_LIBRARY_PATH = lib.makeLibraryPath runtimeLibs; }
|
||||
// lib.optionalAttrs stdenv.isDarwin {
|
||||
DYLD_FALLBACK_LIBRARY_PATH = lib.makeLibraryPath runtimeLibs;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use dark_light;
|
||||
use iced::theme::{self, Mode, Palette, Style};
|
||||
use iced::{Color, color};
|
||||
use std::sync::LazyLock;
|
||||
|
||||
|
|
@ -149,3 +150,60 @@ impl std::fmt::Display for Theme {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl theme::Base for Theme {
|
||||
fn default(preference: Mode) -> Self {
|
||||
match preference {
|
||||
Mode::Light => Self::Light,
|
||||
Mode::Dark => Self::Dark,
|
||||
Mode::None => match *OS_COLOR_SCHEME {
|
||||
dark_light::Mode::Light => Self::Light,
|
||||
dark_light::Mode::Dark | dark_light::Mode::Unspecified => Self::Dark,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn mode(&self) -> Mode {
|
||||
let resolved = match self {
|
||||
Self::Auto => match *OS_COLOR_SCHEME {
|
||||
dark_light::Mode::Light => Self::Light,
|
||||
dark_light::Mode::Dark | dark_light::Mode::Unspecified => Self::Dark,
|
||||
},
|
||||
other => *other,
|
||||
};
|
||||
|
||||
match resolved {
|
||||
Self::Light => Mode::Light,
|
||||
_ => Mode::Dark,
|
||||
}
|
||||
}
|
||||
|
||||
fn base(&self) -> Style {
|
||||
let p = Self::palette(*self);
|
||||
Style {
|
||||
background_color: p.base.background,
|
||||
text_color: p.bright.surface,
|
||||
}
|
||||
}
|
||||
|
||||
fn palette(&self) -> Option<Palette> {
|
||||
let p = Self::palette(*self);
|
||||
Some(Palette {
|
||||
background: p.base.background,
|
||||
text: p.bright.surface,
|
||||
primary: p.normal.primary,
|
||||
success: p.bright.secondary,
|
||||
warning: p.normal.surface,
|
||||
danger: p.normal.error,
|
||||
})
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
match self {
|
||||
Self::Dark => "Dark",
|
||||
Self::Light => "Light",
|
||||
Self::Lupin => "Lupin",
|
||||
Self::Auto => "Auto",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ use crate::core::uad_lists::UadListState;
|
|||
use crate::core::update::{Release, SelfUpdateState, SelfUpdateStatus, get_latest_release};
|
||||
use crate::core::utils::{NAME, string_to_theme};
|
||||
|
||||
use iced::advanced::graphics::image::image_rs::ImageFormat;
|
||||
use iced::font;
|
||||
use iced::window::icon;
|
||||
use image::ImageFormat;
|
||||
use views::about::{About as AboutView, Message as AboutMessage};
|
||||
use views::list::{List as AppsView, LoadingState as ListLoadingState, Message as AppsMessage};
|
||||
use views::settings::{Message as SettingsMessage, Settings as SettingsView};
|
||||
|
|
@ -382,27 +382,23 @@ impl UadGui {
|
|||
}
|
||||
};
|
||||
|
||||
iced::application(
|
||||
"Universal Android Debloater Next Generation",
|
||||
UadGui::update,
|
||||
UadGui::view,
|
||||
)
|
||||
.theme(UadGui::theme)
|
||||
.settings(Settings {
|
||||
id: Some(String::from(NAME)),
|
||||
default_text_size: iced::Pixels(16.0),
|
||||
..Settings::default()
|
||||
})
|
||||
.window(Window {
|
||||
size: iced::Size {
|
||||
width: 950.0,
|
||||
height: 700.0,
|
||||
},
|
||||
resizable: true,
|
||||
decorations: true,
|
||||
icon: icon::from_file_data(logo, Some(ImageFormat::Png)).ok(),
|
||||
..iced::window::Settings::default()
|
||||
})
|
||||
.run_with(UadGui::new)
|
||||
iced::application(UadGui::new, UadGui::update, UadGui::view)
|
||||
.theme(UadGui::theme)
|
||||
.settings(Settings {
|
||||
id: Some(String::from(NAME)),
|
||||
default_text_size: iced::Pixels(16.0),
|
||||
..Settings::default()
|
||||
})
|
||||
.window(Window {
|
||||
size: iced::Size {
|
||||
width: 950.0,
|
||||
height: 700.0,
|
||||
},
|
||||
resizable: true,
|
||||
decorations: true,
|
||||
icon: icon::from_file_data(logo, Some(ImageFormat::Png)).ok(),
|
||||
..iced::window::Settings::default()
|
||||
})
|
||||
.run()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,22 +4,12 @@
|
|||
clippy::wildcard_imports,
|
||||
reason = "Iced style modules use PascalCase and &Theme; wildcard for local convenience"
|
||||
)]
|
||||
use crate::core::theme::Theme;
|
||||
use crate::core::theme::{ColorPalette, Theme};
|
||||
use iced::widget::{
|
||||
button, checkbox, container, overlay, pick_list, radio, scrollable, text, text_editor,
|
||||
text_input,
|
||||
};
|
||||
use iced::{Background, Border, Color, Shadow, application};
|
||||
|
||||
impl application::DefaultStyle for Theme {
|
||||
fn default_style(&self) -> application::Appearance {
|
||||
let p = self.palette();
|
||||
application::Appearance {
|
||||
background_color: p.base.background,
|
||||
text_color: p.bright.surface,
|
||||
}
|
||||
}
|
||||
}
|
||||
use iced::{Background, Border, Color, Shadow};
|
||||
|
||||
// Implement theming catalogs for our custom `Theme` so generic widgets
|
||||
// like `Button<'_, Message, Theme, Renderer>` compile under iced 0.13.
|
||||
|
|
@ -161,7 +151,7 @@ impl text_input::Catalog for Theme {
|
|||
|
||||
match s {
|
||||
text_input::Status::Active => active,
|
||||
text_input::Status::Focused | text_input::Status::Hovered => focused,
|
||||
text_input::Status::Focused { .. } | text_input::Status::Hovered => focused,
|
||||
text_input::Status::Disabled => disabled,
|
||||
}
|
||||
})
|
||||
|
|
@ -228,6 +218,7 @@ impl overlay::menu::Catalog for Theme {
|
|||
},
|
||||
selected_text_color: p.bright.surface,
|
||||
selected_background: p.normal.primary.into(),
|
||||
shadow: Shadow::default(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -283,7 +274,6 @@ impl text_editor::Catalog for Theme {
|
|||
width: 0.0,
|
||||
radius: 0.0.into(),
|
||||
},
|
||||
icon: p.bright.surface,
|
||||
placeholder: p.normal.surface,
|
||||
value: p.bright.surface,
|
||||
selection: Color {
|
||||
|
|
@ -312,9 +302,9 @@ impl iced::widget::rule::Catalog for Theme {
|
|||
let p = t.palette();
|
||||
iced::widget::rule::Style {
|
||||
color: p.bright.surface,
|
||||
width: 2,
|
||||
radius: 2.0.into(),
|
||||
fill_mode: iced::widget::rule::FillMode::Full,
|
||||
snap: true,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -346,6 +336,7 @@ pub mod Container {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -360,6 +351,7 @@ pub mod Container {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -375,6 +367,7 @@ pub mod Container {
|
|||
radius: 8.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -389,6 +382,7 @@ pub mod Container {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -410,6 +404,7 @@ pub mod Button {
|
|||
radius: 2.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -478,6 +473,7 @@ pub mod Button {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
},
|
||||
_ => button::Style {
|
||||
background: Some(Background::Color(p.base.foreground)),
|
||||
|
|
@ -488,6 +484,7 @@ pub mod Button {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -506,6 +503,7 @@ pub mod Button {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -520,6 +518,7 @@ pub mod Button {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -538,6 +537,7 @@ pub mod Button {
|
|||
radius: 2.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
},
|
||||
button::Status::Hovered => button::Style {
|
||||
background: Some(Background::Color(Color { a: 0.25, ..main })),
|
||||
|
|
@ -548,6 +548,7 @@ pub mod Button {
|
|||
radius: 2.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
},
|
||||
button::Status::Disabled => button::Style {
|
||||
background: Some(Background::Color(Color { a: 0.05, ..main })),
|
||||
|
|
@ -558,6 +559,7 @@ pub mod Button {
|
|||
radius: 2.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
snap: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -576,7 +578,7 @@ pub mod Scrollable {
|
|||
radius: 5.0.into(),
|
||||
},
|
||||
scroller: scrollable::Scroller {
|
||||
color: scroller_color,
|
||||
background: Background::Color(scroller_color),
|
||||
border: Border {
|
||||
color: Color::TRANSPARENT,
|
||||
width: 1.0,
|
||||
|
|
@ -587,6 +589,22 @@ pub mod Scrollable {
|
|||
(rail, rail)
|
||||
}
|
||||
|
||||
fn autoscroll(p: ColorPalette) -> scrollable::AutoScroll {
|
||||
scrollable::AutoScroll {
|
||||
background: Background::Color(Color {
|
||||
a: 0.05,
|
||||
..p.base.background
|
||||
}),
|
||||
border: Border {
|
||||
color: Color::TRANSPARENT,
|
||||
width: 0.0,
|
||||
radius: 5.0.into(),
|
||||
},
|
||||
shadow: Shadow::default(),
|
||||
icon: p.bright.surface,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Description(theme: &Theme, _status: scrollable::Status) -> scrollable::Style {
|
||||
let p = theme.palette();
|
||||
let (v, h) = rails(p.normal.surface);
|
||||
|
|
@ -595,6 +613,7 @@ pub mod Scrollable {
|
|||
vertical_rail: v,
|
||||
horizontal_rail: h,
|
||||
gap: Some(Background::Color(Color::TRANSPARENT)),
|
||||
auto_scroll: autoscroll(p),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -606,6 +625,7 @@ pub mod Scrollable {
|
|||
vertical_rail: v,
|
||||
horizontal_rail: h,
|
||||
gap: Some(Background::Color(Color::TRANSPARENT)),
|
||||
auto_scroll: autoscroll(p),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ impl About {
|
|||
let row = row![website_btn, wiki_btn, issue_btn, log_btn,].spacing(20);
|
||||
|
||||
let content = column![
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
descr_container,
|
||||
update_container,
|
||||
row,
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ use crate::gui::widgets::package_row::{Message as RowMessage, PackageRow};
|
|||
use crate::gui::widgets::text;
|
||||
use iced::widget::scrollable::{Direction, Scrollbar};
|
||||
use iced::widget::{
|
||||
Column, Space, button, checkbox, column, container, horizontal_space, pick_list, radio, row,
|
||||
scrollable, text_editor, text_input, tooltip, vertical_rule,
|
||||
Column, Space, button, checkbox, column, container, pick_list, radio, row, rule, scrollable,
|
||||
text_editor, text_input, tooltip,
|
||||
};
|
||||
use iced::{Alignment, Element, Length, Renderer, Task, alignment};
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ impl List {
|
|||
.on_input(Message::SearchInputChanged)
|
||||
.padding([5, 10]);
|
||||
|
||||
let select_all_checkbox = checkbox("", self.all_selected)
|
||||
let select_all_checkbox = checkbox(self.all_selected)
|
||||
.on_toggle(Message::ToggleAllSelected)
|
||||
.size(20)
|
||||
.style(style::CheckBox::SettingsEnabled)
|
||||
|
|
@ -377,7 +377,7 @@ impl List {
|
|||
|
||||
let action_row = row![
|
||||
export_selection,
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
review_selection
|
||||
]
|
||||
.width(Length::Fill)
|
||||
|
|
@ -404,7 +404,7 @@ impl List {
|
|||
// Fallback notifications area
|
||||
let notifications_area: Element<'_, Message, Theme, Renderer> =
|
||||
if self.fallback_notifications.is_empty() {
|
||||
Space::new(Length::Shrink, Length::Shrink).into()
|
||||
Space::new().into()
|
||||
} else {
|
||||
let notification_texts: Vec<_> = self
|
||||
.fallback_notifications
|
||||
|
|
@ -417,7 +417,7 @@ impl List {
|
|||
text("Fallback Actions Performed:").style(style::Text::Default),
|
||||
column(notification_texts).spacing(4),
|
||||
row![
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
button(text("Dismiss"))
|
||||
.on_press(Message::DismissFallbackNotifications)
|
||||
.style(style::Button::Primary)
|
||||
|
|
@ -489,11 +489,11 @@ impl List {
|
|||
let file_row = row![text(EXPORT_FILE_NAME).style(style::Text::Commentary)].padding(20);
|
||||
|
||||
let modal_btn_row = row![
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
button(text("Close").width(Length::Shrink))
|
||||
.width(Length::Shrink)
|
||||
.on_press(Message::ModalHide),
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
];
|
||||
|
||||
let ctn = container(column![title, text_box, file_row, modal_btn_row])
|
||||
|
|
@ -591,7 +591,7 @@ impl List {
|
|||
|
||||
let modal_btn_row = row![
|
||||
button(text("Cancel")).on_press(Message::ModalHide),
|
||||
horizontal_space(),
|
||||
Space::new().width(Length::Fill),
|
||||
button(text("Apply")).on_press(Message::ModalValidate),
|
||||
]
|
||||
.padding(iced::Padding {
|
||||
|
|
@ -1406,25 +1406,25 @@ fn recap<'a>(settings: &Settings, recap: &SummaryEntry) -> Element<'a, Message,
|
|||
text(recap.category.to_string())
|
||||
.size(19)
|
||||
.width(Length::FillPortion(1)),
|
||||
vertical_rule(5),
|
||||
rule::vertical(5),
|
||||
row![
|
||||
if settings.device.disable_mode {
|
||||
text("Disable").style(style::Text::Danger)
|
||||
} else {
|
||||
text("Uninstall").style(style::Text::Danger)
|
||||
},
|
||||
horizontal_space(),
|
||||
Space::new().width(Length::Fill),
|
||||
text(recap.discard.to_string()).style(style::Text::Danger)
|
||||
]
|
||||
.width(Length::FillPortion(1)),
|
||||
vertical_rule(5),
|
||||
rule::vertical(5),
|
||||
row![
|
||||
if settings.device.disable_mode {
|
||||
text("Enable").style(style::Text::Ok)
|
||||
} else {
|
||||
text("Restore").style(style::Text::Ok)
|
||||
},
|
||||
horizontal_space(),
|
||||
Space::new().width(Length::Fill),
|
||||
text(recap.restore.to_string()).style(style::Text::Ok)
|
||||
]
|
||||
.width(Length::FillPortion(1))
|
||||
|
|
|
|||
|
|
@ -390,13 +390,11 @@ impl Settings {
|
|||
}
|
||||
|
||||
fn general_container(&self) -> Element<'_, Message, Theme, Renderer> {
|
||||
let expert_mode_checkbox = checkbox(
|
||||
"Allow to uninstall packages marked as \"unsafe\" (I KNOW WHAT I AM DOING)",
|
||||
self.general.expert_mode,
|
||||
)
|
||||
.on_toggle(Message::ExpertMode)
|
||||
.size(20)
|
||||
.style(style::CheckBox::SettingsEnabled);
|
||||
let expert_mode_checkbox = checkbox(self.general.expert_mode)
|
||||
.label("Allow to uninstall packages marked as \"unsafe\" (I KNOW WHAT I AM DOING)")
|
||||
.on_toggle(Message::ExpertMode)
|
||||
.size(20)
|
||||
.style(style::CheckBox::SettingsEnabled);
|
||||
|
||||
let expert_mode_descr =
|
||||
text("Most unsafe packages are known to bootloop the device if removed.")
|
||||
|
|
@ -413,7 +411,7 @@ impl Settings {
|
|||
let choose_backup_row = row![
|
||||
choose_backup_btn,
|
||||
"Choose backup folder",
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
"Current folder: ",
|
||||
text(self.general.backup_folder.to_string_lossy())
|
||||
]
|
||||
|
|
@ -442,7 +440,7 @@ impl Settings {
|
|||
text("The following settings only affect the currently selected device:")
|
||||
.style(style::Text::Danger),
|
||||
text(phone.model.clone()),
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
text(phone.adb_id.clone()).style(style::Text::Commentary)
|
||||
]
|
||||
.spacing(7),
|
||||
|
|
@ -469,13 +467,11 @@ impl Settings {
|
|||
.style(style::Text::Danger)
|
||||
];
|
||||
|
||||
let multi_user_mode_checkbox = checkbox(
|
||||
"Affect all the users of the device (not only the selected user)",
|
||||
self.device.multi_user_mode,
|
||||
)
|
||||
.on_toggle(Message::MultiUserMode)
|
||||
.size(20)
|
||||
.style(style::CheckBox::SettingsEnabled);
|
||||
let multi_user_mode_checkbox = checkbox(self.device.multi_user_mode)
|
||||
.label("Affect all the users of the device (not only the selected user)")
|
||||
.on_toggle(Message::MultiUserMode)
|
||||
.size(20)
|
||||
.style(style::CheckBox::SettingsEnabled);
|
||||
|
||||
let disable_checkbox_style = if phone.android_sdk >= 23 {
|
||||
style::CheckBox::SettingsEnabled
|
||||
|
|
@ -495,24 +491,22 @@ impl Settings {
|
|||
.height(22)
|
||||
.style(style::Button::Unavailable);
|
||||
|
||||
let disable_mode_checkbox = checkbox(
|
||||
"Clear and disable packages instead of uninstalling them",
|
||||
self.device.disable_mode,
|
||||
)
|
||||
.on_toggle(Message::DisableMode)
|
||||
.size(20)
|
||||
.style(disable_checkbox_style);
|
||||
let disable_mode_checkbox = checkbox(self.device.disable_mode)
|
||||
.label("Clear and disable packages instead of uninstalling them")
|
||||
.on_toggle(Message::DisableMode)
|
||||
.size(20)
|
||||
.style(disable_checkbox_style);
|
||||
|
||||
let disable_setting_row = if phone.android_sdk >= 23 {
|
||||
row![
|
||||
disable_mode_checkbox,
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
]
|
||||
.width(Length::Fill)
|
||||
} else {
|
||||
row![
|
||||
disable_mode_checkbox,
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
unavailable_btn,
|
||||
]
|
||||
.width(Length::Fill)
|
||||
|
|
@ -580,7 +574,7 @@ impl Settings {
|
|||
let backup_row = row![
|
||||
backup_btn,
|
||||
"Backup the current state of the phone",
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
locate_backup_btn,
|
||||
]
|
||||
.spacing(10)
|
||||
|
|
@ -592,7 +586,7 @@ impl Settings {
|
|||
row![
|
||||
restore_btn(true),
|
||||
"Restore the state of the device",
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
text(self.device.backup.backup_state.clone()).style(style::Text::Danger),
|
||||
backup_pick_list,
|
||||
]
|
||||
|
|
@ -603,7 +597,7 @@ impl Settings {
|
|||
let export_row = row![
|
||||
export_btn,
|
||||
"Export uninstalled packages with their description",
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
text(format!(
|
||||
"Selected: user {}",
|
||||
apps_view.selected_user.unwrap_or_default().id
|
||||
|
|
@ -651,11 +645,11 @@ impl Settings {
|
|||
.padding(20);
|
||||
|
||||
let modal_btn_row = row![
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
button(text("Close").width(Length::Shrink))
|
||||
.width(Length::Shrink)
|
||||
.on_press(Message::ModalHide),
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
];
|
||||
|
||||
let ctn = container(column![title, text_box, file_row, modal_btn_row])
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use iced::advanced::widget::{self, Tree, Widget};
|
||||
use iced::advanced::{Clipboard, Layout, Shell, layout, overlay, renderer};
|
||||
use iced::mouse::{self, Cursor};
|
||||
use iced::{Alignment, Color, Element, Event, Length, Point, Rectangle, Size, advanced, event};
|
||||
use iced::{Alignment, Color, Element, Event, Length, Point, Rectangle, Size, Vector, advanced};
|
||||
|
||||
/// A widget that centers a modal element over some base element
|
||||
pub struct Modal<'a, Message, Theme, Renderer> {
|
||||
|
|
@ -52,28 +52,28 @@ where
|
|||
}
|
||||
|
||||
fn layout(
|
||||
&self,
|
||||
&mut self,
|
||||
tree: &mut Tree,
|
||||
renderer: &Renderer,
|
||||
limits: &layout::Limits,
|
||||
) -> layout::Node {
|
||||
self.base
|
||||
.as_widget()
|
||||
.as_widget_mut()
|
||||
.layout(&mut tree.children[0], renderer, limits)
|
||||
}
|
||||
|
||||
fn on_event(
|
||||
fn update(
|
||||
&mut self,
|
||||
state: &mut Tree,
|
||||
event: Event,
|
||||
event: &Event,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Cursor,
|
||||
renderer: &Renderer,
|
||||
clipboard: &mut dyn Clipboard,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
viewport: &Rectangle,
|
||||
) -> event::Status {
|
||||
self.base.as_widget_mut().on_event(
|
||||
) {
|
||||
self.base.as_widget_mut().update(
|
||||
&mut state.children[0],
|
||||
event,
|
||||
layout,
|
||||
|
|
@ -82,7 +82,7 @@ where
|
|||
clipboard,
|
||||
shell,
|
||||
viewport,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fn draw(
|
||||
|
|
@ -109,9 +109,10 @@ where
|
|||
fn overlay<'b>(
|
||||
&'b mut self,
|
||||
state: &'b mut Tree,
|
||||
layout: Layout<'_>,
|
||||
layout: Layout<'b>,
|
||||
_renderer: &Renderer,
|
||||
_translation: iced::Vector,
|
||||
viewport: &Rectangle,
|
||||
_translation: Vector,
|
||||
) -> Option<overlay::Element<'b, Message, Theme, Renderer>> {
|
||||
Some(overlay::Element::new(Box::new(Overlay {
|
||||
position: layout.position(),
|
||||
|
|
@ -119,6 +120,7 @@ where
|
|||
tree: &mut state.children[1],
|
||||
size: layout.bounds().size(),
|
||||
on_blur: self.on_blur.clone(),
|
||||
viewport: *viewport,
|
||||
})))
|
||||
}
|
||||
|
||||
|
|
@ -140,14 +142,14 @@ where
|
|||
}
|
||||
|
||||
fn operate(
|
||||
&self,
|
||||
&mut self,
|
||||
state: &mut Tree,
|
||||
layout: Layout<'_>,
|
||||
renderer: &Renderer,
|
||||
operation: &mut dyn widget::Operation,
|
||||
) {
|
||||
self.base
|
||||
.as_widget()
|
||||
.as_widget_mut()
|
||||
.operate(&mut state.children[0], layout, renderer, operation);
|
||||
}
|
||||
}
|
||||
|
|
@ -158,6 +160,7 @@ struct Overlay<'a, 'b, Message, Theme, Renderer> {
|
|||
tree: &'b mut Tree,
|
||||
size: Size,
|
||||
on_blur: Option<Message>,
|
||||
viewport: Rectangle,
|
||||
}
|
||||
|
||||
impl<Message, Theme, Renderer> overlay::Overlay<Message, Theme, Renderer>
|
||||
|
|
@ -173,22 +176,22 @@ where
|
|||
|
||||
let child = self
|
||||
.content
|
||||
.as_widget()
|
||||
.as_widget_mut()
|
||||
.layout(self.tree, renderer, &limits)
|
||||
.align(Alignment::Center, Alignment::Center, limits.max());
|
||||
|
||||
layout::Node::with_children(self.size, vec![child]).move_to(self.position)
|
||||
}
|
||||
|
||||
fn on_event(
|
||||
fn update(
|
||||
&mut self,
|
||||
event: Event,
|
||||
event: &Event,
|
||||
layout: Layout<'_>,
|
||||
cursor: Cursor,
|
||||
renderer: &Renderer,
|
||||
clipboard: &mut dyn Clipboard,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
) -> event::Status {
|
||||
) {
|
||||
if let Some(message) = self.on_blur.as_ref()
|
||||
&& matches!(
|
||||
event,
|
||||
|
|
@ -203,11 +206,11 @@ where
|
|||
.bounds();
|
||||
if !content_bounds.contains(cursor_position) {
|
||||
shell.publish(message.clone());
|
||||
return event::Status::Captured;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
self.content.as_widget_mut().on_event(
|
||||
self.content.as_widget_mut().update(
|
||||
self.tree,
|
||||
event,
|
||||
layout.children().next().unwrap(),
|
||||
|
|
@ -215,8 +218,8 @@ where
|
|||
renderer,
|
||||
clipboard,
|
||||
shell,
|
||||
&layout.bounds(),
|
||||
)
|
||||
&self.viewport,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw(
|
||||
|
|
@ -255,7 +258,7 @@ where
|
|||
renderer: &Renderer,
|
||||
operation: &mut dyn widget::Operation,
|
||||
) {
|
||||
self.content.as_widget().operate(
|
||||
self.content.as_widget_mut().operate(
|
||||
self.tree,
|
||||
layout.children().next().unwrap(),
|
||||
renderer,
|
||||
|
|
@ -267,14 +270,13 @@ where
|
|||
&self,
|
||||
layout: Layout<'_>,
|
||||
cursor: Cursor,
|
||||
viewport: &Rectangle,
|
||||
renderer: &Renderer,
|
||||
) -> mouse::Interaction {
|
||||
self.content.as_widget().mouse_interaction(
|
||||
self.tree,
|
||||
layout.children().next().unwrap(),
|
||||
cursor,
|
||||
viewport,
|
||||
&self.viewport,
|
||||
renderer,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ pub fn nav_menu<'a>(
|
|||
reboot_btn,
|
||||
apps_refresh_tooltip,
|
||||
pick_list(device_list, Some(phone), Message::DeviceSelected,),
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
uad_version_text,
|
||||
update_btn,
|
||||
apps_btn,
|
||||
|
|
@ -94,7 +94,7 @@ pub fn nav_menu<'a>(
|
|||
reboot_btn,
|
||||
apps_refresh_tooltip,
|
||||
device_list_text,
|
||||
Space::new(Length::Fill, Length::Shrink),
|
||||
Space::new().width(Length::Fill).height(Length::Shrink),
|
||||
uad_version_text,
|
||||
update_btn,
|
||||
apps_btn,
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ impl PackageRow {
|
|||
|| self.state != PackageState::Enabled
|
||||
|| settings.general.expert_mode
|
||||
{
|
||||
selection_checkbox = checkbox("", self.selected)
|
||||
selection_checkbox = checkbox(self.selected)
|
||||
.on_toggle(Message::ToggleSelection)
|
||||
.size(20)
|
||||
.style(style::CheckBox::PackageEnabled);
|
||||
|
|
@ -107,7 +107,7 @@ impl PackageRow {
|
|||
)
|
||||
.on_press(Message::ActionPressed);
|
||||
} else {
|
||||
selection_checkbox = checkbox("", self.selected)
|
||||
selection_checkbox = checkbox(self.selected)
|
||||
.on_toggle(Message::ToggleSelection)
|
||||
.size(20)
|
||||
.style(style::CheckBox::PackageDisabled);
|
||||
|
|
@ -126,6 +126,7 @@ impl PackageRow {
|
|||
text(&self.name).width(Length::FillPortion(8)),
|
||||
action_btn.style(button_style)
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center)
|
||||
)
|
||||
.padding(8)
|
||||
|
|
@ -136,7 +137,7 @@ impl PackageRow {
|
|||
})
|
||||
.width(Length::Fill)
|
||||
.on_press(Message::PackagePressed),
|
||||
Space::with_width(15)
|
||||
Space::new().width(Length::Fixed(15.0))
|
||||
]
|
||||
.align_y(Alignment::Center)
|
||||
.into()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue