Skip to content

Commit

Permalink
fix AppScope.equals
Browse files Browse the repository at this point in the history
  • Loading branch information
Krosxx committed Nov 5, 2022
1 parent 3ac3cfb commit 27154e4
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ package cn.vove7.andro_accessibility_api
* @property pageName String class name of Activity or Dialog
* @constructor
*/
class AppScope(
data class AppScope(
var packageName: String,
var pageName: String
) {
override fun equals(other: Any?): Boolean {
if (other == null || other !is AppScope) return false

return packageName.startsWith(other.packageName) &&
pageName == other.pageName ||
(pageName == other.pageName ||
pageName.isEmpty() || other.pageName.isEmpty() ||
pageName.endsWith("." + other.pageName) ||
pageName.endsWith("$" + other.pageName) ||
other.pageName.endsWith(".$pageName") ||
other.pageName.endsWith("$$pageName")
other.pageName.endsWith("$$pageName"))

}

override fun hashCode(): Int {
var result = packageName.hashCode()
result = 31 * result + pageName.hashCode()
return result
}
}

0 comments on commit 27154e4

Please sign in to comment.