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 @@ -11,6 +11,8 @@
import android.widget.FrameLayout;

import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.databinding.ContextMenuBinding;
Expand Down Expand Up @@ -47,6 +49,12 @@ private void initialize(Context aContext) {
mBinding = DataBindingUtil.inflate(inflater, R.layout.context_menu, this, true);
mContextMenuAdapter = new ContextMenuAdapter(mContextMenuClickCallback);
mBinding.contextMenuList.setAdapter(mContextMenuAdapter);
mBinding.contextMenuList.setLayoutManager(new LinearLayoutManager(getContext()) {
@Override
public boolean canScrollVertically() {
return false;
}
});
mBinding.executePendingBindings();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ private void initialize() {
@Override
protected void initializeWidgetPlacement(WidgetPlacement aPlacement) {
aPlacement.visible = false;
aPlacement.width = WidgetPlacement.pixelDimension(getContext(), R.dimen.browser_width_pixels)/2;
mMaxHeight = WidgetPlacement.dpDimension(getContext(), R.dimen.prompt_height);
aPlacement.height = mMaxHeight;
aPlacement.width = WidgetPlacement.dpDimension(getContext(), R.dimen.context_menu_row_width);
aPlacement.height = WidgetPlacement.dpDimension(getContext(), R.dimen.context_menu_row_height);
aPlacement.parentAnchorX = 0.0f;
aPlacement.parentAnchorY = 1.0f;
aPlacement.anchorX = 0.5f;
Expand Down Expand Up @@ -89,10 +88,12 @@ public void onGlobalLayout() {
PointF anchor = anchorForCurrentMousePosition();
mWidgetPlacement.anchorX = anchor.x;
mWidgetPlacement.anchorY = anchor.y;
int paddingH = getPaddingStart() + getPaddingEnd();
int paddingV = getPaddingTop() + getPaddingBottom();
mWidgetPlacement.translationX = mMousePos.x * WidgetPlacement.worldToWindowRatio(getContext());
mWidgetPlacement.translationY = -(mMousePos.y * WidgetPlacement.worldToWindowRatio(getContext()));
mWidgetPlacement.width = (int)(mContextMenu.getWidth()/mWidgetPlacement.density);
mWidgetPlacement.height = (int)(mContextMenu.getHeight()/mWidgetPlacement.density);
mWidgetPlacement.width = (int)((mContextMenu.getWidth()+paddingH*2)/mWidgetPlacement.density);
mWidgetPlacement.height = (int)((mContextMenu.getHeight()+paddingV*2)/mWidgetPlacement.density);
mWidgetManager.updateWidget(ContextMenuWidget.this);
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/context_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="@dimen/context_menu_row_width"
android:layout_height="wrap_content"
android:background="@drawable/context_menu_background"
android:orientation="vertical">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/context_menu_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<LinearLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_width="@dimen/context_menu_row_width"
android:layout_height="@dimen/context_menu_row_height"
android:background="@drawable/context_menu_item_background_color"
android:clickable="true"
Expand Down