AndroidStringAndBoolDelegateCallback.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Copyright (c) 2021 Vuplex Inc. All rights reserved.
  3. *
  4. * Licensed under the Vuplex Commercial Software Library License, you may
  5. * not use this file except in compliance with the License. You may obtain
  6. * a copy of the License at
  7. *
  8. * https://vuplex.com/commercial-library-license
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #if UNITY_ANDROID && !UNITY_EDITOR
  17. using System;
  18. using UnityEngine;
  19. namespace Vuplex.WebView {
  20. class AndroidStringAndBoolDelegateCallback : AndroidJavaProxy {
  21. public AndroidStringAndBoolDelegateCallback(Action<string, Action<bool>> callback) : base("com.vuplex.webview.StringAndBooleanDelegateCallback") {
  22. _callback = callback;
  23. }
  24. public void callback(string stringParam, AndroidJavaObject delegateParam) {
  25. _callback(stringParam, boolParam => delegateParam.Call("callback", boolParam));
  26. // Don't set _callback = null because this callback is called multiple times.
  27. }
  28. Action<string, Action<bool>> _callback;
  29. }
  30. }
  31. #endif