forked from ReVanced/revanced-patcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: properly manage
ClassProxy
& add ProxyBackedClassList
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
Showing
6 changed files
with
71 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/app/revanced/patcher/util/ProxyBackedClassList.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package app.revanced.patcher.util | ||
|
||
import app.revanced.patcher.proxy.ClassProxy | ||
import org.jf.dexlib2.iface.ClassDef | ||
|
||
class ProxyBackedClassList(internal val internalClasses: MutableList<ClassDef>) : List<ClassDef> { | ||
internal val proxies = mutableListOf<ClassProxy>() | ||
|
||
fun add(classDef: ClassDef) { | ||
internalClasses.add(classDef) | ||
} | ||
|
||
fun add(classProxy: ClassProxy) { | ||
proxies.add(classProxy) | ||
} | ||
|
||
override val size get() = internalClasses.size | ||
override fun contains(element: ClassDef) = internalClasses.contains(element) | ||
override fun containsAll(elements: Collection<ClassDef>) = internalClasses.containsAll(elements) | ||
override fun get(index: Int) = internalClasses[index] | ||
override fun indexOf(element: ClassDef) = internalClasses.indexOf(element) | ||
override fun isEmpty() = internalClasses.isEmpty() | ||
override fun iterator() = internalClasses.iterator() | ||
override fun lastIndexOf(element: ClassDef) = internalClasses.lastIndexOf(element) | ||
override fun listIterator() = internalClasses.listIterator() | ||
override fun listIterator(index: Int) = internalClasses.listIterator(index) | ||
override fun subList(fromIndex: Int, toIndex: Int) = internalClasses.subList(fromIndex, toIndex) | ||
} |
This file contains 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