mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
added removeIndexFromPreviousChain
This commit is contained in:
@@ -59,14 +59,32 @@ public abstract class ViewWidget extends StackWidget {
|
|||||||
previous = null;
|
previous = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replacePrevious(int index) {
|
public void removeIndexFromPreviousChain(int index) {
|
||||||
if (previous == null) {
|
ViewWidget view = previous;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (index > 0 && previous.previous != null) {
|
while (index > 0 && view != null) {
|
||||||
previous = previous.previous;
|
|
||||||
index--;
|
index--;
|
||||||
|
|
||||||
|
if (index == 0) {
|
||||||
|
if (view.previous != null && view.previous.previous != null) {
|
||||||
|
view.previous = view.previous.previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
view = view.previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeViewFromPreviousChain(ViewWidget view) {
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
while (previous != null) {
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if (previous == view) {
|
||||||
|
removeIndexFromPreviousChain(index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user