Skip to content

Commit

Permalink
Optimize refreshData in RoutingSettingActivity (#3775)
Browse files Browse the repository at this point in the history
Optimized the refreshData method by clearing the existing rulesets list and adding the new items to avoid unnecessary reallocation and improve memory management.
  • Loading branch information
CodeWithTamim authored Oct 25, 2024
1 parent 17e0db2 commit 6c29e5e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ class RoutingSettingActivity : BaseActivity() {
}

fun refreshData() {
rulesets = MmkvManager.decodeRoutingRulesets() ?: mutableListOf()
rulesets.clear()
rulesets.addAll(MmkvManager.decodeRoutingRulesets() ?: mutableListOf())
adapter.notifyDataSetChanged()
}

}

0 comments on commit 6c29e5e

Please sign in to comment.