Source:
private void showSettingsPopup(final Point p) { try{ if(player!=null){ player.getController().setAutoHide(!getTouchExploreEnabled()); Activity context = getActivity(); Resources r = getResources(); float popupHeight = TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 80 , r.getDisplayMetrics()); float popupWidth = TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 150 , r.getDisplayMetrics()); LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.setting_popup); LayoutInflater layoutInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = layoutInflater.inflate(R.layout.panel_settings_popup, viewGroup); settingPopup = new PopupWindow(context); settingPopup.setContentView(layout); settingPopup.setWidth((int)popupWidth); settingPopup.setHeight((int)popupHeight); settingPopup.setFocusable(true); settingPopup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { hideTransparentImage(); if(player!=null){ player.getController().setSettingsBtnDrawable(false); player.getController().setAutoHide(!getTouchExploreEnabled()); } } }); settingPopup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); settingPopup.showAtLocation(layout, Gravity.NO_GRAVITY, p.x-(int)popupWidth, p.y-(int)popupHeight); TextView tv_closedCaption = (TextView) layout.findViewById(R.id.tv_closedcaption); if ((langList != null) && (langList.size() > 0)) { tv_closedCaption.setBackgroundResource(R.drawable.white_rounded_selector); tv_closedCaption.setOnClickListener(new View.OnClickListener(){ public void onClick(View paramAnonymousView) { showCCFragmentPopup(); } }); }else{ tv_closedCaption.setBackgroundResource(R.drawable.grey_roundedbg); tv_closedCaption.setOnClickListener(null); } layout.findViewById(R.id.tv_video_speed).setOnClickListener(v -> showVideoSpeedFragmentPopup()); } }catch(Exception e){ logger.error(e); } }

Target:
private void showSettingsPopup(final Point p) { try{ if(player!=null){ player.getController().setAutoHide(!getTouchExploreEnabled()); Activity context = getActivity(); float popupHeight = getResources().getDimension(R.dimen.settings_popup_height); float popupWidth = getResources().getDimension(R.dimen.settings_popup_width); LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.setting_popup); LayoutInflater layoutInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = layoutInflater.inflate(R.layout.panel_settings_popup, viewGroup); settingPopup = new PopupWindow(context); settingPopup.setContentView(layout); settingPopup.setWidth((int)popupWidth); settingPopup.setHeight((int)popupHeight); settingPopup.setFocusable(true); settingPopup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { hideTransparentImage(); if(player!=null){ player.getController().setSettingsBtnDrawable(false); player.getController().setAutoHide(!getTouchExploreEnabled()); } } }); settingPopup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); settingPopup.showAtLocation(layout, Gravity.NO_GRAVITY, p.x-(int)popupWidth, p.y-(int)popupHeight); TextView tv_closedCaption = (TextView) layout.findViewById(R.id.tv_closedcaption); if ((langList != null) && (langList.size() > 0)) { tv_closedCaption.setBackgroundResource(R.drawable.white_rounded_selector); tv_closedCaption.setOnClickListener(new View.OnClickListener(){ public void onClick(View paramAnonymousView) { showCCFragmentPopup(); } }); }else{ tv_closedCaption.setBackgroundResource(R.drawable.grey_roundedbg); tv_closedCaption.setOnClickListener(null); } layout.findViewById(R.id.tv_video_speed).setOnClickListener(v -> showVideoSpeedFragmentPopup()); } }catch(Exception e){ logger.error(e); } }