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 @@ -27,7 +27,7 @@ import com.drdisagree.iconify.R
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_FAILURE
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUBJECT
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUCCESS
import com.drdisagree.iconify.data.common.Const.ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY
import com.drdisagree.iconify.xposed.modules.lockscreen.AlbumArt.Companion.addAlbumArtVisibilityListener
import com.drdisagree.iconify.data.common.Const.AI_PLUGIN_PACKAGE
import com.drdisagree.iconify.data.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.data.common.Preferences.CUSTOM_DEPTH_WALLPAPER_SWITCH
Expand Down Expand Up @@ -89,14 +89,7 @@ class DepthWallpaperA14(context: Context) : ModPack(context) {
private var wallpaperProcessorThread: Thread? = null

private var shouldShowForeground = true
private var mBroadcastRegistered = false
private val mReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.action == ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY) {
updateForegroundVisibility()
}
}
}
private var mAlbumArtListenerRegistered = false

override fun updatePrefs(vararg key: String) {
Xprefs.apply {
Expand Down Expand Up @@ -131,26 +124,12 @@ class DepthWallpaperA14(context: Context) : ModPack(context) {

@SuppressLint("UnspecifiedRegisterReceiverFlag", "NewApi")
override fun handleLoadPackage(loadPackageParam: LoadPackageParam) {
// Receiver to handle foreground visibility
if (!mBroadcastRegistered) {
val intentFilter = IntentFilter().apply {
addAction(ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext.registerReceiver(
mReceiver,
intentFilter,
Context.RECEIVER_EXPORTED
)
} else {
mContext.registerReceiver(
mReceiver,
intentFilter
)
// Listen for album art visibility changes directly (in-process)
if (!mAlbumArtListenerRegistered) {
addAlbumArtVisibilityListener {
updateForegroundVisibility()
}

mBroadcastRegistered = true
mAlbumArtListenerRegistered = true
}

mPluginReceiver = object : BroadcastReceiver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.drdisagree.iconify.R
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_FAILURE
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUBJECT
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUCCESS
import com.drdisagree.iconify.data.common.Const.ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY
import com.drdisagree.iconify.xposed.modules.lockscreen.AlbumArt.Companion.addAlbumArtVisibilityListener
import com.drdisagree.iconify.data.common.Const.AI_PLUGIN_PACKAGE
import com.drdisagree.iconify.data.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.data.common.Preferences.CUSTOM_DEPTH_WALLPAPER_SWITCH
Expand Down Expand Up @@ -103,14 +103,7 @@ class DepthWallpaperA15(context: Context) : ModPack(context) {
)

private var shouldShowForeground = true
private var mBroadcastRegistered = false
private val mReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.action == ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY) {
updateForegroundVisibility()
}
}
}
private var mAlbumArtListenerRegistered = false

override fun updatePrefs(vararg key: String) {
Xprefs.apply {
Expand Down Expand Up @@ -145,26 +138,12 @@ class DepthWallpaperA15(context: Context) : ModPack(context) {

@SuppressLint("UnspecifiedRegisterReceiverFlag", "NewApi")
override fun handleLoadPackage(loadPackageParam: LoadPackageParam) {
// Receiver to handle foreground visibility
if (!mBroadcastRegistered) {
val intentFilter = IntentFilter().apply {
addAction(ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext.registerReceiver(
mReceiver,
intentFilter,
Context.RECEIVER_EXPORTED
)
} else {
mContext.registerReceiver(
mReceiver,
intentFilter
)
// Listen for album art visibility changes directly (in-process)
if (!mAlbumArtListenerRegistered) {
addAlbumArtVisibilityListener {
updateForegroundVisibility()
}

mBroadcastRegistered = true
mAlbumArtListenerRegistered = true
}

mPluginReceiver = object : BroadcastReceiver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package com.drdisagree.iconify.xposed.modules.lockscreen

import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.drawable.Drawable
import android.graphics.drawable.Icon
import android.media.session.PlaybackState
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import com.drdisagree.iconify.data.common.Const.ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY
import com.drdisagree.iconify.data.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.data.common.Preferences.ALBUM_ART_ON_LOCKSCREEN
import com.drdisagree.iconify.data.common.Preferences.ALBUM_ART_ON_LOCKSCREEN_BLUR
Expand Down Expand Up @@ -168,13 +166,7 @@ class AlbumArt(context: Context) : ModPack(context) {
}

private fun broadcastAlbumArtUpdate() {
Thread {
mContext.sendBroadcast(
Intent(ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY).apply {
setFlags(Intent.FLAG_RECEIVER_FOREGROUND)
}
)
}.start()
albumArtListeners.forEach { it.onAlbumArtVisibilityChanged() }
}

private fun updateAlbumArtState() {
Expand Down Expand Up @@ -248,8 +240,18 @@ class AlbumArt(context: Context) : ModPack(context) {
}
}

fun interface AlbumArtVisibilityListener {
fun onAlbumArtVisibilityChanged()
}

companion object {
private var showAlbumArt: Boolean = false
val shouldShowAlbumArt: Boolean get() = showAlbumArt

private val albumArtListeners = mutableListOf<AlbumArtVisibilityListener>()

fun addAlbumArtVisibilityListener(listener: AlbumArtVisibilityListener) {
albumArtListeners.add(listener)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.drdisagree.iconify.xposed.modules.lockscreen.depthwallpaper

import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.ImageDecoder
import android.graphics.drawable.AnimatedImageDrawable
import android.graphics.drawable.Drawable
Expand All @@ -20,8 +17,8 @@ import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.drdisagree.iconify.data.common.Const.ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY
import com.drdisagree.iconify.data.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.xposed.modules.lockscreen.AlbumArt.Companion.addAlbumArtVisibilityListener
import com.drdisagree.iconify.data.common.Preferences.DEPTH_WALLPAPER_BACKGROUND_MOVEMENT_MULTIPLIER
import com.drdisagree.iconify.data.common.Preferences.DEPTH_WALLPAPER_CHANGED
import com.drdisagree.iconify.data.common.Preferences.DEPTH_WALLPAPER_FADE_ANIMATION
Expand Down Expand Up @@ -62,19 +59,7 @@ class DepthWallpaper(context: Context) : ModPack(context) {
private var unzoomWallpaper = false
private var foregroundAlpha = 1.0f

private var mBroadcastRegistered = false
private val mReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.action == ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY) {
// Hide foreground when album art is showing
if (showDepthWallpaper && !shouldShowAlbumArt) {
mDepthWallpaperForeground?.visibility = View.VISIBLE
} else {
mDepthWallpaperForeground?.visibility = View.GONE
}
}
}
}
private var mAlbumArtListenerRegistered = false

override fun updatePrefs(vararg key: String) {
Xprefs.apply {
Expand Down Expand Up @@ -104,26 +89,16 @@ class DepthWallpaper(context: Context) : ModPack(context) {

@SuppressLint("UnspecifiedRegisterReceiverFlag")
override fun handleLoadPackage(loadPackageParam: LoadPackageParam) {
// Receiver to handle foreground visibility
if (!mBroadcastRegistered) {
val intentFilter = IntentFilter().apply {
addAction(ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext.registerReceiver(
mReceiver,
intentFilter,
Context.RECEIVER_EXPORTED
)
} else {
mContext.registerReceiver(
mReceiver,
intentFilter
)
// Listen for album art visibility changes directly (in-process)
if (!mAlbumArtListenerRegistered) {
addAlbumArtVisibilityListener {
if (showDepthWallpaper && !shouldShowAlbumArt) {
mDepthWallpaperForeground?.visibility = View.VISIBLE
} else {
mDepthWallpaperForeground?.visibility = View.GONE
}
}

mBroadcastRegistered = true
mAlbumArtListenerRegistered = true
}

val keyguardBottomAreaViewClass =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.drdisagree.iconify.R
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_FAILURE
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUBJECT
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUCCESS
import com.drdisagree.iconify.data.common.Const.ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY
import com.drdisagree.iconify.xposed.modules.lockscreen.AlbumArt.Companion.addAlbumArtVisibilityListener
import com.drdisagree.iconify.data.common.Const.AI_PLUGIN_PACKAGE
import com.drdisagree.iconify.data.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.data.common.Preferences.CUSTOM_DEPTH_WALLPAPER_SWITCH
Expand Down Expand Up @@ -91,14 +91,7 @@ class DepthWallpaperA14(context: Context) : ModPack(context) {
private var wallpaperProcessorThread: Thread? = null

private var shouldShowForeground = true
private var mBroadcastRegistered = false
private val mReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.action == ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY) {
updateForegroundVisibility()
}
}
}
private var mAlbumArtListenerRegistered = false

override fun updatePrefs(vararg key: String) {
Xprefs.apply {
Expand Down Expand Up @@ -133,26 +126,12 @@ class DepthWallpaperA14(context: Context) : ModPack(context) {

@SuppressLint("UnspecifiedRegisterReceiverFlag", "NewApi")
override fun handleLoadPackage(loadPackageParam: LoadPackageParam) {
// Receiver to handle foreground visibility
if (!mBroadcastRegistered) {
val intentFilter = IntentFilter().apply {
addAction(ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext.registerReceiver(
mReceiver,
intentFilter,
Context.RECEIVER_EXPORTED
)
} else {
mContext.registerReceiver(
mReceiver,
intentFilter
)
// Listen for album art visibility changes directly (in-process)
if (!mAlbumArtListenerRegistered) {
addAlbumArtVisibilityListener {
updateForegroundVisibility()
}

mBroadcastRegistered = true
mAlbumArtListenerRegistered = true
}

mPluginReceiver = object : BroadcastReceiver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.drdisagree.iconify.R
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_FAILURE
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUBJECT
import com.drdisagree.iconify.data.common.Const.ACTION_EXTRACT_SUCCESS
import com.drdisagree.iconify.data.common.Const.ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY
import com.drdisagree.iconify.xposed.modules.lockscreen.AlbumArt.Companion.addAlbumArtVisibilityListener
import com.drdisagree.iconify.data.common.Const.AI_PLUGIN_PACKAGE
import com.drdisagree.iconify.data.common.Const.SYSTEMUI_PACKAGE
import com.drdisagree.iconify.data.common.Preferences.CUSTOM_DEPTH_WALLPAPER_SWITCH
Expand Down Expand Up @@ -105,14 +105,7 @@ class DepthWallpaperA15(context: Context) : ModPack(context) {
)

private var shouldShowForeground = true
private var mBroadcastRegistered = false
private val mReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent?.action == ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY) {
updateForegroundVisibility()
}
}
}
private var mAlbumArtListenerRegistered = false

override fun updatePrefs(vararg key: String) {
Xprefs.apply {
Expand Down Expand Up @@ -147,26 +140,12 @@ class DepthWallpaperA15(context: Context) : ModPack(context) {

@SuppressLint("UnspecifiedRegisterReceiverFlag", "NewApi")
override fun handleLoadPackage(loadPackageParam: LoadPackageParam) {
// Receiver to handle foreground visibility
if (!mBroadcastRegistered) {
val intentFilter = IntentFilter().apply {
addAction(ACTION_UPDATE_DEPTH_WALLPAPER_FOREGROUND_VISIBILITY)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mContext.registerReceiver(
mReceiver,
intentFilter,
Context.RECEIVER_EXPORTED
)
} else {
mContext.registerReceiver(
mReceiver,
intentFilter
)
// Listen for album art visibility changes directly (in-process)
if (!mAlbumArtListenerRegistered) {
addAlbumArtVisibilityListener {
updateForegroundVisibility()
}

mBroadcastRegistered = true
mAlbumArtListenerRegistered = true
}

mPluginReceiver = object : BroadcastReceiver() {
Expand Down