Commit 40a5a6e7 by 刘鹏

feat: js组件抽离完毕

parent 61360c26
......@@ -41,4 +41,6 @@ interface IConfideService : IProvider {
fun isOnlineRtm():Boolean
fun requestConfidePermission(activity: FragmentActivity, call: ((Boolean) -> Unit)?)
fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit)
}
\ No newline at end of file
package com.ydl.confide.home.event
package com.ydl.confide.event
data class ChangeAnotherExpertEvent(
var doctorID: String,
var title: String,
var uid: String,
var linkUrl: String
)
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
)
\ No newline at end of file
package com.ydl.confide.event
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
package com.yidianling.im.event
package com.yidianling.im.api.event
data class CloseBottomWebviewEvent( var close:Boolean)
\ No newline at end of file
......@@ -188,4 +188,6 @@ interface IImService : IProvider {
fun showConsultServiceDialog(activity: Activity, toUid: String, doctorId: String)
fun dismissConsultServiceDialog();
/**群聊*/
fun startTeamSession(activity: Activity, tid: String, doctorId: String)
}
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.js.api">
</manifest>
\ No newline at end of file
package com.ydl.js.api
import com.alibaba.android.arouter.facade.template.IProvider
interface IJsService : IProvider {
fun isH5Open(): Boolean
fun isMainOpen(): Boolean
fun setH5Open(open: Boolean)
fun setMainOpen(open: Boolean)
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.YDLComponent" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">audioim</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.YDLComponent" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.media.api">
</manifest>
\ No newline at end of file
package com.ydl.media.api
import android.app.Activity
import com.alibaba.android.arouter.facade.template.IProvider
interface IMediaService : IProvider {
fun closeFloatView(activity: Activity);
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.YDLComponent" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">audioim</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.YDLComponent" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.muse.api">
</manifest>
\ No newline at end of file
package com.ydl.muse.api
import android.app.Activity
import com.alibaba.android.arouter.facade.template.IProvider
interface IMuseService : IProvider {
fun switchSound(activity: Activity,
mediaId: Int, meditationId: Long, meditationType: Int, businessType: Int,
buried: String?, mediaUrl: String?, mediaCoverUrl: String?,
title: String?, desc: String?, status: Int
)
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.YDLComponent" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">audioim</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.YDLComponent" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
......@@ -7,12 +7,11 @@ import com.google.gson.JsonParser
import com.tencent.smtt.sdk.WebView
import com.ydl.audioim.YDLavManager
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.event.ConfideDialogEvent
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.ui.Loading
import com.yidianling.common.tools.ToastUtil
import com.yidianling.common.tools.asFragmentActivity
import com.yidianling.user.UserHelper
......
......@@ -7,12 +7,10 @@ import android.graphics.Rect;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ScreenUtils;
import com.ydl.confide.api.IConfideService;
import com.ydl.confide.home.event.ChangeAnotherExpertEvent;
import com.ydl.confide.event.ChangeAnotherExpertEvent;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydl_router.manager.YDLRouterParams;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.consultant.preview.GPreviewBuilder;
......@@ -24,13 +22,11 @@ import com.yidianling.muse.activity.ChooseMusicActivity;
import de.greenrobot.event.EventBus;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import com.yidianling.im.api.event.CloseBottomWebviewEvent;
import java.util.ArrayList;
import java.util.List;
import de.greenrobot.event.EventBus;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
......
......@@ -27,8 +27,8 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.tencent.smtt.export.external.interfaces.JsResult
import com.tencent.smtt.sdk.*
import com.ydl.confide.R
import com.ydl.confide.home.event.ChangeAnotherExpertEvent
import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.event.ConfideDialogEvent
import com.ydl.confide.event.ChangeAnotherExpertEvent
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.router.PhoneCallIn
import com.ydl.utils.WebUrlParamsUtils
......
......@@ -91,17 +91,17 @@ class ConfdieServiceImpl : IConfideService {
//debug包根据url判断使用正式或者测试key
val cacheAppEnv = YDLCacheUtils.getCacheApi()
if (!TextUtils.isEmpty(cacheAppEnv)) {
avManagerKey = if (!TextUtils.isEmpty(cacheAppEnv)) {
if (YDLConstants.ENV_TEST == cacheAppEnv) {
avManagerKey = "13b1536698f64905a1e7e5bb978ba821"
"13b1536698f64905a1e7e5bb978ba821"
} else {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
"3387e9b251f3491e9221a9877e8f7830"
}
} else {
if (YDLConstants.ENV_TEST == appEnv || YDLConstants.ENV_AUTO_TEST == appEnv) {
avManagerKey = "13b1536698f64905a1e7e5bb978ba821"
"13b1536698f64905a1e7e5bb978ba821"
} else {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
"3387e9b251f3491e9221a9877e8f7830"
}
}
} else {
......@@ -144,4 +144,8 @@ class ConfdieServiceImpl : IConfideService {
ConfidePermissionDialog().apply { callback = call }.show(activity.supportFragmentManager, "ConfidePermissionDialog")
}
override fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) {
YDLavManager.instances.login(userId,event)
}
}
\ No newline at end of file
......@@ -431,4 +431,13 @@ class IMServiceImpl : IImService {
override fun dismissConsultServiceDialog() {
expertConsultServiceListDialog2?.changeItem()
}
override fun startTeamSession(activity: Activity, tid: String, doctorId: String) {
SessionHelper.startTeamSession(
activity,
tid + "",
null,
P2PCustomActionHandlerImpl(doctorId + "")
)
}
}
\ No newline at end of file
......@@ -61,7 +61,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import com.yidianling.im.api.event.CloseBottomWebviewEvent;
import com.yidianling.im.event.MultipleAnswerBean;
import com.yidianling.im.event.MultipleSelectedEvent;
import com.yidianling.im.helper.IMChatUtil;
......
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply from: "../publish.gradle"
kapt {
arguments {
arg("AROUTER_MODULE_NAME", "js")
}
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: "js"]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled true
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.alibaba:arouter-api:$arouter_api"
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
// 时间选择器
implementation 'com.contrarywind:Android-PickerView:4.1.9'
api rootProject.ext.dependencies["ydl-user-router"]
api project(':ydl-webview')
api project(':ydl-platform')
implementation project(':ydl-media')
implementation project(":ydl-pay")
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:consultant")
implementation project(":api:confide")
implementation project(":api:dynamic")
implementation project(":api:tests")
implementation project(":api:fm")
implementation project(":api:course")
implementation project(':api:media')
implementation project(':api:muse')
implementation project(':api:js')
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.js">
</manifest>
\ No newline at end of file
package com.ydl.js
import android.Manifest
import com.blankj.utilcode.util.PermissionUtils
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.api.IConfideService
import com.ydl.confide.event.ConfideDialogEvent
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.common.tools.asFragmentActivity
import de.greenrobot.event.EventBus
class JsMethod(private val webView: WebView?) {
fun handle(param: String): Boolean {
try {
val obj = JsonParser().parse(param).asJsonObject
val cmd = obj.getAsJsonObject("cmd")
val actionName = cmd?.getAsJsonPrimitive("action_name")?.asString
if (actionName.isNullOrBlank()) return false
return innerHandle(actionName, cmd)
} catch (throwable: Throwable) {
throwable.printStackTrace()
return false
}
}
private fun innerHandle(actionName: String, obj: JsonObject): Boolean {
val param = obj.getAsJsonObject("params")
when (actionName) {
"handle_confide_btn" -> {
val show = param.getAsJsonPrimitive("show").asInt
EventBus.getDefault().post(ConfideDialogEvent(show))
return true
}
"show_loading" -> {
// val topActivity = BaseActivityMgr.INST.getTopActivity()
// Loading.show(topActivity)
return true
}
"close_loading" -> {
// Loading.close()
return true
}
"open_app_eval_list" -> {
val url = param.getAsJsonPrimitive("url").asString
val topActivity = BaseActivityMgr.INST.getTopActivity()
NewH5Activity.start(topActivity, H5Params(url, ""))
return true
}
"toast" -> {
val msg = param.getAsJsonPrimitive("msg").asString
if (!msg.isNullOrBlank()) {
ToastUtil.toastShort(msg)
}
return true
}
"has_audio_permission" -> {
val callback = param.getAsJsonPrimitive("callback").asString
if (callback.isNullOrBlank()) return true
if (PermissionUtils.isGranted(Manifest.permission.RECORD_AUDIO)) {
webView?.post {
webView.loadUrl("javascript:$callback(1)")
}
return true
}
(webView?.context?.asFragmentActivity())?.let {
findRouteService(IConfideService::class.java).requestConfidePermission(it) { granted ->
webView.post {
webView.loadUrl("javascript:$callback(${if (granted) 1 else 0})")
}
}
}
return true
}
"confide_dial" -> {
//倾诉链接 java接口,支持axb和声网
val id = param.getAsJsonPrimitive("id").asInt
val data = param.getAsJsonObject("data").toString()
val topActivity = BaseActivityMgr.INST.topActivity
if (!JsModularService.getIConfideService().isOnlineRtm()) {
//异常退出或者账号被顶掉,重新登录并拨打
JsModularService.getIConfideService().login(JsModularService.getIUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (isSuccess) {
findRouteService(IConfideService::class.java).confideDial(id,
data,
topActivity)
} else {
ToastUtil.toastShort("请重新拨打")
}
}
} else {
findRouteService(IConfideService::class.java).confideDial(id, data, topActivity)
}
return true
}
"check_app_support" -> {
val callback = param.getAsJsonPrimitive("callback").asString
val type = param.getAsJsonPrimitive("type").asInt
if (callback.isNullOrBlank()) return true
webView?.post {
when (type) {
1 -> {//检查音频权限能力
webView.loadUrl("javascript:$callback(1)")
}
else -> {
webView.loadUrl("javascript:$callback(0)")
}
}
}
return true
}
"startCms" ->{
if (Utils.isFastClick()) {
return true
}
val activity = BaseActivityMgr.INST.topActivity
if (JsModularService.getIUserService().loginByOneKeyLogin(activity, true)) {
val location = param.getAsJsonPrimitive("location").asInt
JsModularService.getImService().startP2PSession(activity, location, null)
}
return true
}
"to_search_list" ->{
if (Utils.isFastClick()) {
return true
}
val cateId = param.getAsJsonPrimitive("cateId").asString
val cateTitle = param.getAsJsonPrimitive("cateTitle").asString
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_CONSULT_LIST,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_CATEID, cateId)
.putExtra(IYDLRouterConstant.EXTRA_CATETITLE, cateTitle)
.putExtra(IYDLRouterConstant.EXTRA_SHOWTYPE, "0")
)
return true
}
else -> {
return false
}
}
}
}
\ No newline at end of file
package com.ydl.js
import com.ydl.confide.api.IConfideService
import com.ydl.course.api.ICourseService
import com.ydl.media.api.IMediaService
import com.ydl.muse.api.IMuseService
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.im.api.service.IImService
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
class JsModularService {
companion object{
fun getIConfideService(): IConfideService{
return ModularServiceManager.provide(IConfideService::class.java)
}
fun getIUserService(): IUserService{
return ModularServiceManager.provide(IUserService::class.java)
}
fun getIAppService(): IAppService{
return ModularServiceManager.provide(IAppService::class.java)
}
fun getIDynamicService(): IDynamicService{
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getITestsApiService(): ITestsApiService {
return ModularServiceManager.provide(ITestsApiService::class.java)
}
fun getIFMService(): IFMService {
return ModularServiceManager.provide(IFMService::class.java)
}
fun getICourseService(): ICourseService {
return ModularServiceManager.provide(ICourseService::class.java)
}
fun getIMediaService(): IMediaService {
return ModularServiceManager.provide(IMediaService::class.java)
}
fun getIMuseService(): IMuseService {
return ModularServiceManager.provide(IMuseService::class.java)
}
}
}
\ No newline at end of file
package com.ydl.js
import android.webkit.JavascriptInterface
import androidx.fragment.app.FragmentActivity
import com.google.gson.Gson
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.api.IConfideService
import com.ydl.js_module.manager.WebViewRouterManager
import com.ydl.webview.H5JsBean
import com.ydl.webview.IJavascriptHandler
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.api.service.IUserService
/**
* update by harvie on 2017/7/04
*/
class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnventPro: NewH5_WebViewClientClickListener?) : IJavascriptHandler() {
private val js = JsMethod(webView)
override fun getUriAppendSuffix(): String {
return "platform_main_theme=00C9E2&platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC"
}
@JavascriptInterface
fun sendDataToOC(params: String) {
LogUtil.i("js", params)
LogUtil.d("sendDataToOC")
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.WEB, "params:$params")
//js交互路由 后期会去除掉这个路由 统一使用下面的路由
//该路由只有测试记录h5页面在使用 - 测试题支付/测试题详情/测试题结果
val webViewRouter = WebViewRouterManager()
if (webViewRouter.toNative(params)) {
//
return
}
//壹点灵路由
if (YDLRouterManager.router(params)) {
return
}
if (js.handle(params)) return
val jsData = Gson().fromJson(params, H5JsBean::class.java)
//是否登录
if (jsData.cmd?.action_name != null && jsData.cmd!!.action_name.equals("login")) {
//跳转登陆页面
wvEnventPro?.jumpLogin(jsData.cmd?.params)
return
}
if (jsData.url.equals("http")) {
if (jsData.cmd?.params?.toUid != 0) {
wvEnventPro?.chat(
findRouteService(IUserService::class.java).getUserInfo()?.uid?.toInt() ?: 0,
jsData.cmd?.params?.toUid ?: 0,
0,
findRouteService(IUserService::class.java).getUserInfo()?.accessToken,
jsData.cmd?.params?.isFromQingShu ?: 0,
jsData.cmd?.params?.closeReplaceChat ?: false
)
} else {
wvEnventPro?.openH5(jsData.cmd?.params)
}
} else if (jsData.url.equals("ydl_app")) {
wvEnventPro?.ydlNative(jsData.cmd)
jumpAction(jsData)
}
}
fun jumpAction(jsData: H5JsBean) {
LogUtil.d("jumpAction")
when (jsData.cmd!!.action_name) {
"fm" -> if (jsData.cmd!!.params!!.id > 0) {
//跳转fm详情页面
if (wvEnventPro != null) {
wvEnventPro!!.openFmDetail(jsData.cmd!!.params!!.id)
}
} else if (wvEnventPro != null) {
wvEnventPro!!.openFmList()
}
"search_service_doc" -> if (wvEnventPro != null) {
wvEnventPro!!.searchServiceDoc(jsData.cmd!!.params!!.cate_id)
}
"article_list" ->
//文章列表
if (wvEnventPro != null) {
wvEnventPro!!.openArticle()
}
"fm_detail" ->
//fm详情
if (wvEnventPro != null) {
wvEnventPro!!.openFmDetail(jsData.cmd!!.params!!.id)
}
"pay" -> if (wvEnventPro != null) {
//预约咨询
wvEnventPro!!.pay(jsData.cmd?.params)
}
"pay_receipt" -> if (wvEnventPro != null) {
//专家收款
wvEnventPro!!.payReceipt(jsData.cmd?.params)
}
"pay_course" ->
//购买课程
if (wvEnventPro != null) {
wvEnventPro!!.payCourse(jsData.cmd?.params)
}
"pay_test" ->
//付费测试
if (wvEnventPro != null) {
wvEnventPro!!.payTest(jsData.cmd?.params)
}
"view_test_result" ->
//查看测试结果
if (wvEnventPro != null) {
wvEnventPro?.viewTestResult(jsData.cmd?.params)
}
"chat" ->
//私聊
if (wvEnventPro != null) {
wvEnventPro?.chat(findRouteService(IUserService::class.java).getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid, 0,
JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu,
jsData.cmd!!.params!!.closeReplaceChat
)
// 埋点
ActionCountUtils.count("ydl_user_main_page|private_chat_click")
}
"chat_send_message" ->
//跳转私聊:并发送消息
if (wvEnventPro != null) {
wvEnventPro!!.chatSendMessage(findRouteService(IUserService::class.java).getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid,
0, JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu)
}
"chat_team" ->
//群聊
if (wvEnventPro != null) {
wvEnventPro!!.chatTeam(jsData.cmd!!.params!!.tid, jsData.cmd!!.params!!.doctor_id)
}
"sendResult" -> if (wvEnventPro != null) {
wvEnventPro!!.sendInfo(jsData.cmd!!.params)
}
"active_send_share" -> {
val cover1 = jsData.cmd!!.params!!.share!!.cover
val title1 = jsData.cmd!!.params!!.share!!.title
val purl1 = jsData.cmd!!.params!!.share!!.url
val share_url1 = jsData.cmd!!.params!!.share!!.share_url
if (wvEnventPro != null) {
wvEnventPro!!.sendResultTrend(cover1, title1, purl1, share_url1)
}
}
"active_send" -> if (wvEnventPro != null) {
wvEnventPro!!.sendTrend()
}
"topic_detail" -> if (wvEnventPro != null) {
wvEnventPro!!.openTopicDetail(jsData.cmd?.params?.id.toString() + "")
}
"set_time_warn" ->
//提醒专家设置时间
if (wvEnventPro != null) {
wvEnventPro!!.sendSubscriptionTimeMessage("" + jsData.cmd?.params?.toUid)
}
"user_home" -> if (wvEnventPro != null) {
wvEnventPro!!.openMember("" + jsData.cmd?.params?.uid)
}
"sq_topic" -> if (wvEnventPro != null) {
wvEnventPro!!.openTopicDetail(jsData.cmd?.params?.id.toString() + "")
}
"good_expert" //推荐专家
-> if (wvEnventPro != null) {
wvEnventPro!!.goodExpert()
}
"copywechat"//复制到微信
-> if (wvEnventPro != null) {
wvEnventPro!!.copyWechat(jsData.cmd?.params)
}
"gowechat"//打开微信
-> if (wvEnventPro != null) {
wvEnventPro!!.goWechat()
}
//课程播放--不区分音视频或者试听
"course_play" -> {
wvEnventPro!!.coursePlay(jsData.cmd?.params)
}
//h5播放时,需要关闭app中悬浮的播放窗
"course_close_float_view" -> {
wvEnventPro!!.closeFloatView()
}
//课程评论
"course_write_comment" -> {
wvEnventPro!!.courseWriteComment(jsData.cmd?.params)
}
"contact_yi" //联系小壹
-> if (wvEnventPro != null) {
wvEnventPro!!.contactYi()
}
"contact_course_customer_service" //联系课程专属客服
-> if (wvEnventPro != null) {
wvEnventPro!!.contactCourseCustomerService()
}
"course_comments"//课程评论
-> if (wvEnventPro != null) {
wvEnventPro!!.courseComment(jsData.cmd?.params)
}
"test_item" ->
//开始测试
if (wvEnventPro != null) {
wvEnventPro!!.openTest(jsData.cmd?.params)
}
"doctor_home"//专家主页
-> if (wvEnventPro != null) {
wvEnventPro!!.openExpertsHome(jsData.cmd?.params)
}
"search_list" -> if (wvEnventPro != null) {
wvEnventPro!!.searchList(jsData.cmd?.params)
}
"order_detail"//我的订单详情
-> if (wvEnventPro != null) {
wvEnventPro!!.openOrderDetail(jsData.cmd?.params)
}
"expert_product"//专家商品详情
-> if (wvEnventPro != null) {
wvEnventPro!!.expertProduct(jsData.cmd?.params)
}
"order"//订单预约页面
-> if (wvEnventPro != null) {
wvEnventPro!!.order(jsData.cmd?.params)
}
"to_order_ct"//免费体验下单页面
-> if (wvEnventPro != null) {
wvEnventPro!!.toOrderCt(jsData.cmd?.params)
}
"show_doc"//搜索专家的列表
-> if (wvEnventPro != null) {
wvEnventPro!!.showDocList(jsData.cmd?.params)
}
"listen-order-detail"//倾诉订单详情
-> if (wvEnventPro != null) {
wvEnventPro!!.listenOrderDetail(jsData.cmd?.params)
}
"detail-sub"//预约订单子订单
-> if (wvEnventPro != null) {
wvEnventPro!!.detailSub(jsData.cmd?.params)
}
"agreement"//用户协议
-> if (wvEnventPro != null) {
wvEnventPro!!.openAgreement(jsData.cmd?.params)
}
"modify-eval" -> if (wvEnventPro != null) {
wvEnventPro!!.modifyEval(jsData.cmd?.params)
}
"view-eval"//查看评价
-> {
wvEnventPro?.visitEval(jsData.cmd?.params)
}
"article" -> {
wvEnventPro?.openH5(jsData.cmd?.params)
}
"test" -> {
wvEnventPro?.openH5(jsData.cmd?.params)
}
"test_detail" -> {//测试详情页
wvEnventPro?.openTestDetail(jsData.cmd?.params)
}
"test_list" -> {
wvEnventPro?.openTestList()
}
"course_list" ->
//课程列表
wvEnventPro?.courseList()
"active_detail" -> {
//动态详情
wvEnventPro?.activeDetail(jsData.cmd?.params?.id.toString() + "")
}
"listen_tel" -> {
//倾诉,立即连接
wvEnventPro?.listenTel(jsData.cmd?.params)
}
"listen_agora" -> {
//声网
wvEnventPro?.listenAgora(jsData.cmd?.params)
}
"confide_connect" -> {
//倾诉链接 java接口,支持axb和声网
wvEnventPro?.confideConnect(jsData.cmd?.params)
}
"voice_broadcast" -> {
//语音直播
LogHelper.getInstance().writeLogSync("课程详情页进入课程 " +
"replay_url = " + jsData.cmd?.params?.replay_url +
", roomid = " + jsData.cmd?.params?.roomid +
", roomname = " + jsData.cmd?.params?.roomname +
", starttime = " + jsData.cmd?.params?.start_time)
wvEnventPro?.voiceBroadcast(jsData.cmd?.params)
}
"tel" -> {
wvEnventPro?.tel(jsData.cmd?.params)
}
"onorder_by_app" -> {
//预约下单
wvEnventPro?.onOrderByApp(jsData.cmd?.params)
}
"feedback" -> {
wvEnventPro?.feedBack()
}
"order_set_time" -> {
//预约下单--选择时间回调
wvEnventPro?.orderSetTime(jsData.cmd?.params)
}
"listen_list" -> {
wvEnventPro?.phoneCall()
}
"action_share" -> {
LogUtil.d("action_share")
wvEnventPro?.shareAction(jsData.cmd?.params)
}
"chat_schedule" -> {
// 专家修改时间和用户确认时间跳转到私聊
wvEnventPro?.chatSchedule(jsData.cmd?.params)
}
"action_invite" -> {
wvEnventPro?.invite(jsData.cmd?.params)
}
"action_fund" -> {
wvEnventPro?.balance(jsData.cmd?.params)
}
"down_refresh" -> {
// 禁止下拉刷新
wvEnventPro?.switchDownRefresh(jsData.cmd?.params)
}
//跳转充值界面
"recharge" -> {
wvEnventPro?.recharge()
}
//跳转绑定手机号
"bind_phone" -> {
wvEnventPro?.bindPhone()
}
"refresh" -> {
wvEnventPro?.refresh()
}
"set_title" -> {
wvEnventPro?.setTitle(jsData.cmd?.params)
}
"save_image" -> {
wvEnventPro?.saveImage(jsData.cmd?.params)
}
"send_to_expert" -> {
wvEnventPro?.sendToExpert(jsData.cmd?.params)
}
"confide_pay" -> {
wvEnventPro?.confidePay(jsData.cmd?.params)
}
"back" -> {
//用于h5页面返回上一级
wvEnventPro?.back()
}
//购买系列课程
"common_pay" -> {
wvEnventPro?.commonPay(jsData.cmd?.params)
}
"hideStatusBar" -> {
wvEnventPro?.hideStatusBar()
}
"showStatusBar" -> {
wvEnventPro?.showStatusBar()
}
"openRightTopMenu" -> {
wvEnventPro?.openRightTopMenu()
}
"openShareMenu" -> {
wvEnventPro?.openShareMenu(jsData.cmd?.params)
}
"close" -> {
wvEnventPro?.closeWebKit()
}
//关闭所有页面,返回首页
"goHome" -> {
wvEnventPro?.goHome(jsData.cmd?.params)
}
"chatUnread" -> {
wvEnventPro?.sendUnReadNum(jsData.cmd!!.params?.callBack, jsData.cmd!!.params?.uid.toString())
}
"switch_push_status" -> {
wvEnventPro?.switchPushStatus(jsData.cmd?.params)
}
"showTitleBar" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.shouldShowTitleBar(it.isShowTitleBar!!)
}
}
"setSelfPageType" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.setSelfPageType(it.selfPageType)
}
}
"setBootomFitViewColor" -> {
wvEnventPro?.setBootomFitViewColor(jsData.cmd?.params?.bottomfitViewColor ?: "")
}
// 打开时间选择器
"requestSelectTime"->{
if (Utils.isFastClick()){
return
}
wvEnventPro?.openTimePicker(jsData.cmd?.params?.callBack,jsData.cmd?.params?.day,jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.orderId)
}
// 返回上一页并刷新
"goBackAndReload"->{
wvEnventPro?.goBackAndReload(jsData.cmd?.params?.url)
}
// 跳转到第三方app
"toThirdApp" ->{
wvEnventPro?.toThirdApp(jsData.cmd?.params?.url)
}
"meditation_play" -> {
jsData.cmd!!.params?.let{
val mediaId = it.mediaId
val meditationId = it.meditationId
val meditationType = it.meditionType
val mediaCoverUrl = it.coverImageUrl
if (mediaId != null && meditationId!=null && meditationType!=null) {
wvEnventPro?.playMeditation(mediaId,meditationId.toLong(),
meditationType,mediaCoverUrl)
}
}
}
"switch_sound" -> {
jsData.cmd!!.params?.let{
val mediaId = it.mediaId
val meditationId = it.meditationId
val meditationType = it.meditionType
val businessType = it.businessType
val buried = it.buried
val mediaUrl = it.mediaUrl
val mediaCoverUrl = it.coverImageUrl
val title = it.title
val desc = it.desc
val status = it.status
if (mediaId != null && meditationId!=null && meditationType!=null) {
wvEnventPro?.switchSound(mediaId,meditationType.toLong(),businessType!!,
meditationId,buried,mediaUrl,mediaCoverUrl,title,desc,status)
}
}
}
"loadUrl" -> {
jsData.cmd?.params?.let{
wvEnventPro?.reloadUrl(jsData.cmd?.params?.url)
}
}
"webViewBackgroundColor" -> {
jsData.cmd?.params?.let{
val rgb = it.color
val alpha = it.alpha
wvEnventPro?.setBG(rgb,alpha)
}
}
//再换一位
"get_next_doctor"->{
wvEnventPro?.getNextExpertStatus(jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.title,jsData.cmd?.params?.uid.toString(),jsData.cmd?.params?.linkUrl)
}
"show_popup_window" -> {
val doctorId = jsData.cmd?.params?.doctorId?.toString()
val confideId = jsData.cmd?.params?.confidedId
val uid = jsData.cmd?.params?.uid?.toString()
val topActivity = BaseActivityMgr.INST.getTopActivity()
if (topActivity is FragmentActivity && doctorId != null && confideId != null) {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId)
findRouteService(IConfideService::class.java).showExpertDetailDialog(topActivity, url, doctorId, uid ?: "")
}
}
"chat_close_bottom_webview" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.chatCloseBottomWebView()
}
}
}
}
}
package com.ydl.js;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.ydl.confide.api.IConfideService;
import com.ydl.confide.event.ChangeAnotherExpertEvent;
import com.ydl.js.bean.TimeDataBean;
import com.ydl.js.http.JsHttpImpl;
import com.ydl.js.moduler.service.JsImpl;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.config.HttpConfig;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.router.IYDLRouterConstant;
import com.ydl.ydlcommon.router.YdlCommonOut;
import com.ydl.ydlcommon.utils.ActivityManager;
import com.ydl.ydlcommon.utils.ImageUtil;
import com.ydl.ydlcommon.utils.remind.ToastHelper;
import com.ydl.ydlcommon.view.dialog.YDLShareDialog;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.consultant.api.IConsultantService;
import com.yidianling.im.api.event.CloseBottomWebviewEvent;
import com.yidianling.im.api.service.IImService;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.api.service.IAppService;
import com.yidianling.user.api.service.IUserService;
import com.yidianling.ydl_pay.common.CommonPayDialog;
import com.yidianling.ydl_pay.pay.PayActivity;
import com.yidianling.ydl_pay.pay.PayParams;
import org.jetbrains.annotations.Nullable;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import de.greenrobot.event.EventBus;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import static com.ydl.ydlcommon.router.IYDLRouterConstant.ROUTER_MUSE_PLAY;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
*/
public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickListener {
//上次点击时间
private long lastClickTime = 0L;
private static final int FAST_CLICK_DELAY_TIME = 500; // 快速点击间隔
public Activity mActivity;
private OptionsPickerView<String> pvOptions;
public NewH5_WVClickAbstractListener(Activity activity) {
this.mActivity = activity;
}
/**
* 打开h5页面
*
* @param params
*/
@Override
public void openH5(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("openH5 params: " + params.toString());
H5Params h5Params = new H5Params(params.getUrl(), null);
h5Params.setShareData(params.getShare());
h5Params.setShowMenu(params.getDot_flag());
NewH5Activity.start(mActivity, h5Params);
}
@Override
public void courseList() {
LogUtil.d("course_list");
YDLRouterManager.Companion.router(IYDLRouterConstant.ROUTER_BASE);
}
@Override
public void activeDetail(String id) {
LogUtil.d("active_detail");
try {
JsModularService.Companion.getIDynamicService().startTrendsDetail(mActivity, Integer.parseInt(id), false, false, false, false, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 小壹
*/
@Override
public void contactYi() {
LogUtil.d("contactYi");
try {
JsModularService.Companion.getImService().startP2PSession(mActivity, -1, "14", "14", "客服小壹", "14");
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 课程专属客服
*/
@Override
public void contactCourseCustomerService() {
try {
JsModularService.Companion.getImService().startP2PSession(mActivity, -1, "4108805", "4108805", "课程小助手-壹壹", "4108805");
} catch (Exception e) {
}
}
/**
* 跳转话题详情
*
* @param topic_id
*/
@Override
public void openTopicDetail(String topic_id) {
LogUtil.d("OpenTopicDetail");
try {
Intent intents = JsModularService.Companion.getIDynamicService().topicDetailIntent(mActivity, false, topic_id);
mActivity.startActivity(intents);
} catch (Exception e) {
}
}
/**
* 会员主页
*
* @param id
*/
@Override
public void openMember(String id) {
LogUtil.d("OpenMember");
try {
Intent intentm = JsModularService.Companion.getIDynamicService().membersIntent(mActivity, id);
mActivity.startActivity(intentm);
} catch (Exception e) {
}
}
/**
* 跳转发布动态
*/
@Override
public void sendTrend() {
LogUtil.d("SendTrend");
try {
Intent intenta = JsModularService.Companion.getIDynamicService().publishTrendIntent(mActivity);
mActivity.startActivity(intenta);
} catch (Exception e) {
}
}
/**
* 发送测试题到动态
*
* @param cover1
* @param title1
* @param purl1
* @param share_url1
*/
@Override
public void sendResultTrend(final String cover1, final String title1, final String purl1, final String share_url1) {
LogUtil.d("SendResultTrend");
mActivity.runOnUiThread(() -> {
YDLShareDialog dialog = YDLShareDialog.Companion.style1(mActivity, title1, share_url1, title1, cover1);
dialog.setCallBack(type -> {
if (1 == type) {
if (JsModularService.Companion.getIUserService().loginByOneKeyLogin(mActivity, true)) {
//跳转到发布页面
try {
Intent intentp = JsModularService.Companion.getIDynamicService().publishTrendIntent(mActivity, purl1, cover1, title1);
mActivity.startActivity(intentp);
} catch (Exception e) {
}
}
}
});
dialog.show(mActivity.getFragmentManager(), "lose");
});
}
/**
* 跳转选择用户界面发送消息
*/
@Override
public void sendInfo(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("SendInfo");
try {
Intent intent = JsModularService.Companion.getITestsApiService()
.getSelectConversationActivityIntent(mActivity, 1, params.getShare().getTitle(),
params.getShare().getCover(), params.getId(), params.getUrl(),
params.getShare().getShare_url());
mActivity.startActivity(intent);
} catch (Exception e) {
}
}
/**
* 打开专家搜索列表
*
* @param params
*/
@Override
public void searchList(H5JsBean.H5JsCmd.Params params) {
try {
ModularServiceManager.INSTANCE.provide(IConsultantService.class).startExpertSearchActivity(mActivity, "0", "", 0);
} catch (Exception e) {
}
}
/**
* 专家主页
*
* @param params
*/
@Override
public void openExpertsHome(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("OpenExpertsHome");
openH5(params);
}
/**
* 开始测试
*/
@Override
public void openTest(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("OpenTest");
openH5(params);
}
/**
* 私聊
*
* @param id
* @param toUid
* @param canTalk
* @param accessToken
*/
@Override
public void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu, boolean closeReplaceChat) {
LogUtil.d("chat");
if ((toUid + "").equals("14")) {
//找客服私聊不需要积分
contactYi();
} else {
try {
if (closeReplaceChat) {
ModularServiceManager.INSTANCE.provide(IImService.class)
.startChatCloseReplaceChat(mActivity, String.valueOf(toUid));
} else {
ModularServiceManager.INSTANCE.provide(IImService.class)
.startChat(mActivity, String.valueOf(toUid), 0x001, canTalk, isFromQingShu, false);
}
} catch (Exception e) {
}
}
}
/**
* 跳转私聊并发送消息
*
* @param id
* @param toUid
* @param canTalk
* @param accessToken
* @param isFromQingShu
*/
@Override
public void chatSendMessage(int id, int toUid, int canTalk, String accessToken, int isFromQingShu) {
if (toUid == 0) {
ToastUtil.toastShort("参数错误,请刷新页面后重试");
return;
}
try {
ModularServiceManager.INSTANCE.provide(IImService.class).createTextMessage(String.valueOf(toUid), "你好,我想找你倾诉,请尽快上线私聊我,我在等你。", new com.yidianling.im.api.bean.IMRequestCallback<Void>() {
@Override
public void onSuccess(@Nullable Void aVoid) {
}
@Override
public void onFailed(int i) {
String message = "发送失败";
if (i == 7101) {
message = "您已被对方拉黑!";
}
ToastUtil.toastShort(message);
}
@Override
public void onException(@Nullable Throwable throwable) {
ToastUtil.toastShort("发送异常");
}
});
} catch (Exception e) {
e.printStackTrace();
}
try {
ModularServiceManager.INSTANCE.provide(IImService.class)
.startChat(mActivity, String.valueOf(toUid), 0x001, canTalk, 0, false);
} catch (Exception e) {
}
}
//群聊
@Override
public void chatTeam(int tid, int doctorId) {
LogUtil.d("chatTeam");
//群聊直播
Log.e("js", "群聊直播---------");
if (tid == 0) {
ToastUtil.toastShort("群信息有误,请联系客服");
return;
}
JsModularService.Companion.getImService().startTeamSession(mActivity, tid + "",doctorId + "");
}
/**
* 跳转登录
*/
@Override
public void jumpLogin(H5JsBean.H5JsCmd.Params jsData) {
if (mActivity != null) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).successPage = jsData.getSourceUrl();
}
JsModularService.Companion.getIUserService().loginByOneKeyLogin(mActivity, true);
}
}
/**
* Fm详情
*
* @param id
*/
@Override
public void openFmDetail(int id) {
LogUtil.d("OpenFmDetail");
//电台播放
try {
Intent intent = JsModularService.Companion.getIFMService().fmDetailIntent(mActivity, id);
mActivity.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void openArticle() {
LogUtil.d("OpenArticle");
YDLRouterManager.Companion.router(IYDLRouterConstant.ROUTER_ARTICLE_LIST);
}
@Override
public void openFmList() {
LogUtil.d("OpenFmList");
//电台播放
try {
Intent intent = JsModularService.Companion.getIFMService().fmListIntent(mActivity);
mActivity.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void sendSubscriptionTimeMessage(String to_uid) {
LogUtil.d("sendSubSriptTimeMessage");
try {
ModularServiceManager.INSTANCE.provide(IImService.class).sendSubscriptionTimeMessage(to_uid, "请尽快添加可预约时间", new com.yidianling.im.api.bean.IMRequestCallback<Void>() {
@Override
public void onSuccess(@Nullable Void aVoid) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).dismissProgressDialog();
}
}
@Override
public void onFailed(int i) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).dismissProgressDialog();
}
String message = "发送失败";
if (i == 7101) {
message = "您已被对方拉黑!";
}
ToastHelper.Companion.show(message);
}
@Override
public void onException(@Nullable Throwable throwable) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).dismissProgressDialog();
}
ToastHelper.Companion.show("发送异常");
}
});
} catch (Exception e) {
}
try {
ModularServiceManager.INSTANCE.provide(IImService.class)
.startChat(mActivity, to_uid, 0x001, 0, 0, false);
} catch (Exception e) {
}
}
@Override
public void pay(H5JsBean.H5JsCmd.Params jsData) {
LogUtil.d("pay");
PayParams payParams = new PayParams();
payParams.setPayId(jsData.getPayId());
payParams.setNeedPay(Float.valueOf(jsData.getMoney()));
payParams.setTitle("预约咨询");
payParams.setVisibleIndemnity(true);
payParams.setMerchantType(jsData.getMerchantType());
if (mActivity != null) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).successPage = jsData.getSucc();
}
mActivity.startActivityForResult(PayActivity.Companion.newIntent(mActivity, payParams), 33);
}
}
//专家收款
@Override
public void payReceipt(H5JsBean.H5JsCmd.Params jsData) {
LogUtil.d("pay_receipt");
PayParams payParams = new PayParams();
payParams.setPayId(jsData.getPayId());
payParams.setNeedPay(Float.valueOf(jsData.getMoney()));
payParams.setTitle("预约咨询");
payParams.setVisibleIndemnity(true);
payParams.setMerchantType(jsData.getMerchantType());
if (mActivity != null) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).successPage = jsData.getSucc();
}
mActivity.startActivityForResult(PayActivity.Companion.newIntent(mActivity, payParams), 33);
}
}
@Override
public void payCourse(H5JsBean.H5JsCmd.Params jsData) {
LogUtil.d("pay_course");
PayParams payParams = new PayParams();
payParams.setPayId(jsData.getPayId());
payParams.setNeedPay(Float.valueOf(jsData.getMoney()));
payParams.setTitle("课程");
payParams.setMerchantType(jsData.getMerchantType());
if (mActivity != null) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).successPage = jsData.getSucc();
}
mActivity.startActivityForResult(PayActivity.Companion.newIntent(mActivity, payParams), 33);
}
}
@Override
public void payTest(H5JsBean.H5JsCmd.Params jsData) {
LogUtil.d("pay_course");
if (!TextUtils.isEmpty(jsData.getPayId()) || jsData.getTest_items_id() != 0) {
//设置支付结果页
if (mActivity != null) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).successPage = jsData.getSucc();
}
}
PayParams payParams = new PayParams();
if (TextUtils.isEmpty(jsData.getPayId()) && jsData.getTest_items_id() != 0) {
//创建支付订单
payParams.setNeedPay(jsData.getPrice());
payParams.setPayId(String.valueOf(jsData.getTest_items_id()));
payParams.setTitle("心理测试");
payParams.setBtnPayText("(¥" + jsData.getPrice() + ") 确认付款");
payParams.setInlet(PayParams.INLET_TEST);
payParams.setMerchantType(jsData.getMerchantType());
mActivity.startActivityForResult(PayActivity.Companion.newIntent(mActivity, payParams), 44);
} else if (!TextUtils.isEmpty(jsData.getPayId()) && !TextUtils.isEmpty(jsData.getOrderId())) {
//待支付订单跳转
payParams.setInlet(PayParams.INLET_NORMAL);
payParams.setPayId(jsData.getPayId());
payParams.setNeedPay(jsData.getPrice());
payParams.setTitle("心理测试");
payParams.setType(2);
float couponMoney = TextUtils.isEmpty(jsData.getCouponMoney()) ? 0f : Float.valueOf(jsData.getCouponMoney());
payParams.setBtnPayText("(¥" + new DecimalFormat("0.00").format(jsData.getPrice() - couponMoney) + ")确认付款");
payParams.setCoupon_money(couponMoney);
payParams.setMerchantType(jsData.getMerchantType());
mActivity.startActivityForResult(PayActivity.Companion.newIntent(mActivity, payParams), 44);
} else {
//直接支付
payParams.setPayId(jsData.getPayId());
payParams.setNeedPay(Float.valueOf(jsData.getMoney()));
payParams.setTitle("测评");
payParams.setMerchantType(jsData.getMerchantType());
mActivity.startActivityForResult(PayActivity.Companion.newIntent(mActivity, payParams), 44);
}
}
}
/**
* 查看测试结果
*
* @param jsData
*/
@Override
public void viewTestResult(H5JsBean.H5JsCmd.Params jsData) {
if (jsData.getTestResultId() != 0) {
try {
JsModularService.Companion.getITestsApiService().testH5Result(jsData.getTestResultId().toString());
} catch (Exception e) {
}
}
}
@Override
public void ydlNative(H5JsBean.H5JsCmd jsData) {
LogUtil.d("ydlNative");
//用于子类统计数据的 不做业务处理
}
@Override
public void openOrderDetail(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void expertProduct(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void order(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void toOrderCt(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void showDocList(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void goodExpert() {
}
@Override
public void copyWechat(H5JsBean.H5JsCmd.Params params) {
String weixin_id = params.getWeixin();
//获取剪贴板管理器:
@SuppressLint("WrongConstant") ClipboardManager cm = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
// 创建普通字符型ClipData
ClipData mClipData = ClipData.newPlainText("Label", weixin_id);
// 将ClipData内容放到系统剪贴板里。
cm.setPrimaryClip(mClipData);
}
@Override
public void goWechat() {
LogUtil.d("GoweChat");
try {
Intent intent = mActivity.getPackageManager().getLaunchIntentForPackage("com.tencent.mm");
mActivity.startActivity(intent);
} catch (ActivityNotFoundException e) {
ToastUtil.toastLong(mActivity, "您的手机尚未安装微信或者微信版本太低!");
}
}
@Override
public void listenOrderDetail(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void detailSub(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void openAgreement(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void modifyEval(H5JsBean.H5JsCmd.Params params) {
openH5(params);
}
@Override
public void visitEval(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("VistEval");
openH5(params);
}
@Override
public void coursePlay(H5JsBean.H5JsCmd.Params params) {
if (TextUtils.isEmpty(params.getCourse_id())) {
ToastUtil.toastShort("参数错误,请重试");
return;
}
try {
JsModularService.Companion.getICourseService().startCoursePlayActivity(mActivity,
Integer.valueOf(params.getCourse_id()), params.getCoursePlayUrl(), 1, params.getMediaType());
} catch (Exception e) {
}
}
@Override
public void closeFloatView() {
try {
JsModularService.Companion.getIMediaService().closeFloatView(mActivity);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void courseWriteComment(H5JsBean.H5JsCmd.Params params) {
try {
JsModularService.Companion.getICourseService().startCourseCommentActivity(mActivity, Objects.requireNonNull(params.getCourse_id()));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void courseComment(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("courseComment");
//课程评论列表
try {
JsModularService.Companion.getICourseService().startCourseReplyActivity(mActivity, params.getCourse_id());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void listenTel(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void voiceBroadcast(H5JsBean.H5JsCmd.Params params) {
}
/**
* axb拨号逻辑
*
* @param params
*/
@Override
public void tel(H5JsBean.H5JsCmd.Params params) {
try {
ModularServiceManager.INSTANCE.provide(IConfideService.class).showAxbConfirmDialog(mActivity, 1, params.getPhoneNumber());
} catch (Exception e) {
}
}
/**
* 声网拨号逻辑
*
* @param jsData
*/
@Override
public void listenAgora(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void setTitle(H5JsBean.H5JsCmd.Params jsData) {
}
//倾诉链接java接口,支持axb和声网,双呼由h5发起
@Override
public void confideConnect(H5JsBean.H5JsCmd.Params jsData) {
//h5activity中实现
}
@Override
public void confidePay(H5JsBean.H5JsCmd.Params jsData) {
//h5中实现
}
@Override
public void back() {
//h5中实现
mActivity.finish();
}
@Override
public void saveImage(H5JsBean.H5JsCmd.Params jsData) {
ImageUtil.savePicture(mActivity, jsData.getImageBase64());
}
@Override
public void sendToExpert(H5JsBean.H5JsCmd.Params jsData) {
//专家解读
ARouter.getInstance().build("/test/select_conversation")
.withInt("flag", 1)
.withString("title", jsData.getShare().getTitle())
.withString("head", jsData.getShare().getCover())
.withInt("id", jsData.getTest_items_id())
.withString("share_url", jsData.getShare().getShare_url())
.withString("url", HttpConfig.Companion.getH5_URL() + "ceshi/result/" + jsData.getTestResultId())
.navigation();
}
/**
* 调用公共支付的
*
* @param jsData
*/
@Override
public void commonPay(H5JsBean.H5JsCmd.Params jsData) {
if (System.currentTimeMillis() - lastClickTime < FAST_CLICK_DELAY_TIME) {
return;
}
lastClickTime = System.currentTimeMillis();
UserResponseBean.UserInfo userInfo = JsModularService.Companion.getIUserService().getUserInfo();
if (userInfo != null) {
mActivity.runOnUiThread(() -> {
CommonPayDialog.Build build = new CommonPayDialog.Build(mActivity)
.setCourseId(Objects.requireNonNull(jsData.getGoodsId()))
.setToken(Objects.requireNonNull(userInfo.getAccessToken()))
.setUid(userInfo.getUid())
.setIsTestEnvironment(false)
.setFfrom(YdlCommonOut.Companion.getChannelName())
.setListener(new CommonPayDialog.OnPayResultListener() {
@Override
public void onSuccesed() {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).refresh();
}
}
@Override
public void onFailed() {
}
});
build.build().show();
});
}
}
@Override
public void onOrderByApp(H5JsBean.H5JsCmd.Params params) {
LogUtil.d("onorder_by_app");
//预约下单
// DownOrderActivity.Companion.start(mContext, params.getProduct_id());
//新版走h5下单流程,此处不需要了
}
@Override
public void orderSetTime(H5JsBean.H5JsCmd.Params params) {
//预约下单选择时间
LogUtil.d("order_set_time");
Intent in = mActivity.getIntent();
in.putExtra("schedule_id", params.getSchedule_id());
in.putExtra("schedule_time", params.getSchedule_time());
mActivity.setResult(Activity.RESULT_OK, in);
mActivity.finish();
mActivity.overridePendingTransition(0, R.anim.app_activity_open_down);
}
@Override
public void searchServiceDoc(int cateId) {
try {
ModularServiceManager.INSTANCE.provide(IConsultantService.class).startExpertSearchActivity(mActivity, String.valueOf(cateId));
} catch (Exception e) {
}
}
@Override
public void openTestDetail(H5JsBean.H5JsCmd.Params params) {
try {
JsModularService.Companion.getITestsApiService().testDetailH5(String.valueOf(params.getTest_items_id()));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void shareAction(H5JsBean.H5JsCmd.Params params) {
if (mActivity != null) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).showShareMenu(params);
}
}
}
@Override
public void openTestList() {
YDLRouterManager.Companion.router(IYDLRouterConstant.ROUTER_TEST_HOME);
}
@Override
public void feedBack() {
try {
ModularServiceManager.INSTANCE.provide(IAppService.class).feedBackIntent(mActivity);
} catch (Exception e) {
}
}
@Override
public void phoneCall() {
try {
ModularServiceManager.INSTANCE.provide(IConfideService.class).startCondifeHomePage(mActivity, false);
} catch (Exception e) {
}
}
@Override
public void chatSchedule(H5JsBean.H5JsCmd.Params params) {
try {
ModularServiceManager.INSTANCE.provide(IImService.class)
.chatScheule(mActivity, params.getUser_url(), params.getDoc_url(), params.getDsmId(), params.getTitle(), params.getToUid());
} catch (Exception e) {
}
}
@Override
public void invite(H5JsBean.H5JsCmd.Params params) {
if (mActivity != null && null != params && null != params.getShare()) {
YDLShareDialog dialog = YDLShareDialog.Companion.style4(mActivity, params.getShare().getTitle(), params.getShare().getShare_url(), params.getShare().getDesc(), params.getShare().getCover());
dialog.show(mActivity.getFragmentManager(), "lose");
}
}
@Override
public void balance(H5JsBean.H5JsCmd.Params params) {
if (!JsModularService.Companion.getIUserService().loginByOneKeyLogin(mActivity, true)) {
return;
}
try {
ModularServiceManager.INSTANCE.provide(IAppService.class).accountHistoryIntent(mActivity);
} catch (Exception e) {
}
}
@Override
public void switchDownRefresh(H5JsBean.H5JsCmd.Params params) {
if (mActivity != null && mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).hasShowDownRefresh(params.getSwitch());
}
}
@Override
public void refresh() {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).refresh();
}
}
@Override
public void recharge() {
if (!JsModularService.Companion.getIUserService().loginByOneKeyLogin(mActivity, true)) {
return;
}
try {
ModularServiceManager.INSTANCE.provide(IAppService.class).rechargeActivityIntent(mActivity);
} catch (Exception e) {
}
}
@Override
public void bindPhone() {
try {
ModularServiceManager.INSTANCE.provide(IUserService.class).wxBindToInputhonePage(mActivity);
} catch (Exception e) {
}
}
@Override
public void openRightTopMenu() {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).openRightTopMenu();
}
}
@Override
public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).openShareMenu(params);
}
}
@Override
public void hideStatusBar() {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).hideJavaTitleBar();
}
}
@Override
public void showStatusBar() {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).showTitleBar();
}
}
@Override
public void closeWebKit() {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).closeWebKit();
}
}
@Override
public void goHome(H5JsBean.H5JsCmd.Params params) {
//关闭所有页面返回首页
JsModularService.Companion.getIAppService().mainIntent(mActivity,params.getSelectTab(), false);
//关闭当前H5页面
mActivity.finish();
}
@SuppressLint("CheckResult")
@Override
public void sendUnReadNum(String callbackFuncName, String uid) {
try {
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
ModularServiceManager.INSTANCE.provide(IImService.class)
.getChatUid(mActivity, uid, responseUid -> {
final StringBuffer sb = new StringBuffer();
sb.append(callbackFuncName);
sb.append("('");
int unReadNum = ModularServiceManager.INSTANCE.provide(IImService.class).getUnReadByUid(responseUid);
sb.append(unReadNum);
sb.append(",");
int unReadAllNum = ModularServiceManager.INSTANCE.provide(IImService.class).getAllUnReadNum();
sb.append(unReadAllNum);
sb.append("')");
if (mActivity != null && mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).callJSFunc(sb.toString());
}
});
} catch (Exception e) {
}
}
@Override
public void switchPushStatus(H5JsBean.H5JsCmd.Params params) {
if (params.getSwitchStatus() == 1) {
JsImpl.Companion.setH5Open(true);
} else {
JsImpl.Companion.setH5Open(false);
}
}
@Override
public void shouldShowTitleBar(boolean isShowTitleBar) {
if (isShowTitleBar && mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).notCoverTitleBar();
} else {
((NewH5Activity) mActivity).coverJavaTitleBar();
}
}
@Override
public void setSelfPageType(int selfType) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).setSelfPageType(selfType);
}
}
@Override
public void setBootomFitViewColor(String color) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).setBottomViewColor(color);
}
}
/**
* 打开时间选择器
*/
@SuppressLint("CheckResult")
@Override
public void openTimePicker(String jsCallBackName, String day, String doctorId, String orderId) {
ArrayList<String> options1Items = new ArrayList<>();
ArrayList<List<String>> options2Items = new ArrayList<>();
ArrayList<List<List<String>>> options3Items = new ArrayList<>();
// 所构造的时间数据
ArrayList<List<String>> TIMELIST = new ArrayList<>();
JsHttpImpl.Companion.getInstance().getTimePickerData(day, doctorId, orderId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(response -> {
if (response.code == 200) {
for (int i = 0; i < response.data.size(); i++) { // 遍历服务时间
TimeDataBean timeDataBean = response.data.get(i);
options1Items.add(String.valueOf(timeDataBean.getServiceTime()));
// 构造时间数据
for (int j = 0; j < response.data.size(); j++) {
List<String> list = new ArrayList<>();
for (int k = 0; k < timeDataBean.getTimes().size(); k++) {
String[] times = timeDataBean.getTimes().get(k).split("-");
list.add(times[0]);
int timeInterval = (int) ((getTimeToDate(times[1]) - getTimeToDate(times[0])) / 1000 / 60 / 10);
for (int l = 0; l < timeInterval; l++) {
String time = getHourMin(getTimeToDate(list.get(list.size() - 1)) + 10 * 60 * 1000);
list.add(time);
}
}
TIMELIST.add(list);
}
ArrayList<String> amList = new ArrayList<>(); // 上午、下午集合(第二级)
ArrayList<List<String>> timeList = new ArrayList<>(); // 上午或者下午对应的时间 (第三级)
for (int j = 0; j < 2; j++) {
List<String> tmList = new ArrayList<>(); // 上午或者下午对应的时间集合
if (j == 0) {
for (int k = 0; k < TIMELIST.get(i).size(); k++) {
if (getTimeToDate(TIMELIST.get(i).get(k)) <= getTimeToDate("12:00")) {
tmList.add(TIMELIST.get(i).get(k));
}
}
if (tmList.size() > 0) {
amList.add("上午");
}
} else {
for (int k = 0; k < TIMELIST.get(i).size(); k++) {
if (getTimeToDate(TIMELIST.get(i).get(k)) > getTimeToDate("12:00")) {
tmList.add(TIMELIST.get(i).get(k));
}
}
if (tmList.size() > 0) {
amList.add("下午");
}
}
if (tmList.size() > 0) {
timeList.add(tmList);
}
}
options2Items.add(amList);
options3Items.add(timeList);
}
pvOptions = new OptionsPickerBuilder(mActivity, (options1, options2, options3, v) -> {
// 选择完时间回调给前端
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).callJSFunc("saveChooseTimer(\"" + options3Items.get(options1).get(options2).get(options3) + "," + options1Items.get(options1) + "\")");
}
LogUtil.e("saveChooseTimer(\"" + options3Items.get(options1).get(options2).get(options3) + "," + options1Items.get(options1) + "\")");
})
.setTitleText("请选择开始时间")
.setDividerColor(Color.TRANSPARENT)
.setTextColorCenter(Color.BLACK) //设置选中项文字颜色
.setLabels("分钟", "", "")
.setCyclic(false, false, false)
.setContentTextSize(20)
.isRestoreItem(true)
.build();
pvOptions.setPicker(options1Items, options2Items, options3Items);
pvOptions.show();
}
}, e -> {
ToastUtil.toastShort(e.getMessage());
});
}
// 关闭当前h5页面并刷新上一个h5页面
@Override
public void goBackAndReload(String url) {
H5Params h5Params = new H5Params(url, null);
NewH5Activity.start(mActivity, h5Params);
if (ActivityManager.Companion.getInstance().getSecondTaskActivity() != null) {
ActivityManager.Companion.getInstance().getSecondTaskActivity().finish();
}
mActivity.finish();
}
@Override
public void toThirdApp(String url) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!TextUtils.isEmpty(url)) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
mActivity.startActivity(intent);
}
}
});
}
@Override
public void getNextExpertStatus(String doctorID, String title, String uid, String linkUrl) {
EventBus.getDefault().post(new ChangeAnotherExpertEvent(doctorID, title, uid, linkUrl));
}
@Override
public void chatCloseBottomWebView() {
EventBus.getDefault().post(new CloseBottomWebviewEvent(true));
}
@Override
public void reloadUrl(String url) {
if (mActivity instanceof NewH5Activity) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
((NewH5Activity) mActivity).loadUrl(url);
}
});
}
}
/**
* 时间字符串转时间戳
*
* @param time
* @return
*/
private long getTimeToDate(String time) {
@SuppressLint("SimpleDateFormat")
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Date date = new Date();
try {
date = sdf.parse(time);
} catch (ParseException e) {
e.printStackTrace();
}
return date.getTime();
}
/**
* 根据时间戳获取时分
*
* @return
*/
private String getHourMin(long time) {
@SuppressLint("SimpleDateFormat")
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
return sdf.format(new Date(time));
}
@Override
public void playMeditation(int mediaId, long meditationId, int meditationType, String mediaCoverUrl) {
if (mActivity instanceof NewH5Activity) {
ARouter.getInstance().build("/muse/play")
.withLong("MEDITATION_ID", meditationId)
.withLong("MEDIA_ID", mediaId)
.withInt("MEDITATION_TYPE", meditationType)
.withString("MEDIA_COVER_URL", mediaCoverUrl)
.navigation();}
}
@Override
public void switchSound(int mediaId, long meditationId, int meditationType, int businessType,
String buried, String mediaUrl, String mediaCoverUrl,
String title, String desc, int status) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).switchSound(mediaId, meditationId, meditationType,
businessType, buried, mediaUrl, mediaCoverUrl, title, desc, status);
} else if ("ChooseMusicActivity".equals(mActivity.getClass().getSimpleName())) {
JsModularService.Companion.getIMuseService().switchSound(mActivity,mediaId, meditationId, meditationType,
businessType, buried, mediaUrl, mediaCoverUrl, title, desc, status);
}
}
@Override
public void setBG(String rgb, String alpha) {
if (mActivity instanceof NewH5Activity) {
((NewH5Activity) mActivity).setBG(rgb, alpha);
}
}
}
package com.ydl.js;
import com.ydl.webview.H5JsBean;
/**
* webview 点击事件监听
* Created by harvie on 2017/7/4 0004.
*/
public interface NewH5_WebViewClientClickListener {
void openH5(H5JsBean.H5JsCmd.Params jsData);
void courseList();
void activeDetail(String id);
void contactYi();
void contactCourseCustomerService();
void openTopicDetail(String topic_id);
void openMember(String id);
void sendTrend();
void sendResultTrend(final String cover1, final String title1, final String purl1, String share_url1);
void sendInfo(H5JsBean.H5JsCmd.Params params);
void searchList(H5JsBean.H5JsCmd.Params params);
void openExpertsHome(H5JsBean.H5JsCmd.Params params);
void openTest(H5JsBean.H5JsCmd.Params params);
//注册引导页--跳转私聊界面
void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu, boolean closeReplaceChat);
void chatSendMessage(int id, int toUid, int canTalk, String accessToken, int isFromQingShu);
void chatTeam(int tid, int doctorId);
void jumpLogin(H5JsBean.H5JsCmd.Params jsData);
void openFmDetail(int id);
void openArticle();
void openFmList();
void sendSubscriptionTimeMessage(String to_uid);
void pay(H5JsBean.H5JsCmd.Params jsData);
void payReceipt(H5JsBean.H5JsCmd.Params jsData);
void payCourse(H5JsBean.H5JsCmd.Params jsData);
void payTest(H5JsBean.H5JsCmd.Params jsData);
void viewTestResult(H5JsBean.H5JsCmd.Params jsData);
void ydlNative(H5JsBean.H5JsCmd jsData);//用于神策统计
void openOrderDetail(H5JsBean.H5JsCmd.Params params);
void expertProduct(H5JsBean.H5JsCmd.Params params);
void order(H5JsBean.H5JsCmd.Params params);
void toOrderCt(H5JsBean.H5JsCmd.Params params);
void showDocList(H5JsBean.H5JsCmd.Params params);
void goodExpert();
void copyWechat(H5JsBean.H5JsCmd.Params params);
void goWechat();
void listenOrderDetail(H5JsBean.H5JsCmd.Params params);
void detailSub(H5JsBean.H5JsCmd.Params params);
void openAgreement(H5JsBean.H5JsCmd.Params params);
void modifyEval(H5JsBean.H5JsCmd.Params params);
void visitEval(H5JsBean.H5JsCmd.Params params);
void coursePlay(H5JsBean.H5JsCmd.Params params);
void closeFloatView();
void courseWriteComment(H5JsBean.H5JsCmd.Params params);
void courseComment(H5JsBean.H5JsCmd.Params params);
void listenTel(H5JsBean.H5JsCmd.Params jsData);
void voiceBroadcast(H5JsBean.H5JsCmd.Params params);
void tel(H5JsBean.H5JsCmd.Params params);
void onOrderByApp(H5JsBean.H5JsCmd.Params params);
void orderSetTime(H5JsBean.H5JsCmd.Params params);
void searchServiceDoc(int cateId);
void openTestDetail(H5JsBean.H5JsCmd.Params params);
void shareAction(H5JsBean.H5JsCmd.Params params);
void openTestList();
void feedBack();
void phoneCall();
void chatSchedule(H5JsBean.H5JsCmd.Params params);
void invite(H5JsBean.H5JsCmd.Params params);
void balance(H5JsBean.H5JsCmd.Params params);
//是否显示下拉刷新控件
void switchDownRefresh(H5JsBean.H5JsCmd.Params params);
//跳转充值界面
void recharge();
void bindPhone();
//界面刷新
void refresh();
//声网拨号逻辑
void listenAgora(H5JsBean.H5JsCmd.Params jsData);
void setTitle(H5JsBean.H5JsCmd.Params jsData);
void saveImage(H5JsBean.H5JsCmd.Params jsData);
void sendToExpert(H5JsBean.H5JsCmd.Params jsData);
void confideConnect(H5JsBean.H5JsCmd.Params jsData);
void confidePay(H5JsBean.H5JsCmd.Params jsData);
void back();
//调用公共支付的
void commonPay(H5JsBean.H5JsCmd.Params jsData);
//隐藏statusbar,全屏展示
void hideStatusBar();
void showStatusBar();
//打开与关闭右上角菜单
void openRightTopMenu();
//打开与关闭底部分享弹框
void openShareMenu(H5JsBean.H5JsCmd.Params params);
//关闭页面
void closeWebKit();
void goHome(H5JsBean.H5JsCmd.Params params);
/**
* 向h5发送对那个uid的未读数
* @param callbackFuncName
* @param uid
*/
void sendUnReadNum(String callbackFuncName, String uid);
//h5页面是否需要打开推送
void switchPushStatus(H5JsBean.H5JsCmd.Params params);
//是否展示标题栏
void shouldShowTitleBar(boolean isShowTitleBar);
//设置当前页面类型
void setSelfPageType(int selfType);
void setBootomFitViewColor(String color);
/**打开时间选择器*/
void openTimePicker(String jsCallBackName, String day, String doctorId, String orderId);
/**返回上一页并刷新*/
void goBackAndReload(String url);
/**跳转第三方APP*/
void toThirdApp(String url);
/**页面内跳转url*/
void reloadUrl(String url);
default void playMeditation(int mediaId, long meditationId, int meditationType, String mediaCoverUrl) {
}
default void switchSound(int mediaId, long meditationId, int meditationType, int businessType,
String buried, String mediaUrl, String mediaCoverUrl, String title,
String desc, int status) {
}
default void setBG(String rgb, String alpha) {
}
void getNextExpertStatus(String doctorID, String title, String uid, String linkUrl);
/**
* 关闭私聊窗口立即咨询webview
*/
void chatCloseBottomWebView();
}
package com.ydl.js
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.api.IConfideService
import com.ydl.webview.*
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.ydl_pay.pay.payDialog.CallBack
import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams
import com.yidianling.ydl_pay.pay.payDialog.PayDialog
/**
* Created by haorui on 2019-10-10.
* Des:
*/
@Route(path = "/web/webservice")
class WebServiceImpl : IWebService {
override fun getJavascripHandler(activity: Activity, webView:WebView?, tellData: TellData): IJavascriptHandler {
return NewH5_JavascriptHandler(webView, object : NewH5_WVClickAbstractListener(activity) {
override fun setTitle(jsData: H5JsBean.H5JsCmd.Params?) {
//设置webview标题
if (activity is NewH5Activity) {
activity.setWebViewTitle(jsData?.title)
}
}
//倾诉链接java接口
override fun confideConnect(jsData: H5JsBean.H5JsCmd.Params?) {
if (Utils.isFastClick()) {
//防止连击
return
}
if (!JsModularService.getIConfideService().isOnlineRtm()) {
//异常退出或者账号被顶掉,重新登录并拨打
JsModularService.getIConfideService().login(JsModularService.getIUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (isSuccess) {
connectionJava(jsData?.id ?: 0, jsData?.confideType ?: 1, activity, tellData, jsData?.callType)
} else {
ToastUtil.toastShort("请重新拨打")
}
}
} else {
connectionJava(jsData?.id ?: 0, jsData?.confideType ?: 1, activity, tellData, jsData?.callType)
}
}
//php线路已废除
override fun listenTel(jsData: H5JsBean.H5JsCmd.Params?) {
}
override fun listenAgora(jsData: H5JsBean.H5JsCmd.Params?) {
if (Utils.isFastClick()) {
//防止连击
return
}
//声网路线
connectionJava(jsData?.id ?: 0, 3, activity, tellData, jsData?.callType)
}
override fun confidePay(jsData: H5JsBean.H5JsCmd.Params?) {
//倾诉支付
val confidePay = ConfidePayParams(
jsData?.payTitle ?: "倾诉服务", jsData?.orderPrice, jsData?.coupnPrice ?: 0.00,
jsData?.avliableMoney ?: 0.00, jsData?.payId ?: "", jsData?.confideUrl ?: "", jsData?.merchantType
)
confidePayDialog(jsData?.id, jsData?.confideType, activity, confidePay, jsData?.callType)
}
override fun back() {
if (activity is NewH5Activity) {
activity.goBack()
}
}
})
}
//倾诉支付弹窗
private fun confidePayDialog(id: Int?, type : Int?, activity: Activity, confidePay : ConfidePayParams, callType:String?){
PayDialog(activity)
.setCallback(object : CallBack {
override fun onSuccess() {
//支付成功,直接拨打
if (TextUtils.isEmpty(confidePay.confideUrl)) {
connectionJava(id ?: 0, type ?: 1, activity, null, callType)
} else {
//倾诉订单列表页面过来,会有confideUrl值,则直接跳转此url
NewH5Activity.start(activity, H5Params(confidePay.confideUrl!!, ""))
}
}
override fun onError() {
}
})
.show(confidePay)
}
//java版axb和声网接口
@SuppressLint("CheckResult")
private fun connectionJava(id: Int, type: Int, activity: Activity, tellData: TellData?, callType: String?) {
try {
JsModularService.getIConfideService().connectionJava(
id, type, activity, Gson().toJson(tellData), callType
)
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun init(context: Context) {
}
}
package com.ydl.js.bean
data class TimeDataBean(
var serviceTime:Int, // 咨询时长
var times:ArrayList<String> // 时间集合
)
\ No newline at end of file
package com.ydl.js.http
import com.ydl.js.bean.TimeDataBean
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Query
interface JsApi {
/**
* 获取时间选择器数据
*/
@GET("consult/user/order/selectWorriesReducibleTime")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getTimePickerData(
@Query("day") day: String,
@Query("doctorId") doctorId: String,
@Query("orderId") orderId: String
): Observable<BaseResponse<ArrayList<TimeDataBean>>>
}
\ No newline at end of file
package com.ydl.js.http
import com.ydl.js.bean.TimeDataBean
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
interface JsHttp {
// 获取时间选择器数据
fun getTimePickerData(day:String,doctorId:String,orderId:String): Observable<BaseResponse<ArrayList<TimeDataBean>>>
}
package com.ydl.js.http
import com.ydl.js.bean.TimeDataBean
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
import io.reactivex.Observable
class JsHttpImpl private constructor() : JsHttp{
companion object {
fun getInstance(): JsHttpImpl {
return Holder.INSTANCE
}
fun clearAppApi() {
Holder.INSTANCE.appApi = null
}
}
private var appApi: JsApi? = null
private fun getAppApi(): JsApi {
if (appApi == null) {
appApi = YDLHttpUtils.obtainApi(JsApi::class.java)
}
return appApi!!
}
object Holder {
val INSTANCE = JsHttpImpl()
}
override fun getTimePickerData(
day: String,
doctorId: String,
orderId: String
): Observable<BaseResponse<ArrayList<TimeDataBean>>> {
return getAppApi().getTimePickerData(day,doctorId,orderId)
}
}
\ No newline at end of file
package com.ydl.js.moduler.service
import android.content.Context
import com.ydl.js.api.IJsService
class JsImpl : IJsService {
companion object {
var isH5Open = true
var isMainOpen = true
}
override fun init(context: Context?) {
}
override fun isH5Open(): Boolean {
return isH5Open
}
override fun isMainOpen(): Boolean {
return isMainOpen
}
override fun setH5Open(open: Boolean) {
isH5Open = open
}
override fun setMainOpen(open: Boolean) {
isMainOpen = open
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromYDelta="0"
android:toYDelta="100%p" />
</set>
\ No newline at end of file
......@@ -59,6 +59,7 @@ dependencies {
api project(":ydl-platform")
implementation project(':ydl-media')
implementation project(":api:user")
implementation project(":api:muse")
implementation project(':ydl-flutter-base')
implementation project(':ydl-webview')
......
package com.yidianling.muse.moduler.service
import android.app.Activity
import android.content.Context
import com.ydl.muse.api.IMuseService
import com.yidianling.muse.activity.ChooseMusicActivity
class MuseImpl : IMuseService {
override fun init(context: Context?) {
}
override fun switchSound(
activity: Activity,
mediaId: Int,
meditationId: Long,
meditationType: Int,
businessType: Int,
buried: String?,
mediaUrl: String?,
mediaCoverUrl: String?,
title: String?,
desc: String?,
status: Int
) {
(activity as ChooseMusicActivity).switchSound(
mediaId, meditationId, meditationType,
businessType, buried, mediaUrl, mediaCoverUrl, title, desc, status
)
}
}
\ No newline at end of file
......@@ -5,4 +5,5 @@ include ':app',
':m-consultant', ':m-muse', ':m-fm', ':m-tests', ":m-course",
":m-im",":m-dynamic",":m-article",":m-audioim",":m-user", ":m-confide"
include ':ydl-tuicore', ':api:confide', ':api:dynamic', ':api:fm', ':api:consultant',
':api:course', ':api:user', ':api:tests', ':api:im',':api:home'
':api:course', ':api:user', ':api:tests', ':api:im',':api:home',':api:media',':api:muse',':api:js'
include ':m-js'
......@@ -44,6 +44,7 @@ dependencies {
}
api project(':ydl-platform')
implementation project(':api:media')
}
package com.ydl.media.moduler.service
import android.app.Activity
import android.content.Context
import com.ydl.media.api.IMediaService
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
class MediaImpl :IMediaService {
override fun init(context: Context?) {
}
override fun closeFloatView(activity: Activity) {
activity.runOnUiThread(Runnable {
try {
if (PlayerFloatHelper.isShow(activity)) {
PlayerFloatHelper.removeView(activity)
AudioPlayer.get().stopPlayer()
}
} catch (e: Exception) {
e.printStackTrace()
}
})
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment