mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
remove obsolete method, use lambda sytax
This commit is contained in:
parent
2f22ca06d2
commit
f94f0c4032
1 changed files with 7 additions and 26 deletions
|
|
@ -206,32 +206,13 @@ public class TasksFragment extends BaseMainFragment implements OnCheckedChangeLi
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
TaskRecyclerViewFragment fragment;
|
TaskRecyclerViewFragment fragment;
|
||||||
SortableTasksRecyclerViewAdapter.SortTasksCallback sortCallback =
|
SortableTasksRecyclerViewAdapter.SortTasksCallback sortCallback =
|
||||||
new SortableTasksRecyclerViewAdapter.SortTasksCallback() {
|
(task, from, to) -> {
|
||||||
@Override
|
if (apiHelper != null){
|
||||||
public void onMove(Task task, int from, int to) {
|
apiHelper.apiService.postTaskNewPosition(task.getId(), String.valueOf(to))
|
||||||
if (apiHelper != null){
|
.compose(apiHelper.configureApiCallObserver())
|
||||||
apiHelper.apiService.postTaskNewPosition(task.getId(), String.valueOf(toIndex(to)))
|
.subscribe(aVoid -> {
|
||||||
.compose(apiHelper.configureApiCallObserver())
|
new HabitRPGUserCallback(activity);
|
||||||
.subscribe(aVoid -> {
|
});
|
||||||
new HabitRPGUserCallback(activity);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int toIndex(int to){
|
|
||||||
int toIndex = 0;
|
|
||||||
if (to > 0){
|
|
||||||
boolean shouldBreak = false;
|
|
||||||
for (toIndex = 0; toIndex<user.getTodos().size(); toIndex++){
|
|
||||||
Task otherTask = user.getTodos().get(toIndex);
|
|
||||||
if (!otherTask.getCompleted()){
|
|
||||||
to--;
|
|
||||||
if (shouldBreak) break;
|
|
||||||
if (to == 0) shouldBreak = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toIndex;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue