Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yunlaboratory
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
lihuaikun
yunlaboratory
Commits
5ce668d4
Commit
5ce668d4
authored
Jun 19, 2020
by
lihuaikun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复bug
parent
89d4cbf3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
206 additions
and
62 deletions
+206
-62
app-release.apk
app/release/app-release.apk
+0
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-3
ScanActivity.java
...ava/cn/dankal/yunlaboratory/ui/activity/ScanActivity.java
+1
-1
StartTestActivity.java
...n/dankal/yunlaboratory/ui/activity/StartTestActivity.java
+2
-2
UploadResultActivity.java
...ankal/yunlaboratory/ui/activity/UploadResultActivity.java
+4
-1
PersonFragment.java
...a/cn/dankal/yunlaboratory/ui/fragment/PersonFragment.java
+53
-40
ScanFragment.java
...ava/cn/dankal/yunlaboratory/ui/fragment/ScanFragment.java
+9
-1
CustomFileProvider.java
...a/cn/dankal/yunlaboratory/ui/util/CustomFileProvider.java
+6
-0
FileUtils.java
.../main/java/cn/dankal/yunlaboratory/ui/util/FileUtils.java
+101
-0
file_paths.xml
app/src/main/res/xml/file_paths.xml
+9
-9
AndroidManifest.xml
baselib/src/main/AndroidManifest.xml
+2
-0
UserService.java
...lib/src/main/java/cn/dankal/basiclib/api/UserService.java
+4
-4
NormalSubscriber.java
...src/main/java/cn/dankal/basiclib/rx/NormalSubscriber.java
+11
-1
No files found.
app/release/app-release.apk
View file @
5ce668d4
No preview for this file type
app/src/main/AndroidManifest.xml
View file @
5ce668d4
...
...
@@ -22,7 +22,8 @@
</activity>
<activity
android:name=
".ui.activity.MainActivity"
android:screenOrientation=
"portrait"
></activity>
android:screenOrientation=
"portrait"
android:launchMode=
"singleTask"
></activity>
<activity
android:name=
".ui.activity.GetSampleActivity"
android:screenOrientation=
"portrait"
></activity>
...
...
@@ -41,8 +42,8 @@
android:screenOrientation=
"portrait"
></activity>
<provider
android:name=
"
androidx.core.content.
FileProvider"
android:authorities=
"${applicationId}.
file
provider"
android:name=
"
.ui.util.Custom
FileProvider"
android:authorities=
"${applicationId}.
image_
provider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
...
...
app/src/main/java/cn/dankal/yunlaboratory/ui/activity/ScanActivity.java
View file @
5ce668d4
...
...
@@ -44,7 +44,7 @@ public class ScanActivity extends BaseActivity implements OnCaptureCallback {
mCaptureHelper
.
setOnCaptureCallback
(
this
);
mCaptureHelper
.
onCreate
();
mCaptureHelper
.
vibrate
(
true
)
.
fullScreenScan
(
tru
e
)
//全屏扫码
.
fullScreenScan
(
fals
e
)
//全屏扫码
.
supportVerticalCode
(
true
)
//支持扫垂直条码,建议有此需求时才使用。
.
supportLuminanceInvert
(
true
);
//是否支持识别反色码(黑白反色的码),增加识别率
}
...
...
app/src/main/java/cn/dankal/yunlaboratory/ui/activity/StartTestActivity.java
View file @
5ce668d4
...
...
@@ -148,7 +148,7 @@ public class StartTestActivity extends BaseActivity {
}
public
void
getProjectList
()
{
UserServiceFactory
.
getProjectList
(
recordModel
.
get
Id
()).
map
(
new
MapFunc
<>()).
subscribe
(
new
NormalSubscriber
<
BaseModel
<
List
<
ProjectModel
>>>()
{
UserServiceFactory
.
getProjectList
(
recordModel
.
get
Sample_num
()).
map
(
new
MapFunc
<>()).
subscribe
(
new
NormalSubscriber
<
BaseModel
<
List
<
ProjectModel
>>>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
...
...
@@ -174,7 +174,7 @@ public class StartTestActivity extends BaseActivity {
}
public
void
getDeviceList
()
{
UserServiceFactory
.
getDeviceList
(
recordModel
.
get
Id
()).
map
(
new
MapFunc
<>()).
subscribe
(
new
NormalSubscriber
<
BaseModel
<
List
<
ProjectModel
>>>()
{
UserServiceFactory
.
getDeviceList
(
recordModel
.
get
Sample_num
()).
map
(
new
MapFunc
<>()).
subscribe
(
new
NormalSubscriber
<
BaseModel
<
List
<
ProjectModel
>>>()
{
@Override
public
void
onSubscribe
(
Disposable
d
)
{
...
...
app/src/main/java/cn/dankal/yunlaboratory/ui/activity/UploadResultActivity.java
View file @
5ce668d4
package
cn
.
dankal
.
yunlaboratory
.
ui
.
activity
;
import
android.content.Intent
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.EditText
;
...
...
@@ -84,7 +85,6 @@ public class UploadResultActivity extends BaseActivity {
public
void
onNext
(
BaseModel
stringBaseModel
)
{
if
(
sampleRecordBody
!=
null
)
{
sampleRecordBody
.
setTest_time
(
TimeUtil
.
getTime
(
System
.
currentTimeMillis
()
/
1000
,
TimeUtil
.
DATEFORMATER
));
BaseApi
.
getRetrofit
(
BaseApi
.
OTHER_BASE_URL
).
create
(
UserService
.
class
).
sendsamplerecord
(
sampleRecordBody
)
.
observeOn
(
AndroidSchedulers
.
mainThread
()).
subscribeOn
(
Schedulers
.
io
()).
subscribe
(
new
NormalSubscriber
<
String
>()
{
...
...
@@ -102,6 +102,9 @@ public class UploadResultActivity extends BaseActivity {
view
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
Intent
intent
=
new
Intent
(
UploadResultActivity
.
this
,
MainActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
startActivity
(
intent
);
finish
();
}
},
1000
);
...
...
app/src/main/java/cn/dankal/yunlaboratory/ui/fragment/PersonFragment.java
View file @
5ce668d4
...
...
@@ -4,6 +4,8 @@ import android.Manifest;
import
android.app.Activity
;
import
android.content.ContentValues
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.icu.lang.UScript
;
import
android.net.Uri
;
import
android.os.Build
;
...
...
@@ -14,6 +16,7 @@ import android.view.View;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.FileProvider
;
import
androidx.core.os.EnvironmentCompat
;
...
...
@@ -24,6 +27,7 @@ import java.io.IOException;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Locale
;
import
api.UserServiceFactory
;
...
...
@@ -41,11 +45,14 @@ import cn.dankal.basiclib.rx.MapFunc;
import
cn.dankal.basiclib.rx.NormalSubscriber
;
import
cn.dankal.basiclib.util.FileUtil
;
import
cn.dankal.basiclib.util.GlideUtils
;
import
cn.dankal.basiclib.util.Logger
;
import
cn.dankal.basiclib.util.ToastUtils
;
import
cn.dankal.yunlaboratory.R
;
import
cn.dankal.yunlaboratory.ui.activity.ChangeNicknameActivity
;
import
cn.dankal.yunlaboratory.ui.activity.LoginActivity
;
import
cn.dankal.yunlaboratory.ui.dialog.ChooseAvatarDialog
;
import
cn.dankal.yunlaboratory.ui.dialog.RenderDialog
;
import
cn.dankal.yunlaboratory.ui.util.FileUtils
;
import
cn.dankal.yunlaboratory.ui.widget.MainButton
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.functions.Consumer
;
...
...
@@ -55,8 +62,8 @@ import okhttp3.RequestBody;
public
class
PersonFragment
extends
BaseFragment
implements
View
.
OnClickListener
{
public
static
final
int
RC_CHOOSE_PHOTO
=
0x
1
;
public
static
final
int
CAMERA_REQUEST_CODE
=
0x
2
;
public
static
final
int
RC_CHOOSE_PHOTO
=
1
;
public
static
final
int
CAMERA_REQUEST_CODE
=
2
;
@BindView
(
R
.
id
.
iv_onback
)
ImageView
ivOnback
;
...
...
@@ -83,6 +90,8 @@ public class PersonFragment extends BaseFragment implements View.OnClickListener
// 是否是Android 10以上手机
private
boolean
isAndroidQ
=
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
P
;
private
File
tempPhotoFile
;
public
static
PersonFragment
getInstance
()
{
PersonFragment
personFragment
=
new
PersonFragment
();
return
personFragment
;
...
...
@@ -164,39 +173,34 @@ public class PersonFragment extends BaseFragment implements View.OnClickListener
* 调起相机拍照
*/
private
void
openCamera
()
{
Intent
captureIntent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
// 判断是否有相机
if
(
captureIntent
.
resolveActivity
(
getContext
().
getPackageManager
())
!=
null
)
{
File
photoFile
=
null
;
Uri
photoUri
=
null
;
if
(
isAndroidQ
)
{
// 适配android 10
photoUri
=
createImageUri
();
}
else
{
try
{
photoFile
=
createImageFile
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
CAMERA
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
CAMERA_REQUEST_CODE
);
return
;
}
if
(
photoFile
!=
null
)
{
mCameraImagePath
=
photoFile
.
getAbsolutePath
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
//适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri
photoUri
=
FileProvider
.
getUriForFile
(
getContext
(),
getContext
().
getPackageName
()
+
".fileprovider"
,
photoFile
);
}
else
{
photoUri
=
Uri
.
fromFile
(
photoFile
);
}
}
}
Intent
cameraIntent
=
new
Intent
(
MediaStore
.
ACTION_IMAGE_CAPTURE
);
if
(
cameraIntent
.
resolveActivity
(
getContext
().
getPackageManager
())
!=
null
)
{
tempPhotoFile
=
new
File
(
FileUtils
.
createRootPath
(
getContext
())
+
"/"
+
System
.
currentTimeMillis
()
+
".jpg"
);
FileUtils
.
createFile
(
tempPhotoFile
);
mCameraUri
=
photoUri
;
if
(
photoUri
!=
null
)
{
captureIntent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
photoUri
);
captureIntent
.
addFlags
(
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
);
startActivityForResult
(
captureIntent
,
CAMERA_REQUEST_CODE
);
Uri
uri
=
FileProvider
.
getUriForFile
(
getContext
(),
"cn.dankal.yunlaboratory.image_provider"
,
tempPhotoFile
);
List
<
ResolveInfo
>
resInfoList
=
getContext
().
getPackageManager
().
queryIntentActivities
(
cameraIntent
,
PackageManager
.
MATCH_DEFAULT_ONLY
);
for
(
ResolveInfo
resolveInfo
:
resInfoList
)
{
String
packageName
=
resolveInfo
.
activityInfo
.
packageName
;
getActivity
().
grantUriPermission
(
packageName
,
uri
,
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
|
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
cameraIntent
.
putExtra
(
MediaStore
.
EXTRA_OUTPUT
,
uri
);
//Uri.fromFile(tempFile)
startActivityForResult
(
cameraIntent
,
CAMERA_REQUEST_CODE
);
}
else
{
ToastUtils
.
showLong
(
"打开相机失败"
);
}
}
...
...
@@ -269,11 +273,16 @@ public class PersonFragment extends BaseFragment implements View.OnClickListener
if
(
requestCode
==
RC_CHOOSE_PHOTO
)
{
Uri
uri
=
data
.
getData
();
updateAvatar
(
uri
);
updateAvatar
(
FileUtil
.
getRealFilePath
(
getContext
(),
uri
)
);
}
else
if
(
requestCode
==
CAMERA_REQUEST_CODE
)
{
updateAvatar
(
mCameraUri
);
if
(
tempPhotoFile
!=
null
)
{
updateAvatar
(
tempPhotoFile
.
getAbsolutePath
());
}
}
}
else
{
if
(
tempPhotoFile
!=
null
&&
tempPhotoFile
.
exists
())
{
tempPhotoFile
.
delete
();
}
}
}
...
...
@@ -308,13 +317,14 @@ public class PersonFragment extends BaseFragment implements View.OnClickListener
}
/**
* 更新头像
*
* @param uri
*/
private
void
updateAvatar
(
Uri
uri
)
{
if
(!
TextUtils
.
isEmpty
(
uri
.
toString
()))
{
private
void
updateAvatar
(
String
path
)
{
if
(!
TextUtils
.
isEmpty
(
path
))
{
HashMap
<
String
,
RequestBody
>
map
=
new
HashMap
<>();
...
...
@@ -322,7 +332,7 @@ public class PersonFragment extends BaseFragment implements View.OnClickListener
RequestBody
updateTypeBody
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
"avatar"
);
map
.
put
(
"update_type"
,
updateTypeBody
);
File
file
=
new
File
(
FileUtil
.
getRealFilePath
(
getContext
(),
uri
)
);
File
file
=
new
File
(
path
);
RequestBody
fileRQ
=
RequestBody
.
create
(
MediaType
.
parse
(
"image/png"
),
file
);
MultipartBody
.
Part
part
=
MultipartBody
.
Part
.
createFormData
(
"file"
,
file
.
getName
(),
fileRQ
);
...
...
@@ -357,6 +367,9 @@ public class PersonFragment extends BaseFragment implements View.OnClickListener
}
}
@Override
public
void
onDestroy
()
{
AppBus
.
getInstance
().
unregister
(
this
);
...
...
app/src/main/java/cn/dankal/yunlaboratory/ui/fragment/ScanFragment.java
View file @
5ce668d4
...
...
@@ -14,6 +14,7 @@ import com.tbruyelle.rxpermissions2.RxPermissions;
import
api.UserServiceFactory
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
cn.dankal.basiclib.DKUserManager
;
import
cn.dankal.basiclib.base.fragment.BaseFragment
;
import
cn.dankal.basiclib.model.BaseModel
;
import
cn.dankal.basiclib.model.SampleModel
;
...
...
@@ -63,6 +64,10 @@ public class ScanFragment extends BaseFragment {
}
});
if
(
DKUserManager
.
getUserInfo
()!=
null
&&!
TextUtils
.
isEmpty
(
DKUserManager
.
getUserInfo
().
getName
())){
tvHelloName
.
setText
(
"Hello,"
+
DKUserManager
.
getUserInfo
().
getName
());
}
inputPersonNoDialog
.
setViewClick
(
R
.
id
.
tv_positive
,
new
View
.
OnClickListener
()
{
@Override
...
...
@@ -80,6 +85,7 @@ public class ScanFragment extends BaseFragment {
public
void
onNext
(
BaseModel
<
SubmitRecordModel
>
submitRecordModelBaseModel
)
{
SubmitRecordModel
model
=
submitRecordModelBaseModel
.
getData
();
Intent
intent
=
new
Intent
(
getContext
(),
GetSampleActivity
.
class
);
model
.
setSample_num
(
codeResult
);
intent
.
putExtra
(
"data"
,
model
);
getContext
().
startActivity
(
intent
);
}
...
...
@@ -139,7 +145,9 @@ public class ScanFragment extends BaseFragment {
getBackSampleDialog
.
show
();
}
else
{
Intent
intent
=
new
Intent
(
getContext
(),
GetSampleActivity
.
class
);
intent
.
putExtra
(
"data"
,
sampleModel
.
getUpload_list
());
SubmitRecordModel
model
=
sampleModelBaseModel
.
getData
().
getUpload_list
();
model
.
setSample_num
(
codeResult
);
intent
.
putExtra
(
"data"
,
model
);
getContext
().
startActivity
(
intent
);
}
}
...
...
app/src/main/java/cn/dankal/yunlaboratory/ui/util/CustomFileProvider.java
0 → 100644
View file @
5ce668d4
package
cn
.
dankal
.
yunlaboratory
.
ui
.
util
;
import
androidx.core.content.FileProvider
;
public
class
CustomFileProvider
extends
FileProvider
{
}
app/src/main/java/cn/dankal/yunlaboratory/ui/util/FileUtils.java
0 → 100644
View file @
5ce668d4
package
cn
.
dankal
.
yunlaboratory
.
ui
.
util
;
import
android.content.Context
;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageManager
;
import
android.os.Environment
;
import
java.io.File
;
/**
* @author yuyh.
* @date 16/4/9.
*/
public
class
FileUtils
{
private
static
final
String
TAG
=
FileUtils
.
class
.
getSimpleName
();
/**
* 创建根缓存目录
*
* @return
*/
public
static
String
createRootPath
(
Context
context
)
{
String
cacheRootPath
=
""
;
if
(
isSdCardAvailable
())
{
// /sdcard/Android/data/<application package>/cache
cacheRootPath
=
context
.
getExternalCacheDir
().
getPath
();
}
else
{
// /data/data/<application package>/cache
cacheRootPath
=
context
.
getCacheDir
().
getPath
();
}
return
cacheRootPath
;
}
public
static
boolean
isSdCardAvailable
()
{
return
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
());
}
/**
* 递归创建文件夹
*
* @param dirPath
* @return 创建失败返回""
*/
public
static
String
createDir
(
String
dirPath
)
{
try
{
File
file
=
new
File
(
dirPath
);
if
(
file
.
getParentFile
().
exists
())
{
file
.
mkdir
();
return
file
.
getAbsolutePath
();
}
else
{
createDir
(
file
.
getParentFile
().
getAbsolutePath
());
file
.
mkdir
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
dirPath
;
}
/**
* 递归创建文件夹
*
* @param file
* @return 创建失败返回""
*/
public
static
String
createFile
(
File
file
)
{
try
{
if
(
file
.
getParentFile
().
exists
())
{
file
.
createNewFile
();
return
file
.
getAbsolutePath
();
}
else
{
createDir
(
file
.
getParentFile
().
getAbsolutePath
());
file
.
createNewFile
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
""
;
}
public
static
String
getApplicationId
(
Context
appContext
)
throws
IllegalArgumentException
{
ApplicationInfo
applicationInfo
=
null
;
try
{
applicationInfo
=
appContext
.
getPackageManager
().
getApplicationInfo
(
appContext
.
getPackageName
(),
PackageManager
.
GET_META_DATA
);
if
(
applicationInfo
==
null
)
{
throw
new
IllegalArgumentException
(
" get application info = null, has no meta data! "
);
}
return
applicationInfo
.
metaData
.
getString
(
"APP_ID"
);
}
catch
(
PackageManager
.
NameNotFoundException
e
)
{
throw
new
IllegalArgumentException
(
" get application info error! "
,
e
);
}
}
}
\ No newline at end of file
app/src/main/res/xml/file_paths.xml
View file @
5ce668d4
<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<!-- 这个是保存拍照图片的路径,必须配置。 -->
<external-files-path
name=
"images"
path=
"Pictures"
/>
</paths>
</resources>
\ No newline at end of file
<paths>
<external-path
name=
"external_files"
path=
"."
/>
<root-path
name=
"external_files"
path=
"/storage/"
/>
</paths>
\ No newline at end of file
baselib/src/main/AndroidManifest.xml
View file @
5ce668d4
...
...
@@ -13,6 +13,7 @@
<!-- <activity android:name="cn.dankal.packagename.wxapi.WXEntryActivity"-->
<!-- android:exported="true"-->
<!-- android:screenOrientation="portrait"/>-->
</application>
</manifest>
\ No newline at end of file
baselib/src/main/java/cn/dankal/basiclib/api/UserService.java
View file @
5ce668d4
...
...
@@ -66,14 +66,14 @@ public interface UserService {
* 获取项目
*/
@GET
(
"project"
)
Observable
<
BaseModel
<
List
<
ProjectModel
>>>
getProjectList
(
@Query
(
"sample_
id"
)
int
sample_id
);
Observable
<
BaseModel
<
List
<
ProjectModel
>>>
getProjectList
(
@Query
(
"sample_
num"
)
String
sample_num
);
/**
* 获取设备
*/
@GET
(
"device"
)
Observable
<
BaseModel
<
List
<
ProjectModel
>>>
getDeviceList
(
@Query
(
"sample_
id"
)
int
sample_id
);
Observable
<
BaseModel
<
List
<
ProjectModel
>>>
getDeviceList
(
@Query
(
"sample_
num"
)
String
sample_num
);
/**
...
...
@@ -113,7 +113,7 @@ public interface UserService {
* @return
*/
@FormUrlEncoded
@P
U
T
(
"update/info"
)
@P
OS
T
(
"update/info"
)
Observable
<
BaseModel
>
updateName
(
@Field
(
"update_type"
)
String
type
,
@Field
(
"name"
)
String
name
);
...
...
@@ -127,7 +127,7 @@ public interface UserService {
*
* @return
*/
@P
U
T
(
"update/info"
)
@P
OS
T
(
"update/info"
)
@FormUrlEncoded
Observable
<
BaseModel
>
updateSex
(
@Field
(
"update_type"
)
String
type
,
@Field
(
"sex"
)
int
sex
);
...
...
baselib/src/main/java/cn/dankal/basiclib/rx/NormalSubscriber.java
View file @
5ce668d4
...
...
@@ -8,6 +8,7 @@ import cn.dankal.basiclib.DKUserManager;
import
cn.dankal.basiclib.DankalApplication
;
import
cn.dankal.basiclib.R
;
import
cn.dankal.basiclib.domain.HttpStatusCode
;
import
cn.dankal.basiclib.exception.ApiException
;
import
cn.dankal.basiclib.exception.LocalException
;
import
cn.dankal.basiclib.util.ActivityUtils
;
import
cn.dankal.basiclib.util.ToastUtils
;
...
...
@@ -23,7 +24,16 @@ public abstract class NormalSubscriber<T> implements Observer<T> {
@Override
public
void
onError
(
Throwable
e
)
{
ToastUtils
.
showLong
(
e
.
getLocalizedMessage
());
if
(
e
instanceof
LocalException
){
LocalException
localException
=
(
LocalException
)
e
;
ToastUtils
.
showLong
(
localException
.
getMsg
());
}
else
if
(
e
instanceof
ApiException
){
ApiException
exception
=
(
ApiException
)
e
;
ToastUtils
.
showLong
(
exception
.
getMessage
());
}
else
{
ToastUtils
.
showLong
(
e
.
getLocalizedMessage
());
}
onComplete
();
}
...
...
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