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

Use LoadRequest event to close library panels #2367

Merged
merged 1 commit into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -156,8 +156,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 @@ -159,8 +159,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 @@ -1424,11 +1424,6 @@ public void onHideContextMenu(@NonNull View view) {
hideContextMenus();
}

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

@Override
public void onFxALogin(@NonNull View view) {
hideBookmarks();
Expand Down Expand Up @@ -1463,11 +1458,6 @@ public void onHideContextMenu(@NonNull View view) {
hideContextMenus();
}

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

@Override
public void onFxALogin(@NonNull View view) {
hideHistory();
Expand Down Expand Up @@ -1583,6 +1573,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