-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.like.jsbridge | ||
|
||
import android.content.Context | ||
import android.webkit.JavascriptInterface | ||
|
||
/** | ||
* | ||
* @author like | ||
* @date 2023/9/16 20:36 | ||
*/ | ||
class ConstantJsBridge(private val context: Context){ | ||
|
||
@JavascriptInterface | ||
fun statusHeight():Int{ | ||
var result = 0 | ||
val resourceId = context.resources | ||
.getIdentifier("status_bar_height", "dimen", "android") | ||
if (resourceId > 0) { | ||
result = context.resources.getDimensionPixelSize(resourceId) | ||
} | ||
return result | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ interface IWebView { | |
return "JsBridge" | ||
} | ||
|
||
|
||
/** | ||
* 获取js的Window,可不用重写,如果遇到window对象不对可以使用这个重新赋值window | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
library/src/main/java/com/core/web/base/IJavascriptInterface.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.core.web.base | ||
|
||
/** | ||
* 使用异步回调的类需要实现此类,如果不实现此类,将会走正常[android.webkit.WebView.addJavascriptInterface]流程 | ||
* @author like | ||
* @date 2023/9/16 20:44 | ||
*/ | ||
interface IJavascriptInterface |