`XC_LayoutInflated` should be comparable (#1851)
This commit is contained in:
parent
b5aff15919
commit
81448c3958
|
|
@ -30,7 +30,7 @@ import de.robv.android.xposed.XposedBridge.CopyOnWriteSortedSet;
|
||||||
* Callback for hooking layouts. Such callbacks can be passed to {@link XResources#hookLayout}
|
* Callback for hooking layouts. Such callbacks can be passed to {@link XResources#hookLayout}
|
||||||
* and its variants.
|
* and its variants.
|
||||||
*/
|
*/
|
||||||
public abstract class XC_LayoutInflated extends XCallback {
|
public abstract class XC_LayoutInflated extends XCallback implements Comparable<XC_LayoutInflated> {
|
||||||
/**
|
/**
|
||||||
* Creates a new callback with default priority.
|
* Creates a new callback with default priority.
|
||||||
*/
|
*/
|
||||||
|
|
@ -80,6 +80,22 @@ public abstract class XC_LayoutInflated extends XCallback {
|
||||||
public XResources res;
|
public XResources res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@Override
|
||||||
|
public int compareTo(XC_LayoutInflated other) {
|
||||||
|
if (this == other)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// order descending by priority
|
||||||
|
if (other.priority != this.priority)
|
||||||
|
return other.priority - this.priority;
|
||||||
|
// then randomly
|
||||||
|
else if (System.identityHashCode(this) < System.identityHashCode(other))
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue