Commit ef30999e by 严久程

Merge branch 'feature/im_update' into dev

# Conflicts:
#	config.gradle
parents 49a2cf66 4e797f3e
......@@ -180,8 +180,8 @@ dependencies {
implementation fileTree(dir: 'aars', include: ['*.aar'])
implementation project(':m-user')
implementation modularPublication('com.ydl:m-user-api')
implementation project(':m-tests')
implementation project(':m-consultant')
api project(':m-tests')
api project(':m-consultant')
implementation modularPublication('com.ydl:m-consultant-api')
// implementation project(':m-confide')
......@@ -202,7 +202,7 @@ dependencies {
implementation project(':m-muse')
// implementation project(':m-muse')
implementation project(':m-im')
implementation project(':m-dynamic')
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.ydl.component">
xmlns:tools="http://schemas.android.com/tools"
package="com.ydl.component">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
......@@ -12,24 +12,25 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name="com.ydl.ydlcommon.base.BaseApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_config"
android:theme="@style/platform_CommonTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup, android:icon, android:label">
<activity android:name=".music.FragmentContainerActivity"
android:theme="@style/platform_NoTitleTheme" />
android:name="com.ydl.ydlcommon.base.BaseApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/platform_CommonTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup, android:icon, android:label">
<activity
android:name=".music.FragmentContainerActivity"
android:theme="@style/platform_NoTitleTheme" />
<!-- <activity android:name="com.yidianling.user.ui.login.RegisterAndLoginActivity" -->
<!-- <activity android:name=".MainActivity"/> -->
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:theme="@style/platform_NoTitleTheme">
android:name=".MainActivity"
android:launchMode="singleTask"
android:theme="@style/platform_NoTitleTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
......@@ -37,18 +38,18 @@
<intent-filter>
<action android:name="com.ydl.media.ACTION_MUSIC_CLICK" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.ydl.component.base.DemoGlobalConfig"
android:value="ModuleConfig" />
android:name="com.ydl.component.base.DemoGlobalConfig"
android:value="ModuleConfig" />
<activity
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
android:noHistory="true">
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
......@@ -59,11 +60,11 @@
</intent-filter>
</activity>
<activity android:name=".TestAppActivity" />
<activity
android:name=".home.HomeActivity"
android:launchMode="singleTask"
android:noHistory="true">
</activity>
android:noHistory="true"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -25,7 +25,7 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME
//import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.tests.home.NewTestHomeActivity
......@@ -84,22 +84,23 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
.navigation()
}
bt_to_consultant.setOnClickListener {
ARouter.getInstance()
.build("/consult/hot_search")
.withString(
HOT_SEARCH_DOCTOR_NAME,
this.resources?.getString(R.string.platform_search_hint)
)
.navigation()
// ARouter.getInstance()
// .build("/consult/hot_search")
// .withString(
// HOT_SEARCH_DOCTOR_NAME,
// this.resources?.getString(R.string.platform_search_hint)
// )
// .navigation()
FragmentContainerActivity.start(this, "ExpertSearchFragment")
}
bt_to_music.setOnClickListener {
FragmentContainerActivity.start(this)
}
bt_to_im.setOnClickListener {
FragmentContainerActivity.start(this,"NewMultiMessageFragment")
FragmentContainerActivity.start(this, "NewMultiMessageFragment")
}
bt_to_dynamic.setOnClickListener {
FragmentContainerActivity.start(this,"TrendsHomeFragment")
FragmentContainerActivity.start(this, "TrendsHomeFragment")
}
bt_to_tests.setOnClickListener {
startActivity(Intent(this, NewTestHomeActivity::class.java))
......@@ -109,25 +110,32 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// startActivity(Intent(this, ConfideHomeActivity::class.java))
// }
bt_to_muse.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE,
YDLRouterParams().putExtra(IYDLRouterConstant.MUSIC_URL, "http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3")
.putExtra(IYDLRouterConstant.DATA_JSON, "{\n" +
" \"muses\": [{\n" +
" \"id\": 6,\n" +
" \"name\": \"冥想基础介绍-1-什么是冥想?\",\n" +
" \"audioUrl\":\n" +
" \"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3\",\n" +
" \"backgroundUrl\":\n" +
" \"https://img.yidianling.com/file/2019/06/10/i4qdax82ok2aizq3.png\",\n" +
" \"effectCode\": 1,\n" +
" \"category\": 2,\n" +
" \"playCount\": 929,\n" +
" \"sort\": 255,\n" +
" \"isDelete\": 1,\n" +
" \"createTime\": \"May 30, 2019 4:45:17 PM\",\n" +
" \"updateTime\": \"Jun 10, 2019 7:14:23 PM\"\n" +
" }]\n" +
" }"))
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_MUSE,
YDLRouterParams().putExtra(
IYDLRouterConstant.MUSIC_URL,
"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3"
)
.putExtra(
IYDLRouterConstant.DATA_JSON, "{\n" +
" \"muses\": [{\n" +
" \"id\": 6,\n" +
" \"name\": \"冥想基础介绍-1-什么是冥想?\",\n" +
" \"audioUrl\":\n" +
" \"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3\",\n" +
" \"backgroundUrl\":\n" +
" \"https://img.yidianling.com/file/2019/06/10/i4qdax82ok2aizq3.png\",\n" +
" \"effectCode\": 1,\n" +
" \"category\": 2,\n" +
" \"playCount\": 929,\n" +
" \"sort\": 255,\n" +
" \"isDelete\": 1,\n" +
" \"createTime\": \"May 30, 2019 4:45:17 PM\",\n" +
" \"updateTime\": \"Jun 10, 2019 7:14:23 PM\"\n" +
" }]\n" +
" }"
)
)
}
bt_to_fm.setOnClickListener {
......@@ -135,12 +143,13 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST)
}
bt_to_course.setOnClickListener{
bt_to_course.setOnClickListener {
ARouter.getInstance().build("/course/home")
.navigation()
}
bt_to_home.setOnClickListener {
FragmentContainerActivity.start(this,"YdlHomeFragment")
// FragmentContainerActivity.start(this, "YdlHomeFragment")
startActivity(Intent(this, TestAppActivity::class.java))
}
}
......@@ -186,7 +195,8 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
super.onResume()
MobclickAgent.onResume(this)
ModularServiceManager.provide(IConsultantService::class.java).showConsultAssistantDialog(this)
ModularServiceManager.provide(IConsultantService::class.java)
.showConsultAssistantDialog(this)
}
override fun onPause() {
......
package com.ydl.component
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentPagerAdapter
import android.support.v7.app.AppCompatActivity
import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
import com.yidianling.home.ui.fragment.YdlHomeFragment
import kotlinx.android.synthetic.main.activity_test_app.*
import java.util.*
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/1/14
*/
class TestAppActivity : AppCompatActivity() {
private var fragments: ArrayList<Fragment> =
ArrayList()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_test_app)
fragments.add(YdlHomeFragment())
fragments.add(TrendsHomeFragment().setTab("trend_tap"))
val adapter: FragmentPagerAdapter =
object : FragmentPagerAdapter(supportFragmentManager) {
override fun getItem(position: Int): Fragment {
return fragments.get(position)
}
override fun getCount(): Int {
return fragments.size
}
}
view_page.adapter = adapter
view_page.offscreenPageLimit = 2
}
}
\ No newline at end of file
......@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
......@@ -7,8 +7,11 @@ import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
import com.yidianling.home.ui.fragment.YdlHomeFragment
//import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
//import com.yidianling.home.ui.fragment.YdlHomeFragment
import com.yidianling.im.ui.page.NewMultiMessageFragment
......@@ -67,6 +70,9 @@ class FragmentContainerActivity : BaseLceActivity<DemoContract.View, DemoContra
if ("YdlHomeFragment" == fragmentName) {
return YdlHomeFragment()
}
if ("ExpertSearchFragment" == fragmentName) {
return ExpertSearchFragment()
}
return PlayFragment()
}
}
......@@ -2,8 +2,11 @@ package com.ydl.component.service.web;
import android.app.Activity;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.yidianling.common.tools.LogUtil;
/**
* webview 点击事件监听 抽象类
......@@ -19,7 +22,11 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
@Override
public void openH5(H5JsBean.H5JsCmd.Params jsData) {
LogUtil.d("openH5 params: " + jsData.toString());
H5Params h5Params = new H5Params(jsData.getUrl(), null);
h5Params.setShareData(jsData.getShare());
h5Params.setShowMenu(jsData.getDot_flag());
NewH5Activity.start(mContext, h5Params);
}
@Override
......@@ -386,7 +393,9 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
@Override
public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
if (mContext instanceof NewH5Activity) {
((NewH5Activity) mContext).openShareMenu(params);
}
}
@Override
......@@ -413,4 +422,22 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
}
@Override
public void shouldShowTitleBar(boolean isShowTitleBar) {
if (mContext instanceof NewH5Activity) {
if (isShowTitleBar) {
((NewH5Activity) mContext).showTitleBar();
} else {
((NewH5Activity) mContext).hideJavaTitleBar();
}
}
}
@Override
public void setSelfPageType(int selfType) {
if (mContext instanceof NewH5Activity) {
((NewH5Activity) mContext).setSelfPageType(selfType);
}
}
}
......@@ -9,6 +9,7 @@ import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.UserHelper
/**
* update by harvie on 2017/7/04
......@@ -48,9 +49,10 @@ class WebJavascriptHandler : IJavascriptHandler{
if (jsData.url.equals("http")) {
if (jsData.cmd?.params?.toUid != 0) {
wvEnventPro?.chat(ModularServiceManager.getPlatformUserService()?.getUser()?.userId?.toInt()?:0, jsData.cmd?.params?.toUid
?: 0, 0, ModularServiceManager.getPlatformUserService()?.getUser()?.token, jsData.cmd?.params?.isFromQingShu
wvEnventPro?.chat(
UserHelper.getUserInfo()?.uid?.toInt()
?: 0, jsData.cmd?.params?.toUid
?: 0, 0, UserHelper.getUserInfo()?.accessToken, jsData.cmd?.params?.isFromQingShu
?: 0)
} else {
wvEnventPro?.openH5(jsData.cmd?.params)
......@@ -367,6 +369,16 @@ class WebJavascriptHandler : IJavascriptHandler{
"chatUnread" -> {
wvEnventPro?.sendUnReadNum(jsData.cmd!!.params?.callBack, jsData.cmd!!.params?.uid.toString())
}
"showTitleBar" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.shouldShowTitleBar(it.isShowTitleBar!!)
}
}
"setSelfPageType" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.setSelfPageType(it.selfPageType)
}
}
}
}
}
......@@ -175,4 +175,11 @@ public interface WebViewClientClickListener {
// void storePic();
void sendUnReadNum(String callbackFuncName, String uid);
//是否展示标题栏
void shouldShowTitleBar(boolean isShowTitleBar);
//设置当前页面类型
void setSelfPageType(int selfType);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/view_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
......@@ -42,18 +42,17 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.46",
"m-consultant" : "0.0.55",
"m-fm" : "0.0.27",
"m-user" : "0.0.45",
"m-home" : "0.0.17",
"m-im" : "0.0.10",
"m-dynamic" : "0.0.4",
"m-confide" : "0.0.47",
"m-consultant" : "0.0.56.1",
"m-fm" : "0.0.28",
"m-user" : "0.0.56",
"m-home" : "0.0.19",
"m-im" : "0.0.11",
"m-dynamic" : "0.0.5.1",
//flutter升级会涉及到以下三个
"m-muse" : "0.0.25",
"m-tests" : "0.0.20",
"m-course" : "0.0.39",
"m-muse" : "0.0.26",
"m-tests" : "0.0.21",
"m-course" : "0.0.40.1",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.5",
......@@ -65,19 +64,19 @@ ext {
"m-tests-api" : "0.0.1",
"m-user-api" : "0.0.9",
"m-home-api" : "0.0.3",
"m-im-api" : "0.0.7",
"m-im-api" : "0.0.8",
"m-dynamic-api" : "0.0.1",
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.36",
"ydl-platform" : "0.0.37",
//第二步 若干
"ydl-webview" : "0.0.35.1",
"ydl-media" : "0.0.19",
"ydl-pay" : "0.0.16",
"m-audioim" : "0.0.45",
"ydl-flutter-base": "0.0.9",
"ydl-webview" : "0.0.37.1",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.46",
"ydl-flutter-base": "0.0.10",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -99,7 +98,7 @@ ext {
"m-dynamic" : "0.0.1.7",
"m-muse" : "0.0.20.7",
"m-tests" : "0.0.15.7",
"m-tests" : "0.0.18.1",
"m-course" : "0.0.34.10",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.5",
......@@ -111,19 +110,19 @@ ext {
"m-tests-api" : "0.0.1",
"m-user-api" : "0.0.9",
"m-home-api" : "0.0.3",
"m-im-api" : "0.0.7",
"m-im-api" : "0.0.8",
"m-dynamic-api" : "0.0.1",
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.36",
"ydl-platform" : "0.0.37",
//第二步 若干
"ydl-webview" : "0.0.35.1",
"ydl-media" : "0.0.19",
"ydl-pay" : "0.0.16",
"m-audioim" : "0.0.45",
"ydl-flutter-base": "0.0.9",
"ydl-webview" : "0.0.37.1",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.46",
"ydl-flutter-base": "0.0.10",
//以下 几乎不会动
"router" : "0.0.1",
......
......@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl"
artifactId = "m-consultant-api"
//开发时注释掉版本号,发布api时打开
// version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
......
......@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.lifecycle.IActivityLifecycleable
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.SimplePresenter
......@@ -12,7 +11,6 @@ import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.http.ExpertSearchDataManager
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.AllFilter
......@@ -134,10 +132,10 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
if (allFilter.others.isNotEmpty()) {
sb.append("&others=").append(allFilter.others.map { it.key }.joinToString(","))
}
if (allFilter.showType.key != null) {
showType = allFilter.showType.key!!
sb.append("&showType=").append(allFilter.showType.key!!)
}
// if (allFilter.showType.key != null) {
// showType = allFilter.showType.key!!
// sb.append("&showType=").append(allFilter.showType.key!!)
// }
if(allFilter.title.isNotEmpty()){
sb.append("&title=").append(allFilter.title.map { it.key }.joinToString(","))
}
......@@ -153,11 +151,12 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
if (null != it.list && !it.list!!.isEmpty()) {
if (showType == 0) {
mView.onDoctorListFetched(it.list!!, page, it.pages)
} else {
mView.onServiceListFetched(it.list!!, page, it.pages)
}
// if (showType == 0) {
// mView.onDoctorListFetched(it.list!!, page, it.pages)
// } else {
// mView.onServiceListFetched(it.list!!, page, it.pages)
// }
mView.onDoctorListFetched(it.list!!, page, it.pages)
//更新缓存 只更新第一页的缓存
if (page == 1){
updateCache(showType,it)
......
......@@ -133,7 +133,7 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi
private fun reset() {
tempFilter.showType = filterData.showType[1]
tempFilter.showType = filterData.showType[0]
tempFilter.ages.clear()
tempFilter.enquiries.clear()
tempFilter.others.clear()
......
......@@ -18,6 +18,8 @@ import android.widget.AdapterView
import android.widget.LinearLayout
import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.BaseActivity
......@@ -730,6 +732,15 @@ class CourseListContainerActivity : BaseActivity(), PtrHandler, LoadMoreHandler
getData(false)
}
override fun onDestroy() {
super.onDestroy()
if (!PlayerFloatHelper.isCanClick) {
PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(this)
AudioPlayer.get().stopPlayer()
}
}
override fun onResume() {
super.onResume()
......
......@@ -141,7 +141,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
@Override
public void initDataAndEventLazy() {
initDatas();
// initDatas();
}
private void initViews() {
......
......@@ -101,11 +101,12 @@ public class TrendsContentListFragment extends BaseFragment implements ITrendsLi
public void initDataAndEvent() {
initDatas();
initViews();
onRefresh();
}
@Override
public void initDataAndEventLazy() {
onRefresh();
}
private void initViews() {
......
......@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl"
artifactId = "m-home-api"
//开发时注释掉版本号,发布api时打开
// version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -126,9 +126,22 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
docInfo.tag1 = expert.shareData.tag1;
docInfo.doctorBriefInfoFeedbackRate = expert.doctorBriefInfo.feedbackRate;
docInfo.doctorBriefInfoFeedbackRateForShow = expert.doctorBriefInfo.feedbackRateForShow;
docInfo.doctorBriefInfoHelpLong = expert.doctorBriefInfo.helpLong;
docInfo.doctorBriefInfoOrderNum = expert.doctorBriefInfo.orderNum;
docInfo.doctorBriefInfoSmallImage = expert.doctorBriefInfo.smallImage;
docInfo.isFollowed = expert.shareData.isFollowed;
docInfo.commentCounter = expert.commentCounter;
docInfo.commentCounterUrl = expert.commentCounterUrl;
if (docInfo.commentList == null) {
docInfo.commentList = new ArrayList();
}
docInfo.commentList.clear();
if (expert.commentList != null) {
docInfo.commentList.addAll(expert.commentList);
}
}
public P2PCustomActionHandlerImpl(String toChatUsername,
......
......@@ -13,6 +13,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.utils.YDLCacheUtils;
import com.yidianling.im.BuildConfig;
import com.yidianling.im.R;
import com.yidianling.im.config.constants.UserPreferences;
import com.yidianling.im.config.provider.CustomUserInfoProvider;
......@@ -43,8 +44,10 @@ class NimSDKOptionConfig {
String appEnv = BaseApp.Companion.getInstance().getGlobalConfig().getAppEnv();
//debug包根据url判断使用正式或者测试key
if (!TextUtils.isEmpty(YDLCacheUtils.Companion.getCacheApi())) {
if (YDLConstants.ENV_TEST.equals(appEnv)) {
String cacheAppEnv = YDLCacheUtils.Companion.getCacheApi();
//这边不能加BuildConfig.DEBUG,因为发布了aar之后,必定为release,导致切换云信的环境失败
if (!TextUtils.isEmpty(cacheAppEnv)) {
if (YDLConstants.ENV_TEST.equals(cacheAppEnv)) {
options.appKey = "9a8cefe97b7690537fc1334091af9208";
} else {
options.appKey = "4e258ba5cdf489fa188274ebf0fb5669";
......
package com.yidianling.uikit.business.session.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.WindowManager;
......@@ -26,9 +28,13 @@ import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.business.session.fragment.YDLMessageFragment;
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.ServiceImpl;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* 点对点聊天界面
* <p/>
......
......@@ -137,6 +137,11 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
messageEditText.setText(content == null ? "" : content);
}
//设置输入框hint内容
public void setInputHintContent(String content) {
messageEditText.setHint(content == null ? "" : content);
}
//获取当前聊天输入框内容
public String getInputContent() {
return messageEditText.getText().toString();
......@@ -296,7 +301,6 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
@Override
public void onFocusChange(View v, boolean hasFocus) {
messageEditText.setHint("");
checkSendButtonEnable(messageEditText);
}
});
......
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.view.animation.TranslateAnimation
import android.widget.LinearLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.yidianling.im.R
import com.yidianling.im.api.bean.ImCommendDetailBean
import kotlinx.android.synthetic.main.im_real_view_in.view.*
import kotlinx.android.synthetic.main.im_real_view_left.view.*
import kotlinx.android.synthetic.main.im_real_view_out.view.*
class ImCommentBannerView : LinearLayout {
constructor(context: Context) : super(context) {
mContext = context
initViews()
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
mContext = context
initViews()
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context,
attrs,
defStyle
) {
mContext = context
initViews()
}
private var mContext: Context? = null
private val STATUS_IN = 0
private val STATUS_OUT = 1
private var curTipIndex = 0
private var lastTimeMillis: Long = 0
private val ANIM_DELAYED_MILLIONS = 3 * 1000
/**
* 动画持续时长
*/
private val ANIM_DURATION = 500
/**
* 进、出 两个view (主要用于做动画,其实是两个相同的布局文件)
*/
private var view_out: View? = null
private var view_in: View? = null
/**
* 进、出 两个View 的动画
*/
private var anim_out: Animation? = null
private var anim_in: Animation? = null
/**
* 数据缓存
*/
private var mDataList: ArrayList<ImCommendDetailBean>? = null
private val mHandler: Handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message?) {
super.handleMessage(msg)
updateTipAndPlayAnimation()
sendMessageDelayed(Message(), ANIM_DELAYED_MILLIONS.toLong())
}
}
private fun initViews() {
initView()
initAnimation()
}
/**
* 界面初始化
*/
private fun initView() {
orientation = HORIZONTAL
var params = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
View.inflate(mContext, R.layout.im_real_view_left, this)
view_out = View.inflate(mContext, R.layout.im_real_view_out, null)
view_in = View.inflate(mContext, R.layout.im_real_view_in, null)
imRealViewLeftFrameLayout.addView(view_out)
imRealViewLeftFrameLayout.addView(view_in)
layoutParams = params
}
private fun initAnimation() {
anim_out = newAnimation(0f, -1f)
anim_in = newAnimation(1f, 0f)
anim_in?.setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {
}
override fun onAnimationRepeat(animation: Animation) {
}
override fun onAnimationEnd(animation: Animation) {
updateViewVisibility()
}
})
}
/**
* 设置数据
*/
fun initData(list: ArrayList<ImCommendDetailBean>?) {
mHandler.removeCallbacksAndMessages(null)
if (null == list || list.isEmpty() || list.size == 0) {
visibility = View.INVISIBLE
return
}
visibility = View.VISIBLE
if (null == mDataList) {
mDataList = ArrayList()
} else {
(mDataList as ArrayList).clear()
}
(mDataList as ArrayList).addAll(list)
curTipIndex = 0
updateTip(STATUS_OUT)
updateTipAndPlayAnimation()
mHandler.sendMessageDelayed(Message(), ANIM_DELAYED_MILLIONS.toLong())
}
private fun updateViewVisibility() {
if (curTipIndex % 2 == 0) {
view_out?.visibility = View.INVISIBLE
} else {
view_in?.visibility = View.INVISIBLE
}
}
private fun newAnimation(fromYValue: Float, toYValue: Float): Animation {
val anim = TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, fromYValue, Animation.RELATIVE_TO_SELF, toYValue
)
anim.duration = ANIM_DURATION.toLong()
anim.interpolator = DecelerateInterpolator()
return anim
}
private fun updateTipAndPlayAnimation() {
view_in?.visibility = View.VISIBLE
view_out?.visibility = View.VISIBLE
if (curTipIndex % 2 == 0) {
updateTip(STATUS_OUT)
view_in?.startAnimation(anim_out)
view_out?.startAnimation(anim_in)
this.bringChildToFront(view_in)
} else {
updateTip(STATUS_IN)
view_out?.startAnimation(anim_out)
view_in?.startAnimation(anim_in)
this.bringChildToFront(view_out)
}
}
private fun updateTip(status: Int) {
val bodyBean = getNextTip() ?: return
mContext?.let {
when (status) {
STATUS_IN -> {
tv_in_comment_desc.text = bodyBean.commentContent
tv_in_content_before.text = getName(bodyBean.nickName)
view_in?.setOnClickListener {
val params: H5Params = H5Params(bodyBean.commentUrl, "")
mContext?.let {
NewH5Activity.start(mContext, params)
}
}
}
STATUS_OUT -> {
tv_out_comment_desc.text = bodyBean.commentContent
tv_out_content_before.text = getName(bodyBean.nickName)
view_out?.setOnClickListener {
val params: H5Params = H5Params(bodyBean.commentUrl, "")
mContext?.let {
NewH5Activity.start(mContext, params)
}
}
}
else -> {}
}
}
}
//获取经过加密的名字 : 徐**
private fun getName(name: String?): String {
var nameBuffer = StringBuffer()
name?.let {
nameBuffer.append(name[0])
nameBuffer.append("**:")
}
return nameBuffer.toString()
}
private fun getNextTip(): ImCommendDetailBean? {
if (null == mDataList || mDataList?.isEmpty()!!) {
return null
}
return mDataList!![curTipIndex++ % mDataList!!.size!!]
}
fun onDestory() {
mHandler.removeCallbacksAndMessages(null)
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.util.AttributeSet
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import com.ydl.ydlcommon.utils.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.im.R
import kotlin.math.ceil
import kotlin.math.floor
class ImRedStarGradeView : LinearLayout {
constructor(context: Context) : super(context) {
mContext = context
initViews()
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
mContext = context
initViews()
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context,
attrs,
defStyle
) {
mContext = context
initViews()
}
private var mContext: Context? = null
private fun initViews() {
initView()
}
/**
* 界面初始化
*/
private fun initView() {
orientation = HORIZONTAL
var params = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
RxImageTool.dp2px(11f)
)
layoutParams = params
}
/**
* 设置分数
*/
fun setGrade(grade: Float) {
try {
val generateGrade = floor(grade.toDouble())
val generateNumberInt = if (generateGrade.toInt() > 5) 5 else generateGrade.toInt()
val dp_11 = RxImageTool.dp2px(11f)
for (i in 0 until generateNumberInt) {
val itemView = View.inflate(mContext, R.layout.im_good_icon_layout, null)
val params = LayoutParams(
dp_11, dp_11
)
itemView.layoutParams = params
addView(itemView)
}
if (grade > generateGrade) {
val lastRate = grade - generateGrade
//外部布局
val itemView = View.inflate(mContext, R.layout.im_good_icon_layout, null)
val params = LayoutParams(dp_11, dp_11)
itemView.layoutParams = params
//左侧红色icon布局
val redStarIconView = itemView.findViewById<LinearLayout>(R.id.im_red_star)
val redStarParams =
LayoutParams(RxImageTool.dp2px((lastRate * 11f).toFloat()), dp_11)
redStarIconView.layoutParams = redStarParams
val redStarIconImg = itemView.findViewById<ImageView>(R.id.im_red_star_icon)
val redStarIconImgParams = LayoutParams(dp_11, dp_11)
redStarIconImg.layoutParams = redStarIconImgParams
// 右侧灰色icon布局
val greyStarIconView = itemView.findViewById<LinearLayout>(R.id.im_grey_star)
val greyStarParams = LayoutParams(
RxImageTool.dp2px(((1.0f - lastRate) * 11f).toFloat()), dp_11
)
greyStarIconView.layoutParams = greyStarParams
val greyStarIconImg = itemView.findViewById<ImageView>(R.id.im_grey_star_icon)
val greyStarIconImgParams = LayoutParams(dp_11, dp_11)
greyStarIconImgParams.gravity = Gravity.RIGHT
greyStarIconImg.layoutParams = greyStarIconImgParams
addView(itemView)
}
//补全剩余的灰色icon
val ceilGradeInt = (ceil(grade.toDouble())).toInt()
for (i in ceilGradeInt until 5) {
val itemView = View.inflate(mContext, R.layout.im_good_grey_icon_layout, null)
val params = LayoutParams(
dp_11, dp_11
)
itemView.layoutParams = params
addView(itemView)
}
} catch (e: Exception) {
LogUtil.i(e.toString())
}
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yidianling.im.api.bean.ImCommendDetailBean;
import com.yidianling.uikit.custom.http.response.RecommendExpertBean;
import org.json.JSONObject;
......@@ -144,10 +145,17 @@ public interface IP2PCustomActionHandler {
public int busyTotal = 0; //专家当前在与多少人聊天
public String tag1 = ""; //用与获取推荐专家列表接口的参数catName
public double doctorBriefInfoFeedbackRate = 0.000; //好评率 需要*100
public double doctorBriefInfoFeedbackRate = 0.000; //好评分
public String doctorBriefInfoFeedbackRateForShow = "";
public int doctorBriefInfoOrderNum = 0; //帮助人数
public int doctorBriefInfoHelpLong = 0; //服务时长
public String doctorBriefInfoSmallImage = ""; //小头像
public Boolean isFollowed = false; // 是否关注
public int commentCounter = 0;
public String commentCounterUrl = "";
public ArrayList<ImCommendDetailBean> commentList;
}
//消息中有11位数字,提示是否要隐藏中间5位 相关
......
......@@ -3,10 +3,8 @@ package com.yidianling.uikit.custom.http
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.uikit.custom.http.response.*
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*
......@@ -51,4 +49,19 @@ interface ServiceApi{
@POST("user/collect/submit")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun submitUserCollect(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
//关注
@GET("consult/expert-page/toggle-follow")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun focus(@Query("doctorId") doctorId: String, @Query("status") status: String): Observable<BaseAPIResponse<Any>>
//服务列表
@GET("consult/expert-page/products")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun serviceList(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<List<ServiceItemBean>>>
//获取输入框的hint内容
@GET("systemconfig/get-chat-view-config")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getChatViewConfig(): Observable<BaseAPIResponse<SystemInfoBean>>
}
\ No newline at end of file
......@@ -2,10 +2,7 @@ package com.yidianling.uikit.custom.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import com.yidianling.uikit.custom.http.response.*
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody
......@@ -13,7 +10,7 @@ import okhttp3.RequestBody
/**
* Created by xj on 2019/6/26.
*/
class ServiceImpl private constructor(){
class ServiceImpl private constructor() {
companion object {
val instance by lazy { ServiceImpl() }
......@@ -36,8 +33,13 @@ class ServiceImpl private constructor(){
/**
* 获取推荐专家列表
*/
fun getRecommendExpertList(doctorUid: Long, catName: String, limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getRecommendExpertList(doctorUid, catName, limit)
fun getRecommendExpertList(
doctorUid: Long,
catName: String,
limit: Int
): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java)
.getRecommendExpertList(doctorUid, catName, limit)
}
/**
......@@ -65,7 +67,31 @@ class ServiceImpl private constructor(){
* 上传采集的问题
*/
fun submitUserCollect(params: String): Observable<BaseAPIResponse<Any>> {
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), params) as RequestBody
val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
params
) as RequestBody
return YDLHttpUtils.obtainApi(ServiceApi::class.java).submitUserCollect(body)
}
/**
* 关注用户
*/
fun focus(doctorId: String, status: String): Observable<BaseAPIResponse<Any>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).focus(doctorId, status)
}
/**
* 服务列表
*/
fun serviceList(doctorId: String): Observable<BaseAPIResponse<List<ServiceItemBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).serviceList(doctorId)
}
/**
* 获取输入框的hint内容
*/
fun getChatViewConfig(): Observable<BaseAPIResponse<SystemInfoBean>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getChatViewConfig()
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.http.response
class SystemInfoBean(
val inputBoxReminder: String,
val status: Int
)
\ No newline at end of file
......@@ -56,6 +56,7 @@ public class ConfideOrderInfoView extends RelativeLayout {
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = RxImageTool.dp2px(8f);
params.rightMargin = RxImageTool.dp2px(8f);
params.topMargin = RxImageTool.dp2px(10f);
setLayoutParams(params);
View.inflate(mContext, R.layout.im_nim_chat_confide_order_info_view, this);
setBackground(getResources().getDrawable(R.drawable.im_bg_im_confide_action));
......
package com.yidianling.uikit.custom.widget
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.yidianling.im.R
import kotlinx.android.synthetic.main.im_expert_info_dialog_layout.*
import kotlinx.android.synthetic.main.im_safe_help_remind_dialog_layout.*
/**
* 专家信息弹窗
* Created by xj on 2019/8/7.
*/
class ExpertInfoDialog(val mContext: Context, val help_num: String, val server_num: String, val good_num: String): Dialog(mContext, R.style.dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.im_expert_info_dialog_layout)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
window.setGravity(Gravity.CENTER)
window.attributes = params
im_expert_detail_help_num.text = help_num
im_expert_detail_server_num.text = server_num
im_expert_detail_good_num.text = good_num
expert_info_close.setOnClickListener {
if (null != mContext) {
dismiss()
}
}
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.callback
import com.yidianling.uikit.custom.http.response.ServiceItemBean
interface ConsultServiceViewCallback {
fun onCloseClick() {}//关闭按钮点击
fun onBackClick() {}//返回列表点击
fun onItemClick(serviceId: ServiceItemBean.ProductsBean) {} //服务列表点击
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import android.widget.RelativeLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.GlobalConfig
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.GlobalInfo
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_detail_view.view.*
class ExpertConsultServiceDetailView : RelativeLayout {
constructor(context: Context, listener: ConsultServiceViewCallback) : super(context) {
mListener = listener
mContext = context
initView()
}
private var mListener: ConsultServiceViewCallback? = null
private var mContext: Context? = null
private fun initView() {
val mWidth: Int = RxDeviceTool.getScreenWidth(mContext)
val mHeight: Int = LayoutParams.MATCH_PARENT
val params = LayoutParams(
mWidth,
mHeight
)
params.height = mHeight
layoutParams = params
View.inflate(mContext, R.layout.im_expert_consult_service_detail_view, this)
im_expert_service_list_left_back_btn.setOnClickListener {
mListener?.onBackClick()
}
}
/**
* 设置数据
*/
fun updateData(bean: ServiceItemBean.ProductsBean) {
val mCompare: Comparator<ServiceItemBean.ProductsBean.ProductSpecDtosBean> = Comparator { o1, o2 ->
val res = o1.price.compareTo(o2.price)
when {
res == 0 -> 0
res > 0 -> -1
else -> 1
}
}
if (bean.productSpecDtos != null && bean.productSpecDtos.size > 0) {
val mBean: ServiceItemBean.ProductsBean.ProductSpecDtosBean = bean.productSpecDtos.sortedWith(mCompare).last()
//价格,取productSpecDtos数组最后一个价格,不保留小数
consult_service_service_price.text = String.format(
"%.0f",
mBean.price
)
if (bean.productDto.isPackage == 2) {
consult_service_price_right.text = "/${mBean.spec2}分钟" //例: 套餐展示"/60分钟"
}else {
consult_service_price_right.text = "/次"//例: 不是套餐展示"/次"
}
}
consult_service_title.text = bean.productDto.name ?: ""
consult_service_desc.text = bean.productDto.desc ?: ""
//是否是套餐
if (bean.productDto.isPackage == 2) {
consult_service_is_package.text = "套餐"
consult_service_times.text = "${bean.productDto.packageNum}次"
//起售次数展示
consult_service_low_buy_time.visibility = View.VISIBLE
consult_service_low_buy_time.text = "(${bean.productDto.packageNum}次起售)"
} else {
consult_service_is_package.text = "单次"
consult_service_times.text = "1次"
consult_service_low_buy_time.visibility = View.GONE
}
//可选时间类型
var timeStr = StringBuffer("")
var timeList: ArrayList<String> = ArrayList()
bean.productSpecDtos.forEach {
timeList.add(it.spec2)
}
//去重并按规则拼接
timeList.distinct().forEachIndexed { index, str ->
if (index == 0) {
timeStr.append("${str}分钟")
} else {
timeStr.append("/${str}分钟")
}
}
consult_service_once_time_type.text = timeStr.toString()
//可选服务类型
var serviceTypeStr = StringBuffer("")
var serviceTypeList: ArrayList<String> = ArrayList()
bean.productSpecDtos.forEach {
serviceTypeList.add(it.spec1)
}
//去重并按规则拼接
serviceTypeList.distinct().forEachIndexed { index, str ->
val typeStr = getServiceType(str)
if (typeStr != "未知") {
if (index == 0) {
serviceTypeStr.append("$typeStr")
} else {
serviceTypeStr.append("/$typeStr")
}
}
}
consult_service_service_type.text = serviceTypeStr.toString()
consult_service_btn.setOnClickListener {
NewH5Activity.start(mContext, H5Params(HttpConfig.MH5_URL + "consult/#/pages/DownOrder/DownOrder?product_id=" + bean.productDto.id, null))
}
}
private fun getServiceType(index: String): String {
return when (index) {
"1" -> {
"文字"
}
"2" -> {
"电话"
}
"3" -> {
"当面"
}
"4" -> {
"视频"
}
else -> {
"未知"
}
}
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_item_view.view.*
class ExpertConsultServiceItemView : LinearLayout {
constructor(context: Context, listener: ConsultServiceViewCallback?) : super(context) {
mListener = listener
mContext = context
initView()
}
private var mContext: Context? = null
private var mListener: ConsultServiceViewCallback? = null
private fun initView() {
val mWidth: Int = LayoutParams.MATCH_PARENT
val mHeight: Int = LayoutParams.WRAP_CONTENT
val params = LayoutParams(
mWidth,
mHeight
)
params.height = mHeight
layoutParams = params
orientation = HORIZONTAL
View.inflate(mContext, R.layout.im_expert_consult_service_item_view, this)
}
/**
* 设置数据
*/
@SuppressLint("SetTextI18n")
fun setData(bean: ServiceItemBean.ProductsBean) {
//是否是套餐
if (bean.productDto.isPackage == 2) {
//展示左上角套餐布局
service_item_package.visibility = View.VISIBLE
//服务名
service_item_title.text = " ${bean.productDto.name}"
//起售次数展示
service_item_low_buy_time.visibility = View.VISIBLE
service_item_low_buy_time.text = "(${bean.productDto.packageNum}次起售)"
} else {
//隐藏套餐布局
service_item_package.visibility = View.GONE
//服务名
service_item_title.text = bean.productDto.name ?: ""
//隐藏起售次数限制
service_item_low_buy_time.visibility = View.GONE
}
val mCompare: Comparator<ServiceItemBean.ProductsBean.ProductSpecDtosBean> = Comparator { o1, o2 ->
val res = o1.price.compareTo(o2.price)
when {
res == 0 -> 0
res > 0 -> -1
else -> 1
}
}
if (bean.productSpecDtos != null && bean.productSpecDtos.size > 0) {
val mBean: ServiceItemBean.ProductsBean.ProductSpecDtosBean = bean.productSpecDtos.sortedWith(mCompare).last()
//价格,取productSpecDtos数组最小价格,不保留小数
service_item_price.text = String.format(
"%.0f",
mBean.price
)
//时间,取productSpecDtos数组最后一个的时间
service_item_time.text = "/${mBean.spec2}分钟"
}
//好评率,*20后 保留1位小数
service_item_feddbackrate.text = String.format(
"%.1f",
(bean.productDto.feedbackRate) * 20f
) + "%"
//销量
service_item_saleout_num.text = "销量${bean.productDto.saleoutAmount}"
setOnClickListener {
mListener?.onItemClick(bean)
}
im_expert_service_list_btn.setOnClickListener {
NewH5Activity.start(mContext, H5Params(HttpConfig.MH5_URL + "consult/#/pages/DownOrder/DownOrder?product_id=" + bean.productDto.id, null))
}
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.support.v4.view.PagerAdapter
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.view.animation.TranslateAnimation
import android.widget.LinearLayout
import android.widget.ScrollView
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_list_dialog_layout.*
/**
* 专家咨询服务列表弹框
* Created by xj on 2019/8/7.
*/
class ExpertConsultServiceListDialog(val mContext: Context, val mList: List<ServiceItemBean>): Dialog(mContext, R.style.dialog_default_style) {
private var mConsultServiceListView: ExpertConsultServiceView? = null
private var mConsultServiceDetailView: ExpertConsultServiceDetailView? = null
private var mViewList: ArrayList<View> = ArrayList()
private var mSelectType: String = "全部"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.im_expert_consult_service_list_dialog_layout)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = RxDeviceTool.getScreenHeight(mContext) - RxImageTool.dp2px(100f)
params.gravity = Gravity.BOTTOM
window.setWindowAnimations(R.style.bottom_to_top_dialog_style)
window.attributes = params
var typeList:ArrayList<String> = ArrayList()
typeList.add(mSelectType)//默认选中
mList.forEach { item ->
typeList.add(item.cateName)
}
mConsultServiceListView =
ExpertConsultServiceView(
mContext
)
(mConsultServiceListView as ExpertConsultServiceView).setDataAndClick(typeList, mList, object : ConsultServiceViewCallback {
override fun onCloseClick() {
dismiss()
}
override fun onItemClick(serviceBean: ServiceItemBean.ProductsBean) {
if (mConsultServiceDetailView != null) {
mConsultServiceDetailView?.updateData(serviceBean)
dialog_bottom_scroll_view.currentItem = 1
}
}
})
mViewList.add(mConsultServiceListView as View)
mConsultServiceDetailView =
ExpertConsultServiceDetailView(
mContext, object : ConsultServiceViewCallback {
override fun onBackClick() {
dialog_bottom_scroll_view.currentItem = 0
}
})
mViewList.add(mConsultServiceDetailView as View)
dialog_bottom_scroll_view.adapter = ConsultServicePagerAdapter()
dialog_bottom_scroll_view.currentItem = 0
setCanceledOnTouchOutside(true)
}
internal inner class ConsultServicePagerAdapter : PagerAdapter() {
override fun getCount(): Int {
return mViewList.size
}
override fun isViewFromObject(view: View, `object`: Any): Boolean {
return view === `object`
}
override fun instantiateItem(container: ViewGroup, position: Int): Any {
val view = mViewList[position]
container.addView(view)
return view
}
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
container.removeView(`object` as View)
}
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.yidianling.im.R
import kotlinx.android.synthetic.main.im_expert_consult_service_type_item_view.view.*
class ExpertConsultServiceTypeItemView : LinearLayout {
constructor(context: Context) : super(context) {
mContext = context
initView()
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
mContext = context
initView()
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context,
attrs,
defStyle
) {
mContext = context
initView()
}
private var mContext: Context? = null
private fun initView() {
val mWidth: Int = LayoutParams.WRAP_CONTENT
val mHeight: Int = LayoutParams.WRAP_CONTENT
val params = LayoutParams(
mWidth,
mHeight
)
params.height = mHeight
layoutParams = params
View.inflate(mContext, R.layout.im_expert_consult_service_type_item_view, this)
}
/**
* 设置数据
*/
fun setData(typeString: String, isSelected: Boolean) {
im_expert_info_dialog_type_item_text.text = typeString
if (isSelected) {
im_expert_info_dialog_type_item_text.setTextColor((Color.parseColor("#1DA1F2")))
im_expert_info_dialog_type_item_text.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
im_expert_info_dialog_type_item_text.setBackgroundResource(R.drawable.im_expert_info_dialog_type_item_selected_bg)
} else {
im_expert_info_dialog_type_item_text.setTextColor((Color.parseColor("#999999")))
im_expert_info_dialog_type_item_text.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
im_expert_info_dialog_type_item_text.setBackgroundResource(R.drawable.im_expert_info_dialog_type_item_unselected_bg)
}
}
/**
* 更新状态
*/
fun updateStatus(isSelected: Boolean) {
if (isSelected) {
im_expert_info_dialog_type_item_text.setTextColor((Color.parseColor("#1DA1F2")))
im_expert_info_dialog_type_item_text.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
im_expert_info_dialog_type_item_text.setBackgroundResource(R.drawable.im_expert_info_dialog_type_item_selected_bg)
} else {
im_expert_info_dialog_type_item_text.setTextColor((Color.parseColor("#999999")))
im_expert_info_dialog_type_item_text.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
im_expert_info_dialog_type_item_text.setBackgroundResource(R.drawable.im_expert_info_dialog_type_item_unselected_bg)
}
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_view.view.*
class ExpertConsultServiceView : LinearLayout {
private var typeSelectedIndex: Int = 0
private var mTypeList: ArrayList<String> = ArrayList()
private var mServiceList: ArrayList<ServiceItemBean> = ArrayList()
private var mListener: ConsultServiceViewCallback? = null
val mCompare: Comparator<ServiceItemBean.ProductsBean> = Comparator { o1, o2 ->
val res = o1.productDto.sortOrder.compareTo(o2.productDto.sortOrder)
when {
res == 0 -> 0
res > 0 -> -1
else -> 1
}
}
constructor(context: Context) : super(context) {
mContext = context
initView()
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
mContext = context
initView()
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context,
attrs,
defStyle
) {
mContext = context
initView()
}
private var mContext: Context? = null
private fun initView() {
val mWidth: Int = RxDeviceTool.getScreenWidth(mContext)
val mHeight: Int = LayoutParams.MATCH_PARENT
val params = LayoutParams(
mWidth,
mHeight
)
params.height = mHeight
layoutParams = params
orientation = VERTICAL
View.inflate(mContext, R.layout.im_expert_consult_service_view, this)
}
/**
* typeList 类型列表
* serviceList 服务列表
*/
fun setDataAndClick(
typeList: ArrayList<String>,
allServiceList: List<ServiceItemBean>,
listener: ConsultServiceViewCallback?
) {
mListener = listener
consult_service_dialog_close.setOnClickListener {
mListener?.onCloseClick()
}
// 设置顶部滚动类型数据
if (typeList == null || typeList.size == 0) {
expert_consult_service_top_scroll.visibility = View.GONE
} else {
mTypeList.clear()
mTypeList.addAll(typeList)
mContext?.let {
mTypeList.forEachIndexed { index, str ->
val item =
ExpertConsultServiceTypeItemView(
mContext!!
)
item.setData(str, index == typeSelectedIndex)
item.setOnClickListener {
typeSelectedIndex = index
resetSelected()
selectTypeServiceList()
}
expert_consult_service_type_list.addView(item)
}
}
}
typeSelectedIndex = 0 // 初始化为全部选中
mServiceList.clear()
mServiceList.addAll(allServiceList)
// 设置服务列表数据
selectTypeServiceList()
}
/**
* 刷新服务列表数据
*/
private fun selectTypeServiceList() {
expert_consult_service_service_list.removeAllViews()
if (mServiceList.size != 0) {
val lastList: ArrayList<ServiceItemBean.ProductsBean> = ArrayList()
mServiceList.forEachIndexed { index, itemBean ->
//当选中String相同的时候,添加view,或者选中typeSelectedIndex==0的时候,展示全部
if (itemBean.cateName == mTypeList[typeSelectedIndex] || typeSelectedIndex == 0) {
itemBean.products.forEach {
lastList.add(it)
}
}
}
lastList.sortedWith(mCompare).forEach {
val item = ExpertConsultServiceItemView(mContext!!, mListener)
item.setData(it)
expert_consult_service_service_list.addView(item)
}
}
}
/**
* 刷新类型列表数据
*/
private fun resetSelected() {
for (index in 0 until expert_consult_service_type_list.childCount) {
var view = expert_consult_service_type_list.getChildAt(index)
if (view is ExpertConsultServiceTypeItemView) {
view.updateStatus(index == typeSelectedIndex)
}
}
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ package com.yidianling.im.api.bean;
public class IMDoctorBriefInfo {
public String smallImage = "";
public double feedbackRate = 0.000;
public String feedbackRateForShow = "";
public int orderNum = 0;
public int helpLong = 0;
}
package com.yidianling.im.api.bean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by hgw on 2018/3/13.
*/
......@@ -10,5 +13,8 @@ public class IMExpertBuild {
public String tips; //禁言提示内容
public String url;//禁言帮助URL
public IMDoctorBriefInfo doctorBriefInfo = new IMDoctorBriefInfo();
public List<ImCommendDetailBean> commentList = new ArrayList(); //评论列表
public int commentCounter = 0; //评论总数
public String commentCounterUrl = ""; //评论总数url
}
\ No newline at end of file
......@@ -41,6 +41,7 @@ public class IMShareDataBuild {
public String order_url;
@SerializedName(value = "name", alternate = "doctorName")
public String doctorName;
public Boolean isFollowed = false; // 是否关注
/**
* 是否开启电话倾诉
* 1.开启 2.关闭
......
package com.yidianling.im.api.bean
/**
* 评论细节bean
*/
class ImCommendDetailBean {
var nickName: String = ""
var commentContent: String = ""
var commentUrl: String = ""
}
\ 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="50%p" />
<alpha
android:duration="300"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>
\ 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="100%p"
android:toYDelta="0" />
<alpha
android:duration="300"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
<solid android:color="#ffffff"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#EBF7FF"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp" />
<solid android:color="#F7F7F7"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="19dp" />
<gradient android:startColor="#FF7A5C"
android:endColor="#FF406C"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="14dp" />
<gradient android:startColor="#FF7A5C"
android:endColor="#FF406C"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp"/>
<solid android:color="#FF9500"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:orientation="vertical"
android:paddingTop="10dp"
android:paddingBottom="18dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/service_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text=" 调节孕期情绪烦躁,建立积极心态面对新生活"
android:textColor="#1A1A1A"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="@+id/service_item_package"
android:layout_width="24dp"
android:layout_height="14dp"
android:gravity="center"
android:text="套餐"
android:visibility="gone"
android:layout_marginTop="3dp"
android:textColor="#ffffff"
android:textSize="10dp"
android:background="@drawable/im_service_package_bg"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="top"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="¥"
android:textColor="#FF5040"
android:textSize="9dp"
android:textStyle="bold"
android:layout_marginTop="4dp"/>
<TextView
android:id="@+id/service_item_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#FF5040"
android:textSize="16dp"
android:textStyle="bold"
android:layout_marginBottom="1dp"/>
</LinearLayout>
<TextView
android:id="@+id/service_item_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/0分钟"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
android:id="@+id/service_item_low_buy_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="(几次起售)"
android:visibility="gone"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="好评率"
android:layout_marginLeft="10dp"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
android:id="@+id/service_item_feddbackrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0%"
android:layout_marginLeft="1dp"
android:textColor="#1A1A1A"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical|center"
android:paddingLeft="31dp"
android:paddingRight="18dp"
android:orientation="vertical">
<TextView
android:id="@+id/im_expert_service_list_btn"
android:layout_width="68dp"
android:layout_height="27dp"
android:background="@drawable/im_expert_service_list_btn_bg"
android:gravity="center"
android:text="预约"
android:textColor="#ffffff"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/service_item_saleout_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="销量0"
android:textColor="#999999"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="15dp"
android:background="@drawable/im_expert_conslt_service_list_top_bg" />
<com.ydl.ydlcommon.view.NoScrollViewPager
android:id="@+id/dialog_bottom_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
</com.ydl.ydlcommon.view.NoScrollViewPager>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp">
<TextView
android:id="@+id/im_expert_info_dialog_type_item_text"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:gravity="center"
tools:text="婚姻家庭"
android:textColor="#999999"
android:textSize="12dp"
android:background="@drawable/im_expert_info_dialog_type_item_unselected_bg"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="24dp"
>
<ImageView
android:id="@+id/consult_service_dialog_close"
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/im_expert_service_list_left_delete"
android:layout_marginLeft="14dp"
android:scaleType="centerCrop"
android:layout_centerVertical="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="咨询服务"
android:textColor="#242424"
android:textSize="18dp"
android:textStyle="bold"
android:layout_centerInParent="true"/>
</RelativeLayout>
<HorizontalScrollView
android:id="@+id/expert_consult_service_top_scroll"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="6dp"
android:paddingLeft="15dp"
android:clipToPadding="false"
android:scrollbars="none">
<LinearLayout
android:id="@+id/expert_consult_service_type_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical">
</LinearLayout>
</HorizontalScrollView>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#EBEBEB"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/expert_consult_service_service_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp" />
<solid android:color="@color/im_white" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="18dp"
android:bottomLeftRadius="18dp"/>
<gradient
android:angle="180"
android:startColor="#FF406C"
android:endColor="#FF7A5C"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F7F7F7"/>
<corners android:radius="4dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="6dp"
android:topRightRadius="6dp" />
<gradient
android:angle="270"
android:startColor="#2E27A5F2"
android:endColor="#001DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#ffffff"/>
<corners
android:radius="6dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#E5F5FF"/>
<corners android:radius="10dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#E5F5FF"/>
<corners android:radius="10dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="3dp"></corners>
<gradient
android:angle="270"
android:startColor="#FF406C"
android:endColor="#FF7A5C"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<corners android:radius="10dp"/>
<stroke android:width="0.5dp"
android:color="#CCCCCC"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/im_grey_star"
android:layout_width="11dp"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/im_grey_star_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:src="@drawable/im_star_grey" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/im_red_star"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/im_red_star_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/im_star_red" />
</LinearLayout>
<LinearLayout
android:id="@+id/im_grey_star"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/im_grey_star_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:src="@drawable/im_star_grey" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?android:attr/selectableItemBackground"
xmlns:tools="http://schemas.android.com/tools">
<TextView
android:layout_gravity="center_vertical"
tools:text="姚**:"
android:layout_marginLeft="18dp"
android:id="@+id/tv_in_content_before"
android:textColor="#242424"
android:textStyle="bold"
android:textSize="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_marginRight="6dp"
tools:text="谢谢老师的疏导,相信以后的自相信以后的自相信以后的自…"
android:id="@+id/tv_in_comment_desc"
android:textSize="12dp"
android:textColor="#666666"
android:lines="1"
android:ellipsize="end"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<FrameLayout
android:id="@+id/imRealViewLeftFrameLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?android:attr/selectableItemBackground"
xmlns:tools="http://schemas.android.com/tools">
<TextView
android:layout_gravity="center_vertical"
tools:text="姚**:"
android:layout_marginLeft="18dp"
android:id="@+id/tv_out_content_before"
android:textColor="#242424"
android:textStyle="bold"
android:textSize="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_marginRight="6dp"
tools:text="谢谢老师的疏导,相信以后的自相信以后的自相信以后的自…"
android:id="@+id/tv_out_comment_desc"
android:textSize="12dp"
android:textColor="#666666"
android:lines="1"
android:ellipsize="end"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
......@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl"
artifactId = "m-muse-api"
//开发时注释掉版本号,发布api时打开
//version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
......
......@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl"
artifactId = "m-tests-api"
//开发时注释掉版本号,发布api时打开
// version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
......
......@@ -84,6 +84,12 @@
android:exported="true"
android:launchMode="singleTop" />
<activity
android:name=".ui.login.SecretActivity"
android:theme="@style/platform_NoTitleTheme"
android:exported="true"
android:launchMode="singleTop" />
</application>
</manifest>
\ No newline at end of file
......@@ -173,4 +173,8 @@ interface UserApi {
@POST("user/unbind_third")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>>
//获取隐私政策数据
@GET("site/get-privacy-content")
fun getSecretData(): Observable<BaseResponse<SecretResponse>>
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
import com.yidianling.user.http.response.CountryResponse
import com.yidianling.user.http.response.ExistResponse
import com.yidianling.user.http.response.SecretResponse
import io.reactivex.Observable
/**
......@@ -61,4 +62,6 @@ interface UserHttp {
fun umLogin(activity: Activity, media: SHARE_MEDIA): Observable<ThirdLoginParam>
fun unBindThirdLogin(param: UnBindThirdLoginParam): Observable<BaseResponse<Any>>
fun getSecretData(): Observable<BaseResponse<SecretResponse>>
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
import com.yidianling.user.http.response.CountryResponse
import com.yidianling.user.http.response.ExistResponse
import com.yidianling.user.http.response.SecretResponse
import com.yidianling.user.rxlogin.LoginObservable
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
......@@ -190,6 +191,10 @@ class UserHttpImpl private constructor() : UserHttp {
return getUserApi().unBindThirdLogin(body)
}
override fun getSecretData(): Observable<BaseResponse<SecretResponse>> {
return getUserApi().getSecretData()
}
private object Holder {
val INSTANCE = UserHttpImpl()
......
package com.yidianling.user.http.response;
/**
* is_open 弹窗开关
* 返回值:1开启;2关闭
*
* data.content 隐私内容
*/
public class SecretResponse {
int is_open = 2;
String content = "";
public int getIs_open() {
return is_open;
}
public void setContent(String content) {
this.content = content;
}
public String getContent() {
return content;
}
public void setIs_open(int is_open) {
this.is_open = is_open;
}
}
package com.yidianling.user.ui.login
import android.Manifest
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.Color
......@@ -25,9 +26,11 @@ import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.socialize.UMShareAPI
import com.umeng.socialize.UMShareConfig
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
......@@ -40,6 +43,7 @@ import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.AliAuthBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginAutoParam
import com.yidianling.user.http.response.ChcekPhoneResponeBean
......@@ -50,6 +54,8 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.CountryListActivity
import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.presenter.LoginPresenterImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_register_and_login.*
/**
......@@ -127,7 +133,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
setClickEvent()
}
private fun setWindowStatusBarColor() {
StatusBarUtils.Companion.setWindowStatusBarColor(this, R.color.platform_color_075b66)
}
......
package com.yidianling.user.ui.login
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.text.Html
import android.view.KeyEvent
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.common.tools.RxAppTool
import com.yidianling.user.R
import com.yidianling.user.UserHelper
import com.yidianling.user.widget.SecretDialog
import kotlinx.android.synthetic.main.user_activity_secret.*
/**
* 隐私界面
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/01/10
*/
class SecretActivity : BaseActivity() {
private var secretDialog: SecretDialog? = null
private var mSecretProtocolString: String = ""
companion object {
val SECRET_PROTOCOL: String = "secret_protocol"
val SECRET_PAGE_REQUEST_CODE: Int = 42
val SECRET_PAGE_REQUEST_OK_CODE: Int = 43
val SECRET_PAGE_REQUEST_FAILURE_CODE: Int = 44
fun startProtocol(context: Activity, secretProtocolString: String) {
val intent = Intent(context, SecretActivity::class.java)
intent.putExtra(SECRET_PROTOCOL, secretProtocolString)
context.startActivityForResult(intent, SECRET_PAGE_REQUEST_CODE)
}
}
override fun layoutResId(): Int {
return R.layout.user_activity_secret
}
override fun initDataAndEvent() {
getParam()
initView()
}
private fun getParam() {
mSecretProtocolString = intent.getStringExtra(SECRET_PROTOCOL) ?: ""
if (null != user_secret_desc) {
user_secret_desc.text = Html.fromHtml(mSecretProtocolString)
}
}
private fun initView() {
initStatus()
user_secret_no_agree.setOnClickListener {
if (null == secretDialog) {
secretDialog = SecretDialog(this, object : SecretDialog.OnSecretDialogListener {
override fun onCancel() {
setResult(SECRET_PAGE_REQUEST_FAILURE_CODE)
finish()
}
override fun onSure() {
agreeAction()
}
})
secretDialog?.show()
} else {
secretDialog?.show()
}
}
user_secret_agree.setOnClickListener {
agreeAction()
}
user_use_btn.setOnClickListener {
H5Activity.start(this@SecretActivity, false)
}
user_secret_protect_btn.setOnClickListener {
H5Activity.start(this@SecretActivity, true)
}
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return false
}
return super.onKeyDown(keyCode, event)
}
private fun initStatus() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色
StatusBarUtils.setTransparentForImageView(this, null)
StatusBarUtils.statusBarLightMode(this)
}
}
private fun agreeAction() {
SharedPreferencesEditor.putString("hasAgreeSecret", "true")
setResult(SECRET_PAGE_REQUEST_OK_CODE)
finish()
}
}
\ No newline at end of file
package com.yidianling.user.widget
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.yidianling.user.R
import kotlinx.android.synthetic.main.user_secret_dialog_layout.*
class SecretDialog(context: Context, private val listener: OnSecretDialogListener?): Dialog(context, R.style.platform_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.user_secret_dialog_layout)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
window.setGravity(Gravity.CENTER)
window.attributes = params
user_secret_dialog_agree.setOnClickListener {
listener?.onSure()
}
user_secret_dialog_no_agree.setOnClickListener {
listener?.onCancel()
}
}
interface OnSecretDialogListener {
fun onCancel()
fun onSure()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp"/>
<solid
android:color="#ffffff"/>
</shape>
\ 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