popup_service.h 843 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * progress_dialog.h
  3. *
  4. * Created on: 2021年10月30日
  5. * Author: pengzc
  6. */
  7. #ifndef JNI_CORE_POPUP_SERVICE_H_
  8. #define JNI_CORE_POPUP_SERVICE_H_
  9. #include <atomic>
  10. #include <functional>
  11. #include <thread>
  12. enum class PopupType {
  13. Dialog,
  14. Progress,
  15. };
  16. class PopupService {
  17. public:
  18. virtual ~PopupService();
  19. static PopupService* instance();
  20. typedef std::function<int (PopupService* dialog)> Task;
  21. static void Show(Task task);
  22. static void Dialog(const std::string& text);
  23. void SetMessage(const std::string& msg);
  24. void Animation(bool visible);
  25. static bool busy();
  26. private:
  27. PopupService();
  28. static void Show(Task task, PopupType type);
  29. void InternalShow(const Task& func, PopupType type);
  30. friend void NavibarDialog1ClickOk();
  31. private:
  32. std::atomic<bool> busy_;
  33. };
  34. #endif /* JNI_CORE_POPUP_SERVICE_H_ */