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
a35653fc
Commit
a35653fc
authored
Jan 04, 2020
by
严久程
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component
into dev
parents
8765823e
1e229327
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
521 additions
and
218 deletions
+521
-218
DemoAppLifecycles.java
app/src/main/java/com/ydl/component/base/DemoAppLifecycles.java
+8
-2
config.gradle
config.gradle
+2
-2
CourseNewListAdapter.java
m-course/src/main/java/com/yidianling/course/CourseNewListAdapter.java
+6
-0
HPlayView.kt
m-course/src/main/java/com/yidianling/course/widget/HPlayView.kt
+45
-14
BrowsePicturesActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity.java
+5
-5
BrowsePicturesActivity2.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity2.java
+4
-4
MembersActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/members/MembersActivity.java
+6
-6
SelecTopicActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/SelecTopicActivity.java
+4
-4
PublishQuestionAndTrendFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
+1
-1
AllTopicFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/topic/AllTopicFragment.java
+6
-6
TrendsDetailActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/trendsDetail/TrendsDetailActivity.java
+1
-1
TeamAVChatProfile.java
m-im/src/main/java/com/yidianling/avchatkit/TeamAVChatProfile.java
+2
-3
AVChatActivity.java
m-im/src/main/java/com/yidianling/avchatkit/activity/AVChatActivity.java
+8
-8
AVChatController.java
m-im/src/main/java/com/yidianling/avchatkit/controll/AVChatController.java
+14
-14
TeamAVChatActivity.java
m-im/src/main/java/com/yidianling/avchatkit/teamavchat/activity/TeamAVChatActivity.java
+4
-4
AVChatAudioUI.java
m-im/src/main/java/com/yidianling/avchatkit/ui/AVChatAudioUI.java
+1
-1
AVChatVideoUI.java
m-im/src/main/java/com/yidianling/avchatkit/ui/AVChatVideoUI.java
+2
-2
P2PCustomActionHandlerImpl.java
m-im/src/main/java/com/yidianling/im/bridge/P2PCustomActionHandlerImpl.java
+3
-4
WatchMessagePictureActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchMessagePictureActivity.java
+19
-19
YDLP2PMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
+4
-4
YDLTeamMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLTeamMessageActivity.java
+3
-3
YDLTeamMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
+1
-1
InputPanel.java
m-im/src/main/java/com/yidianling/uikit/business/session/module/input/InputPanel.java
+1
-1
MessageListPanelEx.java
m-im/src/main/java/com/yidianling/uikit/business/session/module/list/MessageListPanelEx.java
+4
-4
ImageOriginPager.java
m-im/src/main/java/com/yidianling/uikit/business/session/view/ImageOriginPager.java
+13
-17
im_nim_watch_picture_activity.xml
m-im/src/main/res_uikit/layout/im_nim_watch_picture_activity.xml
+1
-1
SelectConversationActivity.kt
m-tests/src/main/java/com/yidianling/tests/SelectConversationActivity.kt
+2
-2
AliAuthDemoActivity.java
m-user/src/main/java/com/yidianling/user/ui/AliAuthDemoActivity.java
+3
-3
FillInfoActivity.java
m-user/src/main/java/com/yidianling/user/ui/FillInfoActivity.java
+2
-2
AudioPlayer.kt
ydl-media/src/main/java/com/ydl/media/audio/AudioPlayer.kt
+1
-1
CommonObserver.java
ydl-net/src/main/java/com/ydl/ydlnet/client/observer/CommonObserver.java
+0
-5
DataObserver.java
ydl-net/src/main/java/com/ydl/ydlnet/client/observer/DataObserver.java
+1
-5
NetToastUtils.java
ydl-net/src/main/java/com/ydl/ydlnet/utils/NetToastUtils.java
+0
-27
build.gradle
ydl-platform/build.gradle
+2
-1
Utils.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/Utils.java
+7
-21
YDLAppProtector.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/YDLAppProtector.java
+5
-3
DownloadReceiver.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/receiver/DownloadReceiver.java
+1
-1
ToastUtil.java
ydl-utils/src/main/java/com/yidianling/common/tools/ToastUtil.java
+24
-16
BadTokenListener.java
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/BadTokenListener.java
+12
-0
SafeToastContext.java
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/SafeToastContext.java
+109
-0
ToastCompat.java
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/ToastCompat.java
+184
-0
No files found.
app/src/main/java/com/ydl/component/base/DemoAppLifecycles.java
View file @
a35653fc
...
...
@@ -104,14 +104,20 @@ public class DemoAppLifecycles implements IAppLifecycles {
//umeng
String
umAppkey
=
null
;
if
(
packageName
.
endsWith
(
"yidianling
"
))
{
if
(
BuildConfig
.
FLAVOR
.
endsWith
(
"ydl
"
))
{
umAppkey
=
"56970affe0f55a9cda001e24"
;
channel
=
"android_"
+
channel
;
initUM
(
umAppkey
,
channel
,
application
);
PlatformConfig
.
setWeixin
(
"wx57a9d930270498c7"
,
"17c031f02500ded3457a80e69d8e5e45"
);
PlatformConfig
.
setQQZone
(
"1105070461"
,
"6BvkUnk6wXJekcgR"
);
}
else
if
(
BuildConfig
.
FLAVOR
.
endsWith
(
"xlzx"
))
{
umAppkey
=
"5859e1656e27a42fa400021f"
;
channel
=
"ATK_7_android_"
+
channel
;
initUM
(
umAppkey
,
channel
,
application
);
PlatformConfig
.
setWeixin
(
"wx1c6af5a11b5f531f"
,
"1ddb93abbb2d81e604657d38e94a5720"
);
PlatformConfig
.
setQQZone
(
"1107931541"
,
"8dCvxUpi525uPGTJ"
);
}
PlatformConfig
.
setQQZone
(
"1105070461"
,
"6BvkUnk6wXJekcgR"
);
MobclickAgent
.
setScenarioType
(
application
,
MobclickAgent
.
EScenarioType
.
E_DUM_NORMAL
);
MobclickAgent
.
setCatchUncaughtExceptions
(!
BuildConfig
.
DEBUG
);
...
...
config.gradle
View file @
a35653fc
ext
{
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
...
...
@@ -256,7 +256,7 @@ ext {
"arouter-compiler"
:
"com.alibaba:arouter-compiler:1.2.2"
,
"exoplayer"
:
"com.google.android.exoplayer:exoplayer:2.9.0"
,
"free_reflection"
:
"me.weishu:free_reflection:2.0.0"
,
"imagepicker"
:
"com.ydl:imagepicker:1.0.
6
"
,
"imagepicker"
:
"com.ydl:imagepicker:1.0.
7
"
,
"protector"
:
"com.ydl:protector:1.0.1-SNAPSHOT@aar"
,
"ydl-hnet"
:
"com.ydl:h-net:0.0.8"
,
"ydl-user-router"
:
"com.ydl:router:1.0.0-SNAPSHOT@aar"
,
...
...
m-course/src/main/java/com/yidianling/course/CourseNewListAdapter.java
View file @
a35653fc
...
...
@@ -24,4 +24,10 @@ public class CourseNewListAdapter extends CommonAdapter<Course> {
((
CourseItemNewView
)
convertView
).
setData
(
mDataList
.
get
(
position
));
return
convertView
;
}
//修复 Android 4.4 Bug :cannot be cast to android.widget.AbsListView$LayoutParams
@Override
public
boolean
hasStableIds
()
{
return
true
;
}
}
m-course/src/main/java/com/yidianling/course/widget/HPlayView.kt
View file @
a35653fc
...
...
@@ -2,8 +2,13 @@ package com.yidianling.course.widget
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.os.Build
import
android.os.Handler
import
android.support.annotation.DrawableRes
import
android.support.annotation.Nullable
import
android.support.annotation.RawRes
import
android.view.View
import
android.widget.ImageView
import
android.widget.RelativeLayout
import
android.widget.SeekBar
import
com.bumptech.glide.Glide
...
...
@@ -13,10 +18,11 @@ import com.ydl.media.audio.enums.PlayModeEnum
import
com.ydl.media.audio.model.Music
import
com.ydl.media.view.PlayTypeEnum
import
com.ydl.media.view.PlayerFloatHelper
import
com.yidianling.course.R
import
com.yidianling.course.listener.HPlayStatusListener
import
kotlinx.android.synthetic.main.course_play_music_view.view.*
/**
* Created by hgw on 2018/4/28.
*/
...
...
@@ -37,7 +43,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
fun
init
()
{
if
(
mContext
==
null
)
return
View
.
inflate
(
context
,
R
.
layout
.
course_play_music_view
,
this
)
View
.
inflate
(
context
,
com
.
yidianling
.
course
.
R
.
layout
.
course_play_music_view
,
this
)
AudioPlayer
.
get
().
addOnPlayEventListener
(
this
)
course_audio_play_icon
.
setOnClickListener
{
...
...
@@ -116,7 +122,9 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
}
fun
setImageBackground
(
url
:
String
?)
{
Glide
.
with
(
mContext
).
load
(
url
).
into
(
img_bg
)
if
(!
isDestroy
()){
Glide
.
with
(
mContext
).
load
(
url
).
into
(
img_bg
)
}
}
/**
...
...
@@ -134,9 +142,9 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
@SuppressLint
(
"SetTextI18n"
)
override
fun
onChange
(
music
:
Music
)
{
if
(
mContext
!=
null
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_loading5
).
into
(
img_gif
)
displayImage
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_loading5
,
img_gif
,
true
)
}
course_audio_play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
course_audio_play_icon
.
setImageResource
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_ico_course_play
)
pro_progress
.
progress
=
0
text_start_time
.
text
=
"00:00"
...
...
@@ -190,15 +198,15 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if
(
show
)
{
if
(!
AudioPlayer
.
get
().
isPlaying
)
{
if
(
mContext
!=
null
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_loading5
).
into
(
img_gif
)
displayImage
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_loading5
,
img_gif
,
true
)
}
course_audio_play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
course_audio_play_icon
.
setImageResource
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_ico_course_play
)
}
}
else
{
if
(
mContext
!=
null
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_audio_play
).
into
(
img_gif
)
displayImage
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_audio_play
,
img_gif
,
true
)
}
course_audio_play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_pause
)
course_audio_play_icon
.
setImageResource
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_ico_course_pause
)
}
},
0
)
}
...
...
@@ -208,12 +216,11 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if
(
mContext
==
null
)
return
mHandler
?.
postDelayed
({
if
(
show
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_audio_play
).
into
(
img_gif
)
course_audio_play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_pause
)
displayImage
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_audio_play
,
img_gif
,
true
)
course_audio_play_icon
.
setImageResource
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_ico_course_pause
)
}
else
{
Glide
.
with
(
mContext
).
asBitmap
().
load
(
R
.
drawable
.
course_ico_course_bg_pause
)
.
into
(
img_gif
)
course_audio_play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
displayImage
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_ico_course_bg_pause
,
img_gif
)
course_audio_play_icon
.
setImageResource
(
com
.
yidianling
.
course
.
R
.
drawable
.
course_ico_course_play
)
}
},
0
)
}
...
...
@@ -250,4 +257,27 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
mContext
=
null
mHandler
=
null
}
/**
* 加载Image
*/
private
fun
displayImage
(
@RawRes
@DrawableRes
@Nullable
resourceId
:
Int
,
imageView
:
ImageView
,
isGif
:
Boolean
=
false
)
{
//判断当前页面是否销毁
if
(!
isDestroy
())
{
if
(
isGif
){
Glide
.
with
(
mContext
).
asGif
().
load
(
resourceId
).
into
(
imageView
)
}
else
{
Glide
.
with
(
mContext
).
asBitmap
().
load
(
resourceId
).
into
(
imageView
)
}
}
}
/**
* 判断Activity是否Destroy
* @param activity
* @return
*/
fun
isDestroy
():
Boolean
{
return
mContext
==
null
||
mContext
!!
.
isFinishing
||
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
&&
mContext
!!
.
isDestroyed
}
}
\ No newline at end of file
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity.java
View file @
a35653fc
...
...
@@ -18,9 +18,11 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.dynamic.DynamicConstants
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.common.net.DynamicApiUtils
;
...
...
@@ -28,8 +30,6 @@ import com.yidianling.dynamic.common.tool.DownLoadImageService;
import
com.yidianling.dynamic.common.tool.ImageDownLoadCallBack
;
import
com.yidianling.dynamic.model.Command
;
import
com.yidianling.dynamic.model.RecommendTrendImage
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -237,11 +237,11 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
switch
(
msg
.
what
)
{
case
DynamicConstants
.
REQUEST_SAVE_IMG_SUCCESS
:
dismissProgressDialog
();
Toast
.
makeText
(
BrowsePicturesActivity
.
this
,
"保存成功"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
BrowsePicturesActivity
.
this
,
"保存成功"
);
break
;
case
DynamicConstants
.
REQUEST_SAVE_IMG_FAIL
:
dismissProgressDialog
();
Toast
.
makeText
(
BrowsePicturesActivity
.
this
,
"保存失败"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
BrowsePicturesActivity
.
this
,
"保存失败"
);
break
;
}
}
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity2.java
View file @
a35653fc
...
...
@@ -16,14 +16,14 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.dynamic.DynamicConstants
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.common.tool.DownLoadImageService
;
import
com.yidianling.dynamic.common.tool.ImageDownLoadCallBack
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -180,10 +180,10 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O
public
void
handleMessage
(
Message
msg
)
{
switch
(
msg
.
what
)
{
case
DynamicConstants
.
REQUEST_SAVE_IMG_SUCCESS
:
Toast
.
makeText
(
BrowsePicturesActivity2
.
this
,
"保存成功"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
BrowsePicturesActivity2
.
this
,
"保存成功"
);
break
;
case
DynamicConstants
.
REQUEST_SAVE_IMG_FAIL
:
Toast
.
makeText
(
BrowsePicturesActivity2
.
this
,
"保存失败"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
BrowsePicturesActivity2
.
this
,
"保存失败"
);
break
;
}
}
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/members/MembersActivity.java
View file @
a35653fc
...
...
@@ -312,7 +312,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
members_top_user_focus_ortion_rel
.
setVisibility
(
View
.
VISIBLE
);
members_top_user_focus_iv
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
Toast
.
makeText
(
MembersActivity
.
this
,
resp
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
MembersActivity
.
this
,
resp
.
msg
);
}
},
throwable
->{
DynamicApiUtils
.
handleError
(
MembersActivity
.
this
,
throwable
);
...
...
@@ -424,7 +424,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
}
}
}
else
{
Toast
.
makeText
(
MembersActivity
.
this
,
resp
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
MembersActivity
.
this
,
resp
.
msg
);
}
},
throwable
->
{
...
...
@@ -478,7 +478,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
}
}
else
{
String
msg
=
resp
.
msg
;
Toast
.
makeText
(
MembersActivity
.
this
,
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
MembersActivity
.
this
,
msg
);
dismissProgressDialog
();
}
},
throwable
->
{
...
...
@@ -687,7 +687,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
builder1
.
SetOnItemClickLister
(
new
ListDialog
.
Builder
.
OnItemClickLister
()
{
@Override
public
void
onItemClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
// Toast
.makeText(mContext, dialog_datas.get(position), Toast.LENGTH_SHORT).show(
);
// Toast
Util.toastShort(mContext, dialog_datas.get(position)
);
dialog
.
dismiss
();
if
(!
DynamicIn
.
INSTANCE
.
isLogin
())
{
//未登录则跳转登录页面
...
...
@@ -709,9 +709,9 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
.
doAfterTerminate
(()
->
dismissProgressDialog
())
.
subscribe
(
resp
->
{
if
(
resp
.
code
==
0
)
{
Toast
.
makeText
(
MembersActivity
.
this
,
"举报成功"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
MembersActivity
.
this
,
"举报成功"
);
}
else
{
Toast
.
makeText
(
MembersActivity
.
this
,
resp
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
MembersActivity
.
this
,
resp
.
msg
);
}
},
throwable
->
DynamicApiUtils
.
handleError
(
MembersActivity
.
this
,
throwable
));
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/SelecTopicActivity.java
View file @
a35653fc
...
...
@@ -5,15 +5,15 @@ import android.os.Bundle;
import
android.view.View
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.view.widgets.RecyclerViewForScrollView
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.adapter.SelectTopicAdapter
;
import
com.yidianling.dynamic.common.net.DynamicApiUtils
;
import
com.yidianling.dynamic.common.view.FullyLinearLayoutManager
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.view.widgets.RecyclerViewForScrollView
;
import
com.yidianling.dynamic.model.Command
;
import
com.yidianling.dynamic.model.RecommendTopic
;
...
...
@@ -152,7 +152,7 @@ public class SelecTopicActivity extends BaseActivity {
adapterR
.
notifyDataSetChanged
();
adapterF
.
notifyDataSetChanged
();
}
else
{
Toast
.
makeText
(
SelecTopicActivity
.
this
,
response
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
SelecTopicActivity
.
this
,
response
.
msg
);
}
dismissProgressDialog
();
},
throwable
->
{
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/publishTrend/fragment/PublishQuestionAndTrendFragment.java
View file @
a35653fc
...
...
@@ -673,7 +673,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
getActivity
().
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
// Toast
.makeText(PublishTrendActivity.this, "有图片已被删除", Toast.LENGTH_SHORT).show(
);
// Toast
Util.toastShort(PublishTrendActivity.this, "有图片已被删除"
);
YdlCommonOut
.
Companion
.
showToast
(
"有图片已被删除"
);
loadingDialog
.
dismiss
();
loadingDialog
=
null
;
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/topic/AllTopicFragment.java
View file @
a35653fc
...
...
@@ -7,9 +7,13 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.RelativeLayout
;
import
android.widget.Toast
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.utils.BuryPointUtils
;
import
com.ydl.ydlcommon.view.FullyLinearLayoutManager
;
import
com.ydl.ydlcommon.view.widgets.RecyclerViewForScrollView
;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.dynamic.DynamicFragment
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.adapter.AllTopicAdapter
;
...
...
@@ -18,10 +22,6 @@ import com.yidianling.dynamic.model.Command;
import
com.yidianling.dynamic.model.RecommendTopic
;
import
com.yidianling.dynamic.router.DynamicIn
;
import
com.yidianling.dynamic.topic.topicDetail.TopicDetailActivity
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.utils.BuryPointUtils
;
import
com.ydl.ydlcommon.view.FullyLinearLayoutManager
;
import
com.ydl.ydlcommon.view.widgets.RecyclerViewForScrollView
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -166,7 +166,7 @@ public class AllTopicFragment extends DynamicFragment {
adapterr
.
updateDate
(
mDatasr
);
adapterf
.
updateDate
(
mDatasf
);
}
else
{
Toast
.
makeText
(
context
,
objectBaseResponse
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
objectBaseResponse
.
msg
);
}
dismissProgressDialog
();
},
throwable
->
{
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/trendsDetail/TrendsDetailActivity.java
View file @
a35653fc
...
...
@@ -721,7 +721,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
@Override
public
void
showToast
(
String
msg
)
{
Toast
.
makeText
(
this
,
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
this
,
msg
);
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/TeamAVChatProfile.java
View file @
a35653fc
package
com
.
yidianling
.
avchatkit
;
import
android.widget.Toast
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.netease.nimlib.sdk.NIMClient
;
...
...
@@ -14,6 +12,7 @@ import com.yidianling.avchatkit.common.Handlers;
import
com.yidianling.avchatkit.common.log.LogUtil
;
import
com.yidianling.avchatkit.common.util.TimeUtil
;
import
com.yidianling.avchatkit.teamavchat.activity.TeamAVChatActivity
;
import
com.yidianling.common.tools.ToastUtil
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -97,7 +96,7 @@ public class TeamAVChatProfile {
LogUtil
.
ui
(
"receive team video chat notification "
+
teamId
+
" room "
+
roomName
);
if
(
isTeamAVChatting
||
AVChatProfile
.
getInstance
().
isAVChatting
())
{
LogUtil
.
ui
(
"cancel launch team av chat isTeamAVChatting = "
+
isTeamAVChatting
);
Toast
.
makeText
(
AVChatKit
.
getContext
(),
"正在进行视频通话"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatKit
.
getContext
(),
"正在进行视频通话"
);
return
;
}
LogUtil
.
ui
(
"isSyncComplete = "
+
isSyncComplete
);
...
...
m-im/src/main/java/com/yidianling/avchatkit/activity/AVChatActivity.java
View file @
a35653fc
...
...
@@ -8,7 +8,6 @@ import android.os.SystemClock;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.Observer
;
...
...
@@ -41,6 +40,7 @@ import com.yidianling.avchatkit.notification.AVChatNotification;
import
com.yidianling.avchatkit.receiver.PhoneCallStateObserver
;
import
com.yidianling.avchatkit.ui.AVChatAudioUI
;
import
com.yidianling.avchatkit.ui.AVChatVideoUI
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
/**
...
...
@@ -307,9 +307,9 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
public
void
onAVRecordingCompletion
(
String
account
,
String
filePath
)
{
if
(
account
!=
null
&&
filePath
!=
null
&&
filePath
.
length
()
>
0
)
{
String
msg
=
"音视频录制已结束, "
+
"账号:"
+
account
+
" 录制文件已保存至:"
+
filePath
;
Toast
.
makeText
(
AVChatActivity
.
this
,
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatActivity
.
this
,
msg
);
}
else
{
Toast
.
makeText
(
AVChatActivity
.
this
,
"录制已结束."
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatActivity
.
this
,
"录制已结束."
);
}
if
(
state
==
AVChatType
.
VIDEO
.
getValue
())
{
avChatVideoUI
.
resetRecordTip
();
...
...
@@ -322,9 +322,9 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
public
void
onAudioRecordingCompletion
(
String
filePath
)
{
if
(
filePath
!=
null
&&
filePath
.
length
()
>
0
)
{
String
msg
=
"音频录制已结束, 录制文件已保存至:"
+
filePath
;
Toast
.
makeText
(
AVChatActivity
.
this
,
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatActivity
.
this
,
msg
);
}
else
{
Toast
.
makeText
(
AVChatActivity
.
this
,
"录制已结束."
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatActivity
.
this
,
"录制已结束."
);
}
if
(
state
==
AVChatType
.
AUDIO
.
getValue
())
{
avChatAudioUI
.
resetRecordTip
();
...
...
@@ -465,7 +465,7 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
break
;
case
AVChatControlCommand
.
SWITCH_AUDIO_TO_VIDEO_REJECT
:
rejectAudioToVideo
();
Toast
.
makeText
(
AVChatActivity
.
this
,
R
.
string
.
im_avchat_switch_video_reject
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatActivity
.
this
,
R
.
string
.
im_avchat_switch_video_reject
);
break
;
case
AVChatControlCommand
.
SWITCH_VIDEO_TO_AUDIO
:
onVideoToAudio
();
...
...
@@ -483,7 +483,7 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
}
break
;
default
:
Toast
.
makeText
(
this
,
"对方发来指令值:"
+
notification
.
getControlCommand
(),
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
this
,
"对方发来指令值:"
+
notification
.
getControlCommand
()
);
break
;
}
}
...
...
@@ -544,7 +544,7 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
}
if
(
client
!=
null
)
{
String
option
=
ackInfo
.
getEvent
()
==
AVChatEventType
.
CALLEE_ONLINE_CLIENT_ACK_AGREE
?
"接听!"
:
"拒绝!"
;
Toast
.
makeText
(
AVChatActivity
.
this
,
"通话已在"
+
client
+
"端被"
+
option
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
AVChatActivity
.
this
,
"通话已在"
+
client
+
"端被"
+
option
);
}
finish
();
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/controll/AVChatController.java
View file @
a35653fc
...
...
@@ -4,7 +4,6 @@ import android.app.Activity;
import
android.content.Context
;
import
android.util.Pair
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.netease.nimlib.sdk.ResponseCode
;
import
com.netease.nimlib.sdk.avchat.AVChatCallback
;
...
...
@@ -17,7 +16,6 @@ import com.netease.nimlib.sdk.avchat.model.AVChatParameters;
import
com.netease.nimlib.sdk.avchat.video.AVChatCameraCapturer
;
import
com.netease.nimlib.sdk.avchat.video.AVChatVideoCapturerFactory
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.im.R
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
import
com.yidianling.avchatkit.common.widgets.MultiSelectDialog
;
import
com.yidianling.avchatkit.config.AVChatConfigs
;
...
...
@@ -26,6 +24,8 @@ import com.yidianling.avchatkit.constant.AVChatExitCode;
import
com.yidianling.avchatkit.constant.CallStateEnum
;
import
com.yidianling.avchatkit.module.AVChatControllerCallback
;
import
com.yidianling.avchatkit.module.AVSwitchListener
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -134,9 +134,9 @@ public class AVChatController {
LogUtil
.
d
(
TAG
,
"avChat call failed code->"
+
code
);
if
(
code
==
ResponseCode
.
RES_FORBIDDEN
)
{
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_no_permission
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_no_permission
);
}
else
{
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_call_failed
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_call_failed
);
}
closeRtc
(
avChatType
==
AVChatType
.
VIDEO
?
CallStateEnum
.
VIDEO
:
CallStateEnum
.
AUDIO
);
callback
.
onFailed
(
code
,
""
);
...
...
@@ -178,9 +178,9 @@ public class AVChatController {
@Override
public
void
onFailed
(
int
code
)
{
if
(
code
==
-
1
)
{
Toast
.
makeText
(
context
,
"本地音视频启动失败"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
"本地音视频启动失败"
);
}
else
{
Toast
.
makeText
(
context
,
"建立连接失败"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
"建立连接失败"
);
}
LogUtil
.
e
(
TAG
,
"accept onFailed->"
+
code
);
handleAcceptFailed
(
avChatType
==
AVChatType
.
VIDEO
?
...
...
@@ -416,31 +416,31 @@ public class AVChatController {
case
AVChatExitCode
.
NET_CHANGE
:
// 网络切换
case
AVChatExitCode
.
NET_ERROR
:
// 网络异常
case
AVChatExitCode
.
CONFIG_ERROR
:
// 服务器返回数据错误
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_net_error_then_quit
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_net_error_then_quit
);
break
;
case
AVChatExitCode
.
REJECT
:
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_call_reject
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_call_reject
);
break
;
case
AVChatExitCode
.
PEER_HANGUP
:
case
AVChatExitCode
.
HANGUP
:
if
(
isCallEstablish
.
get
())
{
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_call_finish
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_call_finish
);
}
break
;
case
AVChatExitCode
.
PEER_BUSY
:
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_peer_busy
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_peer_busy
);
break
;
case
AVChatExitCode
.
PROTOCOL_INCOMPATIBLE_PEER_LOWER
:
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_peer_protocol_low_version
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_peer_protocol_low_version
);
break
;
case
AVChatExitCode
.
PROTOCOL_INCOMPATIBLE_SELF_LOWER
:
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_local_protocol_low_version
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_local_protocol_low_version
);
break
;
case
AVChatExitCode
.
INVALIDE_CHANNELID
:
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_invalid_channel_id
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_invalid_channel_id
);
break
;
case
AVChatExitCode
.
LOCAL_CALL_BUSY
:
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_local_call_busy
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_local_call_busy
);
break
;
default
:
break
;
...
...
m-im/src/main/java/com/yidianling/avchatkit/teamavchat/activity/TeamAVChatActivity.java
View file @
a35653fc
...
...
@@ -14,7 +14,6 @@ import android.view.Window;
import
android.view.WindowManager
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.Observer
;
...
...
@@ -37,7 +36,6 @@ import com.netease.nimlib.sdk.avchat.video.AVChatCameraCapturer;
import
com.netease.nimlib.sdk.avchat.video.AVChatVideoCapturerFactory
;
import
com.netease.nrtc.video.render.IVideoRender
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.im.R
;
import
com.yidianling.avchatkit.TeamAVChatProfile
;
import
com.yidianling.avchatkit.common.activity.AVChatBaseUI
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
...
...
@@ -55,6 +53,8 @@ import com.yidianling.avchatkit.teamavchat.TeamAVChatVoiceMuteDialog;
import
com.yidianling.avchatkit.teamavchat.adapter.TeamAVChatAdapter
;
import
com.yidianling.avchatkit.teamavchat.module.SimpleAVChatStateObserver
;
import
com.yidianling.avchatkit.teamavchat.module.TeamAVChatItem
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -830,7 +830,7 @@ public class TeamAVChatActivity extends AVChatBaseUI {
@OnMPermissionDenied
(
BASIC_PERMISSION_REQUEST_CODE
)
@OnMPermissionNeverAskAgain
(
BASIC_PERMISSION_REQUEST_CODE
)
public
void
onBasicPermissionFailed
()
{
Toast
.
makeText
(
this
,
"音视频通话所需权限未全部授权,部分功能可能无法正常运行!"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
this
,
"音视频通话所需权限未全部授权,部分功能可能无法正常运行!"
);
onPermissionChecked
();
}
...
...
@@ -839,7 +839,7 @@ public class TeamAVChatActivity extends AVChatBaseUI {
*/
private
void
showToast
(
String
content
)
{
Toast
.
makeText
(
TeamAVChatActivity
.
this
,
content
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
TeamAVChatActivity
.
this
,
content
);
}
/**
...
...
m-im/src/main/java/com/yidianling/avchatkit/ui/AVChatAudioUI.java
View file @
a35653fc
...
...
@@ -342,7 +342,7 @@ public class AVChatAudioUI implements View.OnClickListener, ToggleListener {
doRecording
();
}
else
if
(
i
==
R
.
id
.
avchat_audio_switch_video
)
{
if
(
isInSwitch
)
{
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_in_switch
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_in_switch
);
}
else
{
avChatController
.
switchAudioToVideo
(
avSwitchListener
);
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/ui/AVChatVideoUI.java
View file @
a35653fc
...
...
@@ -631,7 +631,7 @@ public class AVChatVideoUI implements View.OnClickListener, ToggleListener {
doRefuseCall
();
}
else
if
(
i
==
R
.
id
.
receive
)
{
if
(
isInReceiveing
||
avChatController
.
isCallEstablish
.
get
())
{
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_in_switch
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_in_switch
);
}
else
{
requestPermission
();
}
...
...
@@ -647,7 +647,7 @@ public class AVChatVideoUI implements View.OnClickListener, ToggleListener {
doToggleRecord
();
}
else
if
(
i
==
R
.
id
.
avchat_video_switch_audio
)
{
if
(
isInSwitch
)
{
Toast
.
makeText
(
context
,
R
.
string
.
im_avchat_in_switch
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
context
,
R
.
string
.
im_avchat_in_switch
);
}
else
{
avChatController
.
switchVideoToAudio
(
avSwitchListener
);
}
...
...
m-im/src/main/java/com/yidianling/im/bridge/P2PCustomActionHandlerImpl.java
View file @
a35653fc
...
...
@@ -10,7 +10,6 @@ import android.net.Uri;
import
android.support.v7.app.AppCompatActivity
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.google.gson.internal.LinkedTreeMap
;
import
com.netease.nimlib.sdk.NIMClient
;
...
...
@@ -42,6 +41,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import
com.ydl.ydlcommon.view.dialog.ListDialog
;
import
com.ydl.ydlcommon.view.dialog.NormalDialog
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.api.bean.IMExpertBuild
;
import
com.yidianling.im.api.bean.IMRequestCallback
;
import
com.yidianling.im.api.event.BlackEvent
;
import
com.yidianling.im.bean.GetReportReason
;
...
...
@@ -62,7 +62,6 @@ import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice
import
com.yidianling.im.session.extension.CustomRecommendExpertListMsg
;
import
com.yidianling.im.session.extension.CustomSystemTips
;
import
com.yidianling.im.ui.widget.ChatTeamHisDialog
;
import
com.yidianling.im.api.bean.IMExpertBuild
;
import
com.yidianling.uikit.business.session.helper.MessageListPanelHelper
;
import
com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler
;
import
com.yidianling.uikit.custom.http.response.RecommendExpertBean
;
...
...
@@ -450,10 +449,10 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
resp
->
{
if
(
resp
.
code
==
0
)
{
Toast
.
makeText
(
activity
,
"举报成功"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
activity
,
"举报成功"
);
dialog
.
dismiss
();
}
else
{
Toast
.
makeText
(
activity
,
resp
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
activity
,
resp
.
msg
);
dialog
.
dismiss
();
}
},
throwable
->
{
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/WatchMessagePictureActivity.java
View file @
a35653fc
...
...
@@ -10,7 +10,6 @@ import android.os.Handler;
import
android.provider.MediaStore
;
import
android.support.v4.view.PagerAdapter
;
import
android.support.v4.view.ViewCompat
;
import
android.support.v4.view.ViewPager
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
...
...
@@ -31,6 +30,7 @@ import com.netease.nimlib.sdk.msg.constant.AttachStatusEnum;
import
com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum
;
import
com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
;
import
com.netease.nimlib.sdk.msg.model.IMMessage
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
com.yidianling.nimbase.common.activity.ToolBarOptions
;
import
com.yidianling.nimbase.common.activity.UI
;
...
...
@@ -41,7 +41,7 @@ import com.yidianling.nimbase.common.util.file.AttachmentStore;
import
com.yidianling.nimbase.common.util.media.BitmapDecoder
;
import
com.yidianling.nimbase.common.util.media.ImageUtil
;
import
com.yidianling.nimbase.common.util.storage.StorageUtil
;
import
com.yidianling.
im.R
;
import
com.yidianling.
uikit.business.session.view.ImageOriginPager
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -76,7 +76,7 @@ public class WatchMessagePictureActivity extends UI {
private
ImageView
simpleImageView
;
private
int
mode
;
protected
CustomAlertDialog
alertDialog
;
private
ViewPager
imageView
Pager
;
private
ImageOriginPager
imageImageOrigin
Pager
;
private
PagerAdapter
adapter
;
private
AbortableFuture
downloadFuture
;
...
...
@@ -123,7 +123,7 @@ public class WatchMessagePictureActivity extends UI {
@Override
protected
void
onDestroy
()
{
registerObservers
(
false
);
image
View
Pager
.
setAdapter
(
null
);
image
ImageOrigin
Pager
.
setAdapter
(
null
);
if
(
downloadFuture
!=
null
)
{
downloadFuture
.
abort
();
downloadFuture
=
null
;
...
...
@@ -135,7 +135,7 @@ public class WatchMessagePictureActivity extends UI {
alertDialog
=
new
CustomAlertDialog
(
this
);
loadingLayout
=
findViewById
(
R
.
id
.
loading_layout
);
image
ViewPager
=
(
View
Pager
)
findViewById
(
R
.
id
.
view_pager_image
);
image
ImageOriginPager
=
(
ImageOrigin
Pager
)
findViewById
(
R
.
id
.
view_pager_image
);
simpleImageView
=
(
ImageView
)
findViewById
(
R
.
id
.
simple_image_view
);
if
(
mode
==
MODE_GIF
)
{
...
...
@@ -150,10 +150,10 @@ public class WatchMessagePictureActivity extends UI {
}
});
image
View
Pager
.
setVisibility
(
View
.
GONE
);
image
ImageOrigin
Pager
.
setVisibility
(
View
.
GONE
);
}
else
if
(
mode
==
MODE_NOMARL
)
{
simpleImageView
.
setVisibility
(
View
.
GONE
);
image
View
Pager
.
setVisibility
(
View
.
VISIBLE
);
image
ImageOrigin
Pager
.
setVisibility
(
View
.
VISIBLE
);
}
}
...
...
@@ -184,7 +184,7 @@ public class WatchMessagePictureActivity extends UI {
}
// 查询并显示图片,带
view
Pager
// 查询并显示图片,带
ImageOrigin
Pager
private
void
queryImageMessages
()
{
IMMessage
anchor
=
MessageBuilder
.
createEmptyMessage
(
message
.
getSessionId
(),
message
.
getSessionType
(),
0
);
NIMClient
.
getService
(
MsgService
.
class
).
queryMessageListByType
(
MsgTypeEnum
.
image
,
anchor
,
Integer
.
MAX_VALUE
).
setCallback
(
new
RequestCallback
<
List
<
IMMessage
>>()
{
...
...
@@ -198,7 +198,7 @@ public class WatchMessagePictureActivity extends UI {
// imageMsgList.addAll(param);
Collections
.
reverse
(
imageMsgList
);
setDisplayIndex
();
set
View
PagerAdapter
();
set
ImageOrigin
PagerAdapter
();
}
@Override
...
...
@@ -228,7 +228,7 @@ public class WatchMessagePictureActivity extends UI {
return
(
t1
.
getUuid
().
equals
(
t2
.
getUuid
()));
}
private
void
set
View
PagerAdapter
()
{
private
void
set
ImageOrigin
PagerAdapter
()
{
adapter
=
new
PagerAdapter
()
{
@Override
public
int
getCount
()
{
...
...
@@ -263,7 +263,7 @@ public class WatchMessagePictureActivity extends UI {
layout
.
setTag
(
position
);
if
(
position
==
firstDisplayImageIndex
)
{
on
View
PagerSelected
(
position
);
on
ImageOrigin
PagerSelected
(
position
);
}
return
layout
;
...
...
@@ -275,15 +275,15 @@ public class WatchMessagePictureActivity extends UI {
}
};
image
View
Pager
.
setAdapter
(
adapter
);
image
View
Pager
.
setOffscreenPageLimit
(
2
);
image
View
Pager
.
setCurrentItem
(
firstDisplayImageIndex
);
image
ViewPager
.
setOnPageChangeListener
(
new
View
Pager
.
OnPageChangeListener
()
{
image
ImageOrigin
Pager
.
setAdapter
(
adapter
);
image
ImageOrigin
Pager
.
setOffscreenPageLimit
(
2
);
image
ImageOrigin
Pager
.
setCurrentItem
(
firstDisplayImageIndex
);
image
ImageOriginPager
.
setOnPageChangeListener
(
new
ImageOrigin
Pager
.
OnPageChangeListener
()
{
@Override
public
void
onPageScrolled
(
int
position
,
float
positionOffset
,
int
positionOffsetPixels
)
{
if
(
positionOffset
==
0
f
&&
newPageSelected
)
{
newPageSelected
=
false
;
on
View
PagerSelected
(
position
);
on
ImageOrigin
PagerSelected
(
position
);
}
}
...
...
@@ -299,7 +299,7 @@ public class WatchMessagePictureActivity extends UI {
});
}
private
void
on
View
PagerSelected
(
int
position
)
{
private
void
on
ImageOrigin
PagerSelected
(
int
position
)
{
if
(
downloadFuture
!=
null
)
{
downloadFuture
.
abort
();
downloadFuture
=
null
;
...
...
@@ -310,9 +310,9 @@ public class WatchMessagePictureActivity extends UI {
// 初始化每个view的image
protected
void
updateCurrentImageView
(
final
int
position
)
{
View
currentLayout
=
image
View
Pager
.
findViewWithTag
(
position
);
View
currentLayout
=
image
ImageOrigin
Pager
.
findViewWithTag
(
position
);
if
(
currentLayout
==
null
)
{
ViewCompat
.
postOnAnimation
(
image
View
Pager
,
new
Runnable
()
{
ViewCompat
.
postOnAnimation
(
image
ImageOrigin
Pager
,
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
View file @
a35653fc
...
...
@@ -5,7 +5,6 @@ import android.content.Intent;
import
android.os.Bundle
;
import
android.util.DisplayMetrics
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -16,12 +15,13 @@ import com.netease.nimlib.sdk.msg.MsgServiceObserve;
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
;
import
com.netease.nimlib.sdk.msg.model.CustomNotification
;
import
com.netease.nimlib.sdk.msg.model.IMMessage
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.api.model.session.SessionCustomization
;
import
com.yidianling.nimbase.api.model.user.UserInfoObserver
;
import
com.yidianling.nimbase.business.session.constant.Extras
;
import
com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseFetchLoadAdapter
;
import
com.yidianling.nimbase.common.util.log.LogUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.business.session.fragment.YDLMessageFragment
;
import
com.yidianling.uikit.custom.bridge.ActionHandlerStorage
;
...
...
@@ -176,9 +176,9 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
int
id
=
json
.
getIntValue
(
"id"
);
if
(
id
==
1
)
{
// 正在输入
Toast
.
makeText
(
this
,
"对方正在输入..."
,
Toast
.
LENGTH_LONG
).
show
(
);
Toast
Util
.
toastShort
(
this
,
"对方正在输入..."
);
}
else
{
Toast
.
makeText
(
this
,
"command: "
+
content
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
this
,
"command: "
+
content
);
}
}
catch
(
Exception
e
)
{
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLTeamMessageActivity.java
View file @
a35653fc
...
...
@@ -7,7 +7,6 @@ import android.os.Bundle;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
;
...
...
@@ -16,6 +15,8 @@ import com.netease.nimlib.sdk.team.constant.TeamTypeEnum;
import
com.netease.nimlib.sdk.team.model.Team
;
import
com.netease.nimlib.sdk.team.model.TeamMember
;
import
com.netease.nimlib.sdk.uinfo.UserService
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.api.model.SimpleCallback
;
import
com.yidianling.nimbase.api.model.contact.ContactChangedObserver
;
import
com.yidianling.nimbase.api.model.session.SessionCustomization
;
...
...
@@ -23,7 +24,6 @@ import com.yidianling.nimbase.api.model.team.TeamDataChangedObserver;
import
com.yidianling.nimbase.api.model.team.TeamMemberDataChangedObserver
;
import
com.yidianling.nimbase.business.preference.UserPreferences
;
import
com.yidianling.nimbase.business.session.constant.Extras
;
import
com.yidianling.im.R
;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.business.session.fragment.YDLMessageFragment
;
import
com.yidianling.uikit.business.session.fragment.YDLTeamMessageFragment
;
...
...
@@ -200,7 +200,7 @@ public class YDLTeamMessageActivity extends YDLBaseMessageActivity {
}
private
void
onRequestTeamInfoFailed
()
{
Toast
.
makeText
(
YDLTeamMessageActivity
.
this
,
"获取群组信息失败!"
,
Toast
.
LENGTH_SHORT
);
Toast
Util
.
toastShort
(
YDLTeamMessageActivity
.
this
,
"获取群组信息失败!"
);
finish
();
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
View file @
a35653fc
...
...
@@ -26,7 +26,7 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
public
boolean
isAllowSendMessage
(
IMMessage
message
)
{
TeamMember
teamMember
=
TeamDataCache
.
getInstance
().
getTeamMember
(
team
.
getId
(),
NimUIKit
.
getAccount
());
if
(
team
==
null
||
!
team
.
isMyTeam
())
{
Toast
.
makeText
(
getActivity
(),
R
.
string
.
im_team_send_message_not_allow
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
getActivity
(),
R
.
string
.
im_team_send_message_not_allow
);
return
false
;
}
else
if
(
team
!=
null
&&
team
.
isAllMute
()
&&
teamMember
.
getType
()!=
TeamMemberType
.
Owner
&&
teamMember
.
getType
()!=
TeamMemberType
.
Manager
){
ToastUtil
.
toastShort
(
"管理员开启了全员禁言哦~"
);
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/module/input/InputPanel.java
View file @
a35653fc
...
...
@@ -1070,7 +1070,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
// 发送文本消息
public
void
onTextMessageSendButtonPressed
(
String
text
)
{
if
(
text
.
isEmpty
())
{
Toast
.
makeText
(
container
.
activity
,
"请输入后再发送"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
container
.
activity
,
"请输入后再发送"
);
return
;
}
IMMessage
textMessage
=
createTextMessage
(
text
);
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/module/list/MessageListPanelEx.java
View file @
a35653fc
...
...
@@ -14,7 +14,6 @@ import android.util.Log;
import
android.util.Pair
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.NIMSDK
;
...
...
@@ -41,6 +40,7 @@ import com.netease.nimlib.sdk.msg.model.TeamMessageReceipt;
import
com.netease.nimlib.sdk.robot.model.RobotAttachment
;
import
com.netease.nimlib.sdk.team.constant.TeamMemberType
;
import
com.netease.nimlib.sdk.team.model.TeamMember
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.api.model.main.CustomPushContentProvider
;
import
com.yidianling.nimbase.api.model.user.UserInfoObserver
;
...
...
@@ -1008,13 +1008,13 @@ public class MessageListPanelEx {
values
.
put
(
MediaStore
.
Images
.
Media
.
MIME_TYPE
,
C
.
MimeType
.
MIME_JPEG
);
values
.
put
(
MediaStore
.
Images
.
Media
.
DATA
,
dstPath
);
container
.
activity
.
getContentResolver
().
insert
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
values
);
Toast
.
makeText
(
container
.
activity
,
container
.
activity
.
getString
(
R
.
string
.
im_picture_save_to
),
Toast
.
LENGTH_LONG
).
show
(
);
Toast
Util
.
toastShort
(
container
.
activity
,
container
.
activity
.
getString
(
R
.
string
.
im_picture_save_to
)
);
}
catch
(
Exception
e
)
{
// may be java.lang.UnsupportedOperationException
Toast
.
makeText
(
container
.
activity
,
container
.
activity
.
getString
(
R
.
string
.
im_picture_save_fail
),
Toast
.
LENGTH_LONG
).
show
(
);
Toast
Util
.
toastShort
(
container
.
activity
,
container
.
activity
.
getString
(
R
.
string
.
im_picture_save_fail
)
);
}
}
else
{
Toast
.
makeText
(
container
.
activity
,
container
.
activity
.
getString
(
R
.
string
.
im_picture_save_fail
),
Toast
.
LENGTH_LONG
).
show
(
);
Toast
Util
.
toastShort
(
container
.
activity
,
container
.
activity
.
getString
(
R
.
string
.
im_picture_save_fail
)
);
}
}
});
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/view/ImageOriginPager.java
View file @
a35653fc
package
com
.
yidianling
.
uikit
.
business
.
session
.
view
;
import
android.content.Context
;
import
android.support.v4.view.ViewPager
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.MotionEvent
;
/**
...
...
@@ -11,37 +9,35 @@ import android.view.MotionEvent;
* Des:修复Android 系统级别bug
*
* Android 处理图片放大缩小时报错java.lang.IllegalArgumentException: pointerIndex out of range pointerIndex=-1
* https://github.com/chrisbanes/PhotoView/issues/31
*/
public
class
ImageOriginPager
extends
ViewPager
{
public
class
ImageOriginPager
extends
android
.
support
.
v4
.
view
.
ViewPager
{
public
ImageOriginPager
(
Context
context
)
{
super
(
context
);
super
(
context
);
}
public
ImageOriginPager
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
super
(
context
,
attrs
);
}
@Override
public
boolean
onTouchEvent
(
MotionEvent
ev
ent
)
{
public
boolean
onTouchEvent
(
MotionEvent
ev
)
{
try
{
super
.
onTouchEvent
(
event
);
}
catch
(
IllegalArgumentException
e
)
{
Log
.
e
(
"ImageOriginPager-error"
,
"IllegalArgumentException 错误被活捉了!"
);
e
.
printStackTrace
();
return
super
.
onTouchEvent
(
ev
);
}
catch
(
IllegalArgumentException
ex
)
{
ex
.
printStackTrace
();
}
return
false
;
}
@Override
public
boolean
onInterceptTouchEvent
(
MotionEvent
ev
ent
)
{
public
boolean
onInterceptTouchEvent
(
MotionEvent
ev
)
{
try
{
super
.
onInterceptTouchEvent
(
event
);
}
catch
(
IllegalArgumentException
e
)
{
Log
.
e
(
"ImageOriginPager-error"
,
"IllegalArgumentException 错误被活捉了!"
);
e
.
printStackTrace
();
return
super
.
onInterceptTouchEvent
(
ev
);
}
catch
(
IllegalArgumentException
ex
)
{
ex
.
printStackTrace
();
}
return
false
;
return
false
;
}
}
m-im/src/main/res_uikit/layout/im_nim_watch_picture_activity.xml
View file @
a35653fc
...
...
@@ -11,7 +11,7 @@
<!-- <include layout="@layout/watch_picture_show_more_action_layout" /> -->
<
android.support.v4.view.View
Pager
<
com.yidianling.uikit.business.session.view.ImageOrigin
Pager
android:id=
"@+id/view_pager_image"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
...
...
m-tests/src/main/java/com/yidianling/tests/SelectConversationActivity.kt
View file @
a35653fc
...
...
@@ -7,7 +7,6 @@ import android.view.ViewGroup
import
android.widget.BaseAdapter
import
android.widget.ImageView
import
android.widget.TextView
import
android.widget.Toast
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.ydl.ydl_image.module.GlideApp
import
com.ydl.ydl_image.transform.GlideCircleTransform
...
...
@@ -16,6 +15,7 @@ import com.ydl.ydlcommon.router.YdlCommonOut
import
com.ydl.ydlcommon.utils.NetworkParamsUtils
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import
com.ydl.ydlcommon.view.dialog.NormalDialog
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.bean.IMRequestCallback
import
com.yidianling.tests.home.param.RecentCmd
import
com.yidianling.tests.router.TestsIn
...
...
@@ -138,7 +138,7 @@ class SelectConversationActivity : BaseActivity() {
}
handleData
()
}
else
{
Toast
.
makeText
(
this
@SelectConversationActivity
,
it
.
msg
,
Toast
.
LENGTH_SHORT
).
show
(
)
Toast
Util
.
toastShort
(
this
@SelectConversationActivity
,
it
.
msg
)
}
},{
HttpErrorUtils
.
handleError
(
mContext
,
it
)
...
...
m-user/src/main/java/com/yidianling/user/ui/AliAuthDemoActivity.java
View file @
a35653fc
...
...
@@ -16,7 +16,6 @@ import android.view.View;
import
android.widget.Button
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.mobile.auth.gatewayauth.AuthRegisterViewConfig
;
...
...
@@ -26,6 +25,7 @@ import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
import
com.mobile.auth.gatewayauth.PreLoginResultListener
;
import
com.mobile.auth.gatewayauth.TokenResultListener
;
import
com.mobile.auth.gatewayauth.model.InitResult
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.user.R
;
@Route
(
path
=
"/user/aliAuthDemo"
)
...
...
@@ -141,7 +141,7 @@ public class AliAuthDemoActivity extends Activity {
@Override
public
void
onPermissionDenied
(
boolean
isRequestUser
)
{
Toast
.
makeText
(
AliAuthDemoActivity
.
this
,
"请允许相关权限"
,
Toast
.
LENGTH_LONG
).
show
(
);
Toast
Util
.
toastShort
(
AliAuthDemoActivity
.
this
,
"请允许相关权限"
);
}
});
}
else
{
...
...
@@ -169,7 +169,7 @@ public class AliAuthDemoActivity extends Activity {
.
setCustomInterface
(
new
CustomInterface
()
{
@Override
public
void
onClick
(
Context
context
)
{
Toast
.
makeText
(
context
,
"点击自定义控件"
,
Toast
.
LENGTH_LONG
).
show
(
);
Toast
Util
.
toastShort
(
context
,
"点击自定义控件"
);
}
}).
build
());
showLoadingDialog
(
"正在请求登录Token"
);
...
...
m-user/src/main/java/com/yidianling/user/ui/FillInfoActivity.java
View file @
a35653fc
...
...
@@ -14,7 +14,6 @@ import android.text.TextUtils;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.lzy.imagepicker.ImagePicker
;
import
com.lzy.imagepicker.bean.ImageItem
;
...
...
@@ -38,6 +37,7 @@ 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.RxImageTool
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.user.GlideImageLoader
;
import
com.yidianling.user.LoginHelper
;
import
com.yidianling.user.R
;
...
...
@@ -444,7 +444,7 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
uploadImage
(
images
.
get
(
0
).
path
,
1002
);
}
else
{
Toast
.
makeText
(
this
,
"没有数据"
,
Toast
.
LENGTH_SHORT
).
show
(
);
Toast
Util
.
toastShort
(
this
,
"没有数据"
);
}
break
;
}
...
...
ydl-media/src/main/java/com/ydl/media/audio/AudioPlayer.kt
View file @
a35653fc
...
...
@@ -61,7 +61,7 @@ class AudioPlayer private constructor() {
}
val
audioSessionId
:
Int
get
()
=
mediaPlayer
!!
.
audioSessionId
get
()
=
if
(
mediaPlayer
!=
null
)
mediaPlayer
!!
.
audioSessionId
else
0
val
audioPosition
:
Long
get
()
=
if
(
isPlaying
||
isPausing
)
{
...
...
ydl-net/src/main/java/com/ydl/ydlnet/client/observer/CommonObserver.java
View file @
a35653fc
package
com
.
ydl
.
ydlnet
.
client
.
observer
;
import
android.text.TextUtils
;
import
com.ydl.ydlnet.utils.NetToastUtils
;
import
io.reactivex.disposables.Disposable
;
/**
...
...
@@ -33,9 +31,6 @@ public abstract class CommonObserver<T> extends BaseObserver<T> {
@Override
public
void
doOnError
(
String
errorMsg
)
{
if
(!
isHideToast
()
&&
!
TextUtils
.
isEmpty
(
errorMsg
))
{
NetToastUtils
.
showToast
(
errorMsg
);
}
onError
(
errorMsg
);
}
...
...
ydl-net/src/main/java/com/ydl/ydlnet/client/observer/DataObserver.java
View file @
a35653fc
package
com
.
ydl
.
ydlnet
.
client
.
observer
;
import
android.text.TextUtils
;
import
com.ydl.ydlnet.client.bean.BaseData
;
import
com.ydl.ydlnet.utils.NetToastUtils
;
import
io.reactivex.disposables.Disposable
;
/**
...
...
@@ -42,9 +41,6 @@ public abstract class DataObserver<T> extends BaseObserver<BaseData<T>> {
@Override
public
void
doOnError
(
String
errorMsg
)
{
if
(!
isHideToast
()
&&
!
TextUtils
.
isEmpty
(
errorMsg
))
{
NetToastUtils
.
showToast
(
errorMsg
);
}
onError
(
errorMsg
);
}
...
...
ydl-net/src/main/java/com/ydl/ydlnet/utils/NetToastUtils.java
deleted
100644 → 0
View file @
8765823e
package
com
.
ydl
.
ydlnet
.
utils
;
import
android.widget.Toast
;
import
com.ydl.ydlnet.YDLHttpUtils
;
/**
* Created by haorui on 2019-09-02 .
* Des:
*/
public
class
NetToastUtils
{
private
static
Toast
mToast
;
/**
* Toast提示
*
* @param msg 提示内容
*/
public
static
void
showToast
(
String
msg
)
{
if
(
mToast
==
null
)
{
mToast
=
Toast
.
makeText
(
YDLHttpUtils
.
Companion
.
getContext
(),
msg
,
Toast
.
LENGTH_SHORT
);
}
else
{
mToast
.
setText
(
msg
);
}
mToast
.
show
();
}
}
ydl-platform/build.gradle
View file @
a35653fc
...
...
@@ -87,7 +87,8 @@ dependencies {
exclude
group:
'org.jetbrains.kotlin'
,
module:
'kotlin-stdlib-common'
}
api
rootProject
.
ext
.
dependencies
[
"ydl-utils"
]
// api rootProject.ext.dependencies["ydl-utils"]
api
project
(
':ydl-utils'
)
api
rootProject
.
ext
.
dependencies
[
"ydl-js"
]
api
rootProject
.
ext
.
dependencies
[
"ydl-net"
]
api
rootProject
.
ext
.
dependencies
[
"ydl-js"
]
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/Utils.java
View file @
a35653fc
...
...
@@ -11,13 +11,18 @@ import android.os.Build;
import
android.os.Environment
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
android.text.*
;
import
android.text.Html
;
import
android.text.Spannable
;
import
android.text.SpannableString
;
import
android.text.SpannableStringBuilder
;
import
android.text.Spanned
;
import
android.text.TextUtils
;
import
android.text.style.ForegroundColorSpan
;
import
android.text.style.ImageSpan
;
import
android.view.Display
;
import
android.view.WindowManager
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.ydl.ydlcommon.view.CenterAlignImageSpan
;
...
...
@@ -31,8 +36,6 @@ import java.util.List;
public
class
Utils
{
private
static
long
lastClickTime
;
private
static
Toast
mToast
;
public
synchronized
static
boolean
isFastClick
()
{
long
time
=
System
.
currentTimeMillis
();
if
(
time
-
lastClickTime
<
1000
)
{
...
...
@@ -250,23 +253,6 @@ public class Utils {
return
ssb
;
}
/**
* Toast 展示控制
*
* @param context
* @param msg
* @param duration
*/
public
static
void
showToast
(
Context
context
,
String
msg
,
int
duration
)
{
if
(
mToast
==
null
)
{
mToast
=
Toast
.
makeText
(
context
,
msg
,
duration
);
}
else
{
mToast
.
setText
(
msg
);
}
mToast
.
show
();
}
/**
* 将TextView中带中括号的字体高亮
*
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/YDLAppProtector.java
View file @
a35653fc
...
...
@@ -3,14 +3,16 @@ package com.ydl.ydlcommon.utils;
import
android.app.Application
;
import
android.util.Base64
;
import
android.util.Log
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.ydl.ydlcommon.utils.remind.ToastHelper
;
import
com.yidianling.protector.AppProtectorLib
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
/**
* Created by haorui on 2019/7/10.
* Des:应用防护措施
...
...
@@ -36,7 +38,7 @@ public class YDLAppProtector {
Application
app
=
BaseApp
.
Companion
.
getApp
();
//检查应用多开
handleDetect
(
AppProtectorLib
.
checkIsRunningInVirtualApk
(
app
.
getPackageName
(),
null
),
true
,
getHint
(
hint_1
));
//
handleDetect(AppProtectorLib.checkIsRunningInVirtualApk(app.getPackageName(),null),true,getHint(hint_1));
//模拟器检测
handleDetect
(
AppProtectorLib
.
checkIsRunningInEmulator
(
app
,
null
),
true
,
getHint
(
hint_2
));
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/receiver/DownloadReceiver.java
View file @
a35653fc
...
...
@@ -54,7 +54,7 @@ public class DownloadReceiver extends BroadcastReceiver {
long
[]
ids
=
intent
.
getLongArrayExtra
(
DownloadManager
.
EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS
);
//点击通知栏取消下载
// manager.remove(ids);
// Toast
.makeText(context, "已经取消下载", Toast.LENGTH_SHORT).show(
);
// Toast
Util.toastShort(context, "已经取消下载"
);
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/ToastUtil.java
View file @
a35653fc
...
...
@@ -3,7 +3,7 @@ package com.yidianling.common.tools;
import
android.content.Context
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.
text.TextUtil
s
;
import
android.
support.annotation.StringRe
s
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -12,6 +12,8 @@ import android.widget.LinearLayout;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.yidianling.common.tools.support.toast.ToastCompat
;
/**
* 显示Toast工具类
* Created by Dog on 2015/4/4.
...
...
@@ -25,6 +27,22 @@ public class ToastUtil {
private
static
long
oneTime
=
0
;
private
static
long
twoTime
=
0
;
public
static
void
toastShort
(
Context
context
,
@StringRes
Integer
resourceId
)
{
toastShort
(
resourceId
);
}
public
static
void
toastShort
(
@StringRes
Integer
resourceId
)
{
try
{
String
text
=
RxTool
.
getContext
().
getResources
().
getString
(
resourceId
);
toastShort
(
text
);
}
catch
(
Exception
e
)
{
LogUtil
.
i
(
e
.
getMessage
());
}
}
public
static
void
toastShort
(
Context
context
,
String
message
)
{
safeToast
(
message
);
}
public
static
void
toastShort
(
String
msg
)
{
safeToast
(
msg
);
...
...
@@ -32,7 +50,7 @@ public class ToastUtil {
private
static
void
safeToast
(
String
msg
)
{
if
(
Looper
.
myLooper
()
==
Looper
.
getMainLooper
())
{
toastShor
t
(
RxTool
.
getContext
(),
msg
);
showShortToas
t
(
RxTool
.
getContext
(),
msg
);
}
else
{
//说明不是在主线程
if
(
handler
==
null
)
{
...
...
@@ -44,7 +62,7 @@ public class ToastUtil {
private
static
void
showShortToast
(
Context
mContext
,
String
msg
)
{
if
(
toast
==
null
)
{
toast
=
Toast
.
makeText
(
mContext
.
getApplicationContext
(),
msg
,
Toast
.
LENGTH_SHORT
);
toast
=
Toast
Compat
.
makeText
(
mContext
.
getApplicationContext
(),
msg
,
Toast
.
LENGTH_SHORT
);
centerText
(
toast
.
getView
());
toast
.
show
();
oneTime
=
System
.
currentTimeMillis
();
...
...
@@ -65,16 +83,6 @@ public class ToastUtil {
oneTime
=
twoTime
;
}
public
static
void
toastShort
(
Context
context
,
String
message
)
{
if
(
context
!=
null
&&
!
TextUtils
.
isEmpty
(
message
))
{
showShortToast
(
context
,
message
);
// Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
// toast.setGravity(Gravity.CENTER, 0, 0);
// //toast.setView(getView(context,toast,message));
// centerText(toast.getView());
// toast.show();
}
}
private
static
View
getView
(
Context
context
,
Toast
toast
,
String
message
)
{
View
toastView
=
toast
.
getView
();
...
...
@@ -94,7 +102,7 @@ public class ToastUtil {
public
static
void
toastShortBottom
(
Context
context
,
String
message
)
{
if
(
context
!=
null
)
{
Toast
toast
=
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
);
Toast
toast
=
Toast
Compat
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
);
centerText
(
toast
.
getView
());
toast
.
show
();
}
...
...
@@ -102,7 +110,7 @@ public class ToastUtil {
public
static
void
toastLong
(
Context
context
,
String
message
)
{
if
(
context
!=
null
)
{
Toast
toast
=
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_LONG
);
Toast
toast
=
Toast
Compat
.
makeText
(
context
,
message
,
Toast
.
LENGTH_LONG
);
toast
.
setGravity
(
Gravity
.
CENTER
,
0
,
0
);
centerText
(
toast
.
getView
());
toast
.
show
();
...
...
@@ -112,7 +120,7 @@ public class ToastUtil {
public
static
void
toastImg
(
Context
context
,
int
ImageResourceId
)
{
//创建一个Toast提示消息
Toast
toast
=
Toast
.
makeText
(
context
,
""
,
Toast
.
LENGTH_SHORT
);
Toast
toast
=
Toast
Compat
.
makeText
(
context
,
""
,
Toast
.
LENGTH_SHORT
);
//设置Toast提示消息在屏幕上的位置
toast
.
setGravity
(
Gravity
.
CENTER
,
0
,
0
);
//获取Toast提示消息里原有的View
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/BadTokenListener.java
0 → 100644
View file @
a35653fc
package
com
.
yidianling
.
common
.
tools
.
support
.
toast
;
import
android.support.annotation.NonNull
;
import
android.widget.Toast
;
/**
* @author drakeet
*/
public
interface
BadTokenListener
{
void
onBadTokenCaught
(
@NonNull
Toast
toast
);
}
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/SafeToastContext.java
0 → 100644
View file @
a35653fc
package
com
.
yidianling
.
common
.
tools
.
support
.
toast
;
import
android.content.Context
;
import
android.content.ContextWrapper
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
android.view.Display
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
/**
* @author drakeet
*/
final
class
SafeToastContext
extends
ContextWrapper
{
private
@NonNull
Toast
toast
;
private
@Nullable
BadTokenListener
badTokenListener
;
SafeToastContext
(
@NonNull
Context
base
,
@NonNull
Toast
toast
)
{
super
(
base
);
this
.
toast
=
toast
;
}
@Override
public
Context
getApplicationContext
()
{
return
new
ApplicationContextWrapper
(
getBaseContext
().
getApplicationContext
());
}
public
void
setBadTokenListener
(
@NonNull
BadTokenListener
badTokenListener
)
{
this
.
badTokenListener
=
badTokenListener
;
}
private
final
class
ApplicationContextWrapper
extends
ContextWrapper
{
private
ApplicationContextWrapper
(
@NonNull
Context
base
)
{
super
(
base
);
}
@Override
public
Object
getSystemService
(
@NonNull
String
name
)
{
if
(
Context
.
WINDOW_SERVICE
.
equals
(
name
))
{
// noinspection ConstantConditions
return
new
WindowManagerWrapper
((
WindowManager
)
getBaseContext
().
getSystemService
(
name
));
}
return
super
.
getSystemService
(
name
);
}
}
private
final
class
WindowManagerWrapper
implements
WindowManager
{
private
static
final
String
TAG
=
"WindowManagerWrapper"
;
private
final
@NonNull
WindowManager
base
;
private
WindowManagerWrapper
(
@NonNull
WindowManager
base
)
{
this
.
base
=
base
;
}
@Override
public
Display
getDefaultDisplay
()
{
return
base
.
getDefaultDisplay
();
}
@Override
public
void
removeViewImmediate
(
View
view
)
{
base
.
removeViewImmediate
(
view
);
}
@Override
public
void
addView
(
View
view
,
ViewGroup
.
LayoutParams
params
)
{
try
{
Log
.
d
(
TAG
,
"WindowManager's addView(view, params) has been hooked."
);
base
.
addView
(
view
,
params
);
}
catch
(
BadTokenException
e
)
{
Log
.
i
(
TAG
,
e
.
getMessage
());
if
(
badTokenListener
!=
null
)
{
badTokenListener
.
onBadTokenCaught
(
toast
);
}
}
catch
(
Throwable
throwable
)
{
Log
.
e
(
TAG
,
"[addView]"
,
throwable
);
}
}
@Override
public
void
updateViewLayout
(
View
view
,
ViewGroup
.
LayoutParams
params
)
{
base
.
updateViewLayout
(
view
,
params
);
}
@Override
public
void
removeView
(
View
view
)
{
base
.
removeView
(
view
);
}
}
}
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/ToastCompat.java
0 → 100644
View file @
a35653fc
package
com
.
yidianling
.
common
.
tools
.
support
.
toast
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Application
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.os.Build
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.StringRes
;
import
android.view.View
;
import
android.widget.Toast
;
import
java.lang.reflect.Field
;
/**
* @author drakeet
* Des: 解决 Android 7.1.1 由 Toast 引起的 BadTokenException Crash
*/
public
final
class
ToastCompat
extends
Toast
{
private
final
@NonNull
Toast
toast
;
/**
* Construct an empty Toast object. You must call {@link #setView} before you
* can call {@link #show}.
*
* @param context The context to use. Usually your {@link Application}
* or {@link Activity} object.
* @param base The base toast
*/
private
ToastCompat
(
Context
context
,
@NonNull
Toast
base
)
{
super
(
context
);
this
.
toast
=
base
;
}
/**
* Make a standard toast that just contains a text view.
*
* @param context The context to use. Usually your {@link Application}
* or {@link Activity} object.
* @param text The text to show. Can be formatted text.
* @param duration How long to display the message. Either {@link #LENGTH_SHORT} or
* {@link #LENGTH_LONG}
*/
public
static
ToastCompat
makeText
(
Context
context
,
CharSequence
text
,
int
duration
)
{
// We cannot pass the SafeToastContext to Toast.makeText() because
// the View will unwrap the base context and we are in vain.
@SuppressLint
(
"ShowToast"
)
Toast
toast
=
Toast
.
makeText
(
context
,
text
,
duration
);
setContextCompat
(
toast
.
getView
(),
new
SafeToastContext
(
context
,
toast
));
return
new
ToastCompat
(
context
,
toast
);
}
/**
* Make a standard toast that just contains a text view with the text from a resource.
*
* @param context The context to use. Usually your {@link Application}
* or {@link Activity} object.
* @param resId The resource id of the string resource to use. Can be formatted text.
* @param duration How long to display the message. Either {@link #LENGTH_SHORT} or
* {@link #LENGTH_LONG}
* @throws Resources.NotFoundException if the resource can't be found.
*/
public
static
Toast
makeText
(
Context
context
,
@StringRes
int
resId
,
int
duration
)
throws
Resources
.
NotFoundException
{
return
makeText
(
context
,
context
.
getResources
().
getText
(
resId
),
duration
);
}
public
@NonNull
ToastCompat
setBadTokenListener
(
@NonNull
BadTokenListener
listener
)
{
final
Context
context
=
getView
().
getContext
();
if
(
context
instanceof
SafeToastContext
)
{
((
SafeToastContext
)
context
).
setBadTokenListener
(
listener
);
}
return
this
;
}
@Override
public
void
show
()
{
toast
.
show
();
}
@Override
public
void
setDuration
(
int
duration
)
{
toast
.
setDuration
(
duration
);
}
@Override
public
void
setGravity
(
int
gravity
,
int
xOffset
,
int
yOffset
)
{
toast
.
setGravity
(
gravity
,
xOffset
,
yOffset
);
}
@Override
public
void
setMargin
(
float
horizontalMargin
,
float
verticalMargin
)
{
toast
.
setMargin
(
horizontalMargin
,
verticalMargin
);
}
@Override
public
void
setText
(
int
resId
)
{
toast
.
setText
(
resId
);
}
@Override
public
void
setText
(
CharSequence
s
)
{
toast
.
setText
(
s
);
}
@Override
public
void
setView
(
View
view
)
{
toast
.
setView
(
view
);
setContextCompat
(
view
,
new
SafeToastContext
(
view
.
getContext
(),
this
));
}
@Override
public
float
getHorizontalMargin
()
{
return
toast
.
getHorizontalMargin
();
}
@Override
public
float
getVerticalMargin
()
{
return
toast
.
getVerticalMargin
();
}
@Override
public
int
getDuration
()
{
return
toast
.
getDuration
();
}
@Override
public
int
getGravity
()
{
return
toast
.
getGravity
();
}
@Override
public
int
getXOffset
()
{
return
toast
.
getXOffset
();
}
@Override
public
int
getYOffset
()
{
return
toast
.
getYOffset
();
}
@Override
public
View
getView
()
{
return
toast
.
getView
();
}
public
@NonNull
Toast
getBaseToast
()
{
return
toast
;
}
private
static
void
setContextCompat
(
@NonNull
View
view
,
@NonNull
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
==
25
)
{
try
{
Field
field
=
View
.
class
.
getDeclaredField
(
"mContext"
);
field
.
setAccessible
(
true
);
field
.
set
(
view
,
context
);
}
catch
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
}
}
}
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