feat: optimize code && merge some funs to a signle file#111
Open
ColdWindScholar wants to merge 911 commits into
Open
feat: optimize code && merge some funs to a signle file#111ColdWindScholar wants to merge 911 commits into
ColdWindScholar wants to merge 911 commits into
Conversation
This commit updates the `Miuix KMP` library to version `0.5.0`.
It also refactors the usage of the `Card` composable across multiple files to use the new `colors` parameter instead of the deprecated `color` parameter.
Additionally, the CPU Frequency (`cpu_freq.kt`) screen has been updated:
- Replaced Haze blur effect with `LiquidGlass` for the TopAppBar and icon buttons (Back).
- Improved the logic for fetching CPU frequencies by using `coroutineScope` and `async` for concurrent operations.
- Pull-to-refresh mechanism is now triggered by changes in an `isRefreshing` state variable rather than directly observing `pullToRefreshState.isRefreshing`.
- Cleaned up some unused imports and simplified state management.
Key changes:
- **`gradle/libs.versions.toml`**: Updated `miuix` version to `0.5.0`.
- **Various UI files**:
- Changed `Card(color = ...)` to `Card(colors = CardDefaults.defaultColors(...))` in:
- `ResetApp.kt`
- `FunAppSele.kt`
- `Main_Module.kt`
- `about_contributors.kt`
- `WantFind.kt`
- `about_references.kt`
- `FunNoEnable.kt`
- **`cpufreq.kt`**:
- Removed Haze library dependencies and usage.
- Implemented `LiquidGlass` for the TopAppBar background and back button.
- `getAllCoresFrequencies()` now uses `coroutineScope` and `async` to fetch frequencies for each core concurrently.
- Refresh logic now relies on an `isRefreshing` `MutableState`.
- Removed unused `HazeState`, `HazeStyle`, and related blur configurations.
- Back button is now a `Box` with `liquidGlass` and `clickable` modifiers instead of `IconButton`.
- **`FunPage.kt`**:
- Removed `enable_blur` preference check as `LiquidGlass` is now used for background effects.
- TopAppBar color is set to `Color.Transparent` to allow `LiquidGlass` to show through.
The line `isRefreshing = true` within the `LaunchedEffect` in `cpufreq.kt` was redundant because the effect is triggered when `isRefreshing` becomes `true`. This commit removes the unnecessary assignment.
This commit refactors the `FunSwich` component and its underlying `SuperSwitch` and visual `Switch` components.
**Key Changes:**
- **`FunSwich.kt`:**
- **Replaced `top.yukonga.miuix.kmp.extra.SuperSwitch` with a local implementation.**
- **`SuperSwitch` Refactor:**
- The entire `BasicComponent` (row) is now the clickable area to toggle the switch.
- The `onClick` handler in `BasicComponent` now manages calling `onCheckedChange` with the new state.
- The visual `Switch` component is now purely presentational and receives its `checked` state from `SuperSwitch`. It no longer handles any direct user interaction (clicks or drags).
- `SuperSwitchRightActions` helper composable was introduced to manage the layout of right-side actions alongside the visual `Switch`.
- **New `Switch` Composable (Visual Only):**
- A new, simplified `Switch` composable is introduced.
- It's a purely visual component; its appearance (thumb position, track color) is determined solely by the `checked` and `enabled` parameters passed to it.
- All interaction modifiers (`clickable`, `draggable`) have been removed.
- Uses `animateDpAsState` and `animateColorAsState` for smooth transitions based on the `checked` state.
- **`SwitchDefaults` and `SwitchColors`:**
- `switchColors` now uses `LocalColorMode` to determine dark/light mode for track colors, falling back to `isSystemInDarkTheme()` if mode is auto.
- **`BasicComponent.kt` (moved from `SearchList.kt` and adapted):**
- This component, previously part of `SearchList.kt`, is now part of `FunSwich.kt`'s local implementation.
- The `onClick` parameter is now directly used by its `clickable` modifier to handle interactions for the entire component.
- Vertical padding in `InsideMargin` changed from `16.dp` to `8.dp`.
- **`BasicComponentDefaults` and `BasicComponentColors` (moved from `SearchList.kt`):**
- These supporting objects/classes are also moved to `FunSwich.kt`.
- **`SearchList.kt`:**
- Removed `BasicComponentDefaults` and `BasicComponentColors` as they are now co-located with the `BasicComponent` implementation in `FunSwich.kt`.
This refactoring centralizes the interaction logic within `SuperSwitch` (via `BasicComponent`), making the visual `Switch` component simpler and purely presentational. It also improves the user experience by making the entire row of `FunSwich` tappable to toggle its state.
…ifications
This commit modifies the GitHub Actions workflow to properly escape special characters in the commit message before sending it as a Telegram notification.
Key Changes:
- **`android.yml`:**
- Added a new step "Get Commit Message" to retrieve the latest commit message and store it in the `COMMIT_MSG` environment variable.
- Added a new step "Escape special characters for Telegram" which uses `sed` to escape characters like `[]\[_*()~>#+\-=|{}.!` in the `COMMIT_MSG`. The escaped message is stored in `steps.escape.outputs.ESCAPED_COMMIT_MSG`.
- Updated the "Send Notification to Telegram" step to use the `ESCAPED_COMMIT_MSG` in the notification message.
This prevents formatting issues in Telegram messages caused by unescaped characters in commit messages.
This commit updates the GitHub Actions workflow for Android builds to correctly capture and handle multi-line commit messages. Previously, only the first line of a commit message might have been captured. The workflow now uses a multi-line string approach with `<<EOF` to ensure the entire commit message body is stored in the `COMMIT_MSG` environment variable. This allows for accurate use of the full commit message in subsequent steps, such as Telegram notifications. Key changes in `.github/workflows/android.yml`: - Modified "Get Commit Message" step (renamed to "Get Full Commit Message") to use `echo "COMMIT_MSG<<EOF" >> $GITHUB_ENV`, followed by the git log output, and then `echo "EOF" >> $GITHUB_ENV`.
This commit simplifies and consolidates the steps for preparing and sending commit messages to Telegram in the GitHub Actions workflow. - **Combined Steps:** Merged the "Sanitize multiline commit message" and "Get Full Commit Message" steps into a single "Get and escape submission information" step. - **Improved Escaping:** The `sed` command for escaping special characters is now applied directly to the full commit message obtained via `git log`. - **Environment Variable to Output:** Changed from setting `COMMIT_MSG` as an environment variable (`GITHUB_ENV`) to directly setting `escaped_commit_msg` as a step output (`GITHUB_OUTPUT`). This is then used by the `telegram-action`. - **Action Update:** Updated `appleboy/telegram-action` from `v0.1.1` to `master`. - **Output Variable Renaming:** The output variable used in the Telegram message is now `steps.prepare_message.outputs.escaped_commit_msg` (previously `steps.escape.outputs.ESCAPED_COMMIT_MSG`). These changes streamline the workflow by reducing the number of steps and ensuring more robust escaping of special characters for Telegram messages.
The `sed` command in the `android.yml` workflow was updated to correctly escape the hyphen (`-`) character. Previously, it was missing from the set of characters to be escaped, which could lead to formatting issues when sending commit messages to Telegram.
The character class in the `sed` substitution command was changed from `[]\[_*()~`>#+\-=|{}.!]` to `[]\[_*()~`>#+=|{}.!-` to include the hyphen.
本次提交对 `FunSwich` 及其依赖的组件进行了深度重构,并引入了本地化的 `Card` 组件,旨在统一UI、简化代码并改善用户交互。
## 核心变更
### 1. `FunSwich` 交互与视觉解耦
- **本地化 `SuperSwitch`**: 移除了对 `top.yukonga.miuix.kmp.extra.SuperSwitch` 的外部依赖,替换为一个更符合当前需求的本地实现。
- **改进交互逻辑**:
- 将整个 `BasicComponent` (即列表行) 作为可点击区域来切换开关状态,提升了用户操作的便捷性。
- 交互逻辑(`onClick`)被上移至 `SuperSwitch` 层面进行统一管理。
- **纯展示性 `Switch`**:
- 内部的 `Switch` 组件被重构为一个纯粹的视觉组件,其外观完全由外部传入的 `checked` 和 `enabled` 状态驱动。
- 移除了所有手势交互修饰符(如 `clickable`, `draggable`),使其职责更单一。
- 使用 `animateDpAsState` 和 `animateColorAsState` 实现平滑的开关状态过渡动画。
### 2. `Card` 组件本地化与样式统一
- **引入本地 `Card.kt`**: 新增了项目内的 `Card` Composable,替换了所有对外部库 `top.yukonga.miuix.kmp.basic.Card` 的调用。
- **简化调用**: 新的 `Card` 组件内置了默认的 `Modifier`(如 `fillMaxWidth` 和标准化的 `padding`),极大地简化了应用内各个调用点的代码,并确保了卡片样式的一致性。
### 3. `BasicComponent` 模块化
- **文件迁移**: 将原先位于 `SearchList.kt` 内的 `BasicComponent` 及其附属的 `Defaults` 和 `Colors` 类,迁移到独立的 `funlistui/BasicComponent.kt` 文件中。
- **代码复用**: 此举增强了 `BasicComponent` 的模块化和复用性。
- **样式微调**: 将 `BasicComponent` 的垂直内边距从 `16.dp` 调整为 `8.dp`,使布局更紧凑。
### 4. 代码清理
- **移除冗余代码**: 从 `SearchList.kt` 中删除了已迁移的 `BasicComponent` 相关代码。
- **简化 `addline`**: `addline` Composable 的实现被简化,统一了其内边距。
This commit replaces all instances of `SuperArrow` with a new `FunArrow` composable.
**Key Changes:**
- **New `FunArrow.kt`:**
- Created `FunArrow.kt` which internally uses `top.yukonga.miuix.kmp.extra.SuperArrow`.
- `FunArrow` now handles navigation via an optional `category` parameter and `navController`. If `category` is provided, it navigates to that route before executing the `onClick` lambda.
- Added a `coui_btn_next_normal.xml` drawable for the arrow icon, which is used by the underlying `SuperArrow`.
- **UI Updates:**
- `FunSlider.kt`
- `recent_update.kt`
- `com/android/launcher/main.kt`
- `com/android/systemui/main.kt`
- `com/android/systemui/hardware_indicator.kt`
- `about/about_group.kt`
- `com/android/systemui/status_bar_clock.kt`
- `about/Main_About.kt` (including `IconSuperArrow` renamed to `IconFunArrow`)
- `FunAppSele.kt`
- `about/about_contributors.kt`
- `about/about_references.kt`
- `android/main.kt`
- `FunString.kt`
- `com/android/settings/main.kt`
- All instances of `top.yukonga.miuix.kmp.extra.SuperArrow` were replaced with `com.suqi8.oshin.ui.activity.funlistui.FunArrow`.
This refactoring centralizes the arrow component logic within `FunArrow` and standardizes its usage across the application, particularly for navigation-related actions.
The `NavController` parameter in the `FunArrow` composable is now nullable. This allows `FunArrow` to be used in contexts where navigation is not required or handled differently, by simply not navigating if `navController` is null. - Changed `navController: NavController` to `navController: NavController?`. - Added a null check before calling `navController.navigate(route)`. - Removed the default value `NavController(LocalContext.current)` for `navController`.
- Changed `navController` parameter in `FunArrow` to be optional (nullable). - Changed `category` parameter in `FunArrow` to be optional (nullable). This makes the `FunArrow` component more flexible by not strictly requiring a `NavController` or a `category` for its usage.
This commit refactors the `FunListItem` composable to enhance the vertical alignment of its `title` and `summary` text.
Key Changes:
- `BasicComponent.kt`:
- Wrapped the `Text` composables for `title` and `summary` within `Box` layouts.
- Applied `Modifier.heightIn(min = ...)` to these `Box`es to ensure a minimum height (21.14.dp for title, 18.57.dp for summary).
- Set `contentAlignment = Alignment.Center` for the `Box`es to vertically center the `Text` within the specified minimum height.
This change aims to provide more consistent and visually appealing vertical positioning of the text elements, especially when only one of the title or summary is present.
…oved structure
This commit significantly refactors the `FunSwich` and related `Switch` components.
**Key Changes:**
- **`FunSwich.kt`:**
- **`Switch` Component Overhaul:**
- The core visual `Switch` component is now purely presentational, driven entirely by its `checked` state and does not handle interaction events.
- Implemented a "sticky stretch" animation for the thumb:
- The thumb width animates (stretches and then shrinks) during the transition between checked and unchecked states.
- The thumb offset animation is coordinated with the width animation to create a more dynamic and engaging visual effect.
- `updateTransition` is used to manage these animations.
- Added a subtle shadow to the thumb using `graphicsLayer` for better visual depth and anti-aliasing.
- Track and thumb sizes are now more clearly defined.
- Animation duration for all transitions (thumb offset, width, colors) is standardized.
- **`SuperSwitch` Component:**
- This component now acts as an intermediate layer that wraps the purely visual `Switch` and integrates it with a `BasicComponent` (a row-like layout).
- The entire `SuperSwitch` row is clickable to toggle the state, delegating the actual state change to the `onCheckedChange` callback.
- Renamed internal composable `RightActions` to `SuperSwitchRightActions` for clarity.
- **`FunSwich` Component (Top-Level):**
- Remains the top-level composable responsible for state persistence using YukiHookAPI `prefs`.
- Passes down the persisted state and callbacks to `SuperSwitch`.
- **`SwitchDefaults.switchColors()`:**
- Parameter names clarified for better understanding of light/dark mode and checked/unchecked states.
- **KDoc Documentation:**
- Added and improved KDoc for all components (`FunSwich`, `SuperSwitch`, `Switch`, `SwitchColors`, `SwitchDefaults`) to better explain their purpose, parameters, and relationships.
- Clarified the separation of concerns: `FunSwich` for data, `SuperSwitch` for layout integration and unified click handling, and `Switch` for pure visual representation and animation.
This refactoring aims to create a more robust, visually appealing, and well-structured Switch implementation with clearer separation of concerns and improved animations.
This commit introduces haptic feedback to the `FunSwich` and `SuperSwitch` components, triggering a vibration when the switch toggle animation completes. It also refines the visual animation of the `Switch` component.
Key Changes:
- **`FunSwich.kt` & `SuperSwitch.kt`:**
- Added an `onAnimationFinished` callback parameter to `SuperSwitch` and `Switch`.
- In `FunSwich`, when the switch state changes, haptic feedback (`HapticFeedbackType.ContextClick`) is now performed via the `onAnimationFinished` callback of the underlying `Switch`. This ensures the feedback aligns with the visual completion of the toggle.
- Updated documentation to reflect the new haptic feedback feature and the requirement for the `VIBRATE` permission in `AndroidManifest.xml`.
- **`Switch.kt` (Visual Animation):**
- **Animation End Detection:** Implemented `LaunchedEffect` to monitor the `transition.isRunning` state. The `onAnimationFinished` callback is invoked when the animation transitions from running to finished.
- **"Overshoot" Animation:** Modified the `thumbOffset` keyframe animation to include an "overshoot" effect. The thumb now slightly moves past its final destination before settling, creating a more dynamic and springy feel.
- `animationDuration` increased from 250ms to 300ms to accommodate the refined animation.
- New `overshoot` dp value introduced to control the extent of the overshoot.
- Removed `graphicsLayer` from the thumb as its primary purpose was shadow, which is now handled implicitly or differently. The comment about antialiasing was also removed.
- Removed `@SuppressLint("UnusedTransitionTargetStateParameter")` as it's no longer necessary.
These changes aim to improve the user experience by providing tactile feedback and a more polished visual animation for the switch components.
This commit reimplements the `FunDropdown` and `SuperDropdown` composables locally, removing the dependency on `top.yukonga.miuix.kmp.extra.SuperDropdown`.
**Key Changes:**
- **`FunDropdown.kt`:**
- The `SuperDropdown` composable, previously imported from `top.yukonga.miuix.kmp.extra`, is now defined directly within this file.
- This new `SuperDropdown` implementation includes:
- `ListPopup`: A custom popup component for displaying dropdown items.
- It manages its position based on available space and alignment preferences.
- It supports window dimming and shadow elevation.
- It uses `SubcomposeLayout` for `ListPopupColumn` to correctly measure and arrange items, ensuring the popup width adapts to the widest item.
- `DropdownImpl`: A composable for rendering individual dropdown items with selection state and checkmark.
- `DropdownColors` and `DropdownDefaults`: Define and provide default colors for dropdown states.
- `DropDownMode`: An enum to control the alignment of the dropdown (Normal, AlwaysOnRight).
- `PopupPositionProvider`: An interface and default implementations (`DropdownPositionProvider`, `ContextMenuPositionProvider`) for calculating popup positions.
- Utilizes standard Compose components like `Box`, `Row`, `Image`, `Text`, and modifiers for layout and interaction.
- Integrates `MiuixTheme` for styling and `MiuixIcons` for arrow and checkmark icons.
- Handles haptic feedback on dropdown open and item selection.
- Implements `BackHandler` for dismissing the popup.
- The core logic of saving and retrieving preference values using `prefs` remains unchanged.
- **`FunPicSele.kt`:**
- Removed unused import `top.yukonga.miuix.kmp.basic.BasicComponent`.
This refactoring internalizes the dropdown functionality, reducing external dependencies and providing more direct control over its appearance and behavior within the Oshin app.
Fix(UI): Correctly execute command in getRootStatus()
This commit refactors the `BottomTabs` component to enhance its interaction and state management, particularly in relation to tab selection and animation.
**Key Changes:**
- **`MainActivity.kt`:**
- The `selectedIndex` parameter passed to `BottomTabs` is now `targetPage` (a `MutableState<Int>`) instead of `pagerState.currentPage` (an `Int`). This allows `BottomTabs` to directly observe and update the target page state.
- Removed the direct update of `targetPage.intValue` within the `onTabSelected` callback in `MainActivity`, as this is now handled within `BottomTabs`.
- `userScrollEnabled` for the `HorizontalPager` is set to `true`, allowing users to swipe between pages.
- **`BottomTabs.kt`:**
- **State Management:**
- Changed `selectedIndex: Int` parameter to `selectedIndexState: MutableState<Int>`. `BottomTabs` now observes and modifies this mutable state directly.
- `itemBackground` and `LaunchedEffect` dependencies updated to use `selectedIndexState.value`.
- **Tab Selection Animation:**
- When a tab is tapped:
- If the tapped tab is not the currently selected one, `selectedIndexState.value` is updated.
- The `onTabSelected` callback is invoked to notify the parent.
- A coroutine is launched to animate the `offset` of the selection indicator to the new tab's position using `MotionScheme.slowSpatial()`.
- `isDragging` is temporarily set to `true` and then `false` after a short delay (200ms) to ensure the item background alpha animation triggers correctly during the transition.
- **Drag Interaction:**
- When dragging the selection indicator ends:
- The `targetIndex` is calculated based on the drag offset.
- If the `targetIndex` is different from the current `selectedIndexState.value`, the state is updated, and `onTabSelected` is called.
- The `offset` is animated to the `targetIndex`'s position using `MotionScheme.defaultSpatial()`.
These changes aim to provide a more responsive and fluid user experience for the bottom navigation, synchronizing tab selection with page changes and indicator animations more effectively, especially when interacting via taps or drags. User scrolling of the `HorizontalPager` is also re-enabled.
…nt styles
This commit introduces several changes related to the LiquidGlass effect and UI components:
**LiquidGlass Optimization:**
- **`InnerRefraction.kt`:** Changed the default `depthEffect` from `1f` to `0f`. This means depth effect is now opt-in, potentially improving performance when not explicitly needed.
- **`LiquidGlassModifier.kt`:**
- Conditionally loads a different AGSL shader (`refractionShaderWidthDepthEffectString`) if `style.innerRefraction.depthEffect > 0f`.
- The standard `refractionShaderString` (without depth effect calculations) is used if `depthEffect` is `0f`.
- The `depthEffect` uniform is now only set in the shader if it's being used.
- Optimized layer recording by moving it inside the `graphicsLayer?.let` block.
- **`GlassShaders.kt`:**
- Split the existing `refractionShaderString` into two:
- `refractionShaderString`: For inner refraction without depth effect.
- `refractionShaderWidthDepthEffectString`: For inner refraction with depth effect. This version includes the `depthEffect` uniform and related calculations.
**UI Component Styling and Behavior:**
- **`BottomTabsScope.kt` & `BottomTabs.kt`:**
- `BottomTab` now receives a `color: ColorProducer` lambda for its `icon` and `label` composables, allowing dynamic tinting based on selection state.
- Updated `Content` in `BottomTab` to pass `contentColor` to `icon` and `label`.
- Changed `CornerShape.full` to `RoundedCornerShape(50)` for various elements in `BottomTabs` (indicator, background, individual tabs) for a consistent rounded look.
- Modified animation specs for tab offset and indicator animations to use `spring(0.8f, 200f)` for a more natural feel.
- **`MainActivity.kt`:**
- Updated `topAppBarStyle` to use `RoundedCornerShape(28.dp)`.
- Adapted `BottomTabs` usage to pass `ColorFilter.tint(color())` for icons and `color = color` for text in tab labels.
- **`cpufreq.kt`:**
- Changed `setCpuFrequency` to be a non-suspending function as it only performs shell commands.
- Added logic to set `isRefreshing = true` if `cpuFrequencies.value` is empty initially, ensuring data is loaded on first composition.
- **`FunPage.kt`:**
- Changed `CornerShape.full` to `RoundedCornerShape(50)` for icon buttons.
- Increased clickable icon button size from `40.dp` to `48.dp`.
- Removed `shadow` modifier from icon buttons as LiquidGlass provides its own visual depth.
- **`Main_Function.kt`:**
- Replaced `SuperArrow` with the local `FunArrow` component.
These changes aim to optimize the LiquidGlass rendering path when depth effect is not needed and to refine the visual appearance and interaction of bottom navigation tabs and other UI elements.
This commit removes deprecated type aliases and the `RefractionValue` function from `Compat.kt`. The following deprecated elements have been removed: - `LiquidGlassStyle` (alias for `GlassStyle`) - `InnerRefraction` (self-referential alias) - `GlassMaterial` (self-referential alias) - `GlassBorder` (alias for `GlassHighlight`) - `RefractionValue` type alias - `RefractionValue(value: Dp)` function These changes simplify the codebase by removing outdated compatibility layers. Users should now directly use the non-deprecated types and functions (e.g., `GlassStyle`, `InnerRefraction`, `GlassMaterial`, `GlassHighlight`, `RefractionHeight`, `RefractionAmount`).
本次提交包含一个主要的结构重构和一些次要的内容更新。 **1. UI组件重构 (主要变更):** - 将所有可复用的UI组件(如 Card, FunSwitch, FunArrow 等)从 `com.suqi8.oshin.ui.activity.funlistui` 移动到了一个新的、更通用的包 `com.suqi8.oshin.ui.activity.components` 中。 - 此举旨在提高代码的模块化和可维护性,使组件结构更清晰。 - 相应地,更新了整个应用中所有对这些组件的 `import` 引用。 **2. “关于”页面内容更新:** - **致谢名单:** 在“贡献者”页面新增了 hamjin, kmiit, fatal1101 三位开发者。 - **引用项目:** 在“引用项目”页面新增了 Free Notifications, Liquid Glass, HyperStar 等开源项目。 - **文案优化:** 微调了“贡献者”和“引用项目”页面的介绍性文字。
- AGP 升级至 8.12.0 - Kotlin 升级至 2.2.10,KSP 同步更新 - Compose BOM 升级至 2025.08.00 - core-ktx 升级至 1.17.0 - Compose 正式版 1.9.0 - haze 升级至 1.6.10
…lter
This commit introduces several changes to the LiquidGlass library, primarily focusing on shadow rendering and color filter functionality, along with related updates in the application.
**LiquidGlass Library Changes:**
- **Shadow Rendering Decoupling:**
- `GlassStyle.kt`: The `shadow` property is now nullable (`GlassShadow?`), allowing shadows to be completely disabled.
- `LiquidGlassModifier.kt`:
- Shadow rendering is now handled by a new `GlassShadowElement` and `GlassShadowNode`. This decouples shadow logic from the main `GlassShapeElement`.
- A separate `samplerLayer` is introduced for `LuminanceSampler` to avoid conflicts with other graphics layer operations. The `samplerJob` now uses this dedicated layer.
- `graphicsLayer` recording for the main content is moved inside the `graphicsLayer?.let` block.
- `GlassShapeElement.kt`: Removed direct handling of `shadowElevation` and `shadowColor` properties and the associated `GraphicsLayerScope` settings for shadows. This responsibility is moved to `GlassShadowNode`.
- `GlassShadow.kt`:
- The primary constructor now accepts a `brush: Brush` instead of a `color: Color` for more flexible shadow appearances. Other parameters like `spread`, `offset`, `alpha`, and `blendMode` are added.
- A deprecated constructor `GlassShadow(elevation, color)` is provided for backward compatibility.
- `GlassShadow.None` is now deprecated; `null` should be used to disable shadows.
- `GlassShadowElement.kt` & `GlassShadowNode.kt` (New Files):
- Implement the new shadow rendering logic using `DropShadowPainter` for more sophisticated shadow effects.
- `GlassShadowNode` observes changes in `style().shape` and `style().shadow` to update the shadow painter.
- **Color Filter Improvements:**
- `GlassMaterial.kt`:
- Changed `blendMode` default to `DrawScope.DefaultBlendMode`.
- Changed `DefaultColorFilter` to use the new `simpleColorFilter` with default brightness=0f, contrast=1.5f, saturation=1.5f.
- Removed the old `saturationColorFilter` and its usage.
- `SimpleColorFilter.kt` (New File):
- Introduced a new `simpleColorFilter` function that allows adjusting brightness, contrast, and saturation using a `ColorMatrix`.
- **Highlight Update:**
- `GlassHighlightElement.kt`: The internal `_highlight` state is now tracked to correctly update the render effect when the `highlight` property changes.
- `GlassHighlight.kt`: Changed `blendMode` default to `DrawScope.DefaultBlendMode` for `GlassHighlight.None`.
**Application-Side Changes:**
- **Shape Updates:**
- Replaced `RoundedCornerShape` with `G2RoundedCornerShape` (from the new `capsule` dependency) in several UI components for potentially different corner rendering:
- `FunPicSele.kt`: Image preview clip shape.
- `ResetApp.kt`: Dialog shape.
- `Card.kt`: Card clip shape.
- `MainActivity.kt`: `topAppBarStyle` shape.
- `about_contributors.kt`: Avatar image clip shape.
- **Dependency Update:**
- `app/build.gradle.kts`: Added `implementation(libs.capsule)` dependency.
- `gradle/libs.versions.toml`: Defined the `capsule` library version.
These changes aim to make LiquidGlass shadows more flexible and performant by decoupling their rendering, and to provide a more comprehensive color filtering utility. The UI updates mainly involve adopting a new corner shape implementation.
This commit changes the catch block in `HookEntry.kt` to catch `Throwable` instead of `Exception` when attempting to load the "dexkit" library. This change ensures that all types of errors, including `Error` subclasses which do not inherit from `Exception`, are caught during the library loading process. This makes the error handling more robust.
This commit introduces several improvements to SMS handling and data persistence within the hook.
**Key Changes:**
- **`SmsMsg.kt`:**
- Modified `SmsMessageUtils.getMessageBody(smsMessageParts)` to use a non-nullable return type, directly normalizing it. This simplifies null handling for the message body.
- **`SMSCode.kt`:**
- Replaced `XposedHelpers` with `KavaRef` for reflective operations, specifically for accessing `mDeleteWhere` and `mDeleteWhereArgs` fields in the `smsReceiver` object. This aligns with the project's preference for YukiHookAPI's reflection utilities.
- Added error logging using `YLog.error` within the `catch` block when attempting to delete an SMS from the raw table, providing more insight into potential issues.
- Added `superclass()` to the `firstMethod` resolver for `deleteFromRawTable` to ensure methods from superclasses are also considered during resolution.
- **`SmsParseAction.kt`:**
- **SMS Deduplication Logic:**
- Re-enabled and updated the SMS deduplication logic.
- It now loads the previous SMS message using `EntityStoreManager.loadEntityFromFile(SmsMsg::class.java)`.
- If a previous SMS exists, it checks if the time difference is within 15 seconds.
- If the time difference is small, it further checks if the sender and SMS code match, or if the entire body matches, to determine if it's a duplicate.
- The current SMS (`sms`) is now saved using `EntityStoreManager.storeEntitiesToFile(listOf(sms))` regardless of whether it's a duplicate, to be used for the next comparison.
- **`EntityStoreManager.kt` (New File):**
- Introduced a new singleton object `EntityStoreManager` to handle the serialization and deserialization of entities (like `SmsMsg`) to and from JSON files.
- **`storeEntitiesToFile`:**
- Takes a list of entities and serializes them to JSON using `GsonBuilder`.
- Stores the JSON in a file named `prev_code_record` within the `files` directory of `com.android.phone`'s data directory.
- Sets world-writable permissions on the created file.
- Uses Kotlin's `writer().use {}` for safe and automatic resource management.
- **`loadEntitiesFromFile`:**
- Reads the JSON string from `prev_code_record`.
- Deserializes the JSON back into a list of entities of the specified class using `GsonBuilder` and a custom `ListOfJson` parameterized type.
- Returns an empty list if the file doesn't exist or an error occurs.
- Uses Kotlin's `reader().use {}` for safe and automatic resource management.
- **`loadEntityFromFile`:**
- A convenience function that loads a list of entities and returns the first one, or `null` if the list is empty.
- **`setFileWorldWritable`:**
- A utility function to recursively set executable, writable, and readable permissions for a file and its parent directories up to a specified depth.
These changes aim to improve the robustness of SMS processing by adding deduplication, enhance data persistence with a dedicated manager, and modernize reflection usage.
This commit introduces the ability for users to customize keywords for SMS verification code detection and refines the associated UI.
**Key Changes:**
- **`SMSCode.kt`:**
- The `smsRule` (keywords for detecting verification codes) is now loaded from preferences (`prefs("phone").getString("SMSCodeRule", smsRule)`) when the `com.android.phone` app is loaded, specifically if the "sms_verification_code" feature is enabled.
- Removed redundant loading of `smsRule` from within the constructor hook of `com.android.internal.telephony.InboundSmsHandler`. The rule is now initialized earlier.
- **`main.kt` (UI for com.android.phone settings):**
- The "SMS Verification Code" switch (`FunSwich`) now updates a local `MutableState` (`sms_verification_code`) to control the visibility of the keyword settings.
- Added a `FunString` component for "SMS Code Keyword" (`R.string.sms_code_keyword`).
- This input field allows users to define custom keywords for identifying verification code SMS messages.
- It's conditionally visible (`AnimatedVisibility`) based on the state of the "SMS Verification Code" switch.
- A default list of keywords in multiple languages is provided as `defValue`.
- `addline()` is used to visually separate the switch and the keyword input field.
- **`strings.xml`:**
- Added a new string resource `sms_code_keyword` ("验证码短信关键字").
- **`Main_Module.kt`:**
- Added "SMS Verification Code" (`R.string.sms_verification_code`) and "SMS Code Keyword" (`R.string.sms_code_keyword`) to the list of `FeatureItem`s for the "phone" category, making them discoverable in the app's feature list.
These changes allow users more flexibility in defining what constitutes a verification code SMS by customizing the keywords, and integrate this setting into the UI.
This commit enhances the LiquidGlass effect by introducing optional shadows and color saturation, and applies these enhancements to various UI elements.
**LiquidGlass Enhancements:**
- **`GlassStyle.kt` (Conceptual based on `MainActivity.kt` changes):**
- `GlassStyle` now supports a `shadow` parameter (of type `GlassShadow`), allowing shadows to be configured for glass elements.
- **`GlassMaterial.kt` (Conceptual based on `MainActivity.kt` changes):**
- `GlassMaterial` now supports a `colorFilter` parameter.
- Introduced `saturationColorFilter(value: Float)` to easily apply saturation to the glass material.
- **`GlassBrushElement.kt`:**
- Optimized by caching `material.brush`, `material.alpha`, and `material.blendMode` into local variables before drawing.
**UI Updates:**
- **`FunPage.kt`:**
- The `FunPageScaffoldStyle` now includes a `GlassShadow` with an elevation of `16.dp` and a black tint with `0.15f` alpha, adding depth to the page's top bar.
- **`MainActivity.kt`:**
- `commonGlassMaterial` updated:
- `blurRadius` increased from `0.3.dp` to `3.dp`.
- `brush` (SolidColor) removed, relying on background sampling.
- `colorFilter` added, applying `saturationColorFilter(1.5f)` to enhance colors behind the glass.
- `topAppBarStyle` updated:
- Added a `GlassShadow` with `0.dp` elevation and transparent brush, effectively disabling shadow for the top app bar by default but allowing it to be configured.
- The `liquidGlass` modifier for the main window now uses the updated `commonGlassMaterial`.
These changes provide more visual customization options for the LiquidGlass effect, allowing for richer and more nuanced glass appearances throughout the application.
This commit introduces a new feature allowing users to optionally display a toast message when an SMS verification code is detected and copied.
**Key Changes:**
- **`SMSCode.kt`:**
- Added a new global variable `showCodeToast` (boolean) to control whether the toast is displayed.
- This variable is initialized from the "phone" preferences (`prefs("phone").getBoolean("showCodeToast", false)`) when the hook is loaded.
- **`ToastAction.kt`:**
- The `action()` method now checks the value of `showCodeToast` before calling `showCodeToast()`.
- **`main.kt` (UI for "phone" settings):**
- Added a new `FunSwich` (toggle switch) labeled with `stringResource(R.string.show_verification_toast)`.
- This switch controls the "showCodeToast" preference in the "phone" category.
- The `FunString` for SMS code keywords and the new `FunSwich` are now grouped within a `Column` under the main "sms_verification_code" toggle.
- **`strings.xml`:**
- Added a new string resource `show_verification_toast` with the value "显示验证码吐司" (Show verification code toast).
- **`Main_Module.kt`:**
- Added a new `FeatureItem` for "显示验证码吐司" to the list of features.
This enhancement provides users with more granular control over the SMS verification code feature, allowing them to choose whether they want a visual confirmation (toast) when a code is automatically handled.
This commit reduces the shadow elevation for the `FunPage` component. - In `FunPage.kt`, the `elevation` property of the `GlassShadow` within `liquidGlassStyle` has been changed from `16.dp` to `4.dp`. This change aims to provide a more subtle shadow effect for the page.
本次提交为短信验证码功能增加了通过通知栏提醒用户的选项。
**主要变更:**
- **`SMSCode.kt`:**
- 新增 `showCodeNotification` 变量,用于控制是否显示验证码通知。
- 在 `onHook` 方法中,从 `prefs("phone")` 读取 `showCodeNotification` 的配置值。
- **`NotifyAction.kt`:**
- `action()` 方法现在会检查 `showCodeNotification` 的值,如果为 `true`,则调用 `showCodeNotification()` 显示通知。
- `showCodeNotification()` 方法中,构建通知时注释掉了 `setSmallIcon(R.drawable.icon)`,可能意在调整通知图标显示。
- **`main.kt` (UI):**
- 在“电话”模块的设置界面中,新增了一个 `FunSwich` 开关,用于让用户启用或禁用“显示验证码通知”功能。
- 对应的字符串资源 ID 为 `R.string.show_verification_notification`。
- **`strings.xml`:**
- 新增字符串资源 `show_verification_notification`,文本为“显示验证码通知”。
- **`Main_Module.kt`:**
- 在功能列表中添加了“显示验证码通知”这一项,分类为 "phone"。
现在用户可以选择在收到短信验证码时,除了之前的 Toast 提示外,还可以通过系统通知栏收到提醒。
…ovider`
This commit introduces a major refactoring to centralize all application information (name, icon, dominant color) fetching and caching. It replaces several disparate and component-specific caching implementations with a single, robust, and lifecycle-aware data layer. This significantly improves performance, reduces code duplication, and enhances state management across the app.
### Key Changes:
* **`AppInfoProvider` (Singleton Repository):**
* A new `AppInfoProvider` class has been introduced as a `@Singleton` repository.
* It is now the single source of truth for all app metadata (name and icon).
* It uses a `ConcurrentHashMap` for thread-safe in-memory caching, including caching `null` for uninstalled apps to prevent repeated lookups.
* This replaces the old, scattered implementations in `AppNameCache.kt` and `GetAppIconAndName`.
* **`RouteFormatter` (Singleton):**
* A new `RouteFormatter` utility class has been created to handle the conversion of internal feature routes (e.g., `"systemui\\controlCenter"`) into human-readable breadcrumbs (e.g., `"SystemUI › Control Center"`).
* It leverages `AppInfoProvider` to asynchronously resolve app names within routes, replacing the old, hardcoded `GetFuncRoute.kt`.
* This logic is now centralized and cleanly separated from the UI.
* **Refactored ViewModels:**
* **`ModuleViewModel`**: Now injects `AppInfoProvider` and `RouteFormatter`. It fetches app names, icons, and dominant colors through a unified `loadAppInfoWithColor` function. Search results now have pre-formatted breadcrumbs.
* **`HomeViewModel`**: Also uses `RouteFormatter` to pre-calculate and cache formatted routes for "Today Highlights" features, simplifying the `Composable` logic.
* **`AppSelectionViewModel`**: A new ViewModel for the app selection dialog. It manages the full app list, search state, and caching of UI info (icon/color), making the `FunAppSele` component stateless and more efficient.
* **`AppRestartViewModel`**: A new ViewModel for the app restart dialog. It handles the logic for fetching app info for the restart list and executing the restart commands, abstracting the logic from the UI.
* **Refactored UI Components:**
* **`Main_Module.kt` (Module Screen):**
* The `AppItemList` and `AppItemFlow` composables no longer contain any data-fetching or caching logic. They now observe `AppUiInfo` from the `ModuleViewModel`'s cache.
* The UI reacts to three states: loading (placeholder), loaded (displays info), and not installed (item is hidden).
* **`FunAppSele.kt` (App Selection Dialog):**
* The component has been completely refactored to be driven by the new `AppSelectionViewModel`. All state management, app loading, and searching logic has been moved to the ViewModel.
* The composable is now simpler and focuses purely on rendering the UI based on the state provided by the ViewModel.
* **`ResetApp.kt` -> `apprestart/AppRestart.kt`:**
* The app restart dialog has been moved to its own package and is now backed by `AppRestartViewModel`.
* All logic for fetching app info and executing restart commands is now handled in the ViewModel, cleaning up the Composable.
* **`MainHome.kt` (Home Screen):**
* Feature cards (`ModernFeatureCard`, `HighlightFeatureCard`, etc.) now receive a `HighlightFeature` data class containing the pre-formatted route, removing `GetFuncRoute` calls from the UI layer.
* **Code Deletion and Consolidation:**
* `AppNameCache.kt`, `GetFuncRoute.kt`, and the old `FunAppSele.kt` have been deleted, as their functionality is now covered by the new centralized providers and ViewModels.
* Helper functions like `getAutoColor` have been moved to a central `ColorUtils.kt` file.
fix(settings): ensure OTA card background replacement works
This commit updates the list of contributors on the "About" screen. * Removes the QQ number for contributor "Mikusignal". * Changes the name of one contributor from "喷搜" to "Pencil". * Adds "Liberation" as a new contributor with a link to their GitHub profile.
This commit restructures the project's UI package layout by moving all primary screen components into a new, more organized `com.suqi8.oshin.ui.mainscreen` package. This refactoring aims to improve code organization and scalability. It involves renaming and moving files from their old locations (e.g., `ui.main`, `ui.home`, `ui.module`, `ui.about`) into corresponding sub-packages under `ui.mainscreen`. All associated import statements across the codebase have been updated to reflect these new paths. No functional logic was changed in this commit. Key package changes: * `ui.main` -> `ui.mainscreen` * `ui.home` -> `ui.mainscreen.home` * `ui.module` -> `ui.mainscreen.module` * `ui.about` -> `ui.mainscreen.about` * `ui.softupdate` -> `ui.mainscreen.softupdate`
This commit updates the `minSdk` in `app/build.gradle.kts` from 36 to 33, expanding the range of supported Android devices.
This commit updates the Proguard configuration to improve debugging and remove obsolete rules. - Enables `SourceFile` and `LineNumberTable` attributes to preserve line numbers in stack traces, making debugging easier. - Removes several redundant or overly broad `-keep` rules for Activities, ViewBinding, and specific app packages, simplifying the configuration.
This commit introduces native advertising into the home screen's top carousel by integrating the Umeng Union (友盟+) SDK. The carousel now dynamically mixes promotional content with native ads (including video ads).
### Key Changes:
* **Umeng Union SDK Integration:**
* Added `com.umeng.umsdk:union` dependency.
* Initialized the SDK in `DefaultApplication` with pre-initialization for better performance.
* **Carousel Content Refactoring:**
* Introduced a `CarouselContent` sealed interface to represent different types of carousel items: `Promo` (original promotional content) and `Ad` (Umeng native ads).
* `HomeViewModel` now fetches both promotional items and native ads concurrently.
* The two content types are shuffled and combined into a single list (`combinedCarouselItems`) to be displayed in the carousel.
* **Native Ad Composable:**
* Created a new `UmengNativeBannerAd` composable to render the ad content provided by the SDK.
* This component handles both image and video ads, using `AndroidView` to host `UMVideoView` for video playback.
* It manages the ad's lifecycle (`onPause`, `onResume`, `onDestroy`) using `DisposableEffect` to ensure proper video handling and resource cleanup.
* The ad's view is correctly bound for click and impression tracking.
* **ViewModel Logic:**
* `HomeViewModel` now contains logic to request a native banner ad from the Umeng SDK.
* It includes success and failure handlers for the ad request.
* A new `combineAdAndPromoItems` function merges the fetched ad with the existing carousel items and shuffles the result for a mixed display.
This commit removes the entire Android CI/CD workflow configuration from the repository.
Updated README to reflect repository changes and contact information.
Updated README to reflect repository status and contact info.
- Add translations for new strings - Refine various strings for more natural Korean phrasing
Update Korean translations
Removed commented-out code for hooking download address.
调整了中英文 README,明确主仓库已转为私有,后续源码和功能实现不再公开,并优化了激活步骤、开源说明和联系方式等表述,使内容更清晰易懂。英文版同步修正了措辞和部分按钮文本。
docs: update README
06e0704 to
c10511c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.