Commit d51bf464 authored by Max Lv's avatar Max Lv

Refine Custom Rules

parent a69183cc
...@@ -183,10 +183,10 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi ...@@ -183,10 +183,10 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
undoManager.remove((i, acl.urls(i))) undoManager.remove((i, acl.urls(i)))
acl.urls.remove(i) acl.urls.remove(i)
} else if (k < 0) { } else if (k < 0) {
undoManager.remove((j, acl.subnets(j))) undoManager.remove((i, acl.subnets(j)))
acl.subnets.remove(j) acl.subnets.remove(j)
} else { } else {
undoManager.remove((k, acl.proxyHostnames(k))) undoManager.remove((i, acl.proxyHostnames(k)))
acl.proxyHostnames.remove(k) acl.proxyHostnames.remove(k)
} }
notifyItemRemoved(i) notifyItemRemoved(i)
...@@ -194,7 +194,7 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi ...@@ -194,7 +194,7 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
} }
def remove(item: AnyRef): Unit = item match { def remove(item: AnyRef): Unit = item match {
case subnet: Subnet => case subnet: Subnet =>
notifyItemRemoved(acl.subnets.indexOf(subnet)) notifyItemRemoved(acl.subnets.indexOf(subnet) + acl.urls.size)
acl.subnets.remove(subnet) acl.subnets.remove(subnet)
apply() apply()
case hostname: String => if (acl.isUrl(hostname)) { case hostname: String => if (acl.isUrl(hostname)) {
...@@ -202,7 +202,8 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi ...@@ -202,7 +202,8 @@ class CustomRulesFragment extends ToolbarFragment with Toolbar.OnMenuItemClickLi
acl.urls.remove(hostname) acl.urls.remove(hostname)
apply() apply()
} else { } else {
notifyItemRemoved(acl.proxyHostnames.indexOf(hostname)) notifyItemRemoved(acl.proxyHostnames.indexOf(hostname)
+ acl.urls.size + acl.subnets.size)
acl.proxyHostnames.remove(hostname) acl.proxyHostnames.remove(hostname)
apply() apply()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment