Package io.rong.imkit

Interface KitMediaInterceptor

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void onGlidePrepareLoad(String url, Map<String, String> headers, KitMediaInterceptor.Callback<Map<String, String>> callback) 使用Glide加载图片前的拦截,可用于添加header 使用场景: 1.
      abstract boolean shouldInterceptRequest(WebView view, String url) 拦截WebView资源加载 使用场景: 1.
      String onCombinePortraitLoad(String url)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • onGlidePrepareLoad

         abstract void onGlidePrepareLoad(String url, Map<String, String> headers, KitMediaInterceptor.Callback<Map<String, String>> callback)

        使用Glide加载图片前的拦截,可用于添加header

        使用场景:

        1.大图加载页面(PicturePagerActivity)

        2.SDK内置默认加载头像类GlideKitImageEngine, 加载loadConversationListPortrait、loadConversationPortrait时会使用该方法

        注意:该方法回调在主线程,不能做耗时操作;必须做耗时操作切换到子线程执行.

        注意:调用callback.onComplete(headers)返回header,SDK才会使用该header继续图片加载

        Parameters:
        url - 图片地址
        headers - 准备本次请求前的header
        callback - 调用callback.
      • shouldInterceptRequest

         abstract boolean shouldInterceptRequest(WebView view, String url)

        拦截WebView资源加载

        使用场景:

        1.CombineWebViewActivity加载资源时,优先走此接口,如果返回WebResourceResponse则不会去请求资源

        注意:该方法WebView回调在子线程.

        Parameters:
        view - WebVIew
        url - 图片地址
        Returns:

        是否拦截此请求,true代表不会去请求资源,false代表会去请求资源