Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
b12fe3f8
Commit
b12fe3f8
authored
Dec 16, 2019
by
konghaorui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复线上bug
parent
bbb23593
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
62 additions
and
30 deletions
+62
-30
MainActivity.kt
app/src/main/java/com/ydl/component/MainActivity.kt
+3
-3
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+2
-2
DemoModel.kt
app/src/main/java/com/ydl/component/mvp/DemoModel.kt
+3
-1
DemoPresenter.kt
app/src/main/java/com/ydl/component/mvp/DemoPresenter.kt
+5
-0
config.gradle
config.gradle
+1
-1
OkHttpConfig.java
ydl-net/src/main/java/com/ydl/ydlnet/builder/config/OkHttpConfig.java
+3
-1
BaseObserver.java
ydl-net/src/main/java/com/ydl/ydlnet/client/observer/BaseObserver.java
+5
-1
ToastHelper.kt
ydl-pay/src/main/java/com/yidianling/ydl_pay/toast/ToastHelper.kt
+10
-8
YdlRepository.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/app/YdlRepository.kt
+19
-0
ThrowableConsumer.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/ThrowableConsumer.kt
+1
-1
ToastHelper.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/remind/ToastHelper.kt
+9
-11
ToastUtil.java
ydl-utils/src/main/java/com/yidianling/common/tools/ToastUtil.java
+1
-1
No files found.
app/src/main/java/com/ydl/component/MainActivity.kt
View file @
b12fe3f8
...
...
@@ -63,17 +63,17 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override
fun
initDataAndEvent
()
{
YDLavManager
.
instances
.
init
(
this
,
"3387e9b251f3491e9221a9877e8f7830"
)
//
YDLavManager.instances.init(this, "3387e9b251f3491e9221a9877e8f7830")
bindService
()
reLoadData
()
requestPermission
()
tv_user
.
setOnClickListener
{
reLoadData
()
mPresenter
.
loadFmMusic
()
}
tv_home
.
setOnClickListener
{
mPresenter
?
.
loadHome
()
mPresenter
.
loadHome
()
}
bt_to_other
.
setOnClickListener
{
...
...
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
b12fe3f8
...
...
@@ -26,8 +26,8 @@ public final class DemoGlobalConfig implements IConfigModule {
@Override
public
void
applyOptions
(
@NotNull
Context
context
,
@NotNull
GlobalConfig
.
Builder
builder
)
{
// String env = YDLConstants.ENV_AUTO_TEST;
//
String env = YDLConstants.ENV_PROD;
String
env
=
YDLConstants
.
ENV_TEST
;
String
env
=
YDLConstants
.
ENV_PROD
;
//
String env = YDLConstants.ENV_TEST;
builder
.
setFrom
(
"ydl"
.
equals
(
BuildConfig
.
FLAVOR
)
?
YDLConstants
.
FROM_YDL
:
YDLConstants
.
FROM_XLZX
)
.
addUrl
(
"github"
,
APP_DOMAIN
)
...
...
app/src/main/java/com/ydl/component/mvp/DemoModel.kt
View file @
b12fe3f8
...
...
@@ -20,7 +20,9 @@ class DemoModel : BaseModel(), DemoContract.Model {
return
YDLHttpUtils
.
obtainApi
(
DemoService
::
class
.
java
)
.
getFMData
()
.
compose
(
RxUtils
.
resultJavaData
())
.
map
{
throw
RuntimeException
(
"runtime exception"
)
}
}
override
fun
getHome
():
Observable
<
JsonObject
>
{
...
...
app/src/main/java/com/ydl/component/mvp/DemoPresenter.kt
View file @
b12fe3f8
...
...
@@ -7,6 +7,7 @@ import com.ydl.media.audio.AudioPlayer
import
com.ydl.media.audio.model.Music
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.mvp.base.BasePresenter
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlnet.client.observer.CommonObserver
/**
...
...
@@ -21,15 +22,18 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
.
compose
(
RxUtils
.
applySchedulers
(
mView
))
.
subscribe
(
object
:
CommonObserver
<
HomeFMBean
>()
{
override
fun
onError
(
errorMsg
:
String
)
{
LogUtil
.
d
(
"RxJava loadUsers ---->: $errorMsg"
)
}
override
fun
onSuccess
(
homeFMBean
:
HomeFMBean
)
{
throw
RuntimeException
(
"runtime exception"
)
homeFMBean
.
list
?.
let
{
AudioPlayer
.
get
().
addPlayList
(
stringToMusicPlayerList
(
it
))
mView
.
setData
(
""
)
}
}
})
}
override
fun
loadHome
()
=
mModel
.
getHome
()
...
...
@@ -52,6 +56,7 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
.
compose
(
RxUtils
.
applySchedulers
(
mView
))
//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.
subscribe
(
object
:
CommonObserver
<
JsonArray
>()
{
override
fun
onError
(
errorMsg
:
String
)
{
LogUtil
.
d
(
"RxJava loadUsers ---->: $errorMsg"
)
}
override
fun
onSuccess
(
users
:
JsonArray
)
{
...
...
config.gradle
View file @
b12fe3f8
ext
{
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
...
...
ydl-net/src/main/java/com/ydl/ydlnet/builder/config/OkHttpConfig.java
View file @
b12fe3f8
...
...
@@ -17,6 +17,7 @@ import com.ydl.ydlnet.client.interfaces.BuildHeadersListener;
import
java.io.File
;
import
java.io.InputStream
;
import
java.util.Collections
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -25,6 +26,7 @@ import javax.net.ssl.HostnameVerifier;
import
okhttp3.Cache
;
import
okhttp3.Interceptor
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Protocol
;
/**
* Created by haorui on 2019-09-02 .
...
...
@@ -45,7 +47,7 @@ public class OkHttpConfig {
private
static
OkHttpClient
okHttpClient
;
public
OkHttpConfig
()
{
okHttpClientBuilder
=
new
OkHttpClient
.
Builder
();
okHttpClientBuilder
=
new
OkHttpClient
.
Builder
()
.
protocols
(
Collections
.
singletonList
(
Protocol
.
HTTP_1_1
))
;
}
public
static
OkHttpConfig
getInstance
()
{
...
...
ydl-net/src/main/java/com/ydl/ydlnet/client/observer/BaseObserver.java
View file @
b12fe3f8
...
...
@@ -29,7 +29,11 @@ public abstract class BaseObserver<T> implements Observer<T>, ISubscriber<T> {
@Override
public
void
onNext
(
@NonNull
T
t
)
{
doOnNext
(
t
);
try
{
doOnNext
(
t
);
}
catch
(
Exception
e
)
{
onError
(
e
);
}
}
@Override
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/toast/ToastHelper.kt
View file @
b12fe3f8
...
...
@@ -2,8 +2,10 @@ package com.yidianling.ydl_pay.toast
import
android.content.Context
import
android.support.annotation.StringRes
import
android.text.TextUtils
import
android.widget.Toast
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.utils.LogUtil
import
com.yidianling.common.tools.ToastUtil
/**
* author : Zhangwenchao
...
...
@@ -31,16 +33,16 @@ class ToastHelper private constructor() {
}
private
fun
show
(
context
:
Context
,
text
:
CharSequence
)
{
if
(
TextUtils
.
isEmpty
(
text
))
return
if
(
toast
==
null
)
toast
=
Toast
.
makeText
(
context
,
text
,
Toast
.
LENGTH_SHORT
)
else
toast
?.
setText
(
text
)
toast
?.
show
()
ToastUtil
.
toastShort
(
text
.
toString
())
}
private
fun
show
(
context
:
Context
,
@StringRes
resId
:
Int
)
{
if
(
toast
==
null
)
toast
=
Toast
.
makeText
(
context
,
resId
,
Toast
.
LENGTH_SHORT
)
else
toast
?.
setText
(
resId
)
toast
?.
show
()
try
{
val
text
=
BaseApp
.
getApp
().
resources
.
getString
(
resId
)
ToastUtil
.
toastShort
(
text
)
}
catch
(
e
:
Exception
)
{
LogUtil
.
e
(
e
.
message
)
}
}
private
object
Holder
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/app/YdlRepository.kt
View file @
b12fe3f8
...
...
@@ -8,10 +8,13 @@ import com.lzy.imagepicker.view.CropImageView
import
com.ydl.devicesidlib.DeviceIDHelper
import
com.ydl.ydlcommon.actions.imagepicker.YdlImageLoader
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.data.http.UpLoadLogUtils
import
com.ydl.ydlcommon.utils.BuryPointUtils
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlnet.client.exception.ApiException
import
com.yidianling.common.tools.RxTool
import
io.reactivex.plugins.RxJavaPlugins
/**
...
...
@@ -41,6 +44,22 @@ object YdlRepository {
// }
// refWatcher = LeakCanary.install(app)
initARouter
(
app
,
isDebug
)
initRxPlugin
()
}
private
fun
initRxPlugin
()
{
//保障RxJava调用链流程不会崩溃
RxJavaPlugins
.
setErrorHandler
{
LogUtil
.
e
(
"RxJava ErrorHandler ---->: $it"
)
try
{
val
apiException
=
ApiException
.
handleException
(
it
)
UpLoadLogUtils
.
upLoadLog
(
"RxJava Error Handler "
,
apiException
.
code
,
apiException
.
message
?:
""
)
}
catch
(
e
:
Exception
)
{
LogUtil
.
d
(
"RxJava ErrorHandler UpLoad Log Error ---->: $it"
)
}
}
}
/**
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/ThrowableConsumer.kt
View file @
b12fe3f8
package
com.ydl.ydlcommon.data.http
import
android.text.TextUtils
import
com.ydl.ydlcommon.R
import
com.ydl.ydlcommon.base.BaseApp
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxNetTool
import
com.ydl.ydlcommon.R
import
io.reactivex.functions.Consumer
/**
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/remind/ToastHelper.kt
View file @
b12fe3f8
package
com.ydl.ydlcommon.utils.remind
import
android.support.annotation.StringRes
import
android.text.TextUtils
import
android.widget.Toast
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.utils.LogUtil
import
com.yidianling.common.tools.ToastUtil
/**
* author : Zhangwenchao
...
...
@@ -14,8 +14,6 @@ import com.ydl.ydlcommon.base.BaseApp
*/
class
ToastHelper
private
constructor
()
{
private
var
toast
:
Toast
?
=
null
companion
object
{
private
fun
getInstance
():
ToastHelper
{
return
Holder
.
INSTANCE
...
...
@@ -31,16 +29,16 @@ class ToastHelper private constructor() {
}
private
fun
show
(
text
:
CharSequence
)
{
if
(
TextUtils
.
isEmpty
(
text
))
return
if
(
toast
==
null
)
toast
=
Toast
.
makeText
(
BaseApp
.
getApp
(),
text
,
Toast
.
LENGTH_SHORT
)
else
toast
?.
setText
(
text
)
toast
?.
show
()
ToastUtil
.
toastShort
(
text
.
toString
())
}
private
fun
show
(
@StringRes
resId
:
Int
)
{
if
(
toast
==
null
)
toast
=
Toast
.
makeText
(
BaseApp
.
getApp
(),
resId
,
Toast
.
LENGTH_SHORT
)
else
toast
?.
setText
(
resId
)
toast
?.
show
()
try
{
val
text
=
BaseApp
.
getApp
().
resources
.
getString
(
resId
)
ToastUtil
.
toastShort
(
text
)
}
catch
(
e
:
Exception
)
{
LogUtil
.
e
(
e
.
message
)
}
}
private
object
Holder
{
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/ToastUtil.java
View file @
b12fe3f8
package
com
.
yidianling
.
common
.
tools
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.text.TextUtils
;
...
...
@@ -42,6 +41,7 @@ public class ToastUtil {
handler
.
post
(()
->
toastShort
(
RxTool
.
getContext
(),
msg
));
}
}
private
static
void
showShortToast
(
Context
mContext
,
String
msg
)
{
if
(
toast
==
null
)
{
toast
=
Toast
.
makeText
(
mContext
.
getApplicationContext
(),
msg
,
Toast
.
LENGTH_SHORT
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment