All Projects → Tamicer → Jswebview

Tamicer / Jswebview

Licence: apache-2.0
基于JsBridge封装的高效自带加载进度条的WebView

Programming Languages

java
68154 projects - #9 most used programming language
js
455 projects

Labels

Projects that are alternatives of or similar to Jswebview

Openrtb
Go (Golang) OpenRTB 2.5, 3.0 / AdCOM 1.0 / Native 1.2 types/enums
Stars: ✭ 123 (-28.07%)
Mutual labels:  native
Conari
🧬 Platform for unmanaged memory, pe-modules, related PInvoke features, and more for: Libraries, Executable Modules, enjoy using of the unmanaged native C/C++ in .NET world, and other raw binary data …
Stars: ✭ 138 (-19.3%)
Mutual labels:  native
Jpegkit Android
Efficient JPEG operations for Android without the risk of an OutOfMemoryException.
Stars: ✭ 154 (-9.94%)
Mutual labels:  native
React Native Css Gradient
React Native css gradients - react-native-linear-gradient with css gradient support
Stars: ✭ 129 (-24.56%)
Mutual labels:  native
Stunning Signature
Native Signature Verification For Android (with example)
Stars: ✭ 139 (-18.71%)
Mutual labels:  native
Xcrash
🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.
Stars: ✭ 148 (-13.45%)
Mutual labels:  native
Kotlinnativesample
Kotlin Native app working on Android & iPhone
Stars: ✭ 119 (-30.41%)
Mutual labels:  native
Expo Voxel
🎮🌳 Voxel Terrain made in React Native. ∛
Stars: ✭ 169 (-1.17%)
Mutual labels:  native
React Native Directed Scrollview
UNMAINTAINED- see below. A natively implemented scrollview component which lets you specify different scroll directions for child content.
Stars: ✭ 139 (-18.71%)
Mutual labels:  native
Androidsecurity
Android安全实践
Stars: ✭ 150 (-12.28%)
Mutual labels:  native
Ofxremoteui
OpenFrameworks addon serves any number of variables (bool, float, int, enum, string, ofColor) on the network, so that you can modify from outside the OF app. Includes a native OSX Client. OSC based.
Stars: ✭ 132 (-22.81%)
Mutual labels:  native
Proton Native
A React environment for cross platform desktop apps
Stars: ✭ 10,834 (+6235.67%)
Mutual labels:  native
Purescript Presto
Write Apps like Mathematical Equations!
Stars: ✭ 149 (-12.87%)
Mutual labels:  native
Callapp Lib
🔥call app from h5(H5唤起客户端 )
Stars: ✭ 1,857 (+985.96%)
Mutual labels:  native
Cs2cpp
C# to C++ transpiler (Cs2Cpp) (Powered by Roslyn)
Stars: ✭ 155 (-9.36%)
Mutual labels:  native
Lambda Lantern
🧙 ‎‎ A 3D game about functional programming patterns. Uses PureScript Native, C++, and Panda3D.
Stars: ✭ 122 (-28.65%)
Mutual labels:  native
Nativelogin
Authorization form in native iOS style
Stars: ✭ 140 (-18.13%)
Mutual labels:  native
Robot Js
Native system automation for node.js
Stars: ✭ 169 (-1.17%)
Mutual labels:  native
Node Postal
NodeJS bindings to libpostal for fast international address parsing/normalization
Stars: ✭ 165 (-3.51%)
Mutual labels:  native
Gta V Data Dumps
GTA V Data dumps useful for modding & scripting
Stars: ✭ 148 (-13.45%)
Mutual labels:  native

JsWebView

Android基于JsBridge封装的高效带加载进度的WebView 可用作简单应用内置浏览器,帮你快速开发Hybrid APP

主要功能:

  • 支持header
  • 支持进度
  • 支持自定义错误页面
  • 支持h5和native的快速交互,简单易学
  • 支持cookie同步

#UI

#Dependencies

Gradle:

root:

  repositories {
maven { url "https://jitpack.io" }
jcenter()
  }

Module:

   dependencies {
   .....
   compile 'com.tamic:browse:1.0.0'

   }

Function

   XMl

 <com.tamic.jswebview.view.ProgressBarWebView
    android:id="@+id/login_progress_webview"
    style="@style/NumberProgressBar_Default"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

 </com.tamic.jswebview.view.ProgressBarWebView>

初始化

    ProgressBarWebView  mProgressBarWebView = (ProgressBarWebView) findViewById(R.id.login_progress_webview);

设置WebViewClient

      mProgressBarWebView.setWebViewClient(new CustomWebViewClient(mProgressBarWebView.getWebView()) {
        @Override
        public String onPageError(String url) {
            //指定网络加载失败时的错误页面
            return "file:///android_asset/error.html";
        }

        @Override
        public Map<String, String> onPageHeaders(String url) {

            // 可以加入header

            return null;
        }

        
    });

    // 打开页面,也可以支持网络url
    mProgressBarWebView.loadUrl("file:///android_asset/demo.html");

回调js的方法

    // 添加hander方法名 
    mHandlers.add("login");
   // 订阅此方法key
    mProgressBarWebView.registerHandlers(mHandlers, new JsHandler() {
        @Override
        public void OnHandler(String handlerName, String responseData, CallBackFunction function) {

                String resquestData = "this native data"
                
                 // 返回数据给js
                function.onCallBack(resquestData);
           
        }
    });

调用js

    mProgressBarWebView.callHandler("callNative", "hello H5, 我是java", new JavaCallHandler() {
        @Override
        public void OnHandler(String handlerName, String jsResponseData) {
            Toast.makeText(MainActivity.this, "h5返回的数据:" + jsResponseData, Toast.LENGTH_SHORT).show();
        }
    });

发送消息给js

    mProgressBarWebView.send("hello world!", new CallBackFunction() {
        @Override
        public void onCallBack(String data) {
        
        // data 为js回传数据

            Toast.makeText(MainActivity.this, data, Toast.LENGTH_SHORT).show();

        }
    });

作者:Tamic & Yezhengnan.

介绍:http://www.jianshu.com/p/17054c21dd78

 >http://blog.csdn.net/sk719887916/article/details/52402470

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].