| | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.BaseDialog; |
| | | import com.hdl.photovoltaic.databinding.DialogTypeTitleListBinding; |
| | | import com.hdl.photovoltaic.utils.UnitConversionUtils; |
| | | import com.hdl.photovoltaic.widget.adapter.TypeListDialogAdapter; |
| | | |
| | | import java.util.List; |
| | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | Window window = getWindow(); |
| | | if (window != null) { |
| | | window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); |
| | | WindowManager.LayoutParams layoutParams = window.getAttributes(); |
| | | layoutParams.gravity = Gravity.START | Gravity.TOP; |
| | | layoutParams.width = (int) UnitConversionUtils.dpToPx(mContext, 375 - 32); |
| | | layoutParams.x = (int) UnitConversionUtils.dpToPx(mContext, 16); |
| | | layoutParams.y = (int) UnitConversionUtils.dpToPx(mContext, 130+10); |
| | | window.setAttributes(layoutParams); |
| | | } |
| | | viewBinding = DialogTypeTitleListBinding.inflate(getLayoutInflater()); |
| | | setContentView(viewBinding.getRoot()); |
| | | setDialogTouchOutsideCloseable(this); |
| | |
| | | viewBinding.typeParentCl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | int top = viewBinding.dialogParentCl.getTop(); |
| | | int left = viewBinding.dialogParentCl.getLeft(); |
| | | int bottom = viewBinding.dialogParentCl.getBottom(); |
| | | int right = viewBinding.dialogParentCl.getRight(); |
| | | int top = viewBinding.typeParentCl.getTop(); |
| | | int left = viewBinding.typeParentCl.getLeft(); |
| | | int bottom = viewBinding.typeParentCl.getBottom(); |
| | | int right = viewBinding.typeParentCl.getRight(); |
| | | int y = (int) v.getY(); |
| | | int x = (int) v.getX(); |
| | | if (top < y && y < bottom) { |
| | |
| | | |
| | | public void setOnListener(OnClickListener onClickListener) { |
| | | this.mOnClickListener = onClickListener; |
| | | |
| | | } |
| | | |
| | | |