Commit 930577b6 by fengquan

feat: 咨询师详情页改版联调

parent f6096946
......@@ -2,8 +2,10 @@ package com.ydl.component.service.web;
import android.app.Activity;
import android.graphics.Rect;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ScreenUtils;
import com.ydl.confide.api.IConfideService;
import com.ydl.confide.home.event.ChangeAnotherExpertEvent;
import com.ydl.webview.H5JsBean;
......@@ -13,6 +15,8 @@ import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydl_router.manager.YDLRouterParams;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.consultant.preview.GPreviewBuilder;
import com.yidianling.consultant.preview.UserViewInfo;
import com.yidianling.im.api.service.IImService;
import com.yidianling.muse.activity.ChooseMusicActivity;
......@@ -21,6 +25,9 @@ import com.yidianling.muse.activity.ChooseMusicActivity;
import de.greenrobot.event.EventBus;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import java.util.ArrayList;
import java.util.List;
import de.greenrobot.event.EventBus;
/**
......@@ -495,6 +502,34 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
}
@Override
public void resourceToPreview(H5JsBean.H5JsCmd.Params params) {
List<H5JsBean.MediaInfo> dataList = params.getDataList();
H5JsBean.DoctorInfo info = params.getInfo();
List<UserViewInfo> mThumbViewInfoList = new ArrayList<>();
for (H5JsBean.MediaInfo mediaInfo : dataList) {
UserViewInfo userViewInfo = new UserViewInfo(mediaInfo.getCover(), mediaInfo.getUrl(), mediaInfo.getSourcesType());
Rect bounds = new Rect();
bounds.left = ScreenUtils.getScreenWidth() / 2;
bounds.top = ScreenUtils.getScreenHeight() / 2;
bounds.right = ScreenUtils.getScreenWidth() / 2;
bounds.bottom = ScreenUtils.getScreenHeight() / 2;
userViewInfo.setBounds(bounds);
mThumbViewInfoList.add(userViewInfo);
}
GPreviewBuilder.form(mContext)
.setData(mThumbViewInfoList)
.setCurrentIndex(params.getPreview_index())
.setFullscreen(true)
.setToUid(info.getToUid() +"")
.setDoctorId(info.getDoctorId())
.setType(GPreviewBuilder.IndicatorType.Dot)
.start();
}
@Override
public void switchSound(int mediaId, long meditationId, int meditationType, int businessType,
String buried, String mediaUrl, String mediaCoverUrl,
String title, String desc, int status) {
......
......@@ -464,6 +464,11 @@ class WebJavascriptHandler : IJavascriptHandler{
wvEnventPro?.switchPushStatus(jsData.cmd?.params)
}
"resources_to_preview" -> {
wvEnventPro?.resourceToPreview(jsData.cmd?.params)
}
}
}
}
......@@ -203,4 +203,6 @@ public interface WebViewClientClickListener {
//h5页面是否需要打开推送
void switchPushStatus(H5JsBean.H5JsCmd.Params params);
void resourceToPreview(H5JsBean.H5JsCmd.Params params);
}
......@@ -87,14 +87,23 @@ class BasePhotoFragment : Fragment() {
videoView!!.seekTo(0)
seekBar!!.progress = 0
videoView!!.pause()
if (ivPlay != null && !TextUtils.isEmpty(beanViewInfo!!.videoUrl)) {
ivPlay!!.visibility = VISIBLE
if (ivPlay != null && beanViewInfo?.sourcesType == 2) {
ivPlay?.visibility = VISIBLE
if (ivImg != null) {
ivImg?.visibility = VISIBLE
}
} else if (ivPlay != null && beanViewInfo?.sourcesType == 1) {
ivPlay?.visibility = GONE
if (ivImg != null) {
ivImg!!.visibility = VISIBLE
ivImg!!.visibility = GONE
}
}
stopTiming()
}
if (!isVisiable) {
videoView?.visibility = INVISIBLE
}
}
override fun onDestroy() {
......@@ -173,7 +182,7 @@ class BasePhotoFragment : Fragment() {
rootView!!.tag = beanViewInfo?.getUrl()
//是否展示动画
isTransPhoto = bundle.getBoolean(KEY_TRANS_PHOTO, false)
if (!TextUtils.isEmpty(beanViewInfo!!.getUrl())) {
if (beanViewInfo?.sourcesType == 1) {
ivPlay!!.visibility = GONE
if (beanViewInfo!!.getUrl().toLowerCase().contains(".gif")) {
imageView!!.visibility = VISIBLE
......@@ -191,15 +200,15 @@ class BasePhotoFragment : Fragment() {
mySimpleTarget!!
)
}
} else {
} else if (beanViewInfo?.sourcesType == 2) {
ivPlay!!.visibility = VISIBLE
videoContainer!!.visibility = VISIBLE
imageView!!.visibility = GONE
ZoomMediaLoader.getInstance().loader.displayImage(
this, "https://hellorfimg.zcool.cn/preview260/123343987.jpg", ivImg,
this, beanViewInfo!!.cover, ivImg,
mySimpleTarget!!
)
val videoUlr = beanViewInfo!!.getVideoUrl()
val videoUlr = beanViewInfo!!.url
if (!TextUtils.isEmpty(videoUlr)) {
rootView!!.setBackgroundColor(Color.BLACK)
seekBar!!.visibility = VISIBLE
......@@ -235,6 +244,7 @@ class BasePhotoFragment : Fragment() {
ivImg!!.visibility = GONE
ivPlay!!.visibility = GONE
startTiming()
videoView?.visibility = VISIBLE
videoView!!.start()
isCompletion = false
}
......@@ -296,7 +306,7 @@ class BasePhotoFragment : Fragment() {
}
imageView!!.setAlphaChangeListener { alpha ->
if (alpha == 255) {
val video = beanViewInfo!!.videoUrl
val video = beanViewInfo!!.url
if (video != null && !video.isEmpty()) {
btnVideo!!.visibility = VISIBLE
} else {
......
......@@ -3,21 +3,25 @@ package com.yidianling.consultant.preview
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.view.WindowManager
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.consultant.R
import com.yidianling.consultant.preview.GPreviewBuilder.IndicatorType
import com.yidianling.consultant.preview.SmoothImageView.onTransformListener
import com.yidianling.im.api.service.IImService
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.consultant_image_preview_photo.*
import java.util.*
/**
......@@ -37,6 +41,10 @@ class GPreviewActivity : AppCompatActivity() {
/***默认显示 */
private var isShow = true
private var toUid: String? = null
private var doctorId: String? = null
/***
* 得到PhotoViewPager
* @return PhotoViewPager
......@@ -80,6 +88,19 @@ class GPreviewActivity : AppCompatActivity() {
selectPosition = findViewById(R.id.select_position)
total = findViewById(R.id.total)
titleBar = findViewById(R.id.titleBar)
chatBtn.setOnClickListener {
if (!toUid.isNullOrBlank()) {
ARouter.getInstance().navigation(IImService::class.java)
?.startChatBySessionId(context = this, toUid = toUid!!)
}
}
bookingBtn.setOnClickListener {
}
backIv?.setOnClickListener(View.OnClickListener {
transformOutAnim()
transformOut()
......@@ -109,6 +130,9 @@ class GPreviewActivity : AppCompatActivity() {
currentIndex = intent.getIntExtra("position", -1)
type = intent.getSerializableExtra("type") as IndicatorType
isShow = intent.getBooleanExtra("isShow", true)
toUid = intent.getStringExtra("toUid")
doctorId = intent.getStringExtra("doctorId")
val isScale = intent.getBooleanExtra("isScale", false)
SmoothImageView.setIsScale(isScale)
initFragment(imgUrls, currentIndex, BasePhotoFragment::class.java)
......@@ -173,15 +197,15 @@ class GPreviewActivity : AppCompatActivity() {
isTransformOut = true
val currentItem = viewPager!!.currentItem
if (currentItem < imgUrls!!.size) {
if (TextUtils.isEmpty(imgUrls!![currentItem].videoUrl)) {
if (imgUrls!![currentItem].sourcesType == 1) {
val fragment = fragments!![currentItem]
fragment.changeBg(Color.TRANSPARENT)
fragment.transformOut(onTransformListener {
getViewPager()?.setEnabled(true)
exit()
})
} else {
exit()
} else if (imgUrls!![currentItem].sourcesType == 2) {
exitNormal()
}
} else {
exit()
......@@ -196,6 +220,10 @@ class GPreviewActivity : AppCompatActivity() {
overridePendingTransition(0, 0)
}
private fun exitNormal() {
finish()
}
override fun onBackPressed() {
isTransformOut = false
transformOutAnim()
......
......@@ -81,6 +81,16 @@ public class GPreviewBuilder {
return this;
}
public GPreviewBuilder setToUid(String toUid){
intent.putExtra("toUid", toUid);
return this;
}
public GPreviewBuilder setDoctorId(String doctorId){
intent.putExtra("doctorId", doctorId);
return this;
}
/***
* 指示器类型
* ***/
......
......@@ -70,7 +70,7 @@ public class GridPreviewActivity extends BaseActivity {
mThumbViewInfoList.add(new UserViewInfo(urls.get(i)));
}
mThumbViewInfoList.add(4, new UserViewInfo("https://pic.ydlcdn.com/GGyHyDwKJ8.MP4", null));
// mThumbViewInfoList.add(4, new UserViewInfo("https://pic.ydlcdn.com/GGyHyDwKJ8.MP4", null));
adapter = new MyListAdapter();
gridView.setAdapter(adapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
......
......@@ -28,7 +28,9 @@ public interface IThumbViewInfo extends Parcelable {
/**
* 获取视频链接
***/
String getVideoUrl();
String getCover();
int getSourcesType();
}
......@@ -17,31 +17,31 @@ public final class ImageUrlConfig {
public static List<UserViewInfo> getVideos() {
videos.clear();
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
"http://pic.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
"http://pic.vjshi.com/2017-05-25/b146e104069c2bd0590bb919269193c4/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://ac-QYgvX1CC.clouddn.com/36f0523ee1888a57.jpg"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-05-07/d0bbfc4ac4dd173cc93873ed4eb0be53.mp4",
"http://pic.vjshi.com/2017-05-07/d0bbfc4ac4dd173cc93873ed4eb0be53/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-07-18/80d08ce1a84adfbaed5c7067b73d19ed.mp4",
"http://pic.vjshi.com/2017-07-18/80d08ce1a84adfbaed5c7067b73d19ed/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://img0.imgtn.bdimg.com/it/u=556618733,1205300389&fm=21&gp=0.jpg"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
"http://pic.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://img0.imgtn.bdimg.com/it/u=556618733,1205300389&fm=21&gp=0.jpg"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2018-06-07/cf673556cce54ab9cf4633fd7d9d0d46.mp4",
"http://pic.vjshi.com/2018-06-06/caa296729c8e6e41e6aff2aadf4feff3/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://img44.photophoto.cn/20170730/0018090594006661_s.jpg"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
"http://pic.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://ac-QYgvX1CC.clouddn.com/36f0523ee1888a57.jpg"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2018-01-27/5169bb7bdd7386ce7bd4ce1739229424.mp4",
"http://pic.vjshi.com/2018-01-27/5169bb7bdd7386ce7bd4ce1739229424/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://photocdn.sohu.com/20160307/mp62252655_1457334772519_2.png"));
videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-27/9a6e69f7c257ff7b7832e8bac6fddf82.mp4",
"http://pic.vjshi.com/2017-09-27/9a6e69f7c257ff7b7832e8bac6fddf82/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
// "http://pic.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
// "http://pic.vjshi.com/2017-05-25/b146e104069c2bd0590bb919269193c4/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://ac-QYgvX1CC.clouddn.com/36f0523ee1888a57.jpg"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-05-07/d0bbfc4ac4dd173cc93873ed4eb0be53.mp4",
// "http://pic.vjshi.com/2017-05-07/d0bbfc4ac4dd173cc93873ed4eb0be53/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
//
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-07-18/80d08ce1a84adfbaed5c7067b73d19ed.mp4",
// "http://pic.vjshi.com/2017-07-18/80d08ce1a84adfbaed5c7067b73d19ed/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://img0.imgtn.bdimg.com/it/u=556618733,1205300389&fm=21&gp=0.jpg"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
// "http://pic.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://img0.imgtn.bdimg.com/it/u=556618733,1205300389&fm=21&gp=0.jpg"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2018-06-07/cf673556cce54ab9cf4633fd7d9d0d46.mp4",
// "http://pic.vjshi.com/2018-06-06/caa296729c8e6e41e6aff2aadf4feff3/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://img44.photophoto.cn/20170730/0018090594006661_s.jpg"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a.mp4",
// "http://pic.vjshi.com/2017-09-13/f55a900d89679ac1c9837d5b5aaf632a/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://ac-QYgvX1CC.clouddn.com/36f0523ee1888a57.jpg"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2018-01-27/5169bb7bdd7386ce7bd4ce1739229424.mp4",
// "http://pic.vjshi.com/2018-01-27/5169bb7bdd7386ce7bd4ce1739229424/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
// videos.add(new UserViewInfo("http://photocdn.sohu.com/20160307/mp62252655_1457334772519_2.png"));
// videos.add(new UserViewInfo("http://lmp4.vjshi.com/2017-09-27/9a6e69f7c257ff7b7832e8bac6fddf82.mp4",
// "http://pic.vjshi.com/2017-09-27/9a6e69f7c257ff7b7832e8bac6fddf82/online/puzzle.jpg?x-oss-process=style/resize_w_285_crop_h_428"));
videos.add(new UserViewInfo("http://photocdn.sohu.com/20160307/mp62252655_1457334772519_2.png"));
......
......@@ -14,25 +14,19 @@ public class UserViewInfo implements IThumbViewInfo {
private String url; //图片地址
private Rect mBounds; // 记录坐标
private String user = "用户字段";
private String videoUrl;
private int sourcesType;
private String cover;
public UserViewInfo(String url) {
this.url = url;
}
public UserViewInfo(String videoUrl, String url) {
public UserViewInfo(String cover, String url, int sourcesType) {
this.url = url;
this.videoUrl = videoUrl;
this.cover = cover;
this.sourcesType = sourcesType;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
@Override
public String getUrl() {//将你的图片地址字段返回
......@@ -49,17 +43,21 @@ public class UserViewInfo implements IThumbViewInfo {
}
@Override
public String getVideoUrl() {
return videoUrl;
public String getCover() {
return cover;
}
@Override
public int getSourcesType() {
return sourcesType;
}
public void setBounds(Rect bounds) {
mBounds = bounds;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
@Override
public int describeContents() {
......@@ -70,15 +68,15 @@ public class UserViewInfo implements IThumbViewInfo {
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.url);
dest.writeParcelable(this.mBounds, flags);
dest.writeString(this.user);
dest.writeString(this.videoUrl);
dest.writeString(this.cover);
dest.writeInt(this.sourcesType);
}
protected UserViewInfo(Parcel in) {
this.url = in.readString();
this.mBounds = in.readParcelable(Rect.class.getClassLoader());
this.user = in.readString();
this.videoUrl = in.readString();
this.cover = in.readString();
this.sourcesType = in.readInt();
}
public static final Parcelable.Creator<UserViewInfo> CREATOR = new Parcelable.Creator<UserViewInfo>() {
......
......@@ -40,7 +40,7 @@ class H5JsBean {
var isFromQingShu = 0//是否是从专家倾述主页跳转私聊界面 0: 不是 1:是
var docHead: String? = null//聊天头像
var doctorId: Int = 0//医生id
var confidedId: String?=null//医生id
var confidedId: String? = null//医生id
var listenerId: Int = 0
var orderStatus: Int = 0
var orderStatusDesc: String? = null
......@@ -65,7 +65,7 @@ class H5JsBean {
var succ: String? = null
var course_id: String? = null
var courseType: String? = null//课程类型:0 音频 1 视屏
var mediaType : String? = null//资料类型 1.音频 2.视频
var mediaType: String? = null//资料类型 1.音频 2.视频
var coursePlayUrl: String? = null//课程播放地址
var testResultId: Int? = 0
......@@ -73,6 +73,7 @@ class H5JsBean {
//群聊id
var tid: Int = 0
//专家id
var doctor_id: Int = 0
......@@ -114,66 +115,93 @@ class H5JsBean {
}
var test_items_id = 0
//倾诉线路类型
var confideType = 1 //1 axb 2双呼 3声网
//倾诉支付参数
var payTitle: String? = null
//订单金额
var orderPrice: Double? = null
//优惠金额
var coupnPrice: Double? = null
//测评题 优惠券金额
var couponMoney: String? = ""
//可用余额
var avliableMoney: Double? = null
//倾诉支付成功跳转地址
var confideUrl: String? = null
//打开与关闭右上角菜单
var toggleRightTopMenu: Int = 0 //0 关闭,1 打开
//打开与关闭分享菜单
var toggleShareMenu: Int = 0 //0 关闭,1 打开
//标识首页第几个tab
var selectTab:Int = 0
var selectTab: Int = 0
//倾诉拨打电话使用参数
var callType:String?=null
var callType: String? = null
var switchStatus = 1
var closeReplaceChat=false
var closeReplaceChat = false
var merchantType:String=""
var merchantType: String = ""
var day:String="" // 预约日期
var day: String = "" // 预约日期
// meditation start
// meditation start
// {"meditationId":21,"mediaId":15,"meditionType":1,"status":0,
// "coverImageUrl":"https://pic.ydlcdn.com/NsBRkaxNba.png",
// "title":"创建冥想-标题-20",
// "desc":"冥想测试数据基础入门1冥想测试数据基础入门1冥想测试数据基础入门1冥想测试数据基础入门1冥想测试数据基础入门1",
// "duration":250.9845}
var meditationId:Int?=null
var mediaId:Int?=null
var meditionType:Int?=null
var meditationId: Int? = null
var mediaId: Int? = null
var meditionType: Int? = null
var status = 0
var coverImageUrl:String?=null
var desc:String?=null
var mediaUrl:String?=null
var duration:Double?=null
var businessType:Int?=null
var share_url:String?=null
var cover:String?=null
var coverImageUrl: String? = null
var desc: String? = null
var mediaUrl: String? = null
var duration: Double? = null
var businessType: Int? = null
var share_url: String? = null
var cover: String? = null
var isDarkMode = false
var buried:String?=null
var buried: String? = null
val color:String?=null
val alpha:String?=null
val color: String? = null
val alpha: String? = null
// meditation end
var preview_type: Int = 0
var preview_index: Int = 0
val dataList: List<MediaInfo>? = null
var info: DoctorInfo? = null
}
}
class MediaInfo {
var url: String? = null
var sourcesType: Int = 0
var cover: String? = null
}
class DoctorInfo {
var doctorId: String? = null
var toUid: Int = 0
var utype: String? = null
}
}
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