ParkSangGwon / TedBottomPicker

TedBottomPicker is simple image picker using bottom sheet
1.11k stars 185 forks source link

add onCancel callback #116

Open eGirlAsm opened 5 years ago

eGirlAsm commented 5 years ago

webview 에서 back 버튼 클릭시 WebChromeClient onShowFileChooser 에서 리턴이 안됌. 때문에 이미지 선택창 한번만 뜨고 다시 안뜸.

 // For Android 5.0+
  public boolean onShowFileChooser(WebView webView, ValueCallback < Uri[] > uploadFile, WebChromeClient.FileChooserParams fileChooserParams) {
      TedBottomPicker.with(MainActivity.this)
          .setPeekHeight(1600)
          .showTitle(false)
          .setCompleteButtonText("완료")
          .setEmptySelectionText("No Select")
          .setSelectedUriList(selectedUriList)
          .SetOnUserCancelled(new TedBottomSheetDialogFragment.onUserCancelListener() {
              @Override
              public void onCancel() {
                  uploadFile.onReceiveValue(null); // 이거 없으면 다시 안뜸
              }
          })
          .showMultiImage(uriList - > {
              selectedUriList = uriList;

              Uri[] results = selectedUriList.toArray(new Uri[0]);

              Log.d(TAG1, " length " + results.length);
              mFilePathCallback.onReceiveValue(results);
              selectedUriList.clear();

          });
  }