private static void onDockedStackExistsChanged(boolean exists) {
synchronized (sCallbacks) {
- sCallbacks.removeIf(wf -> wf.get() == null);
- sCallbacks.forEach(wf -> wf.get().accept(exists));
+ sCallbacks.removeIf(wf -> {
+ Consumer<Boolean> l = wf.get();
+ if (l != null) l.accept(exists);
+ return l == null;
+ });
}
}
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.function.Consumer;
public class NavigationBarView extends FrameLayout implements PluginListener<NavGesture> {
final static boolean DEBUG = false;
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
- DockedStackExistsListener.register(exists -> mHandler.post(() -> {
- mDockedStackExists = exists;
- updateRecentsIcon();
- }));
+ DockedStackExistsListener.register(mDockedListener);
updateRotatedViews();
}
void onVerticalChanged(boolean isVertical);
}
+ private final Consumer<Boolean> mDockedListener = exists -> mHandler.post(() -> {
+ mDockedStackExists = exists;
+ updateRecentsIcon();
+ });
}