Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. private void initAddLayerPopup() {
  2. listPopupWindow = new ListPopupWindow(getActivity());
  3. listPopupWindow.setContentWidth(getResources().getDimensionPixelSize(R.dimen.popup_add_layer_width));
  4. listPopupWindow.setAdapter(new AddLayerPopupAdapter(getActivity()));
  5. listPopupWindow.setAnchorView(addLayerButton);
  6. listPopupWindow.setDropDownGravity(Gravity.TOP);
  7. listPopupWindow.setHorizontalOffset(-getResources().getDimensionPixelOffset(R.dimen.popup_add_layer_horizontal_offset));
  8. listPopupWindow.setModal(true);
  9. listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  10. @Override
  11. public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
  12. if (i == 0) {
  13. if (drawingEngine != null) {
  14. drawingEngine.postCommand(Command.addEmptyLayer(Color.TRANSPARENT, new Callback<Void>() {
  15. @Override
  16. public void call(Void value) {
  17. scrollListToTop();
  18. }
  19. }));
  20. }
  21. } else if (i == 1) {
  22.  
  23. openPhotoGallery();
  24.  
  25. }
  26.  
  27. listPopupWindow.dismiss();
  28. }
  29. });
  30.  
  31. @Override
  32. public void onConfigurationChanged(Configuration newConfig) {
  33. super.onConfigurationChanged(newConfig);
  34.  
  35. if(listPopupWindow.isShowing()){
  36. listPopupWindow.dismiss();
  37. listPopupWindow = null;
  38. initAddLayerPopup();
  39.  
  40. listPopupWindow.show();
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement