Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Revert explicit and use LoadRequest event to close library panels
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Nov 25, 2019
1 parent e312506 commit ce51ae6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ default void onFxALogin(@NonNull View view) {}
default void onFxASynSettings(@NonNull View view) {}
default void onShowContextMenu(@NonNull View view, Bookmark item, boolean isLastVisibleItem) {}
default void onHideContextMenu(@NonNull View view) {}
default void onItemClicked(@NonNull View view, Bookmark item) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ default void onFxALogin(@NonNull View view) {}
default void onFxASynSettings(@NonNull View view) {}
default void onShowContextMenu(@NonNull View view, @NonNull VisitInfo item, boolean isLastVisibleItem) {}
default void onHideContextMenu(@NonNull View view) {}
default void onItemClicked(@NonNull View view, VisitInfo item) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ public void onClick(@NonNull View view, @NonNull Bookmark item) {

Session session = SessionStore.get().getActiveSession();
session.loadUri(item.getUrl());

mBookmarksViewListeners.forEach((listener) -> listener.onItemClicked(view, item));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ public void onClick(View view, VisitInfo item) {

Session session = SessionStore.get().getActiveSession();
session.loadUri(item.getUrl());

mHistoryViewListeners.forEach((listener) -> listener.onItemClicked(view, item));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import androidx.annotation.UiThread;

import org.jetbrains.annotations.NotNull;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.PanZoomController;
Expand Down Expand Up @@ -67,7 +68,6 @@
import java.util.GregorianCalendar;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import java.util.function.Consumer;

import mozilla.components.concept.storage.PageObservation;
import mozilla.components.concept.storage.PageVisit;
Expand Down Expand Up @@ -1423,11 +1423,6 @@ public void onFxASynSettings(@NonNull View view) {
public void onHideContextMenu(@NonNull View view) {
hideContextMenus();
}

@Override
public void onItemClicked(@NonNull View view, Bookmark item) {
hideBookmarks();
}
};

private HistoryCallback mHistoryListener = new HistoryCallback() {
Expand Down Expand Up @@ -1457,11 +1452,6 @@ public void onFxASynSettings(@NonNull View view) {
public void onHideContextMenu(@NonNull View view) {
hideContextMenus();
}

@Override
public void onItemClicked(@NonNull View view, VisitInfo item) {
hideHistory();
}
};

private void hideContextMenus() {
Expand Down Expand Up @@ -1573,6 +1563,22 @@ public void captureImage() {
mSession.captureBitmap();
}

// GeckoSession.NavigationDelegate

@Nullable
@Override
public GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession geckoSession, @NonNull LoadRequest loadRequest) {
if (isHistoryVisible()) {
hideHistory();
}

if (isBookmarksVisible()) {
hideBookmarks();
}

return GeckoResult.ALLOW;
}

@Override
public void onLocationChange(@NonNull GeckoSession session, @Nullable String url) {
updateTitleBarUrl(url);
Expand Down

0 comments on commit ce51ae6

Please sign in to comment.