Commit 9f789df6 by konghaorui

Merge branch 'dev' into feature/组件化_ending

# Conflicts:
#	app/src/main/java/com/ydl/component/MainActivity.kt
#	m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
#	ydl-platform/src/main/java/com/ydl/ydlcommon/utils/log/LogHelper.kt
#	ydl-platform/src/main/java/com/ydl/ydlcommon/view/banner/GlideImageDisplayLoader.java
parents 2a690b30 8cfe99cb
...@@ -205,6 +205,7 @@ dependencies { ...@@ -205,6 +205,7 @@ dependencies {
implementation project(':m-muse') implementation project(':m-muse')
implementation project(':m-im') implementation project(':m-im')
implementation project(':m-dynamic') implementation project(':m-dynamic')
implementation project(':m-audioim')
// api rootProject.ext.dependencies["ydl-m-fm-module-ydl"] // api rootProject.ext.dependencies["ydl-m-fm-module-ydl"]
......
...@@ -30,6 +30,8 @@ import com.yidianling.common.tools.ToastUtil ...@@ -30,6 +30,8 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
import com.yidianling.fm.api.service.IFMService import com.yidianling.fm.api.service.IFMService
import com.yidianling.tests.home.NewTestHomeActivity import com.yidianling.tests.home.NewTestHomeActivity
import com.yidianling.user.widget.SecretDescriptionDialog
import com.yidianling.user.widget.SecretDialog
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
/** /**
...@@ -85,7 +87,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -85,7 +87,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
.navigation() .navigation()
} }
bt_to_consultant.setOnClickListener { bt_to_consultant.setOnClickListener {
// ARouter.getInstance() // ARouter.getInstance()
// .build("/consult/hot_search") // .build("/consult/hot_search")
// .withString( // .withString(
// HOT_SEARCH_DOCTOR_NAME, // HOT_SEARCH_DOCTOR_NAME,
...@@ -156,6 +158,36 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -156,6 +158,36 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
bt_to_home.setOnClickListener { bt_to_home.setOnClickListener {
FragmentContainerActivity.start(this, "MineFragment") FragmentContainerActivity.start(this, "MineFragment")
// startActivity(Intent(this, TestAppActivity::class.java)) // startActivity(Intent(this, TestAppActivity::class.java))
// FragmentContainerActivity.start(this, "YdlHomeFragment")
// startActivity(Intent(this, TestAppActivity::class.java))
}
bt_to_test.setOnClickListener {
val dialog = SecretDescriptionDialog(this@MainActivity, "感谢您信任并使用壹点灵APP,\\n\n" +
"我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\\n\\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\\n\n" +
"2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\\n\n" +
"3. 我们会采业界先进的安全措施保护您的信息安全;\\n\n" +
"4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\\n\n" +
"5. 您可以查询、更正、删除您的个人信息。", object : SecretDescriptionDialog.OnSecretDescriptionDialogListener {
override fun onCancel() {
val secretDialog = SecretDialog(this@MainActivity, object : SecretDialog.OnSecretDialogListener {
override fun onCancel() {
ToastUtil.toastShort("onCancel")
}
override fun onSure() {
ToastUtil.toastShort("nextStep")
}
})
secretDialog?.show()
}
override fun onSure() {
ToastUtil.toastShort("nextStep")
}
}
)
dialog.show()
} }
} }
......
...@@ -185,6 +185,23 @@ ...@@ -185,6 +185,23 @@
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:text="动态" /> android:text="动态" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingBottom="20dp">
<Button
android:id="@+id/bt_to_test"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="入口" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<com.ydl.ydlcommon.mvp.lce.view.YDLStateView <com.ydl.ydlcommon.mvp.lce.view.YDLStateView
......
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = true dev_mode = false
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -42,13 +42,13 @@ ext { ...@@ -42,13 +42,13 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.47.1", "m-confide" : "0.0.47.7",
"m-consultant" : "0.0.57", "m-consultant" : "0.0.57.4",
"m-fm" : "0.0.28", "m-fm" : "0.0.28",
"m-user" : "0.0.56", "m-user" : "0.0.58.2",
"m-home" : "0.0.19.1", "m-home" : "0.0.19.1",
"m-im" : "0.0.11", "m-im" : "0.0.14.1",
"m-dynamic" : "0.0.5.1", "m-dynamic" : "0.0.6.1",
"m-muse" : "0.0.27", "m-muse" : "0.0.27",
"m-tests" : "0.0.21", "m-tests" : "0.0.21",
...@@ -69,13 +69,13 @@ ext { ...@@ -69,13 +69,13 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.37.1", "ydl-platform" : "0.0.38.2",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.37.1", "ydl-webview" : "0.0.37.1",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.46", "m-audioim" : "0.0.46.5",
"ydl-flutter-base": "0.0.10", "ydl-flutter-base": "0.0.10",
//以下 几乎不会动 //以下 几乎不会动
...@@ -115,13 +115,13 @@ ext { ...@@ -115,13 +115,13 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.37", "ydl-platform" : "0.0.38.2",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.37.1", "ydl-webview" : "0.0.37.1",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.46", "m-audioim" : "0.0.46.5",
"ydl-flutter-base": "0.0.10", "ydl-flutter-base": "0.0.10",
//以下 几乎不会动 //以下 几乎不会动
...@@ -260,6 +260,7 @@ ext { ...@@ -260,6 +260,7 @@ ext {
"exoplayer" : "com.google.android.exoplayer:exoplayer:2.9.0", "exoplayer" : "com.google.android.exoplayer:exoplayer:2.9.0",
"free_reflection" : "me.weishu:free_reflection:2.0.0", "free_reflection" : "me.weishu:free_reflection:2.0.0",
"imagepicker" : "com.ydl:imagepicker:1.0.8.2", "imagepicker" : "com.ydl:imagepicker:1.0.8.2",
"pictureselector" : "com.ydl:pictureselector:1.2.0",
"protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar", "protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar",
"ydl-hnet" : "com.ydl:h-net:0.0.8", "ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar", "ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
......
...@@ -24,6 +24,22 @@ import android.view.animation.AccelerateInterpolator ...@@ -24,6 +24,22 @@ import android.view.animation.AccelerateInterpolator
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson import com.google.gson.Gson
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.ydl.audioim.bean.AgoraLogInfoBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.audioim.utils.DateUtils
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.burypointlib.ToastUtil
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.ydl_av.messge_service.ChannelManager import com.ydl.ydl_av.messge_service.ChannelManager
import com.ydl.ydl_av.messge_service.YDLRTMClient import com.ydl.ydl_av.messge_service.YDLRTMClient
import com.ydl.ydl_av.messge_service.bean.RTMMesssage import com.ydl.ydl_av.messge_service.bean.RTMMesssage
...@@ -36,22 +52,12 @@ import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler ...@@ -36,22 +52,12 @@ import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import com.ydl.ydl_av.voice.manager.YDLVoiceManager import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydl_image.config.SimpleImageOpConfiger import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.*
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.utils.DateUtils
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.burypointlib.ToastUtil
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.LogUtil import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
...@@ -72,7 +78,8 @@ import java.util.concurrent.TimeUnit ...@@ -72,7 +78,8 @@ import java.util.concurrent.TimeUnit
* @date 2018/10/30 * @date 2018/10/30
*/ */
@Route(path = "/av/AudioHomeActivity") @Route(path = "/av/AudioHomeActivity")
class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(),IAudioHomeActivityContract.View, SensorEventListener { class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(),
IAudioHomeActivityContract.View, SensorEventListener {
/** /**
* 专家头像地址 * 专家头像地址
...@@ -93,7 +100,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -93,7 +100,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
/** /**
* 通话开始时间(接通) * 通话开始时间(接通)
*/ */
private var callStartTime:Long? = null private var callStartTime: Long? = null
/** /**
* 倾诉剩余时长(时长单位s,eg:剩余2min15s,返回135) * 倾诉剩余时长(时长单位s,eg:剩余2min15s,返回135)
*/ */
...@@ -161,9 +168,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -161,9 +168,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private var voiceManage: YDLVoiceManager? = null private var voiceManage: YDLVoiceManager? = null
//频道管理器 //频道管理器
private var channelManager : ChannelManager? = null private var channelManager: ChannelManager? = null
private var isLeavelChannel:Boolean = false private var isLeavelChannel: Boolean = false
private var hasUpLoadLog = false
/** /**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等) * 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
...@@ -186,6 +194,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -186,6 +194,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
when (warn) { when (warn) {
103, 104, 105, 106, 107 -> { 103, 104, 105, 106, 107 -> {
showToast("当前网络较差,请更换网络!") showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel() leaveChannel()
} }
} }
...@@ -255,6 +265,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -255,6 +265,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断 //因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断
if (isConnectSuccess && null != stats?.users && stats.users == 1) { if (isConnectSuccess && null != stats?.users && stats.users == 1) {
com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断") com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel() leaveChannel()
} }
} }
...@@ -264,6 +276,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -264,6 +276,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑 // 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) { if (reason == 3) {
com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断") com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel() leaveChannel()
} }
} }
...@@ -271,6 +285,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -271,6 +285,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) { override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats) super.onLeaveChannel(stats)
LogUtil.e("[agora]离开频道回调") LogUtil.e("[agora]离开频道回调")
//通话结束或挂断时,上传日志文件
uploadLog()
} }
override fun onLastmileQuality(quality: Int) { override fun onLastmileQuality(quality: Int) {
...@@ -296,6 +312,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -296,6 +312,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onUserOffline(uid: Int, elapsed: Int) { override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed) super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]远端用户$uid 离开频道回调") LogUtil.e("[agora]远端用户$uid 离开频道回调")
//通话结束或挂断时,上传日志文件
uploadLog()
showToast("专家已挂断") showToast("专家已挂断")
if (totalDisposable != null) { if (totalDisposable != null) {
...@@ -315,7 +333,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -315,7 +333,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private fun uploadException(message: String) { private fun uploadException(message: String) {
var time: String = (System.currentTimeMillis() / 1000).toString() var time: String = (System.currentTimeMillis() / 1000).toString()
var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!! var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!!
var payLoad = PayLoad(channelId?:"0", time, uid, "1", "999", message) var payLoad = PayLoad(channelId ?: "0", time, uid, "1", "999", message)
var connectException = ConnectExceptionCommand(time, "2", "99", payLoad) var connectException = ConnectExceptionCommand(time, "2", "99", payLoad)
getPresenter().connectException(connectException) getPresenter().connectException(connectException)
} }
...@@ -371,11 +389,36 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -371,11 +389,36 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID) listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID)
commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL) commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL)
writeAgoraLog()
localRemainTime = remainTime?.toInt() localRemainTime = remainTime?.toInt()
handler = Handler() handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator? vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
} }
private fun writeAgoraLog() {
val logBean = AgoraLogInfoBean(
expertHeadUrl,
expertName,
channelId,
remainTime,
listenerUid,
totalDuration,
callId,
listenId
)
Observable.create<Any> {
try {
val content = Gson().toJson(logBean)
AudioLogUtils.writeAgoraLog(content)
} catch (e: Exception) {
}
}.subscribeOn(Schedulers.io())
.subscribe()
}
private fun initView() { private fun initView() {
tv_change_route.isEnabled = false tv_change_route.isEnabled = false
//水波纹view初始化 //水波纹view初始化
...@@ -441,7 +484,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -441,7 +484,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private fun setCallBack() { private fun setCallBack() {
YDLRTMClient.instances.setCallListener(object :CallListener{ YDLRTMClient.instances.setCallListener(object : CallListener {
override fun onCallRecivedByPeer(response: CallLocalResponse?) { override fun onCallRecivedByPeer(response: CallLocalResponse?) {
//返回给主叫:被叫已收到呼叫邀请 //返回给主叫:被叫已收到呼叫邀请
LogUtil.i("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}") LogUtil.i("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}")
...@@ -455,7 +498,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -455,7 +498,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onCallRefused(response: CallLocalResponse?) { override fun onCallRefused(response: CallLocalResponse?) {
//返回给主叫 //返回给主叫
LogUtil.i("[agora]${response?.calleeId}已拒绝呼叫邀请") LogUtil.i("[agora]${response?.calleeId}已拒绝呼叫邀请")
ToastUtil.showToast(applicationContext,"对方已挂断") ToastUtil.showToast(applicationContext, "对方已挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel() leaveChannel()
} }
...@@ -498,7 +543,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -498,7 +543,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
LogUtil.i("[agora]其它消息:${error}") LogUtil.i("[agora]其它消息:${error}")
} }
}) })
channelManager = YDLRTMClient.instances.createChannelManager(channelId,object :ChannelListener{ channelManager = YDLRTMClient.instances.createChannelManager(channelId, object : ChannelListener {
override fun onMemberCountUpdated(memberCount: Int) { override fun onMemberCountUpdated(memberCount: Int) {
//频道人数更新 //频道人数更新
LogUtil.i("[agora]当前频道人数:$memberCount") LogUtil.i("[agora]当前频道人数:$memberCount")
...@@ -506,7 +551,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -506,7 +551,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onMessageReceived(message: RTMMesssage?, member: ChannelMember?) { override fun onMessageReceived(message: RTMMesssage?, member: ChannelMember?) {
//接到频道消息 //接到频道消息
LogUtil.i("[agora]接到${member?.channelId}频道${member?.userId}的消息:"+message?.text) LogUtil.i("[agora]接到${member?.channelId}频道${member?.userId}的消息:" + message?.text)
} }
override fun onMemberJoined(member: ChannelMember?) { override fun onMemberJoined(member: ChannelMember?) {
...@@ -527,22 +572,22 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -527,22 +572,22 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private fun requestPermission() { private fun requestPermission() {
val rxPermissions = RxPermissions(this) val rxPermissions = RxPermissions(this)
rxPermissions.requestEach(Manifest.permission.RECORD_AUDIO) rxPermissions.requestEach(Manifest.permission.RECORD_AUDIO)
.subscribe { permission -> .subscribe { permission ->
if (permission.granted) { if (permission.granted) {
init() init()
} else if (permission.shouldShowRequestPermissionRationale) { } else if (permission.shouldShowRequestPermissionRationale) {
requestPermission() requestPermission()
} else { } else {
ToastHelper.show(getString(R.string.audioim_need_storage_permission_hint)) ToastHelper.show(getString(R.string.audioim_need_storage_permission_hint))
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null) val uri = Uri.fromParts("package", packageName, null)
intent.data = uri intent.data = uri
startActivity(intent) startActivity(intent)
finish() finish()
}
} }
}
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
...@@ -552,39 +597,42 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -552,39 +597,42 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
initializeAgoraEngine() initializeAgoraEngine()
//发起呼叫 //发起呼叫
var msgBean = AudioMessageBean( var msgBean = AudioMessageBean(
1, 1,
channelId!!, channelId!!,
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(), YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl, YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName, YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(), remainTime!!.toInt(),
relationId, relationId,
callId, callId,
null, null,
channelId channelId
) )
YDLRTMClient.instances.call(listenerUid!!,channelId,Gson().toJson(msgBean)) YDLRTMClient.instances.call(listenerUid!!, channelId, Gson().toJson(msgBean))
//开始25s等待倒计时 //开始25s等待倒计时
Observable.interval(0, 100, TimeUnit.MILLISECONDS) Observable.interval(0, 100, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.computation()) .subscribeOn(Schedulers.computation())
.take(253) .take(253)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
progress_view.setProgress(it.toFloat() / 2.5f) progress_view.setProgress(it.toFloat() / 2.5f)
}, { }, {
LogUtil.d(it.message) LogUtil.d(it.message)
}, { }, {
waittingStatus() waittingStatus()
if (!isConnectSuccess){ if (!isConnectSuccess) {
// iv_hang_up.setImageResource(R.mipmap.audioim_ico_close) // iv_hang_up.setImageResource(R.mipmap.audioim_ico_close)
//关闭音乐 //关闭音乐
stopPlaying() stopPlaying()
//提示切换传统线路 //提示切换传统线路
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid,channelId) YDLRTMClient.instances.cancelCall(listenerUid, channelId)
showChooseDialog(2) //通话结束或挂断时,上传日志文件
} uploadLog()
})
showChooseDialog(2)
}
})
//加入频道135 //加入频道135
joinChannel() joinChannel()
//双重保险:加入频道成功,通过服务端发推送给专家 //双重保险:加入频道成功,通过服务端发推送给专家
...@@ -611,7 +659,12 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -611,7 +659,12 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* 声网加入频道 * 声网加入频道
*/ */
private fun joinChannel() { private fun joinChannel() {
voiceManage!!.getVoiceApi().joinChannel(token!!, channelId!!, "Extra Optional Data", YdlCommonRouterManager.getYdlCommonRoute().getUid()) voiceManage!!.getVoiceApi().joinChannel(
token!!,
channelId!!,
"Extra Optional Data",
YdlCommonRouterManager.getYdlCommonRoute().getUid()
)
} }
/** /**
...@@ -621,7 +674,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -621,7 +674,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
*/ */
private fun userCloseCalling() { private fun userCloseCalling() {
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid,channelId) YDLRTMClient.instances.cancelCall(listenerUid, channelId)
//通话结束或挂断时,上传日志文件
uploadLog()
handler!!.postDelayed({ handler!!.postDelayed({
leaveChannel() leaveChannel()
}, 100) }, 100)
...@@ -633,7 +688,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -633,7 +688,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* @param finishStatus 状态值: 0:开始 1:结束 * @param finishStatus 状态值: 0:开始 1:结束
*/ */
private fun updateExpertStatus(isSwitchAxb: Boolean, finishStatus: Int) { private fun updateExpertStatus(isSwitchAxb: Boolean, finishStatus: Int) {
if (isSwitchAxb){ if (isSwitchAxb) {
dialPhone() dialPhone()
} }
...@@ -659,9 +714,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -659,9 +714,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
/** /**
* 线路选择弹窗 * 线路选择弹窗
*/ */
private fun showChooseDialog(type:Int) { private fun showChooseDialog(type: Int) {
val dialog = AxbConfirmDialog(mContext,type, object : AxbConfirmDialog.OnClickEnsureListener { val dialog = AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() { override fun onClickEnsure() {
switchAXB() switchAXB()
} }
...@@ -681,7 +736,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -681,7 +736,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* 切换成axb路线请求 * 切换成axb路线请求
*/ */
private fun switchAXB() { private fun switchAXB() {
mPresenter.getAXBPhone(ConnectCommand(listenId!!,"1")) mPresenter.getAXBPhone(ConnectCommand(listenId!!, "1"))
} }
/** /**
...@@ -692,12 +747,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -692,12 +747,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
this.axbPhone = axbPhone this.axbPhone = axbPhone
isJumpDail = true isJumpDail = true
if (isConnectSuccess) { if (isConnectSuccess) {
//通话结束或挂断时,上传日志文件
uploadLog()
//已经连接成功,切换axb时需要更新专家状态 //已经连接成功,切换axb时需要更新专家状态
updateExpertStatus(true, 1) updateExpertStatus(true, 1)
} else { } else {
//未连接成功,切换axb时:需发送消息通知专家端用户已挂断 //未连接成功,切换axb时:需发送消息通知专家端用户已挂断
//发送消息通知专家用户已挂断 //发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid,channelId) YDLRTMClient.instances.cancelCall(listenerUid, channelId)
leaveChannel() leaveChannel()
} }
} }
...@@ -730,7 +787,12 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -730,7 +787,12 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
tv_change_route.isEnabled = true tv_change_route.isEnabled = true
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.platform_white)) tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.platform_white))
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(this, R.drawable.audioim_img_choose_arrow), null) tv_change_route.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(this, R.drawable.audioim_img_choose_arrow),
null
)
} }
...@@ -851,32 +913,39 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -851,32 +913,39 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//剩余倾诉时长倒计时 //剩余倾诉时长倒计时
totalDisposable = Observable.interval(0, 1, TimeUnit.SECONDS) totalDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation()) .subscribeOn(Schedulers.computation())
.take(remainTime!!.toLong() + 1) .take(remainTime!!.toLong() + 1)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
localRemainTime = remainTime!!.toInt() - it.toInt() localRemainTime = remainTime!!.toInt() - it.toInt()
if (localRemainTime == 180) { if (localRemainTime == 180) {
playNoticeMusic(3) playNoticeMusic(3)
} }
if (localRemainTime == 60) { if (localRemainTime == 60) {
playNoticeMusic(1) playNoticeMusic(1)
} }
if (localRemainTime!! <= 60) { if (localRemainTime!! <= 60) {
if (tv_change_route.isEnabled) { if (tv_change_route.isEnabled) {
tv_change_route.isEnabled = false tv_change_route.isEnabled = false
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.audioim_color_50ffffff)) tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.audioim_color_50ffffff))
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(this, R.drawable.audioim_img_choose_arrow_unuse), null) tv_change_route.setCompoundDrawablesWithIntrinsicBounds(
} null,
null,
ContextCompat.getDrawable(this, R.drawable.audioim_img_choose_arrow_unuse),
null
)
} }
tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString()) }
}, { tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString())
LogUtil.d(it.message) }, {
}, { LogUtil.d(it.message)
//注意:自动挂断时,如果对方离开频道的回调已经触发,就不要再重复调用接口 }, {
showToast("通话已结束") //注意:自动挂断时,如果对方离开频道的回调已经触发,就不要再重复调用接口
updateExpertStatus(false, 1) showToast("通话已结束")
}) //通话结束或挂断时,上传日志文件
uploadLog()
updateExpertStatus(false, 1)
})
} }
/** /**
...@@ -907,16 +976,16 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -907,16 +976,16 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
*/ */
private fun noticeServerPush(isCall: Boolean) { private fun noticeServerPush(isCall: Boolean) {
var msgBean = AudioMessageBean( var msgBean = AudioMessageBean(
1, 1,
channelId!!, channelId!!,
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(), YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl, YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName, YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(), remainTime!!.toInt(),
relationId, relationId,
callId, callId,
null, null,
channelId channelId
) )
var cmd = NoticePushCommand() var cmd = NoticePushCommand()
cmd.data = msgBean cmd.data = msgBean
...@@ -946,7 +1015,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -946,7 +1015,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
sensorManager!!.registerListener(this, sensorManager!!.getDefaultSensor(Sensor.TYPE_PROXIMITY), SensorManager.SENSOR_DELAY_NORMAL) sensorManager!!.registerListener(
this,
sensorManager!!.getDefaultSensor(Sensor.TYPE_PROXIMITY),
SensorManager.SENSOR_DELAY_NORMAL
)
} }
override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) { override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
...@@ -984,14 +1057,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -984,14 +1057,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//// tv_toast.postDelayed({ //// tv_toast.postDelayed({
//// tv_toast.visibility = View.GONE //// tv_toast.visibility = View.GONE
//// }, 1000) //// }, 1000)
ToastHelper.show(msg?:"") ToastHelper.show(msg ?: "")
} }
} }
override fun showProgressView() { override fun showProgressView() {
try { try {
showProgressDialog() showProgressDialog()
}catch (e : Exception){ } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
...@@ -1000,12 +1073,19 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -1000,12 +1073,19 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun dismissProgressView() { override fun dismissProgressView() {
try { try {
dismissProgressDialog() dismissProgressDialog()
}catch (e:Exception){ } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
} }
private fun uploadLog() {
if (!hasUpLoadLog) {
hasUpLoadLog = true
LogHelper.getInstance().uploadLog(false)
}
}
override fun finishActivity() { override fun finishActivity() {
leaveChannel() leaveChannel()
} }
...@@ -1016,6 +1096,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi ...@@ -1016,6 +1096,8 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
handler = null handler = null
} }
hasUpLoadLog = false
if (waitDisposable != null) { if (waitDisposable != null) {
waitDisposable!!.dispose() waitDisposable!!.dispose()
} }
......
package com.ydl.audioim.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/2/12
*/
class AgoraLogInfoBean(
/**
* 专家头像地址
*/
private var expertHeadUrl: String? = null,
/**
* 专家姓名
*/
private var expertName: String? = null,
/**
* 声网点对点聊天房间id
*/
private var channelId: String? = null,
/**
* 倾诉剩余时长(时长单位s,eg:剩余2min15s,返回135)
*/
private var remainTime: String? = null,
/**
* listenerUid专家uid
*/
private var listenerUid: String? = null,
/**
* 倾述总时长
*/
private var totalDuration: Int? = 0,
/**
* callId
*/
private var callId: String? = null,
/**
*聆听者id(不是聆听者的uid)
*/
private var listenId: String? = null
)
\ No newline at end of file
package com.ydl.audioim.utils
import android.annotation.SuppressLint
import com.ydl.audioim.BuildConfig
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxNetTool
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
import java.io.BufferedWriter
import java.io.File
import java.io.FileWriter
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.*
/**
* @author jiucheng
* @描述:记录声网双方信息相关的日志工具
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/2/12
*/
class AudioLogUtils {
companion object {
@SuppressLint("SimpleDateFormat")
private val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
fun writeAgoraLog(content: String) {
Observable.create<Any> {
try {
writeLog(content)
if (BuildConfig.DEBUG) {
LogUtil.d("writeLog_complete")
}
} catch (e: Exception) {
}
}.subscribeOn(Schedulers.io())
.subscribe()
}
private fun writeLog(content: String) {
try {
val folder = getLogFolder()
val file = File(folder, "AgoraInfoLog")
if (!file.exists() || !file.isFile) {
file.createNewFile()
}
val fileWriter = FileWriter(file, true)
val writer = BufferedWriter(fileWriter)
writer.write("""Time:${format.format(Calendar.getInstance().time)}""")
writer.newLine()
writer.write("UserUid = ${ModularServiceManager.getPlatformUserService()?.getUser()?.userId}")
writer.newLine()
writer.write("""Network:${RxNetTool.getNetWorkTypeName(BaseApp.getApp())}""")
writer.newLine()
writer.write("""DevicesInfo:${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()}""")
writer.newLine()
writer.write("""VersionInfo:${RxAppTool.getAppVersionName(BaseApp.getApp())}""")
writer.newLine()
writer.write("AgoraLog:$content")
writer.newLine()
writer.write("--------")
writer.newLine()
writer.flush()
writer.close()
} catch (e: IOException) {
e.printStackTrace()
}
}
//获取app运行日志文件夹
private fun getLogFolder(): File {
val cacheDir = BaseApp.getApp().externalCacheDir.absolutePath
val logFolder = File(cacheDir, "log")
if (!logFolder.exists() || !logFolder.isDirectory) {
logFolder.mkdir()
}
val folder = File(logFolder, "NewYdlApp")
if (!folder.exists() || !folder.isDirectory) {
folder.mkdir()
}
return folder
}
}
}
\ No newline at end of file
...@@ -8,7 +8,7 @@ import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils ...@@ -8,7 +8,7 @@ import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
* 导医跳转私聊的中间页面,用于统一路由 * 导医跳转私聊的中间页面,用于统一路由
*/ */
@Route( path = "/chat/ChatService") @Route( path = "/consult/ChatService")
class ConsultAssistantCenterActivity : BaseActivity() { class ConsultAssistantCenterActivity : BaseActivity() {
override fun initDataAndEvent() { override fun initDataAndEvent() {
supportActionBar?.hide() supportActionBar?.hide()
......
...@@ -77,7 +77,6 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -77,7 +77,6 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
// holder.tvDesc.text = itemBean.famousRemark // holder.tvDesc.text = itemBean.famousRemark
// } // }
//服务中 //服务中
if (itemBean.inConsult || itemBean.isListening) { if (itemBean.inConsult || itemBean.isListening) {
holder.imgHead_online_server.visibility = View.VISIBLE holder.imgHead_online_server.visibility = View.VISIBLE
...@@ -110,59 +109,82 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -110,59 +109,82 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
}else{ }else{
holder.tvCity.text = "" holder.tvCity.text = ""
} }
//能力等级标签
if (1 == itemBean.abilityLevel){ //公益图标,不与其他图标冲突
//实习 if (1 == itemBean.hasServiceFree) {
holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_shixi) if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.serviceFreeIcon)) {
holder.imgAbilityLevel.visibility = View.VISIBLE expertSearchView.showImage(
}else if (2 == itemBean.abilityLevel){ itemBean.tagsIcon.serviceFreeIcon,
//新手 holder.imgServiceFree
holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou) )
holder.imgAbilityLevel.visibility = View.VISIBLE } else {
}
// else if (3 == itemBean.abilityLevel){
// //精英
// holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_jingying)
// holder.imgAbilityLevel.visibility = View.VISIBLE
// }
else{
holder.imgAbilityLevel.visibility = View.GONE
}
//活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)){
holder.imgActivity.visibility = View.VISIBLE
GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity)
// GlideApp.with(context).load("https://video.ydlcdn.com/2019/11/04/abdd3782c98939d0406080a6a80b8ea5.jpg").into(holder.imgActivity)
}else{
holder.imgActivity.visibility = View.GONE
}
//公益图标
if (1 == itemBean.hasServiceFree){
if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.serviceFreeIcon)){
expertSearchView.showImage(itemBean.tagsIcon.serviceFreeIcon,holder.imgServiceFree)
}else{
val sp = SimpleImageOpConfiger() val sp = SimpleImageOpConfiger()
sp.loadingPic = R.drawable.consultant_service_free sp.loadingPic = R.drawable.consultant_service_free
sp.errorPic = R.drawable.consultant_service_free sp.errorPic = R.drawable.consultant_service_free
expertSearchView.showImage("",holder.imgServiceFree,sp) expertSearchView.showImage("", holder.imgServiceFree, sp)
} }
holder.imgServiceFree.visibility = View.VISIBLE holder.imgServiceFree.visibility = View.VISIBLE
}else{ } else {
holder.imgServiceFree.visibility = View.GONE holder.imgServiceFree.visibility = View.GONE
} }
//新驻图标 // 展示了抗疫,就不展示其他标签
if (itemBean.isNewEnter){ if (itemBean.fightEpidemicIconShow) {
if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.newEnterIcon)){ itemBean.tagsIcon?.fightEpidemicIcon?.let {
expertSearchView.showImage(itemBean.tagsIcon.newEnterIcon,holder.imgNewEnter) GlideApp.with(context).load(itemBean.tagsIcon?.fightEpidemicIcon)
}else{ .into(holder.imgFightEpidemicIcon)
val sp = SimpleImageOpConfiger() holder.imgFightEpidemicIcon.visibility = View.VISIBLE
sp.loadingPic = R.drawable.consultant_new_enter
sp.errorPic = R.drawable.consultant_new_enter
expertSearchView.showImage("",holder.imgNewEnter,sp)
} }
holder.imgNewEnter.visibility = View.VISIBLE //影藏其余所有标签(除公益)
}else{ holder.imgAbilityLevel.visibility = View.GONE
holder.imgActivity.visibility = View.GONE
holder.imgNewEnter.visibility = View.GONE holder.imgNewEnter.visibility = View.GONE
} else {
holder.imgFightEpidemicIcon.visibility = View.GONE
//能力等级标签
if (1 == itemBean.abilityLevel) {
//实习
holder.imgAbilityLevel.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_shixi)
holder.imgAbilityLevel.visibility = View.VISIBLE
} else if (2 == itemBean.abilityLevel) {
//新手
holder.imgAbilityLevel.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou)
holder.imgAbilityLevel.visibility = View.VISIBLE
}
// else if (3 == itemBean.abilityLevel){
// //精英
// holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_jingying)
// holder.imgAbilityLevel.visibility = View.VISIBLE
// }
else {
holder.imgAbilityLevel.visibility = View.GONE
}
//活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)) {
holder.imgActivity.visibility = View.VISIBLE
GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity)
// GlideApp.with(context).load("https://video.ydlcdn.com/2019/11/04/abdd3782c98939d0406080a6a80b8ea5.jpg").into(holder.imgActivity)
} else {
holder.imgActivity.visibility = View.GONE
}
//新驻图标
if (itemBean.isNewEnter) {
if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.newEnterIcon)) {
expertSearchView.showImage(
itemBean.tagsIcon.newEnterIcon,
holder.imgNewEnter
)
} else {
val sp = SimpleImageOpConfiger()
sp.loadingPic = R.drawable.consultant_new_enter
sp.errorPic = R.drawable.consultant_new_enter
expertSearchView.showImage("", holder.imgNewEnter, sp)
}
holder.imgNewEnter.visibility = View.VISIBLE
} else {
holder.imgNewEnter.visibility = View.GONE
}
} }
holder.ll_feedbackRate.removeAllViews() holder.ll_feedbackRate.removeAllViews()
for (num in 1..5){ for (num in 1..5){
...@@ -330,6 +352,8 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -330,6 +352,8 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
val imgHead_online_server = itemView.imgHead_online_server!! val imgHead_online_server = itemView.imgHead_online_server!!
//多少人在问询 //多少人在问询
val chat_people_in_question = itemView.people_in_question!! val chat_people_in_question = itemView.people_in_question!!
// 抗疫先锋图标
val imgFightEpidemicIcon = itemView.img_fightEpidemicIcon
init { init {
itemView.setOnClickListener { itemView.setOnClickListener {
......
...@@ -19,4 +19,8 @@ data class ExpertSearchTagsIconBean( ...@@ -19,4 +19,8 @@ data class ExpertSearchTagsIconBean(
/** /**
* 新入驻图标 * 新入驻图标
*/ */
val newEnterIcon : String?) val newEnterIcon : String?,
\ No newline at end of file /**
* 抗疫先锋图标地址
*/
var fightEpidemicIcon: String? = null)
\ No newline at end of file
...@@ -60,6 +60,10 @@ data class DoctorServiceItem( ...@@ -60,6 +60,10 @@ data class DoctorServiceItem(
*/ */
var feedbackRate: Float = 0f, var feedbackRate: Float = 0f,
/** /**
* 是否抗疫先锋图标
*/
var fightEpidemicIconShow: Boolean = false,
/**
* 评价数(咨询订单数) * 评价数(咨询订单数)
*/ */
var zixunOrderNum: Int = 0, var zixunOrderNum: Int = 0,
......
...@@ -75,18 +75,24 @@ ...@@ -75,18 +75,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="10dp" android:paddingLeft="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_alignTop="@+id/tvName" android:layout_alignTop="@+id/tvName"
android:layout_alignBottom="@+id/tvName" android:layout_alignBottom="@+id/tvName"
android:layout_toEndOf="@+id/tvName" android:layout_toEndOf="@+id/tvName"
android:layout_marginStart="@dimen/platform_dp_2"> android:layout_marginStart="@dimen/platform_dp_2">
<ImageView
android:id="@+id/img_fightEpidemicIcon"
android:layout_width="53dp"
android:layout_height="@dimen/platform_dp_17"
android:layout_marginRight="4dp"
android:scaleType="centerCrop"
android:visibility="gone"/>
<!--活动图标--> <!--活动图标-->
<ImageView <ImageView
android:id="@+id/img_activity" android:id="@+id/img_activity"
android:layout_width="42dp" android:layout_width="42dp"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_marginStart="@dimen/platform_dp_4"
android:layout_marginRight="4dp" android:layout_marginRight="4dp"
android:visibility="gone"/> android:visibility="gone"/>
<!--公益图标--> <!--公益图标-->
......
...@@ -20,6 +20,7 @@ import android.view.WindowManager; ...@@ -20,6 +20,7 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.luck.picture.lib.photoview.PhotoView;
import com.miracle.view.imageeditor.utils.FileUtils; import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
...@@ -39,8 +40,6 @@ import java.util.List; ...@@ -39,8 +40,6 @@ import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
/** /**
* 预览大图 * 预览大图
...@@ -324,12 +323,7 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On ...@@ -324,12 +323,7 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
.load(uri) .load(uri)
.error(R.drawable.dynamic_default_img) .error(R.drawable.dynamic_default_img)
.into(mDatas.get(position)); .into(mDatas.get(position));
mDatas.get(position).setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { mDatas.get(position).setOnPhotoTapListener((imageView, v, v1) -> finish());
@Override
public void onPhotoTap(View view, float x, float y) {
finish();
}
});
((ViewPager) container).addView(mDatas.get(position), 0); ((ViewPager) container).addView(mDatas.get(position), 0);
// if (lodingDialog != null) { // if (lodingDialog != null) {
// lodingDialog.dismiss(); // lodingDialog.dismiss();
......
...@@ -17,6 +17,7 @@ import android.view.WindowManager; ...@@ -17,6 +17,7 @@ import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.luck.picture.lib.photoview.PhotoView;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
...@@ -28,11 +29,6 @@ import com.yidianling.dynamic.common.tool.ImageDownLoadCallBack; ...@@ -28,11 +29,6 @@ import com.yidianling.dynamic.common.tool.ImageDownLoadCallBack;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
/** /**
* 预览大图 2 集合范型为String * 预览大图 2 集合范型为String
*/ */
...@@ -257,12 +253,7 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O ...@@ -257,12 +253,7 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O
.load(mImages.get(position)) .load(mImages.get(position))
.error(R.drawable.dynamic_default_img) .error(R.drawable.dynamic_default_img)
.into(mDatas.get(position)); .into(mDatas.get(position));
mDatas.get(position).setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { mDatas.get(position).setOnPhotoTapListener((imageView, v, v1) -> finish());
@Override
public void onPhotoTap(View view, float x, float y) {
finish();
}
});
((ViewPager)container).addView(mDatas.get(position), 0); ((ViewPager)container).addView(mDatas.get(position), 0);
// if (lodingDialog != null) { // if (lodingDialog != null) {
// lodingDialog.dismiss(); // lodingDialog.dismiss();
......
...@@ -32,15 +32,14 @@ import android.widget.LinearLayout; ...@@ -32,15 +32,14 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.lzy.imagepicker.ImagePicker; import com.luck.picture.lib.entity.LocalMedia;
import com.lzy.imagepicker.bean.ImageItem; import com.luck.picture.lib.listener.OnResultCallbackListener;
import com.lzy.imagepicker.view.CropImageView;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.webview.H5Params; import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity; import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback;
import com.ydl.ydlcommon.adapter.custom.PublishImageAdapter; import com.ydl.ydlcommon.adapter.custom.PublishImageAdapter;
import com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp; import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.BaseFragment; import com.ydl.ydlcommon.base.BaseFragment;
...@@ -69,8 +68,6 @@ import com.yidianling.dynamic.publishTrend.PublishTrendActivity; ...@@ -69,8 +68,6 @@ import com.yidianling.dynamic.publishTrend.PublishTrendActivity;
import com.yidianling.dynamic.publishTrend.SelecTopicActivity; import com.yidianling.dynamic.publishTrend.SelecTopicActivity;
import com.yidianling.dynamic.router.DynamicIn; import com.yidianling.dynamic.router.DynamicIn;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -197,17 +194,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie ...@@ -197,17 +194,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
@Override @Override
public void initDataAndEventLazy() { public void initDataAndEventLazy() {
rxPermissions = new RxPermissions(getActivity()); rxPermissions = new RxPermissions(getActivity());
ImagePicker imagePicker = ImagePicker.getInstance();
imagePicker.setImageLoader(new GlideImageDisplayLoader()); //设置图片加载器
imagePicker.setShowCamera(true); //显示拍照按钮
imagePicker.setCrop(true); //允许裁剪(单选才有效)
imagePicker.setSaveRectangle(true); //是否按矩形区域保存
imagePicker.setSelectLimit(9); //选中数量限制
imagePicker.setStyle(CropImageView.Style.RECTANGLE); //裁剪框的形状
imagePicker.setFocusWidth(800); //裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker.setFocusHeight(800); //裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker.setOutPutX(1000);//保存文件的宽度。单位像素
imagePicker.setOutPutY(1000);//保存文件的高度。单位像素
imgFiles = new ArrayList<File>(); imgFiles = new ArrayList<File>();
initView(); initView();
uiHandler = new Handler(); uiHandler = new Handler();
...@@ -770,25 +756,22 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie ...@@ -770,25 +756,22 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
} }
private static final int PICK_IMAGE_COUNT = 9;
private static final int PORTRAIT_IMAGE_WIDTH = 720;
private static final String JPG = ".jpg";
private void showSelector() { private void showSelector() {
ImagePicker.getInstance().setEdit(true); int selectedSize = publishTrendImgs.size()!=0?publishTrendImgs.size()-1:0;
DynamicIn.INSTANCE.startPicker((BaseActivity) activity, false, new PickerCallback() {
YDLImagePicker.INSTANCE.startPicker((BaseActivity) activity, 9 - selectedSize,new OnResultCallbackListener() {
@Override @Override
public void onSuccess(@NotNull ArrayList<ImageItem> images) { public void onResult(List<LocalMedia> list) {
if (images.isEmpty()) { if (list.isEmpty()) {
return; return;
} }
for (int i = 0; i < images.size(); i++) { for (int i = 0; i < list.size(); i++) {
AddImag(images.get(i).uri.toString()); AddImag(list.get(i).getPath());
} }
} }
@Override @Override
public void onFail() { public void onCancel() {
} }
}); });
......
...@@ -6,8 +6,6 @@ import android.support.v4.app.DialogFragment ...@@ -6,8 +6,6 @@ import android.support.v4.app.DialogFragment
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import com.ydl.confide.api.IConfideService import com.ydl.confide.api.IConfideService
import com.ydl.course.api.ICourseService import com.ydl.course.api.ICourseService
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback
import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker
import com.ydl.ydlcommon.base.config.HttpConfig import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
...@@ -168,10 +166,6 @@ object DynamicIn { ...@@ -168,10 +166,6 @@ object DynamicIn {
getImService().showSelector(activity, requestCode) getImService().showSelector(activity, requestCode)
} }
fun startPicker(activity: AppCompatActivity, openCamera: Boolean, callback: PickerCallback) {
YdlImagePicker.startPicker(activity, openCamera, callback)
}
/** /**
* 课程播放页 * 课程播放页
*/ */
......
...@@ -4,20 +4,16 @@ import android.Manifest; ...@@ -4,20 +4,16 @@ import android.Manifest;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import com.lzy.imagepicker.bean.ImageItem; import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.listener.OnResultCallbackListener;
import com.miracle.view.imageeditor.utils.FileUtils; import com.miracle.view.imageeditor.utils.FileUtils;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback; import com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker;
import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.nimbase.business.session.actions.BaseAction; import com.yidianling.nimbase.business.session.actions.BaseAction;
import com.yidianling.nimbase.common.ToastHelper;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.List;
/** /**
* Created by zhoujianghua on 2015/7/31. * Created by zhoujianghua on 2015/7/31.
...@@ -58,19 +54,23 @@ public abstract class PickImageAction extends BaseAction { ...@@ -58,19 +54,23 @@ public abstract class PickImageAction extends BaseAction {
} }
private void selectImage(){ private void selectImage(){
YdlImagePicker.INSTANCE.startPicker((AppCompatActivity) getActivity(), false, new PickerCallback() { YDLImagePicker.INSTANCE.startPicker((AppCompatActivity) getActivity(),9, new OnResultCallbackListener() {
@Override @Override
public void onSuccess(@NotNull ArrayList<ImageItem> images) { public void onResult(List<LocalMedia> list) {
for (int i = 0; i < images.size(); i++) { if (list.isEmpty()) {
onPicked(FileUtils.INSTANCE.getFileByUri(getActivity(),images.get(i).uri.toString())); return;
}
for (int i = 0; i < list.size(); i++) {
onPicked(FileUtils.INSTANCE.getFileByUri(getActivity(),list.get(i).getPath()));
} }
} }
@Override @Override
public void onFail() { public void onCancel() {
ToastHelper.showToast(getActivity(), R.string.im_picker_image_error);
} }
}); });
} }
} }
...@@ -18,6 +18,7 @@ import android.view.ViewGroup; ...@@ -18,6 +18,7 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.luck.picture.lib.photoview.PhotoView;
import com.netease.nimlib.sdk.AbortableFuture; import com.netease.nimlib.sdk.AbortableFuture;
import com.netease.nimlib.sdk.NIMClient; import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer; import com.netease.nimlib.sdk.Observer;
...@@ -48,8 +49,6 @@ import java.util.ArrayList; ...@@ -48,8 +49,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import uk.co.senab.photoview.PhotoView;
/** /**
* 查看聊天消息原图 * 查看聊天消息原图
* Created by huangjun on 2015/3/6. * Created by huangjun on 2015/3/6.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:gravity="center" android:gravity="center"
android:orientation="vertical" > android:orientation="vertical" >
<uk.co.senab.photoview.PhotoView <com.luck.picture.lib.photoview.PhotoView
android:id="@+id/watch_image_view" android:id="@+id/watch_image_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
package com.yidianling.user;
import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.config.ISimpleImageOpConfig;
import com.ydl.ydl_image.config.SimpleImageOpConfiger;
import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydl_image.module.GlideApp;
/**
* Created by xiongyu on 2017/4/7.
*/
public class GlideImageLoader implements ImageLoader {
@Override
public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) {
showImage(activity,path,imageView,width,height);
}
@Override
public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) {
showImage(activity,path,imageView,width,height);
}
@Override
public void displayImage(Activity activity, Uri uri, ImageView imageView, int i, int i1) {
GlideApp.with(activity) //配置上下文
.load(uri) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置错误图片
.placeholder(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
}
private void showImage(Activity activity, String path, ImageView imageView, int width, int height){
SimpleImageOpConfiger sp = new SimpleImageOpConfiger();
sp.loadingPic = R.drawable.platform_default_img;
sp.errorPic = R.drawable.platform_default_img;
sp.scaleType = ISimpleImageOpConfig.CENTER_CROP;
sp.isCacheOnDisk = false;
YDLImageCacheManager.showImage(activity,path,imageView,width, height,sp);
}
@Override
public void clearMemoryCache() {
}
}
...@@ -14,10 +14,9 @@ import android.text.TextWatcher ...@@ -14,10 +14,9 @@ import android.text.TextWatcher
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.lzy.imagepicker.ImagePicker import com.luck.picture.lib.entity.LocalMedia
import com.lzy.imagepicker.bean.ImageItem import com.luck.picture.lib.listener.OnResultCallbackListener
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback import com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker
import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker
import com.ydl.ydlcommon.adapter.custom.PublishImageAdapter import com.ydl.ydlcommon.adapter.custom.PublishImageAdapter
import com.ydl.ydlcommon.base.BaseActivity import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.data.PlatformDataManager import com.ydl.ydlcommon.data.PlatformDataManager
...@@ -25,7 +24,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager ...@@ -25,7 +24,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.ui.ParcelableImage import com.ydl.ydlcommon.ui.ParcelableImage
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.ydl.ydlcommon.view.banner.GlideImageDisplayLoader
import com.ydl.ydlcommon.view.dialog.CommonDialog import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
...@@ -207,25 +205,22 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener { ...@@ -207,25 +205,22 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
} }
private fun showSelector() { private fun showSelector() {
ImagePicker.getInstance().selectLimit = 1 YDLImagePicker.startPicker(this as BaseActivity, object : OnResultCallbackListener {
val imagePicker = ImagePicker.getInstance() override fun onResult(list: List<LocalMedia>) {
imagePicker.imageLoader = GlideImageDisplayLoader() if (list.isEmpty()) {
imagePicker.selectLimit = 1 //选中数量限制
YdlImagePicker.startPicker(this as BaseActivity, false, object : PickerCallback {
override fun onFail() {
}
override fun onSuccess(images: ArrayList<ImageItem>) {
if (images.isEmpty()) {
return return
} }
for (i in images.indices) { for (i in list.indices) {
addImag(images[i].path) addImag(list[i].path)
} }
} }
override fun onCancel() {
}
}) })
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
......
package com.yidianling.user.ui; package com.yidianling.user.ui;
import android.Manifest;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
...@@ -15,13 +14,13 @@ import android.view.View; ...@@ -15,13 +14,13 @@ import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import com.lzy.imagepicker.ImagePicker; import com.luck.picture.lib.entity.LocalMedia;
import com.lzy.imagepicker.bean.ImageItem; import com.luck.picture.lib.listener.OnResultCallbackListener;
import com.lzy.imagepicker.ui.ImageGridActivity; import com.miracle.view.imageeditor.utils.FileUtils;
import com.lzy.imagepicker.view.CropImageView;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.webview.RefreshWebEvent; import com.ydl.webview.RefreshWebEvent;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.actions.imagepicker.YDLImagePicker;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.bean.StatusBarOptions; import com.ydl.ydlcommon.bean.StatusBarOptions;
import com.ydl.ydlcommon.data.http.RxUtils; import com.ydl.ydlcommon.data.http.RxUtils;
...@@ -34,11 +33,8 @@ import com.ydl.ydlcommon.view.ListNoCancelDialog; ...@@ -34,11 +33,8 @@ import com.ydl.ydlcommon.view.ListNoCancelDialog;
import com.ydl.ydlcommon.view.RoundCornerButton; import com.ydl.ydlcommon.view.RoundCornerButton;
import com.ydl.ydlcommon.view.TitleBar; import com.ydl.ydlcommon.view.TitleBar;
import com.ydl.ydlcommon.view.dialog.CommonDialog; import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.ThreeLinesDialog;
import com.yidianling.common.tools.RxFileTool; import com.yidianling.common.tools.RxFileTool;
import com.yidianling.common.tools.RxImageTool; import com.yidianling.common.tools.RxImageTool;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.user.GlideImageLoader;
import com.yidianling.user.LoginHelper; import com.yidianling.user.LoginHelper;
import com.yidianling.user.R; import com.yidianling.user.R;
import com.yidianling.user.UserConstants; import com.yidianling.user.UserConstants;
...@@ -133,18 +129,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen ...@@ -133,18 +129,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
void init() { void init() {
rxPermissions = new RxPermissions(this); rxPermissions = new RxPermissions(this);
head_dir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/yidianling/img/head_img/"; head_dir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/yidianling/img/head_img/";
ImagePicker imagePicker = ImagePicker.getInstance();
imagePicker.setImageLoader(new GlideImageLoader()); //设置图片加载器
imagePicker.setShowCamera(true); //显示拍照按钮
imagePicker.setCrop(true); //允许裁剪(单选才有效)
imagePicker.setMultiMode(false);
imagePicker.setSaveRectangle(true); //是否按矩形区域保存
imagePicker.setSelectLimit(1); //选中数量限制
imagePicker.setStyle(CropImageView.Style.RECTANGLE); //裁剪框的形状
imagePicker.setFocusWidth(800); //裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker.setFocusHeight(800); //裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker.setOutPutX(300);//保存文件的宽度。单位像素
imagePicker.setOutPutY(300);//保存文件的高度。单位像素
if (!TextUtils.isEmpty(icon)) { if (!TextUtils.isEmpty(icon)) {
GlideApp.with(FillInfoActivity.this) GlideApp.with(FillInfoActivity.this)
.load(icon) .load(icon)
...@@ -214,29 +198,23 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen ...@@ -214,29 +198,23 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
public void onClick(View v) { public void onClick(View v) {
int id = v.getId(); int id = v.getId();
if (id == R.id.sdv_head) { if (id == R.id.sdv_head) {
rxPermissions.request(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE) YDLImagePicker.INSTANCE.startPicker(FillInfoActivity.this, new OnResultCallbackListener() {
.subscribe(granted -> { @Override
if (granted) { public void onResult(List<LocalMedia> list) {
ThreeLinesDialog.Builder builder1 = new ThreeLinesDialog.Builder(FillInfoActivity.this); if (list.isEmpty()) {
builder1.setTitle("相机"); return;
builder1.setMessage("相册中选择"); }
builder1.setbottom("取消"); for (int i = 0; i < list.size(); i++) {
builder1.setFirstButton("相机", (dialog, which) -> { uploadImage(list.get(0).getPath(), 1002);
head_path = head_dir + System.currentTimeMillis() + "hand_carmer.jpg"; }
showCameraAction(REQUEST_CODE_FILL_CAMER_HEAD, head_path);
dialog.dismiss(); }
});
builder1.setSecondButton("相册中选择", (dialog, which) -> { @Override
Intent intent = new Intent(FillInfoActivity.this, ImageGridActivity.class); public void onCancel() {
startActivityForResult(intent, IMAGE_PICKER);
dialog.dismiss(); }
}); });
builder1.setThridButton("取消", (dialog, which) -> dialog.dismiss());
builder1.create().show();
} else {
ToastHelper.Companion.show("缺少使用相机和读取存储权限,无法获取图片");
}
});
} else if (id == R.id.tv_sex) { } else if (id == R.id.tv_sex) {
List<String> name = new ArrayList<String>(); List<String> name = new ArrayList<String>();
name.add("男"); name.add("男");
...@@ -436,19 +414,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen ...@@ -436,19 +414,6 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
} }
break; break;
} }
} else if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
switch (requestCode) {
case IMAGE_PICKER:
if (data != null) {
ArrayList<ImageItem> images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS);
uploadImage(images.get(0).path, 1002);
} else {
ToastUtil.toastShort(this, "没有数据");
}
break;
}
} }
} }
...@@ -498,7 +463,8 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen ...@@ -498,7 +463,8 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
*/ */
void uploadImage(final String path, final int requestCode) { void uploadImage(final String path, final int requestCode) {
UserHttp userHttp = UserHttpImpl.Companion.getInstance(); UserHttp userHttp = UserHttpImpl.Companion.getInstance();
userHttp.uploadHead(new HeadParam(new File(path))) File outputFile = FileUtils.INSTANCE.getFileByUri(FillInfoActivity.this,path);
userHttp.uploadHead(new HeadParam(outputFile))
.compose(RxUtils.resultData()) .compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(disposable -> { .doOnSubscribe(disposable -> {
......
...@@ -82,13 +82,13 @@ class SecretActivity : BaseActivity() { ...@@ -82,13 +82,13 @@ class SecretActivity : BaseActivity() {
agreeAction() agreeAction()
} }
user_use_btn.setOnClickListener { // user_use_btn.setOnClickListener {
H5Activity.start(this@SecretActivity, false) // H5Activity.start(this@SecretActivity, false)
} // }
//
user_secret_protect_btn.setOnClickListener { // user_secret_protect_btn.setOnClickListener {
H5Activity.start(this@SecretActivity, true) // H5Activity.start(this@SecretActivity, true)
} // }
} }
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
......
package com.yidianling.user.widget
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.os.Bundle
import android.text.Html
import android.text.SpannableString
import android.text.Spanned
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.user.R
import com.yidianling.user.ui.login.H5Activity
import kotlinx.android.synthetic.main.user_activity_secret.*
class SecretDescriptionDialog(
var mContext: Context,
var mSecretProtocolString: String,
private val listener: OnSecretDescriptionDialogListener?
) : Dialog(mContext, R.style.platform_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.user_activity_secret)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
window.setGravity(Gravity.CENTER)
window.attributes = params
user_secret_desc.text = Html.fromHtml(mSecretProtocolString)
user_secret_no_agree.setOnClickListener {
listener?.onCancel()
}
user_secret_agree.setOnClickListener {
agreeAction()
}
val str = "阅读完整版《用户使用协议》、《隐私保护政策》"
val spannableString = SpannableString(str)
// spannableString.setSpan(
// ForegroundColorSpan(Color.parseColor("#159CEF")),
// 5,
// 13,
// Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
// )
// spannableString.setSpan(
// ForegroundColorSpan(Color.parseColor("#159CEF")),
// str.length - 8,
// str.length,
// Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
// )
spannableString.setSpan(
object : ClickableSpan() {
override fun onClick(widget: View?) {
if (Utils.isFastClick()){
return
}
H5Activity.start(mContext, false)
}
override fun updateDrawState(ds: TextPaint?) {
ds?.color=Color.parseColor("#159CEF")
}
}, 5,
13, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
spannableString.setSpan(
object : ClickableSpan() {
override fun onClick(widget: View?) {
if (Utils.isFastClick()){
return
}
H5Activity.start(mContext, true)
}
override fun updateDrawState(ds: TextPaint?) {
ds?.color=Color.parseColor("#159CEF")
}
}, str.length - 8,
str.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
tv_content.movementMethod = LinkMovementMethod.getInstance()
tv_content.highlightColor = Color.TRANSPARENT
tv_content.text = spannableString
}
private fun agreeAction() {
SharedPreferencesEditor.putString("hasAgreeSecret", "true")
listener?.onSure()
}
interface OnSecretDescriptionDialogListener {
fun onCancel()
fun onSure()
}
}
\ No newline at end of file
...@@ -5,10 +5,12 @@ import android.content.Context ...@@ -5,10 +5,12 @@ import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.view.Gravity import android.view.Gravity
import android.view.WindowManager import android.view.WindowManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.yidianling.user.R import com.yidianling.user.R
import kotlinx.android.synthetic.main.user_secret_dialog_layout.* import kotlinx.android.synthetic.main.user_secret_dialog_layout.*
class SecretDialog(context: Context, private val listener: OnSecretDialogListener?): Dialog(context, R.style.platform_dialog_default_style) { class SecretDialog(context: Context, private val listener: OnSecretDialogListener?) :
Dialog(context, R.style.platform_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
...@@ -22,14 +24,12 @@ class SecretDialog(context: Context, private val listener: OnSecretDialogListene ...@@ -22,14 +24,12 @@ class SecretDialog(context: Context, private val listener: OnSecretDialogListene
window.attributes = params window.attributes = params
user_secret_dialog_agree.setOnClickListener { user_secret_dialog_agree.setOnClickListener {
listener?.onSure() agreeAction()
} }
user_secret_dialog_no_agree.setOnClickListener { user_secret_dialog_no_agree.setOnClickListener {
listener?.onCancel() listener?.onCancel()
} }
} }
interface OnSecretDialogListener { interface OnSecretDialogListener {
...@@ -37,5 +37,9 @@ class SecretDialog(context: Context, private val listener: OnSecretDialogListene ...@@ -37,5 +37,9 @@ class SecretDialog(context: Context, private val listener: OnSecretDialogListene
fun onSure() fun onSure()
} }
private fun agreeAction() {
SharedPreferencesEditor.putString("hasAgreeSecret", "true")
listener?.onSure()
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#E6FFFFFF" android:endColor="#00FFFFFF"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" xmlns:myapp="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content"
android:background="#ffffff"> android:orientation="vertical"
>
<ImageView
android:layout_width="match_parent" <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:orientation="vertical"
android:adjustViewBounds="true" android:layout_marginLeft="34dp"
android:src="@drawable/user_secret_top_bg" /> android:layout_marginRight="34dp"
android:background="@drawable/user_secret_dialog_bg">
<RelativeLayout
android:id="@+id/user_top_rl"
android:layout_width="match_parent" <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
android:layout_height="wrap_content" <com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_marginTop="10dp"> android:layout_width="match_parent"
android:layout_height="wrap_content"
<TextView myapp:pa_borderRadius="12dp"
android:id="@+id/secrey_title" myapp:pa_type="pa_round"
android:layout_width="wrap_content" android:adjustViewBounds="true"
android:layout_height="wrap_content" android:src="@drawable/user_secret_top_bg"/>
android:layout_marginLeft="25dp"
android:layout_marginTop="40dp" <RelativeLayout
android:text="壹点灵" android:id="@+id/user_top_rl"
android:textColor="#242424" android:layout_width="match_parent"
android:textSize="28dp" android:layout_height="wrap_content"
android:textStyle="bold" /> android:layout_marginTop="10dp">
<TextView <TextView
android:layout_width="wrap_content" android:id="@+id/secrey_title"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_below="@+id/secrey_title" android:layout_height="wrap_content"
android:layout_marginLeft="25dp" android:layout_marginLeft="25dp"
android:text="隐私政策概要" android:layout_marginTop="40dp"
android:textColor="#242424" android:text="隐私政策"
android:textSize="28dp" android:textColor="#242424"
android:textStyle="bold" /> android:textSize="28dp"
android:textStyle="bold"/>
</RelativeLayout>
<TextView
<ScrollView android:layout_width="wrap_content"
android:layout_below="@+id/user_top_rl" android:layout_height="wrap_content"
android:layout_alignBottom="@+id/secret_bottom_text" android:layout_below="@+id/secrey_title"
android:layout_width="match_parent" android:layout_marginLeft="25dp"
android:layout_height="wrap_content" android:text="及使用协议说明"
android:layout_marginBottom="42dp"> android:textColor="#242424"
android:textSize="28dp"
<LinearLayout android:textStyle="bold"/>
android:layout_width="match_parent"
android:layout_height="wrap_content" </RelativeLayout>
android:layout_marginLeft="25dp" </RelativeLayout>
android:layout_marginRight="25dp"
android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="194dp">
<ScrollView
<TextView android:layout_width="match_parent"
android:id="@+id/user_secret_desc" android:layout_height="194dp"
android:layout_width="match_parent" android:scrollbars="none"
android:layout_height="wrap_content" >
android:layout_marginTop="30dp"
android:lineHeight="20dp" <RelativeLayout
tools:text="感谢您信任并使用壹点灵APP,\n android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
>
<TextView
android:id="@+id/user_secret_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineHeight="20dp"
tools:text="感谢您信任并使用壹点灵APP,\n
我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\n\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n 我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\n\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n
2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\n 2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\n
3. 我们会采业界先进的安全措施保护您的信息安全;\n 3. 我们会采业界先进的安全措施保护您的信息安全;\n
4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\n 4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\n
5. 您可以查询、更正、删除您的个人信息。" 5. 您可以查询、更正、删除您的个人信息。"
android:textColor="#444444" android:textColor="#444444"
android:textSize="14dp" /> android:textSize="14dp"/>
</LinearLayout> </RelativeLayout>
</ScrollView> </ScrollView>
<View
android:background="@drawable/user_secret_dectription_bg"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_height="30dp"/>
<LinearLayout </RelativeLayout>
android:id="@+id/secret_bottom_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_marginBottom="185dp"
android:layout_marginLeft="@dimen/platform_dp_25">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="阅读完整版"
android:textColor="#444444"
android:textSize="14dp" />
<TextView
android:id="@+id/user_use_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《用户使用协议》"
android:textColor="#159CEF"
android:textSize="14dp" />
<TextView <TextView
android:layout_width="wrap_content" android:id="@+id/tv_content"
android:layout_height="wrap_content" android:layout_marginTop="15dp"
android:text="、" android:layout_width="match_parent"
android:textColor="#444444" android:layout_height="wrap_content"
android:textSize="14dp" /> android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="阅读完整版《用户使用协议》、《隐私保护政策》"
android:textColor="#444444"
android:textSize="14dp"/>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="阅读完整版"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_use_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《用户使用协议》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="、"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_secret_protect_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《隐私保护政策》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<TextView <LinearLayout
android:id="@+id/user_secret_protect_btn" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_marginTop="15dp"
android:text="《隐私保护政策》" android:layout_marginBottom="24dp"
android:textColor="#159CEF" android:layout_alignParentBottom="true"
android:textSize="14dp" /> android:layout_marginLeft="25dp"
</LinearLayout> android:layout_marginRight="25dp"
android:orientation="vertical"
android:background="#ffffff">
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/user_secret_agree"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_alignParentBottom="true" android:layout_height="44dp"
android:layout_marginLeft="25dp" android:layout_weight="1"
android:layout_marginRight="25dp" android:background="@drawable/user_secret_right_btn_bg"
android:layout_marginBottom="40dp" android:gravity="center"
android:orientation="horizontal" android:text="同意并继续"
android:background="#ffffff"> android:textColor="#FFFFFF"
android:textSize="16dp"/>
<TextView <TextView
android:id="@+id/user_secret_no_agree" android:id="@+id/user_secret_no_agree"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="44dp" android:layout_gravity="center_horizontal"
android:layout_marginRight="5.5dp" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_marginTop="10dp"
android:background="@drawable/user_secret_left_btn_bg" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:text="不同意并退出" android:text="仍不同意并退出"
android:textColor="#999999" android:textColor="#999999"
android:textSize="16dp" /> android:textSize="16dp"/>
<TextView </LinearLayout>
android:id="@+id/user_secret_agree"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginLeft="5.5dp"
android:layout_weight="1"
android:background="@drawable/user_secret_right_btn_bg"
android:gravity="center"
android:text="同意并继续"
android:textColor="#FFFFFF"
android:textSize="16dp" />
</LinearLayout> </LinearLayout>
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="40dp" android:layout_marginLeft="34dp"
android:layout_marginRight="40dp" android:layout_marginRight="34dp"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:background="@drawable/user_secret_dialog_bg"> android:background="@drawable/user_secret_dialog_bg">
......
...@@ -81,7 +81,7 @@ dependencies { ...@@ -81,7 +81,7 @@ dependencies {
exclude group: 'com.squareup.okhttp3', module: 'logging-interceptor' exclude group: 'com.squareup.okhttp3', module: 'logging-interceptor'
} }
api(rootProject.ext.dependencies["imagepicker"]) { api(rootProject.ext.dependencies["pictureselector"]) {
exclude group: 'com.android.support', module: 'recyclerview-v7' exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib' exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
......
package com.ydl.ydlcommon.actions.imagepicker;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.bumptech.glide.request.target.ImageViewTarget;
import com.luck.picture.lib.engine.ImageEngine;
import com.luck.picture.lib.listener.ImageCompleteCallback;
import com.luck.picture.lib.tools.MediaUtils;
import com.luck.picture.lib.widget.longimage.ImageSource;
import com.luck.picture.lib.widget.longimage.ImageViewState;
import com.luck.picture.lib.widget.longimage.SubsamplingScaleImageView;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.R;
/**
* @author:luck
* @date:2019-11-13 17:02
* @describe:Glide加载引擎
*/
public class GlideEngine implements ImageEngine {
/**
* 加载图片
*
* @param context
* @param url
* @param imageView
*/
@Override
public void loadImage(@NonNull Context context, @NonNull String url, @NonNull ImageView imageView) {
GlideApp.with(context)
.load(url)
.into(imageView);
}
/**
* 加载网络图片适配长图方案
* # 注意:此方法只有加载网络图片才会回调
*
* @param context
* @param url
* @param imageView
* @param longImageView
* @param callback 网络图片加载回调监听
*/
@Override
public void loadImage(@NonNull Context context, @NonNull String url,
@NonNull ImageView imageView,
SubsamplingScaleImageView longImageView, ImageCompleteCallback callback) {
GlideApp.with(context)
.asBitmap()
.load(url)
.into(new ImageViewTarget<Bitmap>(imageView) {
@Override
public void onLoadStarted(@Nullable Drawable placeholder) {
super.onLoadStarted(placeholder);
if (callback != null) {
callback.onShowLoading();
}
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
super.onLoadFailed(errorDrawable);
if (callback != null) {
callback.onHideLoading();
}
}
@Override
protected void setResource(@Nullable Bitmap resource) {
if (callback != null) {
callback.onHideLoading();
}
if (resource != null) {
boolean eqLongImage = MediaUtils.isLongImg(resource.getWidth(),
resource.getHeight());
longImageView.setVisibility(eqLongImage ? View.VISIBLE : View.GONE);
imageView.setVisibility(eqLongImage ? View.GONE : View.VISIBLE);
if (eqLongImage) {
// 加载长图
longImageView.setQuickScaleEnabled(true);
longImageView.setZoomEnabled(true);
longImageView.setPanEnabled(true);
longImageView.setDoubleTapZoomDuration(100);
longImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
longImageView.setDoubleTapZoomDpi(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER);
longImageView.setImage(ImageSource.bitmap(resource),
new ImageViewState(0, new PointF(0, 0), 0));
} else {
// 普通图片
imageView.setImageBitmap(resource);
}
}
}
});
}
/**
* 加载网络图片适配长图方案
* # 注意:此方法只有加载网络图片才会回调
*
* @param context
* @param url
* @param imageView
* @param longImageView
* @ 已废弃
*/
@Override
public void loadImage(@NonNull Context context, @NonNull String url,
@NonNull ImageView imageView,
SubsamplingScaleImageView longImageView) {
GlideApp.with(context)
.asBitmap()
.load(url)
.into(new ImageViewTarget<Bitmap>(imageView) {
@Override
protected void setResource(@Nullable Bitmap resource) {
if (resource != null) {
boolean eqLongImage = MediaUtils.isLongImg(resource.getWidth(),
resource.getHeight());
longImageView.setVisibility(eqLongImage ? View.VISIBLE : View.GONE);
imageView.setVisibility(eqLongImage ? View.GONE : View.VISIBLE);
if (eqLongImage) {
// 加载长图
longImageView.setQuickScaleEnabled(true);
longImageView.setZoomEnabled(true);
longImageView.setPanEnabled(true);
longImageView.setDoubleTapZoomDuration(100);
longImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
longImageView.setDoubleTapZoomDpi(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER);
longImageView.setImage(ImageSource.bitmap(resource),
new ImageViewState(0, new PointF(0, 0), 0));
} else {
// 普通图片
imageView.setImageBitmap(resource);
}
}
}
});
}
/**
* 加载相册目录
*
* @param context 上下文
* @param url 图片路径
* @param imageView 承载图片ImageView
*/
@Override
public void loadFolderImage(@NonNull Context context, @NonNull String url, @NonNull ImageView imageView) {
GlideApp.with(context)
.asBitmap()
.load(url)
.override(180, 180)
.centerCrop()
.sizeMultiplier(0.5f)
.apply(new RequestOptions().placeholder(R.drawable.picture_image_placeholder))
.into(new BitmapImageViewTarget(imageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.
create(context.getResources(), resource);
circularBitmapDrawable.setCornerRadius(8);
imageView.setImageDrawable(circularBitmapDrawable);
}
});
}
/**
* 加载gif
*
* @param context 上下文
* @param url 图片路径
* @param imageView 承载图片ImageView
*/
@Override
public void loadAsGifImage(@NonNull Context context, @NonNull String url,
@NonNull ImageView imageView) {
GlideApp.with(context)
.asGif()
.load(url)
.into(imageView);
}
/**
* 加载图片列表图片
*
* @param context 上下文
* @param url 图片路径
* @param imageView 承载图片ImageView
*/
@Override
public void loadGridImage(@NonNull Context context, @NonNull String url, @NonNull ImageView imageView) {
GlideApp.with(context)
.load(url)
.override(200, 200)
.centerCrop()
.apply(new RequestOptions().placeholder(R.drawable.picture_image_placeholder))
.into(imageView);
}
private GlideEngine() {
}
private static GlideEngine instance;
public static GlideEngine createGlideEngine() {
if (null == instance) {
synchronized (GlideEngine.class) {
if (null == instance) {
instance = new GlideEngine();
}
}
}
return instance;
}
}
package com.ydl.ydlcommon.actions.imagepicker
import android.app.Activity
import android.content.Intent
import com.lzy.imagepicker.ImagePicker
import com.lzy.imagepicker.bean.ImageItem
import com.lzy.imagepicker.ui.ImageGridActivity
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.remind.ToastHelper
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
internal class ImagePickerActivity: BaseActivity() {
companion object {
private const val REQUEST_CODE = 0X00
private var callback: PickerCallback? = null
private const val OPEN_CAMERA = "open_camera"
fun start(activity: Activity, openCamera: Boolean, callback: PickerCallback) {
val intent = Intent(activity, ImagePickerActivity::class.java)
intent.putExtra(OPEN_CAMERA, openCamera)
activity.startActivityForResult(intent,
REQUEST_CODE
)
Companion.callback = callback
}
}
private var openCamera = false // 是否是直接打开相机
override fun layoutResId(): Int {
return 0
}
override fun initDataAndEvent() {
openCamera = intent.getBooleanExtra(OPEN_CAMERA, false)
val intent = Intent(this, ImageGridActivity::class.java)
intent.putExtra(ImageGridActivity.EXTRAS_TAKE_PICKERS, openCamera)
startActivityForResult(intent,
REQUEST_CODE
)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == REQUEST_CODE) {
val images = data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS) as ArrayList<ImageItem>
callback?.onSuccess(images)
} else {
callback?.onFail()
ToastHelper.show("没有数据")
}
finish()
}
}
override fun onRestart() {
super.onRestart()
finish()
}
}
\ No newline at end of file
package com.ydl.ydlcommon.actions.imagepicker
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.lzy.imagepicker.ImagePicker
import com.lzy.imagepicker.bean.ImageItem
import com.lzy.imagepicker.ui.ImageGridActivity
import com.ydl.ydlcommon.base.BaseFragment
import com.ydl.ydlcommon.utils.remind.ToastHelper
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
internal class ImagePickerFragment: BaseFragment() {
companion object {
private const val REQUEST_CODE = 0X00
private const val OPEN_CAMERA = "open_camera"
private const val PICKER: String = "picker"
fun start(activity: AppCompatActivity, openCamera: Boolean, callback: PickerCallback) {
val fragment = ImagePickerFragment()
fragment.pickerCallback = callback
val args = Bundle()
args.putBoolean(OPEN_CAMERA, openCamera)
fragment.arguments = args
activity.supportFragmentManager.beginTransaction()
.add(fragment, PICKER)
.commitAllowingStateLoss()
}
}
private var pickerCallback: PickerCallback? = null
private var openCamera = false // 是否是直接打开相机
override fun layoutResId(): Int {
return 0
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
openCamera = arguments.getBoolean(OPEN_CAMERA, false)
val intent = Intent(activity, ImageGridActivity::class.java)
startActivityForResult(intent,
REQUEST_CODE
)
}
override fun initDataAndEvent() {
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == ImagePicker.RESULT_CODE_ITEMS) {
if (data != null && requestCode == REQUEST_CODE) {
val images = data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS) as ArrayList<ImageItem>
pickerCallback?.onSuccess(images)
} else {
pickerCallback?.onFail()
ToastHelper.show("没有数据")
}
}
}
override fun initDataAndEventLazy() {
}
}
\ No newline at end of file
package com.ydl.ydlcommon.actions.imagepicker
import com.lzy.imagepicker.bean.ImageItem
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
interface PickerCallback {
fun onSuccess(images: ArrayList<ImageItem>)
fun onFail()
}
\ No newline at end of file
package com.ydl.ydlcommon.actions.imagepicker
import android.support.v7.app.AppCompatActivity
import com.luck.picture.lib.PictureSelector
import com.luck.picture.lib.config.PictureMimeType
import com.luck.picture.lib.listener.OnResultCallbackListener
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
object YDLImagePicker {
fun startPicker(activity: AppCompatActivity, callback: OnResultCallbackListener) {
startPicker(activity,1,callback)
}
fun startPicker(activity: AppCompatActivity, maxSelectNum :Int,callback: OnResultCallbackListener) {
PictureSelector.create(activity)
.openGallery(PictureMimeType.ofImage())
.maxSelectNum(maxSelectNum)
.compress(true)
.minimumCompressSize(100)
.isWeChatStyle(true)
.loadImageEngine(GlideEngine.createGlideEngine())
.forResult(callback)
}
}
\ No newline at end of file
package com.ydl.ydlcommon.actions.imagepicker;
import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.R;
import java.io.File;
/**
* Created by haorui on 2019/6/28.
* Des:
*/
public class YdlImageLoader implements ImageLoader {
@Override
public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) {
showImage(activity,path,imageView,width,height);
}
@Override
public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) {
showImage(activity,path,imageView,width,height);
}
@Override
public void displayImage(Activity activity, Uri uri, ImageView imageView, int i, int i1) {
GlideApp.with(activity) //配置上下文
.load(uri) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(R.drawable.platform_default_img) //设置错误图片
.placeholder(R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
}
private void showImage(Activity activity, String path, ImageView imageView, int width, int height){
GlideApp.with(activity) //配置上下文
.load(Uri.fromFile(new File(path))) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(R.drawable.platform_default_img) //设置错误图片
.placeholder(R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
}
@Override
public void clearMemoryCache() {
}
}
package com.ydl.ydlcommon.actions.imagepicker
import android.support.v7.app.AppCompatActivity
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/07
*/
object YdlImagePicker {
fun startPicker(activity: AppCompatActivity, openCamera: Boolean, callback: PickerCallback) {
ImagePickerFragment.start(activity, openCamera, callback)
}
}
\ No newline at end of file
...@@ -3,10 +3,7 @@ package com.ydl.ydlcommon.app ...@@ -3,10 +3,7 @@ package com.ydl.ydlcommon.app
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Application import android.app.Application
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.lzy.imagepicker.ImagePicker
import com.lzy.imagepicker.view.CropImageView
import com.ydl.devicesidlib.DeviceIDHelper import com.ydl.devicesidlib.DeviceIDHelper
import com.ydl.ydlcommon.actions.imagepicker.YdlImageLoader
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.UpLoadLogUtils import com.ydl.ydlcommon.data.http.UpLoadLogUtils
import com.ydl.ydlcommon.utils.AppProgressUtils import com.ydl.ydlcommon.utils.AppProgressUtils
...@@ -38,7 +35,6 @@ object YdlRepository { ...@@ -38,7 +35,6 @@ object YdlRepository {
//初始化工具类 //初始化工具类
RxTool.init(app) RxTool.init(app)
BuryPointUtils.init() BuryPointUtils.init()
initImagePicker()
// if (LeakCanary.isInAnalyzerProcess(app)) { // if (LeakCanary.isInAnalyzerProcess(app)) {
// // This process is dedicated to LeakCanary for heap analysis. // // This process is dedicated to LeakCanary for heap analysis.
...@@ -75,20 +71,4 @@ object YdlRepository { ...@@ -75,20 +71,4 @@ object YdlRepository {
} }
ARouter.init(app) ARouter.init(app)
} }
private fun initImagePicker() {
val imagePicker = ImagePicker.getInstance()
imagePicker.imageLoader = YdlImageLoader() //设置图片加载器
imagePicker.isEdit = true //设置图片是否可编辑
imagePicker.isShowCamera = true //显示拍照按钮
imagePicker.isCrop = true //允许裁剪(单选才有效)
imagePicker.isSaveRectangle = true //是否按矩形区域保存
imagePicker.selectLimit = 9 //选中数量限制
imagePicker.style = CropImageView.Style.RECTANGLE //裁剪框的形状
imagePicker.focusWidth = 800 //裁剪框的宽度。单位像素(圆形自动取宽高最小值)
imagePicker.focusHeight = 800 //裁剪框的高度。单位像素(圆形自动取宽高最小值)
imagePicker.outPutX = 1000//保存文件的宽度。单位像素
imagePicker.outPutY = 1000//保存文件的高度。单位像素
}
} }
\ No newline at end of file
package com.ydl.ydlcommon.utils.log package com.ydl.ydlcommon.utils.log
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.util.Log import android.util.Log
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
...@@ -45,7 +46,7 @@ class LogHelper private constructor() { ...@@ -45,7 +46,7 @@ class LogHelper private constructor() {
/** /**
* 删除过期日志 * 删除过期日志
*/ */
fun deleteExpireLog() { private fun deleteExpireLog() {
val files = getLogFolder().listFiles() val files = getLogFolder().listFiles()
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()
calendar.add(Calendar.WEEK_OF_YEAR, -1) calendar.add(Calendar.WEEK_OF_YEAR, -1)
...@@ -58,7 +59,9 @@ class LogHelper private constructor() { ...@@ -58,7 +59,9 @@ class LogHelper private constructor() {
} }
} }
@SuppressLint("SimpleDateFormat")
private val dateFormat = SimpleDateFormat("yyyyMMdd") private val dateFormat = SimpleDateFormat("yyyyMMdd")
@SuppressLint("SimpleDateFormat")
private val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") private val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
fun writeLogSync(content: String) { fun writeLogSync(content: String) {
...@@ -107,6 +110,7 @@ class LogHelper private constructor() { ...@@ -107,6 +110,7 @@ class LogHelper private constructor() {
} }
@SuppressLint("CheckResult")
fun uploadLog(showToast: Boolean) { fun uploadLog(showToast: Boolean) {
Observable.create<File> { Observable.create<File> {
it.onNext(zip()) it.onNext(zip())
......
package com.ydl.ydlcommon.view.banner; package com.ydl.ydlcommon.view.banner;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.net.Uri; import android.net.Uri;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.lzy.imagepicker.loader.ImageLoader;
import com.ydl.ydl_image.config.ISimpleImageOpConfig; import com.ydl.ydl_image.config.ISimpleImageOpConfig;
import com.ydl.ydl_image.config.SimpleImageOpConfiger; import com.ydl.ydl_image.config.SimpleImageOpConfiger;
import com.ydl.ydl_image.manager.YDLImageCacheManager; import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.R; import com.ydl.ydlcommon.R;
import com.ydl.ydlcommon.view.banner.loader.ImageLoader;
/** /**
* Created by xiongyu on 2017/4/7. * Created by xiongyu on 2017/4/7.
*/ */
public class GlideImageDisplayLoader implements ImageLoader { public class GlideImageDisplayLoader extends ImageLoader {
@Override private int placeholderImage;//加载过程中的中间页面
public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) { private int radius = 0;
showImage(activity,path,imageView,width,height);
}
@Override public GlideImageDisplayLoader() {
public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) {
showImage(activity,path,imageView,width,height);
} }
@Override public GlideImageDisplayLoader(int placeholderImage) {
public void displayImage(Activity activity, Uri uri, ImageView imageView, int width, int i1) { this.placeholderImage = placeholderImage;
GlideApp.with(activity) //配置上下文
.load(uri) //设置图片路径(fix #8,文件名包含%符号 无法识别和显示)
.error(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置错误图片
.placeholder(com.ydl.ydlcommon.R.drawable.platform_default_img) //设置占位图片
.diskCacheStrategy(DiskCacheStrategy.ALL)//缓存全尺寸
.into(imageView);
} }
private void showImage(Activity activity, String path, ImageView imageView, int width, int height){ public GlideImageDisplayLoader(int placeholderImage, int radius) {
SimpleImageOpConfiger sp = new SimpleImageOpConfiger(); this.placeholderImage = placeholderImage;
sp.loadingPic = R.drawable.platform_default_img; this.radius = radius;
sp.errorPic = R.drawable.platform_default_img;
sp.scaleType = ISimpleImageOpConfig.CENTER_CROP;
sp.isCacheOnDisk = false;
YDLImageCacheManager.showImage(activity,path,imageView,width, height,sp);
} }
@Override @Override
public void clearMemoryCache() { public void displayImage(Context context, Object path, ImageView imageView) {
if (placeholderImage > 0) {
if (path instanceof String) {
SimpleImageOpConfiger sp = new SimpleImageOpConfiger();
sp.loadingPic = placeholderImage;
sp.scaleType = ISimpleImageOpConfig.CENTER_CROP;
sp.transform = ISimpleImageOpConfig.TRANSFORM_ROUND;
sp.radius = radius;
sp.transition = false;
YDLImageCacheManager.showImage(context, (String) path, imageView, imageView.getWidth(), imageView.getHeight(), sp);
}
} else {
if (path instanceof String) {
if (imageView != null) {
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
YDLImageCacheManager.showImage(context, (String) path, imageView, imageView.getWidth());
}
}
} }
} }
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