From f452cb482dfa1204f27ae4fff6dedca3e43f3e28 Mon Sep 17 00:00:00 2001 From: Adamantcheese Date: Sun, 16 Feb 2020 19:56:18 -0800 Subject: [PATCH] Closes #664 --- .../chan/ui/controller/ThreadSlideController.java | 10 +++++----- .../chan/ui/toolbar/ToolbarContainer.java | 3 ++- .../adamantcheese/chan/ui/toolbar/ToolbarMenuItem.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/controller/ThreadSlideController.java b/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/controller/ThreadSlideController.java index edb4b1f05d..3188750f56 100644 --- a/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/controller/ThreadSlideController.java +++ b/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/controller/ThreadSlideController.java @@ -92,7 +92,7 @@ public void onSlidingPaneLayoutStateRestored() { } if (restoredOpen != leftOpen) { leftOpen = restoredOpen; - slideStateChanged(leftOpen); + slideStateChanged(); } } @@ -104,7 +104,7 @@ public void onPanelSlide(View panel, float slideOffset) { public void onPanelOpened(View panel) { if (this.leftOpen != leftOpen()) { this.leftOpen = leftOpen(); - slideStateChanged(leftOpen()); + slideStateChanged(); } } @@ -112,7 +112,7 @@ public void onPanelOpened(View panel) { public void onPanelClosed(View panel) { if (this.leftOpen != leftOpen()) { this.leftOpen = leftOpen(); - slideStateChanged(leftOpen()); + slideStateChanged(); } } @@ -130,7 +130,7 @@ public void switchToController(boolean leftController) { if (slidingPaneLayout.getWidth() == 0) { // It won't tell us it switched when it's not laid out yet. leftOpen = leftController; - slideStateChanged(leftController); + slideStateChanged(); } } } @@ -266,7 +266,7 @@ private boolean leftOpen() { return slidingPaneLayout.isOpen(); } - private void slideStateChanged(boolean leftOpen) { + private void slideStateChanged() { setParentNavigationItem(leftOpen); notifySlideChanged(leftOpen ? leftController : rightController); diff --git a/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarContainer.java b/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarContainer.java index 80ef463d71..738314f3aa 100644 --- a/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarContainer.java +++ b/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarContainer.java @@ -114,10 +114,11 @@ public void setArrowMenu(ArrowMenuDrawable arrowMenu) { } public void set(NavigationItem item, Theme theme, ToolbarPresenter.AnimationStyle animation) { - if (transitionView != null) { + if (transitionView != null || (currentView != null && currentView.item == item)) { // Happens when you are in Phone layout, moving the thread fragment and at the same time // thread update occurs. We probably should just skip it. But maybe there is a better // solution. + // Also prevent setting of an item that already exists in the current view return; } diff --git a/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarMenuItem.java b/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarMenuItem.java index 8fc9977ea0..17fd4691d9 100644 --- a/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarMenuItem.java +++ b/Kuroba/app/src/main/java/com/github/adamantcheese/chan/ui/toolbar/ToolbarMenuItem.java @@ -36,7 +36,7 @@ import static com.github.adamantcheese.chan.utils.AndroidUtils.removeFromParentView; /** - * An item for the Toolbar menu. These are ImageViews with an icon, that wehen pressed call + * An item for the Toolbar menu. These are ImageViews with an icon, that when pressed call * some callback. Add them with the NavigationItem MenuBuilder. */ public class ToolbarMenuItem {