mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 09:57:26 +00:00
Fixed a bug that creates 2 items when the user reinstalls the apps and returns to launcher with back.
This commit is contained in:
parent
de79b2752d
commit
2b63b1d6b0
1 changed files with 7 additions and 8 deletions
|
|
@ -106,7 +106,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
job?.cancel()
|
job?.cancel()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
@ -498,13 +497,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect insertions
|
|
||||||
newList.forEachIndexed { index, newItem ->
|
|
||||||
if (!oldSet.contains(Pair(newItem.first.applicationInfo.packageName, newItem.second.second))) {
|
|
||||||
changes.add(Change(ChangeType.INSERT, index))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect removals
|
// Detect removals
|
||||||
oldList.forEachIndexed { index, oldItem ->
|
oldList.forEachIndexed { index, oldItem ->
|
||||||
if (!newSet.contains(Pair(oldItem.first.applicationInfo.packageName, oldItem.second.second))) {
|
if (!newSet.contains(Pair(oldItem.first.applicationInfo.packageName, oldItem.second.second))) {
|
||||||
|
|
@ -512,6 +504,13 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detect insertions
|
||||||
|
newList.forEachIndexed { index, newItem ->
|
||||||
|
if (!oldSet.contains(Pair(newItem.first.applicationInfo.packageName, newItem.second.second))) {
|
||||||
|
changes.add(Change(ChangeType.INSERT, index))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
changes.addAll(removalChanges.reversed())
|
changes.addAll(removalChanges.reversed())
|
||||||
|
|
||||||
return changes
|
return changes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue