Commit 7a742ae6 by fengquan

fix: 咨询师详情页

parent 09667d3f
......@@ -17,6 +17,7 @@ import androidx.fragment.app.Fragment
import com.dou361.ijkplayer.widget.IjkVideoView
import com.ydl.ydlcommon.ui.Loading.close
import com.ydl.ydlcommon.ui.Loading.show
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.R
import com.yidianling.consultant.preview.SmoothImageView.*
import io.reactivex.Observable
......@@ -158,6 +159,9 @@ class BasePhotoFragment : Fragment() {
override fun onLoadFailed(errorDrawable: Drawable?) {
loading?.setVisibility(GONE)
if (isVisiable) {
ToastUtil.toastShort(activity, "加载失败")
}
if (errorDrawable != null) {
imageView?.setImageDrawable(errorDrawable)
}
......
......@@ -17,6 +17,7 @@ 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.listener.ApiStringResponseCallback
import com.yidianling.im.api.service.IImService
import kotlinx.android.synthetic.main.consultant_image_preview_photo.*
import kotlinx.android.synthetic.main.fragment_image_photo_layout.*
......@@ -135,29 +136,39 @@ class GPreviewActivity : AppCompatActivity() {
override fun onPageScrollStateChanged(state: Int) {}
})
// viewPager.setOffscreenPageLimit(3);
}
override fun onResume() {
super.onResume()
if (toUid != null) {
val unReadByUid =
ARouter.getInstance().navigation(IImService::class.java).getUnReadByUid(toUid!!)
when {
unReadByUid <= 0 -> {
un_read_num_ll.visibility = View.GONE
}
unReadByUid > 99 -> {
un_read_num_ll.visibility = View.VISIBLE
un_read_num.text = "99"
}
else -> {
un_read_num_ll.visibility = View.VISIBLE
un_read_num.text = unReadByUid.toString()
}
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
try {
ModularServiceManager.provide(IImService::class.java)
.getChatUid(context = this, uid = toUid!!, callback = object :
ApiStringResponseCallback {
override fun onUidCallback(uid: String) {
val unReadNum =
ModularServiceManager.provide(IImService::class.java)
.getUnReadByUid(uid!!)
when {
unReadNum <= 0 -> {
un_read_num_ll.visibility = View.GONE
}
unReadNum > 99 -> {
un_read_num_ll.visibility = View.VISIBLE
un_read_num.text = "99"
}
else -> {
un_read_num_ll.visibility = View.VISIBLE
un_read_num.text = unReadNum.toString()
}
}
}
})
} catch (e: Exception) {
}
}
// viewPager.setOffscreenPageLimit(3);
}
private fun initData() {
......
......@@ -12,6 +12,7 @@ import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.yidianling.consultant.R;
import org.jetbrains.annotations.NotNull;
......@@ -21,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
public class TestImageLoader implements IZoomMediaLoader {
@Override
public void displayImage(@NonNull Fragment context, @NonNull String path, final ImageView imageView, @NonNull final MySimpleTarget simpleTarget) {
Glide.with(context).asBitmap().load(path)
Glide.with(context).asBitmap().load(path).placeholder(R.drawable.consultant_bg_black).error(R.drawable.consultant_bg_black)
// .placeholder(android.R.color.darker_gray)
.fitCenter()
......@@ -35,6 +36,7 @@ public class TestImageLoader implements IZoomMediaLoader {
@Override
public void onLoadFailed(@Nullable @org.jetbrains.annotations.Nullable Drawable errorDrawable) {
simpleTarget.onLoadFailed(errorDrawable);
imageView.setImageDrawable(errorDrawable);
}
});
......
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