Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
f33ec28d
Commit
f33ec28d
authored
Apr 19, 2019
by
sikang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://47.100.14.92:8929/sikang/lib_base
update string#
parents
a23c570d
16e80b6a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
script/code/rename_api.py
+1
-1
src/main/java/tech/starwin/base/BasePresenter.java
+1
-1
src/main/java/tech/starwin/impl/HttpObserver.java
+13
-1
No files found.
script/code/rename_api.py
View file @
f33ec28d
...
@@ -23,7 +23,7 @@ def rename_api(path):
...
@@ -23,7 +23,7 @@ def rename_api(path):
if
"//API-REPAIR*-*"
in
api_l
:
if
"//API-REPAIR*-*"
in
api_l
:
api_l
=
"
\t
"
+
api_l
.
split
(
"*-*"
)[
1
]
api_l
=
"
\t
"
+
api_l
.
split
(
"*-*"
)[
1
]
if
(
api_map
[
1
]
+
"/"
in
api_l
or
api_map
[
1
]
+
"
\"
"
in
api_l
)
and
(
"@GET"
in
api_l
or
"@PUT"
in
api_l
or
"@POST"
in
api_l
):
if
(
api_map
[
1
]
+
"/
{
"
in
api_l
or
api_map
[
1
]
+
"
\"
"
in
api_l
)
and
(
"@GET"
in
api_l
or
"@PUT"
in
api_l
or
"@POST"
in
api_l
):
api_l
=
api_l
.
replace
(
api_map
[
1
],
api_map
[
0
])
api_l
=
api_l
.
replace
(
api_map
[
1
],
api_map
[
0
])
print
(
api_map
[
1
]
+
" -> "
+
api_map
[
0
])
print
(
api_map
[
1
]
+
" -> "
+
api_map
[
0
])
f_w
.
write
(
api_l
)
f_w
.
write
(
api_l
)
...
...
src/main/java/tech/starwin/base/BasePresenter.java
View file @
f33ec28d
...
@@ -54,7 +54,7 @@ public class BasePresenter<T> {
...
@@ -54,7 +54,7 @@ public class BasePresenter<T> {
observable
.
subscribeOn
(
Schedulers
.
io
())
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
compose
(
view
.<
T
>
bindToLifecycle
())
.
compose
(
view
.<
T
>
bindToLifecycle
())
.
subscribe
(
new
HttpObserver
<
T
>()
{
.
subscribe
(
new
HttpObserver
<
T
>(
action
)
{
@Override
@Override
public
void
onStart
()
{
public
void
onStart
()
{
view
.
onHttpStart
(
action
,
true
);
view
.
onHttpStart
(
action
,
true
);
...
...
src/main/java/tech/starwin/impl/HttpObserver.java
View file @
f33ec28d
...
@@ -9,9 +9,11 @@ import io.reactivex.disposables.Disposable;
...
@@ -9,9 +9,11 @@ import io.reactivex.disposables.Disposable;
import
retrofit2.HttpException
;
import
retrofit2.HttpException
;
import
tech.starwin.R
;
import
tech.starwin.R
;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
import
com.common.bean.BasicAck
;
import
com.common.bean.BasicAck
;
import
com.common.bean.ResponseErrorBody
;
import
com.common.bean.ResponseErrorBody
;
import
com.common.bean.UpdateBean
;
import
com.common.bean.UpdateBean
;
import
tech.starwin.network.Error
;
import
tech.starwin.network.Error
;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.LoginManager
;
...
@@ -21,6 +23,16 @@ import tech.starwin.utils.LoginManager;
...
@@ -21,6 +23,16 @@ import tech.starwin.utils.LoginManager;
* HTTP请求回调
* HTTP请求回调
*/
*/
public
abstract
class
HttpObserver
<
T
>
implements
Observer
<
T
>
{
public
abstract
class
HttpObserver
<
T
>
implements
Observer
<
T
>
{
private
String
action
;
public
HttpObserver
()
{
}
public
HttpObserver
(
String
action
)
{
this
.
action
=
action
;
}
private
Disposable
disposable
;
private
Disposable
disposable
;
public
abstract
void
onStart
();
public
abstract
void
onStart
();
...
@@ -48,7 +60,7 @@ public abstract class HttpObserver<T> implements Observer<T> {
...
@@ -48,7 +60,7 @@ public abstract class HttpObserver<T> implements Observer<T> {
public
void
onError
(
Throwable
throwable
)
{
public
void
onError
(
Throwable
throwable
)
{
onFinish
();
onFinish
();
String
msg
=
throwable
.
getMessage
();
String
msg
=
throwable
.
getMessage
();
LogUtils
.
d
(
"HttpObserver"
,
"
error msg : "
+
msg
);
LogUtils
.
d
(
"HttpObserver"
,
action
+
" ->
error msg : "
+
msg
);
try
{
try
{
if
(
throwable
!=
null
)
{
if
(
throwable
!=
null
)
{
if
(
isNetworkError
(
msg
))
{
if
(
isNetworkError
(
msg
))
{
...
...
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