-
Notifications
You must be signed in to change notification settings - Fork 30
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
lemon
committed
Apr 10, 2018
1 parent
d903960
commit 7f14494
Showing
9 changed files
with
78 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
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
18 changes: 18 additions & 0 deletions
18
app/src/main/java/tech/easily/easybridge/handler/GetUserInfoHandler.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,18 @@ | ||
package tech.easily.easybridge.handler | ||
|
||
import tech.easily.easybridge.annotation.EasyBridgeHandler | ||
import tech.easily.easybridge.lib.EasyBridgeWebView | ||
import tech.easily.easybridge.lib.ResultCallBack | ||
import tech.easily.easybridge.lib.handler.BaseBridgeHandler | ||
import tech.easily.easybridge.model.User | ||
|
||
/** | ||
* Created by hzyangjiehao on 2018/4/10. | ||
*/ | ||
@EasyBridgeHandler(name = "getUserInfo") | ||
class GetUserInfoHandler(handlerName: String, webView: EasyBridgeWebView) : BaseBridgeHandler(handlerName, webView) { | ||
override fun onCall(parameters: String?, callBack: ResultCallBack?) { | ||
val user = User("userName", 13, "Hangzhou") | ||
callBack?.onResult(user) | ||
} | ||
} |
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,6 @@ | ||
package tech.easily.easybridge.model | ||
|
||
/** | ||
* Created by hzyangjiehao on 2018/4/10. | ||
*/ | ||
data class User(var name: String, var age: Int, var address: String) |
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,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="oval"> | ||
|
||
<padding | ||
android:bottom="8dp" | ||
android:left="8dp" | ||
android:right="8dp" | ||
android:top="8dp" /> | ||
<solid android:color="@color/colorPrimary" /> | ||
|
||
</shape> |
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 |
---|---|---|
@@ -1,18 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MainActivity"> | ||
|
||
<tech.easily.easybridge.lib.EasyBridgeWebView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:id="@+id/webView" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tvCallJS" | ||
android:layout_width="60dp" | ||
android:layout_height="60dp" | ||
android:layout_gravity="right|bottom" | ||
android:layout_margin="16dp" | ||
android:background="@drawable/bg_circle_button" | ||
android:elevation="1dp" | ||
android:gravity="center" | ||
android:text="callJS" | ||
android:textColor="#fff" /> | ||
|
||
</android.support.constraint.ConstraintLayout> | ||
</FrameLayout> |
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