Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import io.github.soclear.oneuix.ui.category.DetailPaneCamera
import io.github.soclear.oneuix.ui.category.DetailPaneDualApp
import io.github.soclear.oneuix.ui.category.DetailPaneGalaxyStore
import io.github.soclear.oneuix.ui.category.DetailPaneMyFiles
import io.github.soclear.oneuix.ui.category.DetailPaneWallpaper
import io.github.soclear.oneuix.ui.category.DetailPaneGallery
import io.github.soclear.oneuix.ui.category.DetailPaneSamsungHealth
import io.github.soclear.oneuix.ui.category.DetailPaneHealthMonitor
Expand Down Expand Up @@ -60,6 +61,7 @@ import io.github.soclear.oneuix.ui.category.onCameraEvent
import io.github.soclear.oneuix.ui.category.onDualAppEvent
import io.github.soclear.oneuix.ui.category.onGalaxyStoreEvent
import io.github.soclear.oneuix.ui.category.onMyFilesEvent
import io.github.soclear.oneuix.ui.category.onWallpaperEvent
import io.github.soclear.oneuix.ui.category.onGalleryEvent
import io.github.soclear.oneuix.ui.category.onSamsungHealthEvent
import io.github.soclear.oneuix.ui.category.onHealthMonitorEvent
Expand Down Expand Up @@ -242,6 +244,11 @@ fun SettingScreen(viewModel: SettingViewModel, modifier: Modifier = Modifier) {
onEvent = viewModel::onMyFilesEvent
)

Category.Wallpaper -> DetailPaneWallpaper(
uiState = preference.other,
onEvent = viewModel::onWallpaperEvent
)

Category.NFC -> DetailPaneNFC(
onNavigateToNfcCards = {
navigateToExtra(SettingDestination.Extra.NfcCards)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum class Category(val packageName: String) {
SPen(Package.TRANSLATION),
ThemeCenter(Package.THEME_CENTER),
Video(Package.VIDEO),
Wallpaper(Package.WALLPAPER),
WatchManager(Package.WATCH_MANAGER),
Weather(Package.WEATHER),
Other("");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.github.soclear.oneuix.ui.category

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import io.github.soclear.oneuix.R
import io.github.soclear.oneuix.common.Preference
import io.github.soclear.oneuix.ui.SettingViewModel
import io.github.soclear.oneuix.ui.component.SwitchItem

@Composable
fun DetailPaneWallpaper(
uiState: Preference.Other,
onEvent: (WallpaperEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.wallpaper_live),
title = stringResource(id = R.string.restoreLiveWallpaperEntry_title),
summary = stringResource(id = R.string.restoreLiveWallpaperEntry_summary),
checked = uiState.restoreLiveWallpaperEntry,
onCheckedChange = { onEvent(WallpaperEvent.RestoreLiveWallpaperEntry(it)) }
)
}
}

sealed interface WallpaperEvent {
@JvmInline
value class RestoreLiveWallpaperEntry(val value: Boolean) : WallpaperEvent
}

fun SettingViewModel.onWallpaperEvent(event: WallpaperEvent) {
updateData { preference ->
preference.copy(other = when (event) {
is WallpaperEvent.RestoreLiveWallpaperEntry -> preference.other.copy(restoreLiveWallpaperEntry = event.value)
})
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/wallpaper_live.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M200,160L760,160Q840,160 840,240L840,720Q840,800 760,800L200,800Q120,800 120,720L120,240Q120,160 200,160ZM220,240Q200,240 200,260L200,700Q200,720 220,720L740,720Q760,720 760,700L760,260Q760,240 740,240ZM390,350L610,480L390,610Z"/>
</vector>
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,6 @@
<string name="allowLowBatteryFlashlight_summary">Utilisable jusqu’à 1 % sans extinction automatique due à la batterie faible. La protection thermique est conservée</string>
<string name="fixMyFilesNetworkStorage_title">Corriger la redirection du stockage réseau dans Mes fichiers</string>
<string name="fixMyFilesNetworkStorage_summary">Pour la version internationale de Mes fichiers sur une ROM chinoise : empêche le stockage réseau de rediriger vers la page de mise à jour du Galaxy Store. La dernière version en cache est alignée sur la version installée</string>
<string name="restoreLiveWallpaperEntry_title">Restaurez l'entrée du fond d'écran animé dans le menu "\u22EE" de l'application de fond d'écran</string>
<string name="restoreLiveWallpaperEntry_summary">Restaurez l'option d'entrée "Live Wallpaper" dans le menu "\u22EE" des "Fonds d'écran et styles" de Samsung</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,6 @@
<string name="allowLowBatteryFlashlight_summary">배터리 부족으로 자동으로 꺼지지 않고 1%까지 사용합니다. 과열 보호는 유지됩니다</string>
<string name="fixMyFilesNetworkStorage_title">내 파일 네트워크 저장소 이동 문제 수정</string>
<string name="fixMyFilesNetworkStorage_summary">중국 ROM에서 국제판 내 파일을 사용할 때 네트워크 저장소를 누르면 Galaxy Store 업데이트 페이지로 이동하는 문제를 막습니다. 캐시된 최신 버전을 설치된 버전과 동일하게 유지합니다</string>
<string name="restoreLiveWallpaperEntry_title">배경화면 애플리케이션의 "\u22EE" 메뉴에서 라이브 배경화면 항목을 복원합니다.</string>
<string name="restoreLiveWallpaperEntry_summary">삼성 '배경화면 및 스타일'의 "\u22EE" 메뉴에서 '라이브 배경화면' 항목 옵션을 복원합니다.</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,6 @@
<string name="allowLowBatteryFlashlight_summary">Работа до 1 % без автоматического отключения из-за низкого заряда. Защита от перегрева сохраняется</string>
<string name="fixMyFilesNetworkStorage_title">Исправить переход «Сетевого хранилища» в «Моих файлах»</string>
<string name="fixMyFilesNetworkStorage_summary">Для международной версии «Моих файлов» на китайской прошивке: не даёт «Сетевому хранилищу» перенаправлять на страницу обновления в Galaxy Store. Кэшированная последняя версия приравнивается к установленной</string>
<string name="restoreLiveWallpaperEntry_title">Восстановите запись о живых обоях в меню «\u22EE» приложения обоев.</string>
<string name="restoreLiveWallpaperEntry_summary">Восстановите опцию записи «Живые обои» в меню «\u22EE» меню «Обои и стили» Samsung.</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,6 @@
<string name="allowLowBatteryFlashlight_summary">电量低至 1% 时仍可使用,不因低电量自动关闭;保留过热保护</string>
<string name="fixMyFilesNetworkStorage_title">修复我的文件网络存储跳转</string>
<string name="fixMyFilesNetworkStorage_summary">适用于国行系统上使用国际版“我的文件”:点击网络存储时不再跳转到应用商店更新页面。让缓存的最新版本与已安装版本保持一致</string>
<string name="restoreLiveWallpaperEntry_title">恢复壁纸应用“\u22EE”菜单的动态壁纸入口</string>
<string name="restoreLiveWallpaperEntry_summary">恢复三星“壁纸和风格”的“\u22EE”菜单中“动态壁纸”入口选项</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,6 @@
<string name="allowLowBatteryFlashlight_summary">Allow use down to 1% without automatic shutoff due to low battery. Thermal protection is retained</string>
<string name="fixMyFilesNetworkStorage_title">Fix My Files network storage redirect</string>
<string name="fixMyFilesNetworkStorage_summary">For the international My Files on a China ROM: stop Network storage from jumping to the Galaxy Store update page. Keeps the cached latest version equal to the installed version</string>
<string name="restoreLiveWallpaperEntry_title">Restore the live wallpaper entry in the "\u22EE" menu of the wallpaper application</string>
<string name="restoreLiveWallpaperEntry_summary">Restore the "Live Wallpaper" entry option in the "\u22EE" menu of Samsung's "Wallpapers and Styles"</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ object Package {
const val MDEC_SERVICE = "com.samsung.android.mdecservice"
const val MESSAGING = "com.samsung.android.messaging"
const val MY_FILES = "com.sec.android.app.myfiles"
const val WALLPAPER = "com.samsung.android.app.dressroom"
const val NFC = "com.android.nfc"
const val NOTES = "com.samsung.android.app.notes"
const val PHOTO_RETOUCHING = "com.sec.android.mimage.photoretouching"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ data class Preference(
val setGalaxyStoreSimOperator: Boolean = false,
val galaxyStoreSimOperator: String = "",
val fixMyFilesNetworkStorage: Boolean = false,
val restoreLiveWallpaperEntry: Boolean = false,
val makeAllUserAppsAvailable: Boolean = true,
val setWeatherProviderCN: Boolean = false,
val showMemoryUsageInRecents: Boolean = false,
Expand Down
6 changes: 6 additions & 0 deletions hook/src/main/java/io/github/soclear/oneuix/hook/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ class Main : XposedModule() {
}
}

Package.WALLPAPER -> {
if (preference.other.restoreLiveWallpaperEntry) {
Wallpaper.restoreLiveWallpaperEntry()
}
}

Package.WATCH_MANAGER -> {
if (preference.other.bypassWatchPairingRegionCheck ||
preference.other.watchPairingConnectionMode != WatchPairing.MODE_NONE
Expand Down
57 changes: 57 additions & 0 deletions hook/src/main/java/io/github/soclear/oneuix/hook/Wallpaper.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package io.github.soclear.oneuix.hook

import android.app.Activity
import android.content.Intent
import android.view.Menu
import android.view.MenuItem
import io.github.libxposed.api.XposedModule
import io.github.soclear.oneuix.hook.util.afterAttachTry

object Wallpaper {
private const val LIBRARY_ACTIVITY =
"com.samsung.android.app.dressroom.presentation.library.ui.WallpaperLibraryActivity"
private const val MENU_ID_LIVE_WALLPAPER = 0x4C575001
private const val ACTION_LIVE_WALLPAPER_CHOOSER = "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER"

/**
* 三星壁纸应用在国行系统上,三点菜单里没有“动态壁纸”入口(菜单资源里没有,处理代码也被删了)。
* 这里在菜单创建后补一项,点击时打开系统的动态壁纸选择器。不改 APK,只依赖
* WallpaperLibraryActivity 里两个标准的菜单回调,更新壁纸应用后一般无需适配。
*/
context(xposedModule: XposedModule)
fun restoreLiveWallpaperEntry() = afterAttachTry {
val activityClass = classLoader.loadClass(LIBRARY_ACTIVITY)

xposedModule.hook(
activityClass.getDeclaredMethod("onCreateOptionsMenu", Menu::class.java)
).intercept { chain ->
val result = chain.proceed()
runCatching {
val activity = chain.thisObject as Activity
val menu = chain.args[0] as Menu
// 菜单为空说明库页面当前不显示三点菜单,此时不添加
if (menu.size() > 0 && menu.findItem(MENU_ID_LIVE_WALLPAPER) == null) {
val titleRes = activity.resources.getIdentifier(
"options_menu_title_live_wallpapers", "string", activity.packageName
)
val title = if (titleRes != 0) activity.getString(titleRes) else "Live wallpapers"
menu.add(Menu.NONE, MENU_ID_LIVE_WALLPAPER, Menu.NONE, title)
}
}
result
}

xposedModule.hook(
activityClass.getDeclaredMethod("onOptionsItemSelected", MenuItem::class.java)
).intercept { chain ->
val item = chain.args[0] as MenuItem
if (item.itemId == MENU_ID_LIVE_WALLPAPER) {
val activity = chain.thisObject as Activity
runCatching { activity.startActivity(Intent(ACTION_LIVE_WALLPAPER_CHOOSER)) }
true
} else {
chain.proceed()
}
}
}
}
1 change: 1 addition & 0 deletions hook/src/main/resources/META-INF/xposed/scope.list
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ com.sec.android.app.shealth
com.sec.android.daemonapp
com.sec.android.gallery3d
com.sec.android.mimage.photoretouching
com.samsung.android.app.dressroom
Loading