Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
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 @@ -104,7 +104,7 @@ public int itemCount() {

public int getItemPosition(String id) {
for (int position=0; position<mBookmarkList.size(); position++)
if (mBookmarkList.get(position).getGuid() == id)
if (mBookmarkList.get(position).getGuid().equalsIgnoreCase(id))
return position;
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.mozilla.vrbrowser.ui.views;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -53,6 +54,7 @@ public BookmarksView(Context aContext, AttributeSet aAttrs, int aDefStyle) {
initialize(aContext);
}

@SuppressLint("ClickableViewAccessibility")
private void initialize(Context aContext) {
mAudio = AudioEngine.fromContext(aContext);

Expand Down Expand Up @@ -115,7 +117,8 @@ public void onMore(View view, BookmarkNode item) {
boolean isLastVisibleItem = false;
if (mBinding.bookmarksList.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) mBinding.bookmarksList.getLayoutManager();
if (rowPosition == layoutManager.findLastVisibleItemPosition()) {
int lastVisibleItem = layoutManager.findLastCompletelyVisibleItemPosition();
if (rowPosition == layoutManager.findLastVisibleItemPosition() && rowPosition != lastVisibleItem) {
isLastVisibleItem = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public void onMore(View view, VisitInfo item) {
boolean isLastVisibleItem = false;
if (mBinding.historyList.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) mBinding.historyList.getLayoutManager();
if (rowPosition == layoutManager.findLastVisibleItemPosition()) {
int lastVisibleItem = layoutManager.findLastCompletelyVisibleItemPosition();
if (rowPosition == layoutManager.findLastVisibleItemPosition() && rowPosition != lastVisibleItem) {
isLastVisibleItem = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ private void initialize(Context aContext) {
}

public void setItem(@NonNull LibraryContextMenuItem item) {
mBinding.setItem(item);
SessionStore.get().getBookmarkStore().isBookmarked(item.getUrl()).thenAccept((isBookmarked -> {
mBinding.setItem(item);
mBinding.setIsBookmarked(isBookmarked);
mBinding.bookmark.setText(isBookmarked ? R.string.history_context_remove_bookmarks : R.string.history_context_add_bookmarks);
invalidate();
Expand All @@ -96,6 +96,10 @@ public void setContextMenuClickCallback(LibraryItemContextMenuClickCallback call
}

public int getMenuHeight() {
if (mBinding.getItem() == null) {
throw new IllegalStateException("setItem must be called before getMenuHeight");

}
switch (mBinding.getItem().getType()) {
case BOOKMARKS:
mBinding.bookmarkLayout.setVisibility(GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@ private void showLibraryItemContextMenu(@NotNull View view, LibraryItemContextMe
offsetDescendantRectToMyCoords(view, offsetViewBounds);

mLibraryItemContextMenu = new LibraryItemContextMenuWidget(getContext());
mLibraryItemContextMenu.setItem(item);
mLibraryItemContextMenu.mWidgetPlacement.parentHandle = getHandle();

PointF position;
Expand All @@ -1165,7 +1166,6 @@ private void showLibraryItemContextMenu(@NotNull View view, LibraryItemContextMe
}

mLibraryItemContextMenu.setPosition(position);
mLibraryItemContextMenu.setItem(item);
mLibraryItemContextMenu.setHistoryContextMenuItemCallback((new LibraryItemContextMenuClickCallback() {
@Override
public void onOpenInNewWindowClick(LibraryItemContextMenu.LibraryContextMenuItem item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class LibraryItemContextMenuWidget extends UIWidget implements WidgetMana
private LibraryItemContextMenu mContextMenu;
private int mMaxHeight;
private PointF mTranslation;
private int height;

public LibraryItemContextMenuWidget(Context aContext) {
super(aContext);
Expand Down