mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
SQLiteHabitList: fix corrupted order automatically
This commit is contained in:
@@ -133,7 +133,6 @@ public class SQLiteHabitList extends HabitList
|
|||||||
return Collections.unmodifiableCollection(toList()).iterator();
|
return Collections.unmodifiableCollection(toList()).iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void rebuildOrder()
|
public void rebuildOrder()
|
||||||
{
|
{
|
||||||
List<Habit> habits = toList();
|
List<Habit> habits = toList();
|
||||||
@@ -176,7 +175,7 @@ public class SQLiteHabitList extends HabitList
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reorder(Habit from, Habit to)
|
public synchronized void reorder(Habit from, Habit to)
|
||||||
{
|
{
|
||||||
if (from == to) return;
|
if (from == to) return;
|
||||||
|
|
||||||
@@ -213,6 +212,7 @@ public class SQLiteHabitList extends HabitList
|
|||||||
fromRecord.save();
|
fromRecord.save();
|
||||||
|
|
||||||
update(from);
|
update(from);
|
||||||
|
rebuildOrder();
|
||||||
|
|
||||||
getObservable().notifyListeners();
|
getObservable().notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user