Commit d1fcc291 by konghaorui

用户模块、咨询模块业务组件完善,未发布状态,h5页面状态栏高度问题待修改

parent 746eaaac
......@@ -4,6 +4,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'trace-point'
kapt {
arguments {
......@@ -34,6 +35,8 @@ android {
arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"]
}
}
multiDexEnabled true
}
compileOptions {
......@@ -49,10 +52,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
versionNameSuffix "-debug"
signingConfig null
}
// debug {
// versionNameSuffix "-debug"
// signingConfig null
// }
}
......@@ -105,7 +108,7 @@ android {
MEIZU_APPKEY : "MZ-00d268d7228748479036f202d45b4ef2",//魅族平台注册的appkey
MEIZU_APPID : "MZ-120344",//魅族平台注册的appid
qqappid : "1105070461",
APPLICATIONID : applicationId
APPLICATIONID : rootProject.ext.ydl_app["applicationId"]
]
//签名文件
......@@ -137,7 +140,7 @@ android {
MEIZU_APPKEY : "MZ-00d268d7228748479036f202d45b4ef2",//魅族平台注册的appkey
MEIZU_APPID : "MZ-120344",//魅族平台注册的appid
qqappid : "1105070461",
APPLICATIONID : applicationId
APPLICATIONID : rootProject.ext.xlzx_app["applicationId"]
]
//签名文件
......@@ -154,8 +157,28 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
kapt rootProject.ext.dependencies["dagger2-compiler"]
implementation project(':m-consultant')
api project(':m-user')
implementation project(':ydl-platform')
implementation project(':m-other')
implementation project(':m-user')
implementation project(':ydl-webview')
implementation rootProject.ext.dependencies["retrofit-url-manager"]
kapt 'com.alibaba:arouter-compiler:1.2.2'
}
noTracePoint{
outputModifyFile = false
targetPackages = ['com.cxzapp.yidianling',
'com.yidianling.consultant',
'com.yidianling.course',
'com.yidianling.dynamic',
'com.ydl.home_module',
'com.yidianling.fm',
'com.yidianling.im',
'com.yidianling.avchatkit',
'com.yidianling.uikit',
'com.yidianling.phonecall',
'com.yidianling.tests',
'com.yidianling.user',
'com.yidianling.ydlcommon',
]
}
\ No newline at end of file
......@@ -12,15 +12,17 @@
<application
android:name="com.yidianling.ydlcommon.base.BaseApplication"
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"
tools:replace="android:allowBackup, android:icon, android:label"
android:theme="@style/AppTheme"
android:theme="@style/CommonTheme"
tools:ignore="GoogleAppIndexingWarning">
<!--<activity android:name="com.yidianling.user.ui.login.RegisterAndLoginActivity"-->
<!--<activity android:name=".MainActivity"/>-->
<activity android:name=".MainActivity"
android:theme="@style/NoTitleTheme"
>
......@@ -35,6 +37,20 @@
android:name="com.ydl.component.base.DemoGlobalConfig"
android:value="ModuleConfig"/>
<activity
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tencent1105070461" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.ydl.component
import android.Manifest
import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import com.alibaba.android.arouter.launcher.ARouter
import com.tbruyelle.rxpermissions2.RxPermissions
import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
import com.yidianling.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME
import kotlinx.android.synthetic.main.activity_main.*
/**
......@@ -26,7 +34,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() {
loadData()
requestPermission()
tv_user.setOnClickListener {
loadData()
}
......@@ -36,11 +44,42 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
}
bt_to_other.setOnClickListener {
ARouter.getInstance().build("/other/MainActivity").navigation()
ARouter.getInstance().build("/user/login")
.withBoolean("bind_phone",false)
.withBoolean("isFromGuide",true)
.navigation()
}
bt_to_consultant.setOnClickListener {
ARouter.getInstance()
.build("/consult/hot_search")
.withString(HOT_SEARCH_DOCTOR_NAME, this.resources?.getString(R.string.search_hint))
.navigation()
}
}
override fun loadData() {
mPresenter?.loadUsers()
}
@SuppressLint("CheckResult")
private fun requestPermission() {
val rxPermissions = RxPermissions(this)
rxPermissions.requestEach(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe { permission ->
if (permission.granted) {
ToastUtil.toastShort("Permission Success")
} else if (permission.shouldShowRequestPermissionRationale) {
requestPermission()
} else {
ToastUtil.toastLong(this, getString(R.string.need_storage_permission_hint))
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
intent.data = uri
startActivity(intent)
finish()
}
}
}
}
......@@ -2,8 +2,8 @@ package com.ydl.component.api
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.yidianling.ydlcommon.base.config.YDL_DOMAIN
import com.yidianling.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
......
......@@ -3,7 +3,7 @@ package com.ydl.component.base;
import android.app.Application;
import android.content.Context;
import com.yidianling.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import org.jetbrains.annotations.NotNull;
/**
......
......@@ -3,9 +3,10 @@ package com.ydl.component.base;
import android.content.Context;
import com.ydl.component.BuildConfig;
import com.yidianling.ydlcommon.base.config.IConfigModule;
import com.yidianling.ydlcommon.base.delegate.IAppLifecycles;
import com.yidianling.ydlcommon.base.config.GlobalConfig;
import com.ydl.ydlcommon.base.config.IConfigModule;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.base.config.GlobalConfig;
import org.jetbrains.annotations.NotNull;
import java.util.List;
......@@ -24,7 +25,8 @@ public final class DemoGlobalConfig implements IConfigModule {
@Override
public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) {
builder.setDebug(BuildConfig.DEBUG);
builder.addUrl("github", APP_DOMAIN);
builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX)
.addUrl("github", APP_DOMAIN)
.setDebug(BuildConfig.DEBUG);
}
}
......@@ -2,9 +2,9 @@ package com.ydl.component.mvp
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.yidianling.ydlcommon.mvp.base.IModel
import com.yidianling.ydlcommon.mvp.base.IPresenter
import com.yidianling.ydlcommon.mvp.lce.ILceView
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.lce.ILceView
import io.reactivex.Observable
/**
......
......@@ -5,7 +5,7 @@ import android.arch.lifecycle.OnLifecycleEvent
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.ydl.component.api.DemoService
import com.yidianling.ydlcommon.mvp.base.BaseModel
import com.ydl.ydlcommon.mvp.base.BaseModel
import com.ydl.ydlnet.YDLHttpUtils
import io.reactivex.Observable
......
......@@ -2,8 +2,8 @@ package com.ydl.component.mvp
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.yidianling.ydlcommon.mvp.base.BasePresenter
import com.yidianling.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlnet.builder.interceptor.YDLTransformer
import com.ydl.ydlnet.client.observer.CommonObserver
......@@ -11,7 +11,7 @@ import com.ydl.ydlnet.client.observer.CommonObserver
* Created by haorui on 2019-09-01 .
* Des:
*/
class DemoPresenter : BasePresenter<DemoContract.Model, DemoContract.View>(),
class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
DemoContract.Presenter {
override fun loadHome() = mModel!!.getHome()
.compose(YDLTransformer.switchSchedulers(mView))
......@@ -43,9 +43,4 @@ class DemoPresenter : BasePresenter<DemoContract.Model, DemoContract.View>(),
return DemoModel()
}
override fun destroy() {
super.destroy()
}
}
package com.ydl.component.service;
import android.app.Activity;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.ydl.component.service.web.WebJavascriptHandler;
import com.ydl.component.service.web.WVClickAbstractListener;
import com.ydl.webview.IJavascriptHandler;
import com.ydl.webview.IWebService;
import com.ydl.webview.TellData;
import org.jetbrains.annotations.NotNull;
/**
* Created by haorui on 2019-10-10.
* Des:
*/
@Route(path = "/web/webservice")
public class WebServiceImpl implements IWebService {
@Override
public void init(Context context) {
}
@NotNull
@Override
public IJavascriptHandler getJavascripHandler(@NotNull Activity activity, @NotNull TellData tellData) {
return new WebJavascriptHandler(new WVClickAbstractListener(activity));
}
}
package com.ydl.component.service.web;
import android.app.Activity;
import com.ydl.webview.H5JsBean;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
*/
public class WVClickAbstractListener implements WebViewClientClickListener {
public Activity mContext;
public WVClickAbstractListener(Activity activity) {
this.mContext = activity;
}
@Override
public void openH5(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void courseList() {
}
@Override
public void activeDetail(String id) {
}
@Override
public void contactYi() {
}
@Override
public void contactCourseCustomerService() {
}
@Override
public void openTopicDetail(String topic_id) {
}
@Override
public void openMember(String id) {
}
@Override
public void sendTrend() {
}
@Override
public void sendResultTrend(String cover1, String title1, String purl1, String share_url1) {
}
@Override
public void sendInfo(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void searchList(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void openExpertsHome(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void openTest(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu) {
}
@Override
public void chatSendMessage(int id, int toUid, int canTalk, String accessToken, int isFromQingShu) {
}
@Override
public void chatTeam(int tid, int doctorId) {
}
@Override
public void jumpLogin(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void openFmDetail(int id) {
}
@Override
public void openArticle() {
}
@Override
public void openFmList() {
}
@Override
public void sendSubscriptionTimeMessage(String to_uid) {
}
@Override
public void pay(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void payReceipt(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void payCourse(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void payTest(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void viewTestResult(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void ydlNative(H5JsBean.H5JsCmd jsData) {
}
@Override
public void openOrderDetail(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void expertProduct(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void order(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void toOrderCt(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void showDocList(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void goodExpert() {
}
@Override
public void copyWechat(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void goWechat() {
}
@Override
public void listenOrderDetail(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void detailSub(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void openAgreement(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void modifyEval(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void visitEval(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void coursePlay(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void closeFloatView() {
}
@Override
public void courseWriteComment(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void courseComment(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void listenTel(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void voiceBroadcast(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void tel(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void onOrderByApp(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void orderSetTime(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void searchServiceDoc(int cateId) {
}
@Override
public void openTestDetail(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void shareAction(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void openTestList() {
}
@Override
public void feedBack() {
}
@Override
public void phoneCall() {
}
@Override
public void chatSchedule(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void invite(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void balance(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void switchDownRefresh(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void recharge() {
}
@Override
public void bindPhone() {
}
@Override
public void refresh() {
}
@Override
public void listenAgora(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void setTitle(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void saveImage(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void sendToExpert(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void confideConnect(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void confidePay(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void back() {
}
@Override
public void commonPay(H5JsBean.H5JsCmd.Params jsData) {
}
@Override
public void hideStatusBar() {
}
@Override
public void showStatusBar() {
}
@Override
public void openRightTopMenu() {
}
@Override
public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
}
@Override
public void closeWebKit() {
}
@Override
public void goHome(H5JsBean.H5JsCmd.Params params) {
}
}
package com.ydl.component.service.web;
import com.ydl.webview.H5JsBean;
/**
* webview 点击事件监听
* Created by harvie on 2017/7/4 0004.
*/
public interface 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);
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);
//保存图片
// void storePic();
}
......@@ -67,18 +67,29 @@
android:background="@color/google_blue"
android:layout_width="match_parent"
android:layout_height="50dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/bt_to_other"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Jump to Other"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/bt_to_consultant"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Jump to consultant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<Button
android:id="@+id/bt_to_other"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Jump to Other"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<com.yidianling.ydlcommon.mvp.lce.view.YDLStateView
<com.ydl.ydlcommon.mvp.lce.view.YDLStateView
android:id="@+id/lce_state_view"
android:layout_width="match_parent"
android:layout_height="300dp"/>
......
......@@ -26,7 +26,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
classpath 'com.meituan.android.walle:plugin:1.1.5'
......@@ -39,6 +39,7 @@ buildscript {
//微信资源混淆
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.16'
classpath 'com.ydl.plugins:modular:1.0.0'
classpath 'com.ydl:notracepoint-gradle-plugin:0.0.3'
}
}
......@@ -54,16 +55,16 @@ allprojects {
maven {
url 'https://dl.bintray.com/zouyuhan/maven'
}
//壹点灵android maven私服 开发版
//壹点灵android maven私服
maven {
url 'http://nexus.yidianling.com/repository/AndroidRepository/'
url 'http://nexus.yidianling.com/repository/AndroidReleases/'
credentials {
username "admin"
password "fjoi#1+#@"
}
}
maven {
url 'http://nexus.yidianling.com/repository/AndroidReleases/'
url 'http://nexus.yidianling.com/repository/AndroidRepository/'
credentials {
username "admin"
password "fjoi#1+#@"
......
......@@ -18,7 +18,7 @@ ext {
android = [
compileSdkVersion: 28,
buildToolsVersion: "28.0.3",
minSdkVersion : 14,
minSdkVersion : 17,
targetSdkVersion : 28,
versionCode : 1000,
versionName : "1.0.00",
......@@ -158,7 +158,8 @@ ext {
"bugly-crashreport" : 'com.tencent.bugly:crashreport:2.8.6.0',
"bugly-nativecrashreport" : 'com.tencent.bugly:nativecrashreport:3.6.0.1',
"ydl-image" : 'com.ydl:ydl-image:1.0.7-SNAPSHOT@aar',
"ydl-pushagent" : 'com.ydl:ydl-pushagent:0.1.0',
"ydl-pushagent" : 'com.ydl:ydl-pushagent:0.1.8',
"ydl-notracepoint" : 'com.ydl:notracepoint-lib:0.1.8@aar',
"ydl-js" : 'com.ydl:ydl-js:1.0.7-SNAPSHOT@aar',
"ydl-router" : 'com.ydl:ydl-router:1.3.0-SNAPSHOT@aar',
"xrecyclerview" : 'com.ydl:xrecyclerview:1.0.0-SNAPSHOT@aar',
......@@ -168,6 +169,9 @@ ext {
"free_reflection" : 'me.weishu:free_reflection:2.0.0',
"imagepicker" : 'com.ydl:imagepicker:1.0.6',
"protector" : 'com.ydl:protector:1.0.1-SNAPSHOT@aar',
"ydl-hnet" : 'com.ydl:h-net:0.0.8',
"ydl-utils" : 'com.ydl:ydl-utils:0.0.1',
"ydl-net" : 'com.ydl:ydl-net:0.0.1',
]
}
......@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
kapt {
arguments {
arg("AROUTER_MODULE_NAME", "consultant")
}
}
android {
compileSdkVersion 28
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
......@@ -13,7 +21,7 @@ android {
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
arguments = [AROUTER_MODULE_NAME: "consultant"]
}
}
......@@ -35,11 +43,7 @@ android {
sourceSets {
main {
if (isApplicaiton.toBoolean()) {
manifest.srcFile 'src/main/module/AndroidManifest.xml'
} else {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
......@@ -52,6 +56,10 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'
implementation project(":ydl-platform")
kapt 'com.alibaba:arouter-compiler:1.2.2'
api'com.ydl:router:1.0.0-SNAPSHOT@aar'
implementation modularPublication('com.ydl:m-user-api')
api project(":ydl-webview")
api project(":ydl-platform")
}
modular {
packageName "com.yidianling.consultant"
// 模块发布需要的参数
publish {
modules {
xlzx {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-consultant-module-xlzx"
// 上报的业务模块 aar 包的版本号
version = "0.0.1"
}
ydl{
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-consultant-module-ydl"
// 上报的业务模块 aar 包的版本号
version = "0.0.1"
}
}
api {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-consultant-api"
// version = "0.0.1"
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ 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.yidianling.consultant">
<application>
<activity
android:name=".ExpertSearchActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/NoTitleTheme"/>
<activity
android:name=".HotSearchActivity"
android:screenOrientation="portrait"
android:theme="@style/NoTitleTheme"/>
</application>
</manifest>
\ No newline at end of file
......@@ -2,13 +2,9 @@ package com.ydl.other;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.ydl.user.UserService;
//import com.yidianling.user.UserService;
/**
* Created by haorui on 2019-09-01 .
......@@ -17,23 +13,23 @@ import com.ydl.user.UserService;
@Route(path = "/other/MainActivity")
public class MainActivity extends AppCompatActivity {
@Autowired//(name = "/user/UserService")
UserService mUserService;
// @Autowired//(name = "/user/UserService")
// UserService mUserService;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ARouter.getInstance().inject(this);
setContentView(R.layout.other_activity_main);
// setContentView(R.layout.other_activity_main);
//mUserService=ARouter.getInstance().navigation(UserService.class);
findViewById(R.id.btHello).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Hello:" + mUserService.getUser().getName(), Toast.LENGTH_SHORT).show();
}
});
// findViewById(R.id.btHello).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Toast.makeText(MainActivity.this, "Hello:" + mUserService.getUser().getName(), Toast.LENGTH_SHORT).show();
// }
// });
}
}
package com.yidianling.consultant
import android.annotation.SuppressLint
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.SimplePresenter
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.consultant.http.ExpertSearchDataManager
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.AllFilter
import com.yidianling.consultant.model.bean.ExpertSearchBean
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
/**
* 专家搜索页Presenter
* Created by zqk on 17-9-19.
*/
class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
@SuppressLint("CheckResult")
fun fetchListHead() {
SearchApi.getSearchApi()
.searchConditions()
.compose(RxLifecycleUtils.bindToLifecycle(mView!!))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
mView.onHeadFetched(resp)
}, { t ->
HttpErrorUtils.handleError(BaseApp.getApp(), t)
mView.fetchFailed(t.message)
})
}
fun fetchBannerList() {
ExpertSearchDataManager.getHttp().getBannerList()
.subscribeOn(Schedulers.io())
.compose(RxLifecycleUtils.bindToLifecycle(mView!!)).compose(RxUtils.resultJavaData())
.map { it }
.filter { it != null }
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
mView.onBannerListFetched(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.onBannerListFetched(null)
// mView.fetchFailed(msg)
}
})
}
/**
* 加载缓存
*/
fun localData(showType : Int){
YDLAsyncUtils.asyncAsResult(object : YDLAsyncUtils.AsyncObjecyerResult{
override fun doAsyncAction(): Any {
return when(showType){
0 ->{//按专家
YDLCacheUtils.getDoctorListData()
}
1 ->{//按服务
YDLCacheUtils.getServerListData()
}
else ->{
YDLCacheUtils.getServerListData()
}
}
}
override fun asyncResult(`object`: Any?) {
//如果没有缓存数据,显示加载框
if (`object` !is String || TextUtils.isEmpty(`object`)){
mView.showRefreshLayout()
}
if (`object` is String){
val gson = Gson()
val bean = gson.fromJson<ExpertSearchBean>(`object`,ExpertSearchBean::class.java)
// val bean = gson.fromJson<ExpertSearchBean>(`object`, object : TypeToken<ExpertSearchBean>() {}.type)
if(bean?.list != null){
when(showType){
0 ->{
mView.onDoctorListFetched(bean.list, 1, 1)
}
1 ->{
mView.onServiceListFetched(bean.list, 1, 1)
}
else ->{
mView.onServiceListFetched(bean.list, 1, 1)
}
}
}
}
}
})
}
fun updateCache(showType: Int,searchBean: ExpertSearchBean){
val gson = Gson()
val json = gson.toJson(searchBean)
when(showType){
0 ->{
YDLCacheUtils.saveDoctorListData(json)
}
1 ->{
YDLCacheUtils.saveServerListData(json)
}
}
}
fun fetchListData(allFilter: AllFilter, page: Int) {
var showType = 0
val sb = StringBuffer()
sb.append("searchWord=").append(if(TextUtils.isEmpty(allFilter.searchWord)) "" else allFilter.searchWord)
if (allFilter.categories.isNotEmpty()) {
var categorys = allFilter.categories.map { it.cateId }.joinToString(",")
if ("0" == categorys) {
categorys = ""
}
sb.append("&categories=").append(categorys)
}
if (allFilter.sub.key != null) {
sb.append("&city=").append(Integer.parseInt(allFilter.sub.key))
}
if (allFilter.region.key != null) {
sb.append("&province=").append(Integer.parseInt(allFilter.region.key))
}
if (allFilter.reorder.key != null) {
sb.append("&reorder=").append(allFilter.reorder.key)
}
if (allFilter.enquiries.isNotEmpty()) {
sb.append("&enquirys=").append(allFilter.enquiries.map { it.key }.joinToString(","))
}
if (allFilter.ages.isNotEmpty()) {
sb.append("&ages=").append(allFilter.ages.map { it.key }.joinToString(","))
}
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.title.isNotEmpty()){
sb.append("&title=").append(allFilter.title.map { it.key }.joinToString(","))
}
if (allFilter.priceRanges !=null) {
sb.append("&minPrice=").append(allFilter.priceRanges?.minPrice)
sb.append("&maxPrice=").append(allFilter.priceRanges?.maxPrice)
}
sb.append("&page=").append(page)
ExpertSearchDataManager.getHttp().searchDoctor(sb.toString())
.compose(RxLifecycleUtils.bindToLifecycle(mView!!)).compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.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 (page == 1){
updateCache(showType,it)
}
} else {
mView.fetchListEmpty("没有搜到相关信息,换个关键词看看吧")
}
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.fetchListFailed(msg)
}
})
}
}
\ No newline at end of file
package com.yidianling.consultant
import android.widget.ImageView
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.consultant.model.bean.DoctorServiceItem
import com.yidianling.consultant.model.bean.ExpertBannerBean
import com.yidianling.consultant.model.bean.ExpertSearchBean
import com.yidianling.consultant.model.bean.HeadData
/**
* Created by zqk on 17-9-19.
*/
interface IExpertSearchView : IView {
fun onServiceListFetched(data: MutableList<DoctorServiceItem>, page: Int, totalPage: Int)
fun showRefreshLayout()
fun localData()
fun updateCache(showType: Int,searchBean: ExpertSearchBean)
fun onHeadFetched(headData: HeadData?)
fun onDoctorListFetched(data: MutableList<DoctorServiceItem>, page: Int,totalPage : Int)
fun fetchFailed(msg: String?)
fun fetchListFailed(msg: String?)
fun fetchListEmpty(msg: String?)
fun onBannerListFetched(data: MutableList<ExpertBannerBean>?)
/**
* 加载图片
*/
fun showImage(url : String?, imgView : ImageView, width : Int, heigh : Int, ops : SimpleImageOpConfiger)
/**
* 加载图片
*/
fun showImage(url : String?, imgView : ImageView)
/**
* 加载图片
*/
fun showImage(url : String?, imgView : ImageView, ops : SimpleImageOpConfiger)
}
\ No newline at end of file
package com.yidianling.consultant.adapter
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.CateItem
import kotlinx.android.synthetic.main.item_subject.view.*
/**
* 主题Recycler适配器
* Created by zqk on 17-9-19.
*/
class CategoryRecyclerViewAdapter(private val context: Context, private val categories: ArrayList<CateItem>, private val selectedCategories: ArrayList<CateItem>) : RecyclerView.Adapter<CategoryRecyclerViewAdapter.ViewHolder>() {
override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
if (holder != null) {
val category = categories[position]
holder.tvSubjectName.text = categories[position].cateName
holder.tvSubjectName.isSelected = selectedCategories.contains(category)
}
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.item_subject, parent, false)
return ViewHolder(itemView)
}
override fun getItemCount(): Int = categories.size
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tvSubjectName: TextView = itemView.tvSubjectName
init {
itemView.setOnClickListener {
if (adapterPosition != RecyclerView.NO_POSITION) {
val subject = categories[adapterPosition]
when {
adapterPosition == 0 -> {
selectedCategories.clear()
selectedCategories.add(subject)
notifyDataSetChanged()
}
selectedCategories.contains(subject) -> {
selectedCategories.remove(subject)
notifyItemChanged(adapterPosition)
if (selectedCategories.size == 0) {
selectedCategories.add(categories[0])
notifyItemChanged(0)
}
}
else -> {
selectedCategories.add(subject)
notifyItemChanged(adapterPosition)
if (selectedCategories.contains(categories[0])) {
selectedCategories.remove(categories[0])
notifyItemChanged(0)
}
}
}
}
}
}
}
}
\ No newline at end of file
package com.yidianling.consultant.adapter
import android.content.Context
import android.graphics.Typeface
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ydl.ydlcommon.adapter.MyBaseAdapter
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.RegionItem
import kotlinx.android.synthetic.main.item_region.view.*
@Suppress("DEPRECATION")
/**
* 省份列表适配器
* Created by zqk on 17-7-21.
*/
class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<RegionItem>, var selectedRegion: RegionItem) : RecyclerView.Adapter<RegionRecyclerViewAdapter.ViewHolder>() {
var onItemClickListener: MyBaseAdapter.OnItemClickListener<RegionItem>? = null
override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
var region = RegionItem(ArrayList(), "全国", null)
if (position > 0) {
region = regionList[position - 1]
}
if (holder != null) {
holder.itemView.tvRegionName.text = region.value
if (selectedRegion.key == region.key) {
//选中状态
holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT_BOLD)
// holder.itemView.tvRegionName.setBackgroundColor(Color.rgb(255, 255, 255))
holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.main_theme))
holder.itemView.view_select.visibility = View.VISIBLE
} else {
//未选中状态
holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT)
// holder.itemView.tvRegionName.setBackgroundColor(Color.rgb(245, 245, 245))
holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.default_text_color))
holder.itemView.view_select.visibility = View.INVISIBLE
}
}
}
override fun getItemCount(): Int = regionList.size + 1
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.item_region, parent, false)
return ViewHolder(view)
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
init {
itemView.setOnClickListener {
val position = adapterPosition
if (position != RecyclerView.NO_POSITION) {
selectedRegion = if (position == 0) {
RegionItem(ArrayList(), "全国", null)
} else {
regionList[position - 1]
}
notifyDataSetChanged()
onItemClickListener?.onItemClickListener(itemView, adapterPosition, selectedRegion)
}
}
}
}
}
\ No newline at end of file
package com.yidianling.consultant.adapter
import android.content.Context
import android.graphics.Typeface
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.yidianling.consultant.R
import com.yidianling.consultant.listener.OnSortItemSelectedListener
import com.yidianling.consultant.model.bean.ReorderItem
import kotlinx.android.synthetic.main.item_sort.view.*
/**
* Created by zqk on 17-9-20.
*/
class SortRecyclerViewAdapter(private val context: Context,
private val sortItems: ArrayList<ReorderItem>,
private val selectedSort: ReorderItem,
private val onItemSelectedListener: OnSortItemSelectedListener) : RecyclerView.Adapter<SortRecyclerViewAdapter.ViewHolder>() {
override fun getItemCount(): Int = sortItems.size
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.item_sort, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
val item = sortItems[position]
if (holder != null) {
holder.tvSort.text = item.value
if (item.key == selectedSort.key) {
holder.tvSort.setTypeface(Typeface.DEFAULT_BOLD)
holder.tvSort.setTextColor(ContextCompat.getColor(context, R.color.main_theme))
// holder.ivCheck.visibility = View.VISIBLE
}
}
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tvSort = itemView.tvSort!!
val ivCheck = itemView.ivCheck!!
init {
itemView.setOnClickListener {
if (adapterPosition != RecyclerView.NO_POSITION){
onItemSelectedListener.onSortItemSelected(sortItems[adapterPosition])
}
}
}
}
}
\ No newline at end of file
package com.yidianling.consultant.adapter
import android.content.Context
import android.graphics.Typeface
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ydl.ydlcommon.adapter.MyBaseAdapter
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.SubItem
import kotlinx.android.synthetic.main.item_consult_type.view.*
/**
* 城市列表适配器
* Created by zqk on 17-7-21.
*/
class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubItem>, var selectedSub: SubItem) : RecyclerView.Adapter<SubRecyclerViewAdapter.ViewHolder>() {
var onItemClickListener: MyBaseAdapter.OnItemClickListener<SubItem>? = null
override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
var region = SubItem("不限", null)
if (position > 0) {
region = subList[position - 1]
}
if (holder != null) {
holder.itemView.tvConsultTypeName.text = region.value
if (selectedSub.key == region.key) {
//选中状态
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT_BOLD)
holder.itemView.tvConsultTypeName.setTextColor(ContextCompat.getColor(context,R.color.main_theme))
// holder.itemView.ivCheckCircle.visibility = View.VISIBLE
} else {
//未选中状态
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT)
holder.itemView.tvConsultTypeName.setTextColor(ContextCompat.getColor(context,R.color.default_text_color))
// holder.itemView.ivCheckCircle.visibility = View.INVISIBLE
}
}
}
override fun getItemCount(): Int = subList.size + 1
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.item_consult_type, parent, false)
return ViewHolder(view)
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
init {
itemView.setOnClickListener {
val position = adapterPosition
if (position != RecyclerView.NO_POSITION) {
selectedSub = if (position == 0) {
SubItem("不限", null)
} else {
subList[adapterPosition - 1]
}
notifyDataSetChanged()
onItemClickListener?.onItemClickListener(itemView, adapterPosition, selectedSub)
}
}
}
}
}
\ No newline at end of file
package com.yidianling.consultant.bean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/4/3
*/
data class ExpertSearchProductsBean(
/**
* 1.单次/2.套餐
*/
val isPackage : Int?,
/**
* 套餐名称
*/
val name : String?)
\ No newline at end of file
package com.yidianling.consultant.bean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/4/3
*/
data class ExpertSearchTagsIconBean(
/**
* 优质图标
*/
val abilityLevelIcon : String?,
/**
* 公益图标
*/
val serviceFreeIcon : String?,
/**
* 新入驻图标
*/
val newEnterIcon : String?)
\ No newline at end of file
package com.yidianling.consultant.bean
import com.ydl.ydlcommon.bean.YDLBaseDataBean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/3/19
*/
data class HotSearchBean(
/**
* 热门搜索
*/
val keywordData : MutableList<HotSearchKeyWordDataBean>?,
/**
* 本周热门专家
*/
val popularDoctors : MutableList<HotSearchPopularDoctorBean>?,
/**
* banner数据
*/
val focusList : MutableList<HotSearchFocusItemBean>?) : YDLBaseDataBean(){
}
\ No newline at end of file
package com.yidianling.consultant.bean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/3/19
*/
data class HotSearchFocusItemBean(val id : String?,
/**
* 路由跳转地址
*/
val linkUrl : String?,
/**
* 标题
*/
val title : String?,
/**
* 图片地址
*/
val imageUrl : String?)
\ No newline at end of file
package com.yidianling.consultant.bean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/3/19
*/
data class HotSearchKeyWordDataBean(
/**
* 热词id
*/
val id : String?,
/**
* linkUrl
*/
val url : String?,
/**
* 关键词
*/
val keyword : String?)
\ No newline at end of file
package com.yidianling.consultant.bean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/3/19
*/
data class HotSearchPopularDoctorBean(val id : String?,
val name : String?)
\ No newline at end of file
package com.yidianling.consultant.common.net;
import com.ydl.ydlcommon.data.http.BaseCommand;
/**
* Created by Jim on 2018/1/11 0011.
*/
public class Command {
//获取专家相关信息
public static class Service extends BaseCommand {
public String id;
public Service(String id) {
this.id = id;
}
}
//电话倾诉列表and tag获取 同一个接口
public static class NewCallList extends BaseCommand {
public int page;
public int type;
public String name;
public NewCallList(int page, int type) {
this.page = page;
this.type = type;
}
public NewCallList(int page, int type, String name) {
this.page = page;
this.type = type;
this.name = name;
}
}
//关注
public static class FocusCmd extends BaseCommand {
public String id;//话题id或用户uid
public String type;//业务类型:1关注用户,2关注话题
public FocusCmd(String id, String type) {
this.id = id;
this.type = type;
}
}
//点赞:动态,回帖,个人主页
public static class ZanAction extends BaseCommand {
public String type;//业务类型:1访问用户,2动态,3话题
public String id;//动态id,回复id,用户uid
public ZanAction(String type, String id) {
this.type = type;
this.id = id;
}
}
public static class ListHead extends BaseCommand {
public ListHead() {
}
}
public static class SearchDoctor extends BaseCommand {
/**
* 关键词
*/
public String searchWord;
/**
* 类名ID
*/
public String categorys;
/**
* 城市id
*/
public int city;
/**
* 省份id
*/
public int province;
/**
* 排序,默认 智能排序
*/
public String reorder;
/**
* 咨询方式,多选,以“,”分隔连接:1,2,4,3 顺序不限
*/
public String enquirys;
/**
* 咨询师年龄,多选,以“-”分隔连接:50-60-90 顺序不限
*/
public String ages;
/**
* 咨询师性别,当前在线,今天有空,多选,以“,”分隔连接:1,2或者1,3,2,4,3,4 顺序不限
*/
public String others;
/**
* 0按专家,1按服务:根据show_type显示不同的结构体
*/
public int showType;
/**
* 页码
*/
public int page;
}
public static class AdClickCount extends BaseCommand {
public int foc_id;
public AdClickCount(int foc_id) {
this.foc_id = foc_id;
}
}
public static class upLoadLoginStatus extends BaseCommand {
public int os_type = 2;
public String apiurl;
public int errorCode;
public String errorMsg;
public upLoadLoginStatus(String apiurl, int errorCode, String errorMsg) {
this.apiurl = apiurl;
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public upLoadLoginStatus() {
}
}
}
package com.yidianling.consultant.constants
/**
* Created by xj on 2019/7/1.
*/
class ConsultBIConstants {
companion object {
//咨询筛选页
const val PART_ID_CONSULT_FILTER_PAGE = "consult_filter_page"
const val POSITION_CONSULT_TYPE_CLICK = "consult_type_click" //咨询方式
const val POSITION_AVERAGE_SERVICE_INPUT = "average_service_input" //服务均价
const val POSITION_AGE_CHOICE_CLICK = "age_choice_click" //年龄选择
const val POSITION_QUALIFICATION_CHOICE_CLICK = "qualification_choice_click" //资质选择
const val POSITION_OTHER_CHOICE_CLICK = "other_choice_click" //其他选择
const val POSITION_CONSULT_FILTER_RESET_CLICK = "consult_filter_reset_click" //重置
const val POSITION_CONSULT_FILTER_CHECKOUT_CLICK = "consult_filter_checkoutallconsultants_click" //查看XXX位咨询师
}
//====================APP咨询列表页(app_consult_list_page)====================
class ConsultEvent {
companion object {
private const val APP_CONSULT_LIST_PAGE: String = "app_consult_list_page|"//APP咨询列表页 partId
const val APP_CONSULT_LIST_PAGE_VISIT: String = APP_CONSULT_LIST_PAGE + "app_consult_list_page_visit"//列表页浏览事件
const val APP_CONSULT_LIST_CONSULT_GUIDE_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_consult_guide_click "//咨询指南
const val APP_CONSULT_LIST_ONLINE_CUSTOMER_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_online_customer_click"//在线客服
const val APP_CONSULT_LIST_THEME_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_theme_click "//主题全部
const val APP_CONSULT_LIST_AREA_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_area_click"//地区各个地区
const val APP_CONSULT_LIST_SORT_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_sort_click"//排序综合排序
const val APP_CONSULT_LIST_DOCTOR_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_doctor_click"//每个咨询师页面点击
const val APP_CONSULT_LIST_CHAT_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_chat_click"//每个咨询师私聊
}
}
class UserMainEvent {
companion object {
private const val YDL_USER_MAIN_PAGE: String = "ydl_user_main_page|"//壹点灵用户版首页 partId
const val YDL_USER_SEARCH_CLICK: String = YDL_USER_MAIN_PAGE + "ydl_user_search_click"//搜索栏
}
}
}
\ No newline at end of file
package com.yidianling.consultant.contract
import android.content.Context
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.consultant.bean.HotSearchBean
import io.reactivex.Observable
/**
* @author yuanWai
* @描述: 搜索页面约束类
* @Copyright Copyright (c) 2019
* @Company 壹点灵
* @date 2019/03/19
*/
class IHotSearchContract {
interface View : IView {
/**
* 搜索页接口
*/
fun searchDataResponse(hotSearchBean: HotSearchBean)
/**
* 请求失败
*/
fun requestFail()
}
interface Presenter : IPresenter<View> {
/**
* 获取本地缓存
*/
fun localData(context: Context)
/**
* 搜索页接口请求
*/
fun searchData()
}
interface Model : IModel {
/**
* 搜索页接口
*/
fun searchData(): Observable<HotSearchBean>
}
}
\ No newline at end of file
package com.yidianling.consultant.data
object ConsultantDataManager {
fun getRam(): ConsultantRam = ConsultantRamImpl.getInstance()
}
\ No newline at end of file
package com.yidianling.consultant.data
import com.yidianling.router.consultant.Keyworks
interface ConsultantRam {
fun getHotSearch(): MutableList<Keyworks>
fun setHotSearch(hotSearch: MutableList<Keyworks>)
}
\ No newline at end of file
package com.yidianling.consultant.data
import com.yidianling.router.consultant.Keyworks
class ConsultantRamImpl private constructor(): ConsultantRam {
override fun setHotSearch(hotSearch: MutableList<Keyworks>) {
this.hotSearch = hotSearch!!
}
companion object {
fun getInstance(): ConsultantRamImpl {
return Holder.INSTANCE
}
}
private var hotSearch: MutableList<Keyworks> = ArrayList()
override fun getHotSearch(): MutableList<Keyworks> {
return hotSearch
}
private object Holder {
val INSTANCE = ConsultantRamImpl()
}
}
\ No newline at end of file
package com.yidianling.consultant.http
/**
* @author yuanwai
* @描述:专家搜索页接口实现模型
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
object ExpertSearchDataManager{
fun getHttp(): IExpertSearchHttp = ExpertSearchHttpImpl.getInstance()
}
\ No newline at end of file
package com.yidianling.consultant.http
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.ExpertBannerBean
import com.yidianling.consultant.model.bean.ExpertSearchBean
import io.reactivex.Observable
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
class ExpertSearchHttpImpl : IExpertSearchHttp {
override fun getFilterCount(params: String?): Observable<BaseAPIResponse<Int>> {
return getSearchApi().getFilterCount(HttpConfig.JAVA_BASE_URL+ "doctor/count?"+params)
}
companion object {
fun getInstance(): ExpertSearchHttpImpl {
return Holder.INSTANCE
}
fun clearSearchApi() {
Holder.INSTANCE.searchApi = null
}
}
object Holder {
val INSTANCE = ExpertSearchHttpImpl()
}
private var searchApi: SearchApi? = null
private fun getSearchApi(): SearchApi {
if (searchApi == null) {
searchApi = YDLHttpUtils.obtainApi(SearchApi::class.java)
}
return searchApi!!
}
override fun searchDoctor(params: String?): Observable<BaseAPIResponse<ExpertSearchBean>> {
return getSearchApi().searchDoctorService(HttpConfig.JAVA_BASE_URL+ "doctor/list?"+params)
}
override fun getBannerList(): Observable<BaseAPIResponse<MutableList<ExpertBannerBean>>> {
return getSearchApi().expertBannerList()
}
}
\ No newline at end of file
package com.yidianling.consultant.http
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
data class ExpertSearchParam(val param : String)
\ No newline at end of file
package com.yidianling.consultant.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.consultant.model.bean.ExpertBannerBean
import com.yidianling.consultant.model.bean.ExpertSearchBean
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:专家搜索页请求接口
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
interface IExpertSearchHttp{
/**
* 专家搜索页请求
*/
fun searchDoctor(params : String?): Observable<BaseAPIResponse<ExpertSearchBean>>
/**
* 专家首页banner
*/
fun getBannerList(): Observable<BaseAPIResponse<MutableList<ExpertBannerBean>>>
/**
* 获取当前筛选条件结果数
*/
fun getFilterCount(params:String?): Observable<BaseAPIResponse<Int>>
}
\ No newline at end of file
package com.yidianling.consultant.http.hotsearch
/**
* @author yuanwai
* @描述:专家搜索页接口实现模型
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
object HotSearchDataManager{
fun getHttp(): IHotSearchHttp = HotSearchHttpImpl.getInstance()
}
\ No newline at end of file
package com.yidianling.consultant.http.hotsearch
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.http.ExpertSearchParam
import com.yidianling.consultant.model.SearchApi
import io.reactivex.Observable
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
class HotSearchHttpImpl : IHotSearchHttp {
companion object {
fun getInstance(): HotSearchHttpImpl {
return Holder.INSTANCE
}
fun clearSearchApi() {
Holder.INSTANCE.searchApi = null
}
}
object Holder {
val INSTANCE = HotSearchHttpImpl()
}
private var searchApi: SearchApi? = null
private fun getSearchApi(): SearchApi {
if (searchApi == null) {
searchApi = YDLHttpUtils.Companion.obtainApi(SearchApi::class.java)
}
return searchApi!!
}
override fun searchData(): Observable<BaseAPIResponse<HotSearchBean>> {
return RxUtils.mapObservable(ExpertSearchParam(""))
.flatMap {
getSearchApi().searchPage()
}
}
}
\ No newline at end of file
package com.yidianling.consultant.http.hotsearch
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.consultant.bean.HotSearchBean
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/26
*/
interface IHotSearchHttp{
/**
* 测评首页请求
*/
fun searchData(): Observable<BaseAPIResponse<HotSearchBean>>
}
\ No newline at end of file
package com.yidianling.consultant.listener
import com.yidianling.consultant.model.bean.CateItem
/**
* Created by zqk on 17-9-20.
*/
interface OnCategoriesSelectedListener {
fun onCategoriesSelected(categories: ArrayList<CateItem>)
}
\ No newline at end of file
package com.yidianling.consultant.listener
/**
* Created by zqk on 17-9-21.
*/
interface OnFilterConfirmListener {
fun onFilterConfirmed()
}
\ No newline at end of file
package com.yidianling.consultant.listener
import com.yidianling.consultant.model.bean.ReorderItem
/**
* Created by zqk on 17-9-20.
*/
interface OnSortItemSelectedListener {
fun onSortItemSelected(sortItem: ReorderItem)
}
\ No newline at end of file
package com.yidianling.consultant.model
import com.ydl.ydlcommon.data.http.RxUtils
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.http.hotsearch.HotSearchDataManager
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:测评首页数据模型实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/26
*/
class HotSearchModelImpl : IHotSearchContract.Model{
override fun searchData(): Observable<HotSearchBean> {
return HotSearchDataManager.getHttp().searchData().compose(RxUtils.resultJavaData())
}
}
\ No newline at end of file
package com.yidianling.consultant.model
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.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.model.bean.ExpertBannerBean
import com.yidianling.consultant.model.bean.ExpertSearchBean
import com.yidianling.consultant.model.bean.HeadData
import io.reactivex.Observable
import retrofit2.http.*
/**
* Created by zqk on 17-10-26.
*/
interface SearchApi {
companion object {
var instance: SearchApi? = null
fun getSearchApi():SearchApi {
if (instance == null) {
instance = YDLHttpUtils.obtainApi(SearchApi::class.java)
}
return instance!!
}
}
//服务列表头部
@POST("product/list-head")
@FormUrlEncoded
fun listHead(@FieldMap maps: Map<String, String>): Observable<BaseResponse<HeadData>>
//搜索条件
@GET("consult/search/conditions")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun searchConditions(): Observable<BaseAPIResponse<HeadData>>
//专家服务搜索
@retrofit2.http.Headers("Content-Type:application/json")
@GET
fun searchDoctorService(@Url url : String): Observable<BaseAPIResponse<ExpertSearchBean>>
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET("delivery/banner")
fun expertBannerList(@Query(value = "planId") planId:String?="32"): Observable<BaseAPIResponse<MutableList<ExpertBannerBean>>>
//搜索页面接口
@retrofit2.http.Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET("home/search-page")
fun searchPage(): Observable<BaseAPIResponse<HotSearchBean>>
//筛选结果计数
@retrofit2.http.Headers("Content-Type:application/json")
@GET
fun getFilterCount(@Url url : String?): Observable<BaseAPIResponse<Int>>
}
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class AgeItem(
@field:SerializedName("value")
val value: String? = null,
@field:SerializedName("key")
val key: Int? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import android.widget.TextView
/**
* 所有筛选条件
* Created by zqk on 17-9-20.
*/
data class AllFilter(
var searchWord: String? = null,
val categories: ArrayList<CateItem> = ArrayList(), //主题
var reorder: ReorderItem = ReorderItem(), //排序
var region: RegionItem = RegionItem(), //省
var sub: SubItem = SubItem(), //市
var showType: ShowTypeItem = ShowTypeItem(), //显示方式
val enquiries: ArrayList<EnquiryItem> = ArrayList(), //咨询方式
var priceRanges: PriceRangesItem ?= null, //服务均价
var priceRangesView: TextView ?= null, //服务均价
val ages: ArrayList<AgeItem> = ArrayList(), //年龄
val others: ArrayList<OtherItem> = ArrayList(),//其他筛选
val title:ArrayList<ReorderItem> = ArrayList()//资质
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
data class CateItem(
@field:SerializedName("cate_name")
var cateName: String? = null,
@field:SerializedName("cate_id")
var cateId: Int? = null
) : Parcelable {
constructor(source: Parcel) : this(
source.readString(),
source.readValue(Int::class.java.classLoader) as Int?
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(cateName)
writeValue(cateId)
}
companion object {
@JvmField
val CREATOR: Parcelable.Creator<CateItem> = object : Parcelable.Creator<CateItem> {
override fun createFromParcel(source: Parcel): CateItem = CateItem(source)
override fun newArray(size: Int): Array<CateItem?> = arrayOfNulls(size)
}
}
}
\ No newline at end of file
//package com.yidianling.consultant.model.bean
//
//import com.google.gson.annotations.SerializedName
//import com.yidianling.ydlcommon.data.ShareData
//
//data class DoctorItem(
// /**
// * 专家uid
// */
// val doctorUid: Int = 0,
// /**
// * 专家id
// */
// val doctorId: Int = 0,
// /**
// * 专家费率
// */
// val feedbackRate: String? = null,
// /**
// * 专家头像
// */
// val doctorHead: String? = null,
// /**
// * 省
// */
// val province: String? = null,
// /**
// * 市
// */
// val city: String? = null,
// /**
// * 服务费用
// */
// val serviceFee: String? = null,
// /**
// * 专家名称
// */
// val doctorName: String? = null,
// /**
// * 分享数据
// */
// @field:SerializedName("share")
// val shareData: ShareData? = null,
// /**
// * 标签
// */
// val tags: List<String?> = ArrayList(),
// /**
// * 咨询数量
// */
// val zixunOrderNum: Int = 0,
// /**
// * 是否在线
// */
// val isOnline: Int = 0, //1在线,2离线
// /**
// * m站url
// */
// val mUrl: String? = null,
// /**
// * h站url
// */
// val hUrl: String? = null
//)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.yidianling.consultant.bean.ExpertSearchProductsBean
import com.yidianling.consultant.bean.ExpertSearchTagsIconBean
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
data class DoctorServiceItem(/**
* 专家ID
*/
val doctorId : String?,
/**
* 专家uid
*/
val uid : String?,
/**
* 专家名称
*/
val name : String?,
/**
* 跳转路由地址(正常为专家主页地址)
*/
val linkUrl : String?,
/**
* 专家头像地址
*/
val head : String?,
/**
* 专家是否在线 1.在线
*/
val isOnline : Int?,
/**
* 能力等级 5.精英
*/
val abilityLevel : Int?,
/**
* 有免费咨询:1.有,2.无
*/
val hasServiceFree : Int?,
/**
* 是否新入驻:true:是,false:否
*/
var isNewEnter : Boolean = false,
/**
* 好评率(倾诉+咨询)
*/
var feedbackRate : Float = 0f,
/**
* 评价数(咨询订单数)
*/
var zixunOrderNum : Int = 0,
/**
* 咨询最低价
*/
val minBookingPrice : String?,
/**
* 资质材料
*/
val teamCertifications : String?,
/**
* 标签分类
*/
val tags : String?,
/**
* 已帮助人数(咨询人数)
*/
val zixunOrderUser : String?,
/**
* 月售时长
*/
var saleDurationForMonth : Float = 0f,
/**
* 服务
*/
val products : MutableList<ExpertSearchProductsBean>?,
/**
* 标签图片
*/
val tagsIcon : ExpertSearchTagsIconBean?,
/**
* 今日是否可约
*/
val isTodayFree : Boolean?,
/**
* 是否咨询中
*/
var inConsult : Boolean = false,
/**
* 是否聆听中
*/
var isListening: Boolean = false,
/**
* 私聊人数
*/
var chatNum: Int = 0,
/**
* 个人铭言
*/
val famousRemark : String?,
/**
* 省
*/
val province : String?,
/**
* 市
*/
val city : String?
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class EnquiryItem(
@field:SerializedName("value")
val value: String? = null,
@field:SerializedName("key")
val key: Int? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
/**
* Created by haorui on 2019/3/3.
* Des:
*/
data class ExpertBannerBean(
val title: String? = null,
val image: String? = null,
val linkUrl: String? = null ,
var id: Int = 0,
var resourceId: Int = 0,
var categoryType: String? = null,
var tag: String? = null,
var status: Int = 0,
var keyWord: String? = null,
var detailDesc: String? = null,
var des: String? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
/**
* @author yuanWai
* @描述:专家搜索页数据bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
data class ExpertSearchBean(val endRow : Int = 0,
val hasNextPage : Boolean = false,
val hasPreviousPage : Boolean = false,
val isFirstPage : Boolean = false,
val isLastPage : Boolean = false,
/**
* 数据列表
*/
val list : MutableList<DoctorServiceItem>?,
val navigateFirstPage : Int = 0,
val navigateLastPage : Int = 0,
val navigatePages : Int = 0,
val navigatepageNums : MutableList<Int>?,
val nextPage : Int = 0,
val pageNum : Int = 0,
val pageSize : Int = 0,
/**
* 总页数
*/
val pages : Int = 0,
val prePage : Int = 0,
val size : Int = 0,
val startRow : Int = 0,
/**
* 数据总条数
*/
val total : Int = 0)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class Filters(
/**
* 按服务或者按专家
*/
@field:SerializedName("show_type")
val showType: List<ShowTypeItem> = ArrayList(),
/**
* 其他选择
*/
@field:SerializedName("other")
val other: List<OtherItem> = ArrayList(),
/**
* 咨询方式
*/
@field:SerializedName("enquiry")
val enquiry: List<EnquiryItem> = ArrayList(),
/**
* 服务均价
*/
@field:SerializedName("priceRanges")
val priceRanges: List<PriceRangesItem> = ArrayList(),
/**
* 年龄选择
*/
@field:SerializedName("age")
val age: List<AgeItem> = ArrayList(),
/**
* 资质选择
*/
@field:SerializedName("title")
val title: List<ReorderItem> = ArrayList() //资质
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class HeadData(
/**
* 主题
*/
@field:SerializedName("cates")
val cates: ArrayList<CateItem> = ArrayList(),
/**
* 排序
*/
@field:SerializedName("reorder")
val reorder: ArrayList<ReorderItem> = ArrayList(),
/**
* 筛选
*/
@field:SerializedName("filters")
val filters: Filters = Filters(),
/**
* 热门
*/
@field:SerializedName("highlighter")
val highlighter: ArrayList<HighlighterItem> = ArrayList(),
/**
* 地区
*/
@field:SerializedName("region")
val region: ArrayList<RegionItem> = ArrayList()
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class HighlighterItem(
@field:SerializedName("value")
var value: String? = null,
/**
* 这个type
*
* 1:主题
* 2:省
* 3:排序
* 4:咨询方式
* 5:年龄选择
* 6:其他选择
* 7:资质选择
* 8.市
*
*/
@field:SerializedName("type")
var type: String? = null,
@field:SerializedName("id")
var id: String? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class OtherItem(
@field:SerializedName("value")
val value: String? = null,
@field:SerializedName("key")
val key: Int? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class PriceRangesItem(
@field:SerializedName("minPrice")
var minPrice: String? = null,
@field:SerializedName("maxPrice")
var maxPrice: String? = null,
@SerializedName("recommendPercent")
var recommendPercent: String? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class RegionItem(
@field:SerializedName("sub")
var sub: List<SubItem> = ArrayList(),
@field:SerializedName("value")
var value: String? = null,
@field:SerializedName("key")
var key: String? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class ReorderItem(
@field:SerializedName("value")
var value: String? = null,
@field:SerializedName("key")
var key: String? = null
)
\ No newline at end of file
//package com.yidianling.consultant.model.bean
//
//import com.google.gson.annotations.SerializedName
//
//data class ServiceItem(
//
// @field:SerializedName("doctor_uid")
// val doctorUid: Int = 0,
//
// @field:SerializedName("city")
// val city: String? = null,
//
// @field:SerializedName("product_name")
// val productName: String? = null,
//
// @field:SerializedName("tags")
// val tags: List<String?> = ArrayList(),
//
// @field:SerializedName("uid")
// val uid: Int? = null,
//
// @field:SerializedName("doctor_id")
// val doctorId: Int? = null,
//
// @field:SerializedName("feedback_rate")
// val feedbackRate: String? = null,
//
// @field:SerializedName("doctor_head")
// val doctorHead: String? = null,
//
// @field:SerializedName("province")
// val province: String? = null,
//
//
// @field:SerializedName("doctor_name")
// val doctorName: String? = null,
//
// @field:SerializedName("m_url")
// val mUrl: String? = null,
//
// @field:SerializedName("h_url")
// val hUrl: String? = null,
//
// @field:SerializedName("is_online")
// val isOnline: Int = 0 //1在线,2离线
//)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class ShowTypeItem(
@field:SerializedName("value")
var value: String? = null,
@field:SerializedName("key")
var key: Int? = null
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class SubItem(
@field:SerializedName("value")
var value: String? = null,
@field:SerializedName("key")
var key: String? = null
)
\ No newline at end of file
package com.yidianling.consultant.presenter
import android.content.Context
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.model.HotSearchModelImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
/**
* @author yuanwai
* @描述:搜索页面逻辑实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/3/19
*/
class HotSearchPresenterImpl () :
BasePresenter<IHotSearchContract.View, IHotSearchContract.Model>(), IHotSearchContract.Presenter{
/**
* 实例化数据模型
*/
override fun createModel(): IHotSearchContract.Model {
return HotSearchModelImpl()
}
override fun localData(context: Context) {
YDLAsyncUtils.asyncAsResult(object : YDLAsyncUtils.AsyncObjecyerResult{
override fun doAsyncAction(): Any {
return YDLCacheUtils.getHotSearchData()
}
override fun asyncResult(`object`: Any?) {
//如果没有缓存数据,显示加载框
if (`object` !is String || TextUtils.isEmpty(`object`)){
}
if (`object` is String){
val gson = Gson()
val bean = gson.fromJson<HotSearchBean>(`object`,HotSearchBean::class.java)
if(null != bean){
mView.searchDataResponse(bean)
}
}
searchData()
}
})
}
/**
* 搜索页接口
*/
override fun searchData() {
mModel.searchData().map { it }
.filter { it != null }
.compose(RxLifecycleUtils.bindToLifecycle(mView!!))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
mView.searchDataResponse(it)
YDLCacheUtils.saveHotSearchData(Gson().toJson(it))
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.requestFail()
}
})
}
}
\ No newline at end of file
package com.yidianling.consultant.router
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import com.yidianling.router.RouterManager
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/23
*/
object ConsultantIn {
// 打开小壹聊天界面
fun startP2PXiaoYi(context: Context) {
RouterManager.getImRouter().startP2PXiaoYi(context)
}
fun startP2PSession(context: AppCompatActivity, toUid: String) {
RouterManager.getImRouter().startP2PSession(context, toUid)
}
fun mainIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.mainIntent(activity)
}
}
\ No newline at end of file
package com.yidianling.consultant.router
import android.app.Activity
import android.content.Intent
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.data.ConsultantDataManager
import com.yidianling.router.consultant.IConsultantRouter
import com.yidianling.router.consultant.Keyworks
class ConsultantRouterImp : IConsultantRouter{
override fun expertSearchIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent {
return ExpertSearchActivity.newIntent(activity, category, showType, isInitShowHot)
}
override fun getHotSearch(): MutableList<Keyworks> {
return ConsultantDataManager.getRam().getHotSearch();
}
override fun setHotSearch(hotSearch: MutableList<Keyworks>) {
return ConsultantDataManager.getRam().setHotSearch(hotSearch);
}
}
\ No newline at end of file
package com.yidianling.consultant.ui.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.LinearSnapHelper
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.ydl.ydlcommon.adapter.MyBaseAdapter
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.R
import com.yidianling.consultant.adapter.RegionRecyclerViewAdapter
import com.yidianling.consultant.adapter.SubRecyclerViewAdapter
import com.yidianling.consultant.model.bean.RegionItem
import com.yidianling.consultant.model.bean.SubItem
import kotlinx.android.synthetic.main.ui_region_popup_window.view.*
/**
* 地区选择弹窗
*/
class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
private var selectedRegion: RegionItem, private var selectedSub: SubItem)
: PopupWindow(null, ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(369f)) {
private val subList = ArrayList<SubItem>()
private val regionAdapter = RegionRecyclerViewAdapter(context, regionList, selectedRegion)
private val subAdapter = SubRecyclerViewAdapter(context, subList, selectedSub)
var onRegionSelectedListener: OnRegionSelectedListener? = null
init {
subList.addAll(selectedRegion.sub)
val view = LayoutInflater.from(context).inflate(R.layout.ui_region_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
this.height = ((RxDeviceTool.getScreenHeight(context) - RxImageTool.dp2px(90f)) * 0.618).toInt() //设置高度为屏幕的80%
view.rvRegion.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
regionAdapter.onItemClickListener = MyBaseAdapter.OnItemClickListener { _, _, data ->
selectedRegion = data
subList.clear()
subList.addAll(data.sub)
subAdapter.notifyDataSetChanged()
view.rvSub.scrollToPosition(0)
}
view.rvRegion.adapter = regionAdapter
// view.rvRegion.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
val helper = LinearSnapHelper()
// LinearSnapHelper().attachToRecyclerView(view.rvRegion)
val i = regionList
.takeWhile { it.key != selectedRegion.key }
.count()
view.rvRegion.scrollToPosition(i + 1)
view.rvSub.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
subAdapter.onItemClickListener = MyBaseAdapter.OnItemClickListener { _, _, data ->
selectedSub = data
onRegionSelectedListener?.onRegionSelected(selectedRegion, selectedSub)
}
view.rvSub.adapter = subAdapter
// view.rvSub.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
// LinearSnapHelper().attachToRecyclerView(view.rvSub)
view.rvSub.scrollToPosition(subList.indexOf(selectedSub) + 1)
}
interface OnRegionSelectedListener {
fun onRegionSelected(region: RegionItem, sub: SubItem)
}
}
package com.yidianling.consultant.ui.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.ydl.ydlcommon.view.SpaceItemDecorator2
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.R
import com.yidianling.consultant.adapter.CategoryRecyclerViewAdapter
import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.model.bean.CateItem
import kotlinx.android.synthetic.main.ui_subject_popup_window.view.*
/**
* 主题弹窗
* Created by zqk on 17-9-15.
*/
class CategoryPopupWindow(context: Context, categories: ArrayList<CateItem>, selectedCategories: ArrayList<CateItem>)
: PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
var onSubjectsSelectedListener: OnCategoriesSelectedListener? = null
init {
val view = LayoutInflater.from(context).inflate(R.layout.ui_subject_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
val rvSubject = view.rvSubject
val adapter = CategoryRecyclerViewAdapter(context, categories, selectedCategories)
rvSubject.adapter = adapter
rvSubject.layoutManager = GridLayoutManager(context, 3, LinearLayoutManager.VERTICAL, false)
rvSubject.addItemDecoration(SpaceItemDecorator2(RxImageTool.dp2px(5f), 3))
inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
view.btnConfirm.setOnClickListener {
onSubjectsSelectedListener?.onCategoriesSelected(selectedCategories)
dismiss()
}
}
}
\ No newline at end of file
package com.yidianling.consultant.ui.view;
import android.content.Context;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* 用于子类防止父类拦截子类的事件
*/
public class DisInterceptNestedScrollView extends NestedScrollView {
public DisInterceptNestedScrollView(Context context) {
super(context);
requestDisallowInterceptTouchEvent(true);
}
public DisInterceptNestedScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
requestDisallowInterceptTouchEvent(true);
}
public DisInterceptNestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
requestDisallowInterceptTouchEvent(true);
}
public boolean dispatchTouchEvent(MotionEvent ev) {
getParent().requestDisallowInterceptTouchEvent(true);
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE:
requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
requestDisallowInterceptTouchEvent(false);
break;
}
return super.onTouchEvent(event);
}
}
package com.yidianling.consultant.ui.view
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Rect
import android.graphics.drawable.ColorDrawable
import android.support.v4.view.ViewCompat
import android.support.v7.widget.RecyclerView
import android.view.View
import com.yidianling.common.tools.RxImageTool
/**
* 专家或咨询列表条目添加灰色间隔
* Created by zqk on 17-9-21.
*/
class ExpertItemDecoration(val context: Context) : RecyclerView.ItemDecoration() {
var space = RxImageTool.dp2px( 7f)
override fun onDraw(c: Canvas?, parent: RecyclerView?, state: RecyclerView.State?) {
if (parent != null && c != null) {
val view = ColorDrawable(Color.parseColor("#f3f3f3"))
val left = parent.paddingLeft
val right = parent.width - parent.paddingRight
val childCount = parent.childCount
for (i in 0 until childCount) {
val child = parent.getChildAt(i)
val params = child
.layoutParams as RecyclerView.LayoutParams
val top = child.bottom + params.bottomMargin +
Math.round(ViewCompat.getTranslationY(child))
val bottom = top + space
if (i == 0) {
view.setBounds(left, child.top - space, right, child.top)
view.draw(c)
}
view.setBounds(left, top, right, bottom)
view.draw(c)
}
}
}
override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: RecyclerView.State?) {
if (parent != null && outRect != null) {
if (parent.getChildAdapterPosition(view) == 0) {
outRect.top = 1
}
outRect.bottom = space
}
}
}
\ No newline at end of file
package com.yidianling.consultant.ui.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.support.v7.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.yidianling.consultant.R
import com.yidianling.consultant.adapter.SortRecyclerViewAdapter
import com.yidianling.consultant.listener.OnSortItemSelectedListener
import com.yidianling.consultant.model.bean.ReorderItem
import kotlinx.android.synthetic.main.ui_sort_popup_window.view.*
/**
* 排序弹窗
* Created by zqk on 17-9-15.
*/
class SortPopupWindow(val context: Context, private val sortItems: ArrayList<ReorderItem>, var selectedSort: ReorderItem, private val onSortItemSelectedListener: OnSortItemSelectedListener)
: PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private var adapter: SortRecyclerViewAdapter
init {
val view = LayoutInflater.from(context).inflate(R.layout.ui_sort_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
val rvSortItem = view.rvSortItem
adapter = SortRecyclerViewAdapter(context, sortItems, selectedSort, onSortItemSelectedListener)
rvSortItem.adapter = adapter
rvSortItem.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
// rvSortItem.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
}
fun notifyDataSetChanged() {
adapter.notifyDataSetChanged()
}
}
\ 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:fromXDelta="0"
android:toXDelta="100%p" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromXDelta="100%p"
android:toXDelta="0" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/filter_content_text_color_en" android:state_selected="true" android:state_enabled="true"/>
<item android:color="@color/filter_content_text_color_un" android:state_enabled="true"/>
</selector>
\ 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