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
5e2fb2d5
Commit
5e2fb2d5
authored
Aug 12, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: minSdkVersion 升级到23
parent
901d7e61
Show whitespace changes
Inline
Side-by-side
Showing
108 changed files
with
277 additions
and
1169 deletions
+277
-1169
MDTLoginActivity.kt
app/src/main/java/com/ydl/component/rtc/MDTLoginActivity.kt
+0
-7
MDTMainActivity.java
app/src/main/java/com/ydl/component/rtc/MDTMainActivity.java
+0
-5
ProfileActivity.java
app/src/main/java/com/ydl/component/rtc/ProfileActivity.java
+0
-5
TUICallingEntranceActivity.java
app/src/main/java/com/ydl/component/rtc/TUICallingEntranceActivity.java
+0
-6
build.gradle
app2/build.gradle
+1
-1
build.gradle
build.gradle
+1
-1
config.gradle
config.gradle
+1
-1
build.gradle
m-article/build.gradle
+0
-1
build.gradle
m-audioim/build.gradle
+0
-3
AudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
+0
-5
AudioPlayer.kt
m-audioim/src/main/java/com/ydl/audioim/player/AudioPlayer.kt
+0
-9
build.gradle
m-confide/build.gradle
+0
-1
ConfideHomeActivity.kt
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
+0
-3
ConfideHomeRecentView.kt
m-confide/src/main/java/com/ydl/confide/home/widget/ConfideHomeRecentView.kt
+5
-8
ExpertIntroActivity.kt
m-confide/src/main/java/com/ydl/confide/intro/ExpertIntroActivity.kt
+0
-3
VersionedGestureDetector.java
m-consultant/src/main/java/com/yidianling/consultant/preview/VersionedGestureDetector.java
+0
-9
SeekBar.java
m-consultant/src/main/java/com/yidianling/consultant/ui/view/rangeseekbar/SeekBar.java
+0
-13
Utils.java
m-consultant/src/main/java/com/yidianling/consultant/ui/view/rangeseekbar/Utils.java
+0
-5
build.gradle
m-course/build.gradle
+0
-1
CoursePlayActivity.kt
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayActivity.kt
+1
-9
HPlayView.kt
m-course/src/main/java/com/yidianling/course/widget/HPlayView.kt
+5
-6
build.gradle
m-dynamic/build.gradle
+0
-1
BrowsePicturesActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity.java
+6
-8
BrowsePicturesActivity2.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity2.java
+5
-7
NineGridViewWrapper.java
m-dynamic/src/main/java/com/yidianling/dynamic/common/view/NineGridViewWrapper.java
+3
-11
MembersActivity.java
m-dynamic/src/main/java/com/yidianling/dynamic/members/MembersActivity.java
+5
-15
TrendsHomeFragment.java
m-dynamic/src/main/java/com/yidianling/dynamic/trendsHome/TrendsHomeFragment.java
+17
-18
FMDetailActivity.java
m-fm/src/main/java/com/yidianling/fm/FMDetailActivity.java
+2
-8
HomeConfideView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConfideView.kt
+3
-7
HomeConsultView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConsultView.kt
+2
-4
HomeConfideView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeConfideView.kt
+4
-3
HomeConsultView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeConsultView.kt
+4
-3
build.gradle
m-im/build.gradle
+0
-1
AVChatProfile.java
m-im/src/main/java/com/yidianling/avchatkit/AVChatProfile.java
+0
-17
AVChatActivity.java
m-im/src/main/java/com/yidianling/avchatkit/activity/AVChatActivity.java
+0
-1
AVChatBaseUI.java
m-im/src/main/java/com/yidianling/avchatkit/common/activity/AVChatBaseUI.java
+5
-10
BaseMPermission.java
m-im/src/main/java/com/yidianling/avchatkit/common/permission/BaseMPermission.java
+2
-34
MPermission.java
m-im/src/main/java/com/yidianling/avchatkit/common/permission/MPermission.java
+1
-9
BaseViewHolder.java
m-im/src/main/java/com/yidianling/avchatkit/common/recyclerview/holder/BaseViewHolder.java
+4
-13
AVChatVideoUI.java
m-im/src/main/java/com/yidianling/avchatkit/ui/AVChatVideoUI.java
+3
-22
MsgViewHolderLingxiWhichQuestion.java
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
+0
-11
ContactsSelectHolder.java
m-im/src/main/java/com/yidianling/uikit/business/contact/selector/viewholder/ContactsSelectHolder.java
+1
-6
CaptureVideoActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/CaptureVideoActivity.java
+3
-25
VideoMessageHelper.java
m-im/src/main/java/com/yidianling/uikit/business/session/helper/VideoMessageHelper.java
+1
-6
NormalTeamInfoActivity.java
m-im/src/main/java/com/yidianling/uikit/business/team/activity/NormalTeamInfoActivity.java
+0
-4
ChooseMusicActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/ChooseMusicActivity.kt
+2
-9
ChooseMusicDialog.kt
m-muse/src/main/java/com/yidianling/muse/dialog/ChooseMusicDialog.kt
+0
-5
MeditationFloatPermissionUtil.kt
m-muse/src/main/java/com/yidianling/muse/utils/MeditationFloatPermissionUtil.kt
+3
-6
TestHomeActivity.kt
m-tests/src/main/java/com/yidianling/tests/home/TestHomeActivity.kt
+5
-7
build.gradle
m-user/build.gradle
+0
-1
NotificationsSettingActivity.java
m-user/src/main/java/com/yidianling/user/mine/NotificationsSettingActivity.java
+0
-6
ReceiveRedPacketActivity.kt
m-user/src/main/java/com/yidianling/user/mine/ReceiveRedPacketActivity.kt
+1
-3
FingerPrintUtil.kt
m-user/src/main/java/com/yidianling/user/safePrivate/FingerPrintUtil.kt
+10
-19
SecretActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/SecretActivity.kt
+1
-3
VerificationCodeActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/VerificationCodeActivity.kt
+2
-5
SquarePinField.kt
m-user/src/main/java/com/yidianling/user/widget/PinField/SquarePinField.kt
+13
-5
build.gradle
ydl-media/build.gradle
+3
-4
MediaSessionManager.kt
ydl-media/src/main/java/com/ydl/media/audio/manager/MediaSessionManager.kt
+0
-5
build.gradle
ydl-net/build.gradle
+3
-4
build.gradle
ydl-pay/build.gradle
+3
-4
NetUtils.java
ydl-pay/src/main/java/com/yidianling/ydl_pay/common/http/utils/NetUtils.java
+0
-5
RxDeviceTool.java
ydl-pay/src/main/java/com/yidianling/ydl_pay/common/http/utils/RxDeviceTool.java
+0
-8
Cockroach.java
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/crash/Cockroach.java
+13
-11
BrowsePicturesActivity.java
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/BrowsePicturesActivity.java
+4
-6
StatusBarOptions.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/bean/StatusBarOptions.kt
+4
-11
AndroidSystemHelper.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/AndroidSystemHelper.kt
+2
-6
ApkInstallTool.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/ApkInstallTool.kt
+16
-9
DeviceTool.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/DeviceTool.java
+4
-20
DeviceUtils.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/DeviceUtils.kt
+2
-37
FileUtils.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/FileUtils.java
+4
-4
KeyboardChangeListener.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/KeyboardChangeListener.java
+0
-3
StatusBarUtils.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/StatusBarUtils.kt
+20
-123
Utils.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/Utils.java
+1
-7
FlymeStatusbarUtils.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/statusBar/FlymeStatusbarUtils.java
+0
-7
StatusBarUtil.java
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/statusBar/StatusBarUtil.java
+5
-17
BaseViewHolder.java
ydl-platform/src/main/java/com/ydl/ydlcommon/view/BaseViewHolder.java
+3
-12
SlidingTabLayout.java
ydl-platform/src/main/java/com/ydl/ydlcommon/view/SlidingTabLayout.java
+4
-9
TabView.java
ydl-platform/src/main/java/com/ydl/ydlcommon/view/verticaltablayout/TabView.java
+3
-10
build.gradle
ydl-resource/build.gradle
+3
-3
TUIThemeManager.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/TUIThemeManager.java
+1
-2
PermissionUtil.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/calling/trtccalling/model/util/PermissionUtil.java
+0
-8
TRTCBaseActivity.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/calling/videocall/TRTCBaseActivity.java
+1
-3
FileUtil.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/util/FileUtil.java
+1
-5
PopWindowUtil.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/util/PopWindowUtil.java
+0
-3
StatusBarUtil.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/util/StatusBarUtil.java
+2
-20
RxBarTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxBarTool.java
+4
-25
RxDataTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxDataTool.java
+7
-6
RxDeviceTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxDeviceTool.java
+0
-8
RxFileTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxFileTool.java
+6
-19
RxImageTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxImageTool.java
+3
-8
RxIntentTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxIntentTool.java
+0
-12
RxNetTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxNetTool.java
+0
-7
RxPhotoTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxPhotoTool.java
+12
-13
RxProcessTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxProcessTool.java
+0
-130
RxWebViewTool.java
ydl-utils/src/main/java/com/yidianling/common/tools/RxWebViewTool.java
+1
-12
DisplayMetricsHolder.java
ydl-utils/src/main/java/com/yidianling/common/tools/keyboard/DisplayMetricsHolder.java
+0
-25
ToastCompat.java
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/ToastCompat.java
+4
-3
RxDialog.java
ydl-utils/src/main/java/com/yidianling/common/view/dialog/RxDialog.java
+4
-6
RxPopupViewBackgroundConstructor.java
ydl-utils/src/main/java/com/yidianling/common/view/popupwindows/tools/RxPopupViewBackgroundConstructor.java
+0
-13
RxPopupViewManager.java
ydl-utils/src/main/java/com/yidianling/common/view/popupwindows/tools/RxPopupViewManager.java
+2
-4
RxIconRoundProgressBar.java
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/RxIconRoundProgressBar.java
+0
-9
RxRoundProgressBar.java
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/RxRoundProgressBar.java
+0
-5
RxTextRoundProgressBar.java
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/RxTextRoundProgressBar.java
+0
-48
RxBaseRoundProgressBar.java
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/common/RxBaseRoundProgressBar.java
+0
-11
WaveSideBarView.java
ydl-utils/src/main/java/com/yidianling/common/view/sidebar/WaveSideBarView.java
+0
-3
build.gradle
ydl-webview/build.gradle
+3
-4
ProxyCheckUtils.kt
ydl-webview/src/main/java/com/ydl/utils/ProxyCheckUtils.kt
+4
-12
NewH5Activity.java
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
+3
-5
No files found.
app/src/main/java/com/ydl/component/rtc/MDTLoginActivity.kt
View file @
5e2fb2d5
...
@@ -3,7 +3,6 @@ package com.ydl.component.rtc
...
@@ -3,7 +3,6 @@ package com.ydl.component.rtc
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
...
@@ -23,11 +22,9 @@ import com.ydl.component.rtc.bean.UserSigResponse
...
@@ -23,11 +22,9 @@ import com.ydl.component.rtc.bean.UserSigResponse
import
com.ydl.component.rtc.http.MDTHttpImpl.Companion.getInstance
import
com.ydl.component.rtc.http.MDTHttpImpl.Companion.getInstance
import
com.ydl.ydlcommon.modular.ModularServiceManager.provide
import
com.ydl.ydlcommon.modular.ModularServiceManager.provide
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.api.service.IUserService
import
com.yidianling.user.api.service.IUserService
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
java.util.*
class
MDTLoginActivity
:
AppCompatActivity
()
{
class
MDTLoginActivity
:
AppCompatActivity
()
{
private
var
mEditUserId
:
EditText
?
=
null
private
var
mEditUserId
:
EditText
?
=
null
...
@@ -157,16 +154,12 @@ class MDTLoginActivity : AppCompatActivity() {
...
@@ -157,16 +154,12 @@ class MDTLoginActivity : AppCompatActivity() {
}
}
private
fun
initStatusBar
()
{
private
fun
initStatusBar
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
val
window
=
window
val
window
=
window
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
window
.
decorView
.
systemUiVisibility
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
decorView
.
systemUiVisibility
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
)
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
)
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
statusBarColor
=
Color
.
TRANSPARENT
window
.
statusBarColor
=
Color
.
TRANSPARENT
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
}
}
companion
object
{
companion
object
{
...
...
app/src/main/java/com/ydl/component/rtc/MDTMainActivity.java
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.app.Dialog;
...
@@ -4,7 +4,6 @@ import android.app.Dialog;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -63,16 +62,12 @@ public class MDTMainActivity extends AppCompatActivity {
...
@@ -63,16 +62,12 @@ public class MDTMainActivity extends AppCompatActivity {
}
}
private
void
initStatusBar
()
{
private
void
initStatusBar
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
private
void
login
()
{
private
void
login
()
{
...
...
app/src/main/java/com/ydl/component/rtc/ProfileActivity.java
View file @
5e2fb2d5
...
@@ -2,7 +2,6 @@ package com.ydl.component.rtc;
...
@@ -2,7 +2,6 @@ package com.ydl.component.rtc;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.Editable
;
import
android.text.Editable
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
...
@@ -158,15 +157,11 @@ public class ProfileActivity extends AppCompatActivity {
...
@@ -158,15 +157,11 @@ public class ProfileActivity extends AppCompatActivity {
}
}
private
void
initStatusBar
()
{
private
void
initStatusBar
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
}
}
app/src/main/java/com/ydl/component/rtc/TUICallingEntranceActivity.java
View file @
5e2fb2d5
...
@@ -111,16 +111,12 @@ public class TUICallingEntranceActivity extends Activity {
...
@@ -111,16 +111,12 @@ public class TUICallingEntranceActivity extends Activity {
}
}
private
void
initStatusBar
()
{
private
void
initStatusBar
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
private
void
initView
()
{
private
void
initView
()
{
...
@@ -401,11 +397,9 @@ public class TUICallingEntranceActivity extends Activity {
...
@@ -401,11 +397,9 @@ public class TUICallingEntranceActivity extends Activity {
return
;
return
;
}
}
//其他厂商
//其他厂商
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
Intent
intent
=
new
Intent
(
Settings
.
ACTION_MANAGE_OVERLAY_PERMISSION
);
Intent
intent
=
new
Intent
(
Settings
.
ACTION_MANAGE_OVERLAY_PERMISSION
);
intent
.
setData
(
Uri
.
parse
(
"package:"
+
getPackageName
()));
intent
.
setData
(
Uri
.
parse
(
"package:"
+
getPackageName
()));
startActivityForResult
(
intent
,
PERMISSION_RESULT_CODE
);
startActivityForResult
(
intent
,
PERMISSION_RESULT_CODE
);
}
}
else
{
}
else
{
//已经有权限
//已经有权限
PermissionUtil
.
mHasPermissionOrHasHinted
=
true
;
PermissionUtil
.
mHasPermissionOrHasHinted
=
true
;
...
...
app2/build.gradle
View file @
5e2fb2d5
...
@@ -8,7 +8,7 @@ android {
...
@@ -8,7 +8,7 @@ android {
defaultConfig
{
defaultConfig
{
applicationId
"com.cxzapp.yidianling"
applicationId
"com.cxzapp.yidianling"
minSdk
2
1
minSdk
2
3
targetSdk
28
targetSdk
28
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
...
...
build.gradle
View file @
5e2fb2d5
...
@@ -5,7 +5,7 @@ buildscript {
...
@@ -5,7 +5,7 @@ buildscript {
ext
{
ext
{
kotlin_version
=
'1.6.10'
kotlin_version
=
'1.6.10'
support_version
=
'26.1.0'
support_version
=
'26.1.0'
minSdkVersion
=
2
1
minSdkVersion
=
2
3
targetSdkVersion
=
28
targetSdkVersion
=
28
compileSdkVersion
=
28
compileSdkVersion
=
28
buildToolsVersion
=
'28.0.3'
buildToolsVersion
=
'28.0.3'
...
...
config.gradle
View file @
5e2fb2d5
...
@@ -16,7 +16,7 @@ ext {
...
@@ -16,7 +16,7 @@ ext {
android
=
[
android
=
[
compileSdkVersion:
28
,
compileSdkVersion:
28
,
buildToolsVersion:
"28.0.3"
,
buildToolsVersion:
"28.0.3"
,
minSdkVersion
:
2
1
,
minSdkVersion
:
2
3
,
targetSdkVersion
:
28
,
targetSdkVersion
:
28
,
versionCode
:
1000
,
versionCode
:
1000
,
versionName
:
"1.0.00"
,
versionName
:
"1.0.00"
,
...
...
m-article/build.gradle
View file @
5e2fb2d5
...
@@ -14,7 +14,6 @@ android {
...
@@ -14,7 +14,6 @@ android {
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
...
...
m-audioim/build.gradle
View file @
5e2fb2d5
...
@@ -15,10 +15,7 @@ android {
...
@@ -15,10 +15,7 @@ android {
compileSdkVersion
rootProject
.
ext
.
compileSdkVersion
compileSdkVersion
rootProject
.
ext
.
compileSdkVersion
buildToolsVersion
rootProject
.
ext
.
buildToolsVersion
buildToolsVersion
rootProject
.
ext
.
buildToolsVersion
defaultConfig
{
defaultConfig
{
// minSdkVersion rootProject.ext.android["minSdkVersion"]
// targetSdkVersion rootProject.ext.android["targetSdkVersion"]
minSdkVersion
rootProject
.
ext
.
minSdkVersion
minSdkVersion
rootProject
.
ext
.
minSdkVersion
targetSdkVersion
rootProject
.
ext
.
targetSdkVersion
targetSdkVersion
rootProject
.
ext
.
targetSdkVersion
versionCode
1
versionCode
1
...
...
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
View file @
5e2fb2d5
...
@@ -55,7 +55,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
...
@@ -55,7 +55,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.router.YdlCommonRouterManager
import
com.ydl.ydlcommon.router.YdlCommonRouterManager
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
...
@@ -548,7 +547,6 @@ class AudioHomeActivity :
...
@@ -548,7 +547,6 @@ class AudioHomeActivity :
private
fun
setWindowStatusBarColor
()
{
private
fun
setWindowStatusBarColor
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
val
decorView
=
window
.
decorView
val
decorView
=
window
.
decorView
val
option
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
val
option
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
)
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
)
...
@@ -558,9 +556,6 @@ class AudioHomeActivity :
...
@@ -558,9 +556,6 @@ class AudioHomeActivity :
window
.
attributes
?.
layoutInDisplayCutoutMode
=
window
.
attributes
?.
layoutInDisplayCutoutMode
=
WindowManager
.
LayoutParams
.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
WindowManager
.
LayoutParams
.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
}
}
else
{
StatusBarUtils
.
setWindowStatusBarColor
(
this
,
R
.
color
.
audioim_color_40353535
)
}
}
}
@SuppressLint
(
"InvalidWakeLockTag"
)
@SuppressLint
(
"InvalidWakeLockTag"
)
...
...
m-audioim/src/main/java/com/ydl/audioim/player/AudioPlayer.kt
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.content.Context
...
@@ -4,7 +4,6 @@ import android.content.Context
import
android.media.AudioAttributes
import
android.media.AudioAttributes
import
android.media.AudioManager
import
android.media.AudioManager
import
android.media.MediaPlayer
import
android.media.MediaPlayer
import
android.os.Build
/**
/**
...
@@ -23,14 +22,10 @@ class AudioPlayer {
...
@@ -23,14 +22,10 @@ class AudioPlayer {
this
.
mContext
=
mContext
this
.
mContext
=
mContext
mPlayer
=
MediaPlayer
()
mPlayer
=
MediaPlayer
()
if
(
isSpeakerphoneOn
)
{
if
(
isSpeakerphoneOn
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
var
attributes
=
AudioAttributes
.
Builder
()
var
attributes
=
AudioAttributes
.
Builder
()
.
setLegacyStreamType
(
AudioManager
.
STREAM_MUSIC
)
.
setLegacyStreamType
(
AudioManager
.
STREAM_MUSIC
)
.
build
()
.
build
()
mPlayer
?.
setAudioAttributes
(
attributes
)
mPlayer
?.
setAudioAttributes
(
attributes
)
}
else
{
mPlayer
?.
setAudioStreamType
(
AudioManager
.
STREAM_MUSIC
)
}
audioManager
=
mContext
!!
.
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
?
audioManager
=
mContext
!!
.
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
?
audioManager
?.
setStreamVolume
(
audioManager
?.
setStreamVolume
(
...
@@ -41,14 +36,10 @@ class AudioPlayer {
...
@@ -41,14 +36,10 @@ class AudioPlayer {
}
else
{
}
else
{
mPlayer
?.
setAudioStreamType
(
AudioManager
.
STREAM_VOICE_CALL
)
mPlayer
?.
setAudioStreamType
(
AudioManager
.
STREAM_VOICE_CALL
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
var
attributes
=
AudioAttributes
.
Builder
()
var
attributes
=
AudioAttributes
.
Builder
()
.
setLegacyStreamType
(
AudioManager
.
STREAM_VOICE_CALL
)
.
setLegacyStreamType
(
AudioManager
.
STREAM_VOICE_CALL
)
.
build
()
.
build
()
mPlayer
?.
setAudioAttributes
(
attributes
)
mPlayer
?.
setAudioAttributes
(
attributes
)
}
else
{
mPlayer
?.
setAudioStreamType
(
AudioManager
.
STREAM_VOICE_CALL
)
}
audioManager
=
mContext
!!
.
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
?
audioManager
=
mContext
!!
.
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
?
audioManager
?.
setStreamVolume
(
audioManager
?.
setStreamVolume
(
...
...
m-confide/build.gradle
View file @
5e2fb2d5
...
@@ -14,7 +14,6 @@ android {
...
@@ -14,7 +14,6 @@ android {
compileSdkVersion
rootProject
.
ext
.
compileSdkVersion
compileSdkVersion
rootProject
.
ext
.
compileSdkVersion
buildToolsVersion
rootProject
.
ext
.
buildToolsVersion
buildToolsVersion
rootProject
.
ext
.
buildToolsVersion
defaultConfig
{
defaultConfig
{
minSdkVersion
rootProject
.
ext
.
minSdkVersion
minSdkVersion
rootProject
.
ext
.
minSdkVersion
targetSdkVersion
rootProject
.
ext
.
targetSdkVersion
targetSdkVersion
rootProject
.
ext
.
targetSdkVersion
...
...
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
View file @
5e2fb2d5
...
@@ -5,7 +5,6 @@ import android.content.Context
...
@@ -5,7 +5,6 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -310,13 +309,11 @@ class ConfideHomeActivity :
...
@@ -310,13 +309,11 @@ class ConfideHomeActivity :
* 初始化状态栏位置
* 初始化状态栏位置
*/
*/
private
fun
initStatusBar
()
{
private
fun
initStatusBar
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
window
?.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
window
?.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
window
?.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
?.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
?.
statusBarColor
=
Color
.
WHITE
window
?.
statusBarColor
=
Color
.
WHITE
window
?.
decorView
?.
systemUiVisibility
=
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
window
?.
decorView
?.
systemUiVisibility
=
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
}
/**
/**
* 初始化一键倾诉浮层的点击事件
* 初始化一键倾诉浮层的点击事件
...
...
m-confide/src/main/java/com/ydl/confide/home/widget/ConfideHomeRecentView.kt
View file @
5e2fb2d5
package
com.ydl.confide.home.widget
package
com.ydl.confide.home.widget
import
android.content.Context
import
android.content.Context
import
android.os.Build
import
androidx.cardview.widget.CardView
import
androidx.recyclerview.widget.RecyclerView
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
com.ydl.ydl_image.module.GlideApp
import
androidx.cardview.widget.CardView
import
com.ydl.ydl_image.transform.GlideRoundTransform
import
androidx.recyclerview.widget.RecyclerView
import
com.yidianling.common.tools.RxImageTool
import
com.ydl.confide.R
import
com.ydl.confide.R
import
com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.home.event.IConfideHomeEvent
import
com.ydl.confide.home.event.IConfideHomeEvent
import
com.ydl.ydl_image.module.GlideApp
import
com.ydl.ydl_image.transform.GlideRoundTransform
import
com.yidianling.common.tools.RxImageTool
import
kotlinx.android.synthetic.main.confide_recent_view.view.*
import
kotlinx.android.synthetic.main.confide_recent_view.view.*
/**
/**
...
@@ -46,10 +45,8 @@ class ConfideHomeRecentView(mContext: Context, private var confideHomeEvent: ICo
...
@@ -46,10 +45,8 @@ class ConfideHomeRecentView(mContext: Context, private var confideHomeEvent: ICo
params
.
setMargins
(
dp15
,
RxImageTool
.
dip2px
(
28f
),
dp15
,
RxImageTool
.
dip2px
(
24f
))
params
.
setMargins
(
dp15
,
RxImageTool
.
dip2px
(
28f
),
dp15
,
RxImageTool
.
dip2px
(
24f
))
radius
=
RxImageTool
.
dip2px
(
23f
).
toFloat
()
radius
=
RxImageTool
.
dip2px
(
23f
).
toFloat
()
layoutParams
=
params
layoutParams
=
params
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
elevation
=
RxImageTool
.
dip2px
(
1f
).
toFloat
()
elevation
=
RxImageTool
.
dip2px
(
1f
).
toFloat
()
}
}
}
/**
/**
* 数据赋值
* 数据赋值
...
...
m-confide/src/main/java/com/ydl/confide/intro/ExpertIntroActivity.kt
View file @
5e2fb2d5
package
com.ydl.confide.intro
package
com.ydl.confide.intro
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
...
@@ -64,13 +63,11 @@ class ExpertIntroActivity : AppCompatActivity() {
...
@@ -64,13 +63,11 @@ class ExpertIntroActivity : AppCompatActivity() {
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
ARouter
.
getInstance
().
inject
(
this
)
ARouter
.
getInstance
().
inject
(
this
)
binding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
activity_expert_intro
)
binding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
activity_expert_intro
)
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
val
decorView
=
window
.
decorView
val
decorView
=
window
.
decorView
val
option
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
val
option
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
)
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
)
decorView
.
systemUiVisibility
=
option
decorView
.
systemUiVisibility
=
option
window
.
statusBarColor
=
Color
.
TRANSPARENT
window
.
statusBarColor
=
Color
.
TRANSPARENT
}
if
(
initData
!=
null
)
{
if
(
initData
!=
null
)
{
val
beans
=
JSON
.
parseArray
(
initData
,
ConfideHomeBodyBean
::
class
.
java
)
val
beans
=
JSON
.
parseArray
(
initData
,
ConfideHomeBodyBean
::
class
.
java
)
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
).
isLogin
()
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
).
isLogin
()
...
...
m-consultant/src/main/java/com/yidianling/consultant/preview/VersionedGestureDetector.java
View file @
5e2fb2d5
...
@@ -17,7 +17,6 @@ package com.yidianling.consultant.preview;
...
@@ -17,7 +17,6 @@ package com.yidianling.consultant.preview;
*******************************************************************************/
*******************************************************************************/
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
/**
/**
* @author rainb
* @author rainb
...
@@ -26,16 +25,8 @@ public final class VersionedGestureDetector {
...
@@ -26,16 +25,8 @@ public final class VersionedGestureDetector {
public
static
GestureDetector
newInstance
(
Context
context
,
public
static
GestureDetector
newInstance
(
Context
context
,
OnGestureListener
listener
)
{
OnGestureListener
listener
)
{
final
int
sdkVersion
=
Build
.
VERSION
.
SDK_INT
;
GestureDetector
detector
;
GestureDetector
detector
;
if
(
sdkVersion
<
Build
.
VERSION_CODES
.
ECLAIR
)
{
detector
=
new
CupcakeGestureDetector
(
context
);
}
else
if
(
sdkVersion
<
Build
.
VERSION_CODES
.
FROYO
)
{
detector
=
new
EclairGestureDetector
(
context
);
}
else
{
detector
=
new
FroyoGestureDetector
(
context
);
detector
=
new
FroyoGestureDetector
(
context
);
}
detector
.
setOnGestureListener
(
listener
);
detector
.
setOnGestureListener
(
listener
);
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/rangeseekbar/SeekBar.java
View file @
5e2fb2d5
...
@@ -15,7 +15,6 @@ import android.graphics.Path;
...
@@ -15,7 +15,6 @@ import android.graphics.Path;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.graphics.RectF
;
import
android.graphics.RectF
;
import
android.graphics.Typeface
;
import
android.graphics.Typeface
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
...
@@ -571,11 +570,7 @@ public class SeekBar {
...
@@ -571,11 +570,7 @@ public class SeekBar {
public
void
setThumbInactivatedDrawableId
(
@DrawableRes
int
thumbInactivatedDrawableId
,
int
width
,
int
height
)
{
public
void
setThumbInactivatedDrawableId
(
@DrawableRes
int
thumbInactivatedDrawableId
,
int
width
,
int
height
)
{
if
(
thumbInactivatedDrawableId
!=
0
&&
getResources
()
!=
null
)
{
if
(
thumbInactivatedDrawableId
!=
0
&&
getResources
()
!=
null
)
{
this
.
thumbInactivatedDrawableId
=
thumbInactivatedDrawableId
;
this
.
thumbInactivatedDrawableId
=
thumbInactivatedDrawableId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
thumbInactivatedBitmap
=
Utils
.
drawableToBitmap
(
width
,
height
,
getResources
().
getDrawable
(
thumbInactivatedDrawableId
,
null
));
thumbInactivatedBitmap
=
Utils
.
drawableToBitmap
(
width
,
height
,
getResources
().
getDrawable
(
thumbInactivatedDrawableId
,
null
));
}
else
{
thumbInactivatedBitmap
=
Utils
.
drawableToBitmap
(
width
,
height
,
getResources
().
getDrawable
(
thumbInactivatedDrawableId
));
}
}
}
}
}
...
@@ -589,22 +584,14 @@ public class SeekBar {
...
@@ -589,22 +584,14 @@ public class SeekBar {
}
}
if
(
thumbDrawableId
!=
0
&&
getResources
()
!=
null
)
{
if
(
thumbDrawableId
!=
0
&&
getResources
()
!=
null
)
{
this
.
thumbDrawableId
=
thumbDrawableId
;
this
.
thumbDrawableId
=
thumbDrawableId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
thumbBitmap
=
Utils
.
drawableToBitmap
(
thumbWidth
,
thumbHeight
,
getResources
().
getDrawable
(
thumbDrawableId
,
null
));
thumbBitmap
=
Utils
.
drawableToBitmap
(
thumbWidth
,
thumbHeight
,
getResources
().
getDrawable
(
thumbDrawableId
,
null
));
}
else
{
thumbBitmap
=
Utils
.
drawableToBitmap
(
thumbWidth
,
thumbHeight
,
getResources
().
getDrawable
(
thumbDrawableId
));
}
}
}
}
}
public
void
setThumbDrawableId
(
@DrawableRes
int
thumbDrawableId
,
int
width
,
int
height
)
{
public
void
setThumbDrawableId
(
@DrawableRes
int
thumbDrawableId
,
int
width
,
int
height
)
{
if
(
thumbDrawableId
!=
0
&&
getResources
()
!=
null
&&
width
>
0
&&
height
>
0
)
{
if
(
thumbDrawableId
!=
0
&&
getResources
()
!=
null
&&
width
>
0
&&
height
>
0
)
{
this
.
thumbDrawableId
=
thumbDrawableId
;
this
.
thumbDrawableId
=
thumbDrawableId
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
thumbBitmap
=
Utils
.
drawableToBitmap
(
width
,
height
,
getResources
().
getDrawable
(
thumbDrawableId
,
null
));
thumbBitmap
=
Utils
.
drawableToBitmap
(
width
,
height
,
getResources
().
getDrawable
(
thumbDrawableId
,
null
));
}
else
{
thumbBitmap
=
Utils
.
drawableToBitmap
(
width
,
height
,
getResources
().
getDrawable
(
thumbDrawableId
));
}
}
}
}
}
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/rangeseekbar/Utils.java
View file @
5e2fb2d5
...
@@ -10,7 +10,6 @@ import android.graphics.Paint;
...
@@ -10,7 +10,6 @@ import android.graphics.Paint;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.graphics.drawable.BitmapDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.util.Log
;
import
android.util.Log
;
import
androidx.annotation.ColorRes
;
import
androidx.annotation.ColorRes
;
...
@@ -42,11 +41,7 @@ public class Utils {
...
@@ -42,11 +41,7 @@ public class Utils {
public
static
Bitmap
drawableToBitmap
(
Context
context
,
int
width
,
int
height
,
int
drawableId
)
{
public
static
Bitmap
drawableToBitmap
(
Context
context
,
int
width
,
int
height
,
int
drawableId
)
{
if
(
context
==
null
||
width
<=
0
||
height
<=
0
||
drawableId
==
0
)
return
null
;
if
(
context
==
null
||
width
<=
0
||
height
<=
0
||
drawableId
==
0
)
return
null
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
Utils
.
drawableToBitmap
(
width
,
height
,
context
.
getResources
().
getDrawable
(
drawableId
,
null
));
return
Utils
.
drawableToBitmap
(
width
,
height
,
context
.
getResources
().
getDrawable
(
drawableId
,
null
));
}
else
{
return
Utils
.
drawableToBitmap
(
width
,
height
,
context
.
getResources
().
getDrawable
(
drawableId
));
}
}
}
/**
/**
...
...
m-course/build.gradle
View file @
5e2fb2d5
...
@@ -8,7 +8,6 @@ android {
...
@@ -8,7 +8,6 @@ android {
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
...
...
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayActivity.kt
View file @
5e2fb2d5
...
@@ -5,9 +5,7 @@ import android.app.AlertDialog
...
@@ -5,9 +5,7 @@ import android.app.AlertDialog
import
android.content.Intent
import
android.content.Intent
import
android.content.res.Configuration
import
android.content.res.Configuration
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.os.Handler
import
android.os.Handler
import
androidx.recyclerview.widget.LinearLayoutManager
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -15,6 +13,7 @@ import android.view.WindowManager
...
@@ -15,6 +13,7 @@ import android.view.WindowManager
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
android.widget.TextView
import
android.widget.TextView
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.dou361.ijkplayer.widget.PlayStateParams
import
com.dou361.ijkplayer.widget.PlayStateParams
...
@@ -52,7 +51,6 @@ import com.yidianling.ydl_pay.common.CommonPayDialog
...
@@ -52,7 +51,6 @@ import com.yidianling.ydl_pay.common.CommonPayDialog
import
kotlinx.android.synthetic.main.activity_course_play.*
import
kotlinx.android.synthetic.main.activity_course_play.*
import
org.json.JSONException
import
org.json.JSONException
import
org.json.JSONObject
import
org.json.JSONObject
import
java.util.*
/**
/**
* 课程播放页面
* 课程播放页面
...
@@ -324,7 +322,6 @@ class CoursePlayActivity : BaseActivity() {
...
@@ -324,7 +322,6 @@ class CoursePlayActivity : BaseActivity() {
}
}
private
fun
initWindows
()
{
private
fun
initWindows
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
val
window
=
window
val
window
=
window
//获取状态栏高度
//获取状态栏高度
var
statusBarheight
:
Int
=
ScreenUtil
.
getStatusBarHeight
(
mContext
)
var
statusBarheight
:
Int
=
ScreenUtil
.
getStatusBarHeight
(
mContext
)
...
@@ -336,16 +333,11 @@ class CoursePlayActivity : BaseActivity() {
...
@@ -336,16 +333,11 @@ class CoursePlayActivity : BaseActivity() {
RxImageTool
.
dp2px
(
15f
),
RxImageTool
.
dp2px
(
15f
),
0
0
)
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
window
.
statusBarColor
=
Color
.
TRANSPARENT
window
.
statusBarColor
=
Color
.
TRANSPARENT
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
window
.
decorView
.
systemUiVisibility
=
window
.
decorView
.
systemUiVisibility
=
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
}
else
{
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
}
}
}
private
fun
setMargins
(
v
:
View
?,
l
:
Int
,
t
:
Int
,
r
:
Int
,
b
:
Int
)
{
private
fun
setMargins
(
v
:
View
?,
l
:
Int
,
t
:
Int
,
r
:
Int
,
b
:
Int
)
{
...
...
m-course/src/main/java/com/yidianling/course/widget/HPlayView.kt
View file @
5e2fb2d5
...
@@ -2,15 +2,14 @@ package com.yidianling.course.widget
...
@@ -2,15 +2,14 @@ package com.yidianling.course.widget
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.os.Build
import
android.os.Handler
import
android.os.Handler
import
androidx.annotation.DrawableRes
import
androidx.annotation.Nullable
import
androidx.annotation.RawRes
import
android.view.View
import
android.view.View
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.RelativeLayout
import
android.widget.RelativeLayout
import
android.widget.SeekBar
import
android.widget.SeekBar
import
androidx.annotation.DrawableRes
import
androidx.annotation.Nullable
import
androidx.annotation.RawRes
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.audio.OnPlayerEventListener
import
com.ydl.media.audio.OnPlayerEventListener
...
@@ -22,7 +21,6 @@ import com.yidianling.course.listener.HPlayStatusListener
...
@@ -22,7 +21,6 @@ import com.yidianling.course.listener.HPlayStatusListener
import
kotlinx.android.synthetic.main.course_play_music_view.view.*
import
kotlinx.android.synthetic.main.course_play_music_view.view.*
/**
/**
* Created by hgw on 2018/4/28.
* Created by hgw on 2018/4/28.
*/
*/
...
@@ -279,6 +277,6 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
...
@@ -279,6 +277,6 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
* @return
* @return
*/
*/
fun
isDestroy
():
Boolean
{
fun
isDestroy
():
Boolean
{
return
mContext
==
null
||
mContext
!!
.
isFinishing
||
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
&&
mContext
!!
.
isDestroyed
return
mContext
==
null
||
mContext
!!
.
isFinishing
||
mContext
?.
isDestroyed
==
true
}
}
}
}
\ No newline at end of file
m-dynamic/build.gradle
View file @
5e2fb2d5
...
@@ -14,7 +14,6 @@ android {
...
@@ -14,7 +14,6 @@ android {
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity.java
View file @
5e2fb2d5
...
@@ -5,14 +5,10 @@ import android.content.Context;
...
@@ -5,14 +5,10 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
androidx.fragment.app.FragmentPagerAdapter
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
...
@@ -20,19 +16,23 @@ import android.view.WindowManager;
...
@@ -20,19 +16,23 @@ import android.view.WindowManager;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.fragment.app.FragmentPagerAdapter
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.ui.ParcelableImage
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.dynamic.bean.DynamicConstants
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.bean.DynamicConstants
;
import
com.yidianling.dynamic.common.net.DynamicApiUtils
;
import
com.yidianling.dynamic.common.net.DynamicApiUtils
;
import
com.yidianling.dynamic.common.tool.DownLoadImageService
;
import
com.yidianling.dynamic.common.tool.DownLoadImageService
;
import
com.yidianling.dynamic.common.tool.ImageDownLoadCallBack
;
import
com.yidianling.dynamic.common.tool.ImageDownLoadCallBack
;
import
com.yidianling.dynamic.model.Command
;
import
com.yidianling.dynamic.model.Command
;
import
com.ydl.ydlcommon.ui.ParcelableImage
;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -226,12 +226,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
...
@@ -226,12 +226,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
}
}
private
void
initWindows
()
{
private
void
initWindows
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
private
Handler
mHandler
=
new
Handler
()
{
private
Handler
mHandler
=
new
Handler
()
{
@SuppressLint
(
"WrongConstant"
)
@SuppressLint
(
"WrongConstant"
)
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/browsePictures/BrowsePicturesActivity2.java
View file @
5e2fb2d5
...
@@ -3,26 +3,26 @@ package com.yidianling.dynamic.common.browsePictures;
...
@@ -3,26 +3,26 @@ package com.yidianling.dynamic.common.browsePictures;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
androidx.fragment.app.FragmentPagerAdapter
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.fragment.app.FragmentPagerAdapter
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.dynamic.bean.DynamicConstants
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.R
;
import
com.yidianling.dynamic.bean.DynamicConstants
;
import
com.yidianling.dynamic.common.tool.DownLoadImageService
;
import
com.yidianling.dynamic.common.tool.DownLoadImageService
;
import
com.yidianling.dynamic.common.tool.ImageDownLoadCallBack
;
import
com.yidianling.dynamic.common.tool.ImageDownLoadCallBack
;
...
@@ -164,12 +164,10 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O
...
@@ -164,12 +164,10 @@ public class BrowsePicturesActivity2 extends BaseActivity implements ViewPager.O
}
}
private
void
initWindows
()
{
private
void
initWindows
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
private
Handler
mHandler
=
new
Handler
(){
private
Handler
mHandler
=
new
Handler
(){
@Override
@Override
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/common/view/NineGridViewWrapper.java
View file @
5e2fb2d5
...
@@ -7,14 +7,14 @@ import android.graphics.Paint;
...
@@ -7,14 +7,14 @@ import android.graphics.Paint;
import
android.graphics.PorterDuff
;
import
android.graphics.PorterDuff
;
import
android.graphics.RectF
;
import
android.graphics.RectF
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
androidx.core.view.ViewCompat
;
import
android.text.TextPaint
;
import
android.text.TextPaint
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
androidx.core.view.ViewCompat
;
public
class
NineGridViewWrapper
extends
ImageView
{
public
class
NineGridViewWrapper
extends
ImageView
{
private
int
moreNum
=
0
;
//显示更多的数量
private
int
moreNum
=
0
;
//显示更多的数量
...
@@ -56,16 +56,8 @@ public class NineGridViewWrapper extends ImageView {
...
@@ -56,16 +56,8 @@ public class NineGridViewWrapper extends ImageView {
protected
void
onDraw
(
Canvas
canvas
)
{
protected
void
onDraw
(
Canvas
canvas
)
{
super
.
onDraw
(
canvas
);
super
.
onDraw
(
canvas
);
if
(
moreNum
>
0
)
{
if
(
moreNum
>
0
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
canvas
.
drawRoundRect
(
getWidth
()
/
2
,
0
f
,
getRight
(),
getHeight
()
/
4
,
20
f
,
20
f
,
mPaint
);
canvas
.
drawRoundRect
(
getWidth
()
/
2
,
0
f
,
getRight
(),
getHeight
()
/
4
,
20
f
,
20
f
,
mPaint
);
}
else
{
// canvas.drawColor(maskColor);
mRectF
.
left
=
getWidth
()
/
2
;
mRectF
.
top
=
0
;
mRectF
.
bottom
=
getHeight
()
/
4
;
mRectF
.
right
=
getRight
();
canvas
.
drawRoundRect
(
mRectF
,
20
f
,
20
f
,
mPaint
);
}
// canvas.drawColor(maskColor);
float
baseY
=
getHeight
()
/
8
-
(
textPaint
.
ascent
()
+
textPaint
.
descent
())
/
2
;
float
baseY
=
getHeight
()
/
8
-
(
textPaint
.
ascent
()
+
textPaint
.
descent
())
/
2
;
canvas
.
drawText
(
msg
,
getWidth
()
/
2
+
10
,
baseY
,
textPaint
);
canvas
.
drawText
(
msg
,
getWidth
()
/
2
+
10
,
baseY
,
textPaint
);
}
}
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/members/MembersActivity.java
View file @
5e2fb2d5
...
@@ -13,10 +13,6 @@ import android.os.Bundle;
...
@@ -13,10 +13,6 @@ import android.os.Bundle;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentTransaction
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
androidx.appcompat.app.AlertDialog
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewTreeObserver
;
import
android.view.ViewTreeObserver
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
...
@@ -24,6 +20,11 @@ import android.widget.LinearLayout;
...
@@ -24,6 +20,11 @@ import android.widget.LinearLayout;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentTransaction
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
com.google.gson.internal.LinkedTreeMap
;
import
com.google.gson.internal.LinkedTreeMap
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseActivity
;
import
com.ydl.ydlcommon.base.BaseActivity
;
...
@@ -197,17 +198,6 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
...
@@ -197,17 +198,6 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
});
});
}
}
/* @SuppressLint("WrongConstant")
private void initWindows() {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
} else {
members_top_view.setVisibility(View.GONE);
}
}*/
/**
/**
* 获取顶部图片高度后,设置滚动监听
* 获取顶部图片高度后,设置滚动监听
*/
*/
...
...
m-dynamic/src/main/java/com/yidianling/dynamic/trendsHome/TrendsHomeFragment.java
View file @
5e2fb2d5
package
com
.
yidianling
.
dynamic
.
trendsHome
;
package
com
.
yidianling
.
dynamic
.
trendsHome
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_PAGE_STAY_VISIT
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_PAGE_VISIT
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_QUESTIONS_BUTTON_CLICK
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_TYPE_CLICK
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_THOUGHTS_GROUP_MORE_CLICK
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_THOUGHTS_GROUP_TYPE_CLICK
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
com.google.android.material.appbar.AppBarLayout
;
import
com.google.android.material.appbar.CollapsingToolbarLayout
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
androidx.fragment.app.Fragment
;
import
androidx.viewpager.widget.ViewPager
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
androidx.appcompat.widget.Toolbar
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.fragment.app.Fragment
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
import
androidx.viewpager.widget.ViewPager
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.google.android.material.appbar.AppBarLayout
;
import
com.google.android.material.appbar.CollapsingToolbarLayout
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.BaseFragment
;
import
com.ydl.ydlcommon.base.BaseFragment
;
import
com.ydl.ydlcommon.utils.BuryPointUtils
;
import
com.ydl.ydlcommon.utils.BuryPointUtils
;
...
@@ -43,13 +50,6 @@ import java.util.List;
...
@@ -43,13 +50,6 @@ import java.util.List;
import
jp.wasabeef.glide.transformations.RoundedCornersTransformation
;
import
jp.wasabeef.glide.transformations.RoundedCornersTransformation
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_PAGE_STAY_VISIT
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_PAGE_VISIT
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_QUESTIONS_BUTTON_CLICK
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_ASK_TYPE_CLICK
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_THOUGHTS_GROUP_MORE_CLICK
;
import
static
com
.
yidianling
.
dynamic
.
bean
.
DynamicConstants
.
YDL_USER_THOUGHTS_GROUP_TYPE_CLICK
;
/**
/**
* Created by Jim on 2017/9/22 0022.
* Created by Jim on 2017/9/22 0022.
* 首页问答fragment
* 首页问答fragment
...
@@ -151,7 +151,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
...
@@ -151,7 +151,7 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
}
}
private
void
initStatus
()
{
private
void
initStatus
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//4.4以下不支持状态栏变色
//4.4以下不支持状态栏变色
int
statusBarHeight
=
ScreenUtil
.
getStatusBarHeight
(
getActivity
());
int
statusBarHeight
=
ScreenUtil
.
getStatusBarHeight
(
getActivity
());
CollapsingToolbarLayout
.
LayoutParams
layoutParams
=
(
CollapsingToolbarLayout
.
LayoutParams
)
mToolBarTv
.
getLayoutParams
();
CollapsingToolbarLayout
.
LayoutParams
layoutParams
=
(
CollapsingToolbarLayout
.
LayoutParams
)
mToolBarTv
.
getLayoutParams
();
layoutParams
.
height
=
(
int
)
(
getResources
().
getDimension
(
R
.
dimen
.
title_bar_height
)
+
statusBarHeight
);
layoutParams
.
height
=
(
int
)
(
getResources
().
getDimension
(
R
.
dimen
.
title_bar_height
)
+
statusBarHeight
);
...
@@ -159,7 +159,6 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
...
@@ -159,7 +159,6 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
mToolBarTv
.
setLayoutParams
(
layoutParams
);
mToolBarTv
.
setLayoutParams
(
layoutParams
);
}
}
}
private
void
initDatas
()
{
private
void
initDatas
()
{
mPresenter
=
new
TrendsHomePresenter
();
mPresenter
=
new
TrendsHomePresenter
();
...
...
m-fm/src/main/java/com/yidianling/fm/FMDetailActivity.java
View file @
5e2fb2d5
...
@@ -5,9 +5,7 @@ import android.annotation.SuppressLint;
...
@@ -5,9 +5,7 @@ import android.annotation.SuppressLint;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
androidx.cardview.widget.CardView
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
...
@@ -21,6 +19,8 @@ import android.widget.RelativeLayout;
...
@@ -21,6 +19,8 @@ import android.widget.RelativeLayout;
import
android.widget.SeekBar
;
import
android.widget.SeekBar
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.cardview.widget.CardView
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.ydl.media.audio.AudioPlayer
;
import
com.ydl.media.audio.AudioPlayer
;
import
com.ydl.media.audio.OnPlayerEventListener
;
import
com.ydl.media.audio.OnPlayerEventListener
;
...
@@ -269,18 +269,12 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
...
@@ -269,18 +269,12 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
int
changeProgress
=
0
;
int
changeProgress
=
0
;
void
init
()
{
void
init
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
}
else
{
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
fm_progress
.
setMax
(
max_progress
);
fm_progress
.
setMax
(
max_progress
);
tb_title
.
setDivideVisible
(
View
.
GONE
);
tb_title
.
setDivideVisible
(
View
.
GONE
);
tb_title
.
setLeftListener
(
new
View
.
OnClickListener
()
{
tb_title
.
setLeftListener
(
new
View
.
OnClickListener
()
{
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConfideView.kt
View file @
5e2fb2d5
...
@@ -2,18 +2,16 @@ package com.yidianling.home.ui.view
...
@@ -2,18 +2,16 @@ package com.yidianling.home.ui.view
import
android.content.Context
import
android.content.Context
import
android.graphics.Typeface
import
android.graphics.Typeface
import
android.os.Build
import
com.google.android.material.tabs.TabLayout
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.RecyclerView
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
android.widget.TextView
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.RecyclerView
import
com.google.android.material.tabs.TabLayout
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.home.R
import
com.yidianling.home.R
import
com.yidianling.home.event.HomeImpl
import
com.yidianling.home.event.HomeImpl
import
com.yidianling.home.event.IHomeBaseEvent
import
com.yidianling.home.model.bean.HomeConfideBean
import
com.yidianling.home.model.bean.HomeConfideBean
import
com.yidianling.home.model.bean.HomeHeaderBean
import
com.yidianling.home.model.bean.HomeHeaderBean
import
kotlinx.android.synthetic.xlzx.home_confide_view.view.*
import
kotlinx.android.synthetic.xlzx.home_confide_view.view.*
...
@@ -83,13 +81,11 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: Home
...
@@ -83,13 +81,11 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: Home
textView
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
textView
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
textView
.
typeface
=
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
)
textView
.
typeface
=
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
)
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
}
}
}
}
}
/**
/**
* 设置数据
* 设置数据
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConsultView.kt
View file @
5e2fb2d5
...
@@ -3,7 +3,6 @@ package com.yidianling.home.ui.view
...
@@ -3,7 +3,6 @@ package com.yidianling.home.ui.view
import
android.content.Context
import
android.content.Context
import
android.graphics.Color
import
android.graphics.Color
import
android.graphics.Typeface
import
android.graphics.Typeface
import
android.os.Build
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.LinearLayout
import
android.widget.LinearLayout
...
@@ -98,14 +97,13 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
...
@@ -98,14 +97,13 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
try
{
try
{
var
textView
=
tab_layout
.
getTabAt
(
0
)
as
TextView
var
textView
=
tab_layout
.
getTabAt
(
0
)
as
TextView
updateText
(
textView
,
true
)
updateText
(
textView
,
true
)
}
catch
(
e
:
Exception
)
{
}
}
catch
(
e
:
Exception
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
}
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
}
}
}
}
}
/**
/**
* 设置数据
* 设置数据
...
...
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeConfideView.kt
View file @
5e2fb2d5
...
@@ -72,19 +72,20 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom
...
@@ -72,19 +72,20 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom
}
}
listener
=
ConfideExpertTabSelectedListener
(
list
,
tab_layout
)
listener
=
ConfideExpertTabSelectedListener
(
list
,
tab_layout
)
tab_layout
.
addOnTabSelectedListener
(
listener
!!
)
tab_layout
.
addOnTabSelectedListener
(
listener
!!
)
var
textView
=
((
tab_layout
!!
.
getChildAt
(
0
)
as
LinearLayout
).
getChildAt
(
lastPosition
)
as
LinearLayout
).
getChildAt
(
1
)
var
textView
=
((
tab_layout
!!
.
getChildAt
(
0
)
as
LinearLayout
).
getChildAt
(
lastPosition
)
as
LinearLayout
).
getChildAt
(
1
)
if
(
textView
!=
null
&&
textView
is
TextView
)
{
if
(
textView
!=
null
&&
textView
is
TextView
)
{
textView
.
textSize
=
17f
textView
.
textSize
=
17f
textView
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
textView
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
textView
.
typeface
=
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
)
textView
.
typeface
=
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
)
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
}
}
}
}
}
/**
/**
* 设置数据
* 设置数据
...
...
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeConsultView.kt
View file @
5e2fb2d5
...
@@ -75,19 +75,20 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
...
@@ -75,19 +75,20 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
}
}
listener
=
ConsultTabSelectedListener
(
list
,
tab_layout
)
listener
=
ConsultTabSelectedListener
(
list
,
tab_layout
)
tab_layout
.
addOnTabSelectedListener
(
listener
!!
)
tab_layout
.
addOnTabSelectedListener
(
listener
!!
)
val
textView
=
((
tab_layout
!!
.
getChildAt
(
0
)
as
LinearLayout
).
getChildAt
(
lastPosition
)
as
LinearLayout
).
getChildAt
(
1
)
val
textView
=
((
tab_layout
!!
.
getChildAt
(
0
)
as
LinearLayout
).
getChildAt
(
lastPosition
)
as
LinearLayout
).
getChildAt
(
1
)
if
(
textView
!=
null
&&
textView
is
TextView
)
{
if
(
textView
!=
null
&&
textView
is
TextView
)
{
textView
.
textSize
=
17f
textView
.
textSize
=
17f
textView
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
textView
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
textView
.
typeface
=
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
)
textView
.
typeface
=
Typeface
.
defaultFromStyle
(
Typeface
.
BOLD
)
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
tab_layout
.
setOnScrollChangeListener
{
v
,
scrollX
,
scrollY
,
oldScrollX
,
oldScrollY
->
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"scrollX=$scrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
LogUtil
.
e
(
"oldScrollX=$oldScrollX"
)
}
}
}
}
}
/**
/**
* 设置数据
* 设置数据
...
...
m-im/build.gradle
View file @
5e2fb2d5
...
@@ -14,7 +14,6 @@ android {
...
@@ -14,7 +14,6 @@ android {
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
...
...
m-im/src/main/java/com/yidianling/avchatkit/AVChatProfile.java
View file @
5e2fb2d5
package
com
.
yidianling
.
avchatkit
;
package
com
.
yidianling
.
avchatkit
;
import
android.app.NotificationManager
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.content.Intent
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.core.app.NotificationCompat
;
import
com.netease.nimlib.sdk.avchat.model.AVChatData
;
import
com.netease.nimlib.sdk.avchat.model.AVChatData
;
import
com.yidianling.avchatkit.activity.AVChatActivity
;
import
com.yidianling.avchatkit.activity.AVChatActivity
;
...
@@ -52,20 +49,6 @@ public class AVChatProfile {
...
@@ -52,20 +49,6 @@ public class AVChatProfile {
Runnable
runnable
=
new
Runnable
()
{
Runnable
runnable
=
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && AppForegroundWatcherCompat.isBackground()) {
backgroundIncomingCallData = data;
backgroundIncomingCallNotification = new AVChatNotification(AVChatKit.getContext());
backgroundIncomingCallNotification.init(data.getAccount(), displayName);
backgroundIncomingCallNotification.activeIncomingCallNotification(true, backgroundIncomingCallData);
} else {
// 启动,如果 task正在启动,则稍等一下
if (AVChatKit.isMainTaskLaunching()) {
launchIncomingCall(data, displayName, source);
} else {
launchActivityTimeout();
AVChatActivity.incomingCall(AVChatKit.getContext(), data, displayName, source);
}}*/
// 启动,如果 task正在启动,则稍等一下
// 启动,如果 task正在启动,则稍等一下
if
(
AVChatKit
.
isMainTaskLaunching
())
{
if
(
AVChatKit
.
isMainTaskLaunching
())
{
launchIncomingCall
(
data
,
displayName
,
source
);
launchIncomingCall
(
data
,
displayName
,
source
);
...
...
m-im/src/main/java/com/yidianling/avchatkit/activity/AVChatActivity.java
View file @
5e2fb2d5
...
@@ -175,7 +175,6 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
...
@@ -175,7 +175,6 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
cancelCallingNotifier
();
cancelCallingNotifier
();
if
(
hasOnPause
)
{
if
(
hasOnPause
)
{
avChatVideoUI
.
onResume
();
avChatController
.
resumeVideo
();
avChatController
.
resumeVideo
();
hasOnPause
=
false
;
hasOnPause
=
false
;
}
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/activity/AVChatBaseUI.java
View file @
5e2fb2d5
package
com
.
yidianling
.
avchatkit
.
common
.
activity
;
package
com
.
yidianling
.
avchatkit
.
common
.
activity
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentTransaction
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.Toolbar
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.MenuItem
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.view.inputmethod.InputMethodManager
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentTransaction
;
import
com.yidianling.avchatkit.common.TFragment
;
import
com.yidianling.avchatkit.common.TFragment
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
import
com.yidianling.avchatkit.common.log.LogUtil
;
import
com.yidianling.avchatkit.common.util.ReflectionUtil
;
import
com.yidianling.avchatkit.common.util.ReflectionUtil
;
...
@@ -183,14 +183,9 @@ public abstract class AVChatBaseUI extends AppCompatActivity {
...
@@ -183,14 +183,9 @@ public abstract class AVChatBaseUI extends AppCompatActivity {
public
boolean
isDestroyedCompatible
()
{
public
boolean
isDestroyedCompatible
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
17
)
{
return
isDestroyedCompatible17
();
return
isDestroyedCompatible17
();
}
else
{
return
destroyed
||
super
.
isFinishing
();
}
}
}
@TargetApi
(
17
)
private
boolean
isDestroyedCompatible17
()
{
private
boolean
isDestroyedCompatible17
()
{
return
super
.
isDestroyed
();
return
super
.
isDestroyed
();
}
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/permission/BaseMPermission.java
View file @
5e2fb2d5
package
com
.
yidianling
.
avchatkit
.
common
.
permission
;
package
com
.
yidianling
.
avchatkit
.
common
.
permission
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
androidx.fragment.app.Fragment
;
import
android.util.Log
;
import
android.util.Log
;
import
androidx.fragment.app.Fragment
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -18,10 +17,6 @@ public class BaseMPermission {
...
@@ -18,10 +17,6 @@ public class BaseMPermission {
GRANTED
,
DENIED
,
DENIED_NEVER_ASK_AGAIN
GRANTED
,
DENIED
,
DENIED_NEVER_ASK_AGAIN
}
}
static
boolean
isOverMarshmallow
()
{
return
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
;
}
static
Activity
getActivity
(
Object
object
)
{
static
Activity
getActivity
(
Object
object
)
{
if
(
object
instanceof
Fragment
)
{
if
(
object
instanceof
Fragment
)
{
return
((
Fragment
)
object
).
getActivity
();
return
((
Fragment
)
object
).
getActivity
();
...
@@ -42,12 +37,9 @@ public class BaseMPermission {
...
@@ -42,12 +37,9 @@ public class BaseMPermission {
return
findPermissionResult
(
fragment
.
getActivity
(),
permissions
);
return
findPermissionResult
(
fragment
.
getActivity
(),
permissions
);
}
}
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
private
static
List
<
MPermissionResultEnum
>
findPermissionResult
(
Activity
activity
,
String
...
permissions
)
{
private
static
List
<
MPermissionResultEnum
>
findPermissionResult
(
Activity
activity
,
String
...
permissions
)
{
boolean
overM
=
isOverMarshmallow
();
List
<
MPermissionResultEnum
>
result
=
new
ArrayList
<>();
List
<
MPermissionResultEnum
>
result
=
new
ArrayList
<>();
for
(
String
p
:
permissions
)
{
for
(
String
p
:
permissions
)
{
if
(
overM
)
{
if
(
activity
.
checkSelfPermission
(
p
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
activity
.
checkSelfPermission
(
p
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
result
.
add
(
MPermissionResultEnum
.
GRANTED
);
result
.
add
(
MPermissionResultEnum
.
GRANTED
);
}
else
{
}
else
{
...
@@ -57,9 +49,6 @@ public class BaseMPermission {
...
@@ -57,9 +49,6 @@ public class BaseMPermission {
result
.
add
(
MPermissionResultEnum
.
DENIED
);
result
.
add
(
MPermissionResultEnum
.
DENIED
);
}
}
}
}
}
else
{
result
.
add
(
MPermissionResultEnum
.
GRANTED
);
}
}
}
return
result
;
return
result
;
...
@@ -76,12 +65,7 @@ public class BaseMPermission {
...
@@ -76,12 +65,7 @@ public class BaseMPermission {
return
findDeniedPermissions
(
fragment
.
getActivity
(),
permissions
);
return
findDeniedPermissions
(
fragment
.
getActivity
(),
permissions
);
}
}
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
static
List
<
String
>
findDeniedPermissions
(
Activity
activity
,
String
...
permissions
)
{
static
List
<
String
>
findDeniedPermissions
(
Activity
activity
,
String
...
permissions
)
{
if
(!
isOverMarshmallow
())
{
return
null
;
}
List
<
String
>
denyPermissions
=
new
ArrayList
<>();
List
<
String
>
denyPermissions
=
new
ArrayList
<>();
for
(
String
value
:
permissions
)
{
for
(
String
value
:
permissions
)
{
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
...
@@ -103,12 +87,7 @@ public class BaseMPermission {
...
@@ -103,12 +87,7 @@ public class BaseMPermission {
return
findNeverAskAgainPermissions
(
fragment
.
getActivity
(),
permissions
);
return
findNeverAskAgainPermissions
(
fragment
.
getActivity
(),
permissions
);
}
}
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
private
static
List
<
String
>
findNeverAskAgainPermissions
(
Activity
activity
,
String
...
permissions
)
{
private
static
List
<
String
>
findNeverAskAgainPermissions
(
Activity
activity
,
String
...
permissions
)
{
if
(!
isOverMarshmallow
())
{
return
null
;
}
List
<
String
>
neverAskAgainPermission
=
new
ArrayList
<>();
List
<
String
>
neverAskAgainPermission
=
new
ArrayList
<>();
for
(
String
value
:
permissions
)
{
for
(
String
value
:
permissions
)
{
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
...
@@ -122,12 +101,7 @@ public class BaseMPermission {
...
@@ -122,12 +101,7 @@ public class BaseMPermission {
return
neverAskAgainPermission
;
return
neverAskAgainPermission
;
}
}
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
static
boolean
hasNeverAskAgainPermission
(
Activity
activity
,
List
<
String
>
permission
)
{
static
boolean
hasNeverAskAgainPermission
(
Activity
activity
,
List
<
String
>
permission
)
{
if
(!
isOverMarshmallow
())
{
return
false
;
}
for
(
String
value
:
permission
)
{
for
(
String
value
:
permission
)
{
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
!
activity
.
shouldShowRequestPermissionRationale
(
value
))
{
!
activity
.
shouldShowRequestPermissionRationale
(
value
))
{
...
@@ -149,12 +123,7 @@ public class BaseMPermission {
...
@@ -149,12 +123,7 @@ public class BaseMPermission {
return
findDeniedPermissionWithoutNeverAskAgain
(
fragment
.
getActivity
(),
permissions
);
return
findDeniedPermissionWithoutNeverAskAgain
(
fragment
.
getActivity
(),
permissions
);
}
}
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
private
static
List
<
String
>
findDeniedPermissionWithoutNeverAskAgain
(
Activity
activity
,
String
...
permission
)
{
private
static
List
<
String
>
findDeniedPermissionWithoutNeverAskAgain
(
Activity
activity
,
String
...
permission
)
{
if
(!
isOverMarshmallow
())
{
return
null
;
}
List
<
String
>
denyPermissions
=
new
ArrayList
<>();
List
<
String
>
denyPermissions
=
new
ArrayList
<>();
for
(
String
value
:
permission
)
{
for
(
String
value
:
permission
)
{
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
if
(
activity
.
checkSelfPermission
(
value
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
...
@@ -162,7 +131,6 @@ public class BaseMPermission {
...
@@ -162,7 +131,6 @@ public class BaseMPermission {
denyPermissions
.
add
(
value
);
// 上次申请被用户拒绝了
denyPermissions
.
add
(
value
);
// 上次申请被用户拒绝了
}
}
}
}
return
denyPermissions
;
return
denyPermissions
;
}
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/permission/MPermission.java
View file @
5e2fb2d5
package
com
.
yidianling
.
avchatkit
.
common
.
permission
;
package
com
.
yidianling
.
avchatkit
.
common
.
permission
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.fragment.app.Fragment
;
import
androidx.fragment.app.Fragment
;
...
@@ -49,18 +48,11 @@ public class MPermission extends BaseMPermission {
...
@@ -49,18 +48,11 @@ public class MPermission extends BaseMPermission {
* ********************* request *********************
* ********************* request *********************
*/
*/
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
public
void
request
()
{
public
void
request
()
{
doRequestPermissions
(
object
,
requestCode
,
permissions
);
doRequestPermissions
(
object
,
requestCode
,
permissions
);
}
}
@TargetApi
(
value
=
Build
.
VERSION_CODES
.
M
)
private
static
void
doRequestPermissions
(
Object
object
,
int
requestCode
,
String
[]
permissions
)
{
private
static
void
doRequestPermissions
(
Object
object
,
int
requestCode
,
String
[]
permissions
)
{
if
(!
isOverMarshmallow
())
{
doExecuteSuccess
(
object
,
requestCode
);
return
;
}
List
<
String
>
deniedPermissions
=
findDeniedPermissions
(
getActivity
(
object
),
permissions
);
List
<
String
>
deniedPermissions
=
findDeniedPermissions
(
getActivity
(
object
),
permissions
);
if
(
deniedPermissions
!=
null
&&
deniedPermissions
.
size
()
>
0
)
{
if
(
deniedPermissions
!=
null
&&
deniedPermissions
.
size
()
>
0
)
{
if
(
object
instanceof
Activity
)
{
if
(
object
instanceof
Activity
)
{
...
...
m-im/src/main/java/com/yidianling/avchatkit/common/recyclerview/holder/BaseViewHolder.java
View file @
5e2fb2d5
...
@@ -20,14 +20,9 @@ import android.graphics.Bitmap;
...
@@ -20,14 +20,9 @@ import android.graphics.Bitmap;
import
android.graphics.Paint
;
import
android.graphics.Paint
;
import
android.graphics.Typeface
;
import
android.graphics.Typeface
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
androidx.annotation.DrawableRes
;
import
androidx.annotation.StringRes
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.text.util.Linkify
;
import
android.text.util.Linkify
;
import
android.util.SparseArray
;
import
android.util.SparseArray
;
import
android.view.View
;
import
android.view.View
;
import
android.view.animation.AlphaAnimation
;
import
android.widget.Adapter
;
import
android.widget.Adapter
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView
;
import
android.widget.CheckedTextView
;
import
android.widget.CheckedTextView
;
...
@@ -37,6 +32,10 @@ import android.widget.ProgressBar;
...
@@ -37,6 +32,10 @@ import android.widget.ProgressBar;
import
android.widget.RatingBar
;
import
android.widget.RatingBar
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.DrawableRes
;
import
androidx.annotation.StringRes
;
import
androidx.recyclerview.widget.RecyclerView
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
...
@@ -179,15 +178,7 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
...
@@ -179,15 +178,7 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
* Alpha between 0-1.
* Alpha between 0-1.
*/
*/
public
BaseViewHolder
setAlpha
(
int
viewId
,
float
value
)
{
public
BaseViewHolder
setAlpha
(
int
viewId
,
float
value
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
getView
(
viewId
).
setAlpha
(
value
);
getView
(
viewId
).
setAlpha
(
value
);
}
else
{
// Pre-honeycomb hack to set Alpha value
AlphaAnimation
alpha
=
new
AlphaAnimation
(
value
,
value
);
alpha
.
setDuration
(
0
);
alpha
.
setFillAfter
(
true
);
getView
(
viewId
).
startAnimation
(
alpha
);
}
return
this
;
return
this
;
}
}
...
...
m-im/src/main/java/com/yidianling/avchatkit/ui/AVChatVideoUI.java
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.Manifest;
...
@@ -4,7 +4,6 @@ import android.Manifest;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Rect
;
import
android.graphics.Rect
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
...
@@ -16,6 +15,7 @@ import android.widget.FrameLayout;
...
@@ -16,6 +15,7 @@ import android.widget.FrameLayout;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.netease.nimlib.sdk.avchat.AVChatManager
;
import
com.netease.nimlib.sdk.avchat.AVChatManager
;
import
com.netease.nimlib.sdk.avchat.constant.AVChatType
;
import
com.netease.nimlib.sdk.avchat.constant.AVChatType
;
import
com.netease.nimlib.sdk.avchat.constant.AVChatVideoScalingType
;
import
com.netease.nimlib.sdk.avchat.constant.AVChatVideoScalingType
;
...
@@ -25,8 +25,8 @@ import com.netease.nimlib.sdk.avchat.video.AVChatSurfaceViewRenderer;
...
@@ -25,8 +25,8 @@ import com.netease.nimlib.sdk.avchat.video.AVChatSurfaceViewRenderer;
import
com.netease.nrtc.video.render.IVideoRender
;
import
com.netease.nrtc.video.render.IVideoRender
;
import
com.tbruyelle.rxpermissions2.Permission
;
import
com.tbruyelle.rxpermissions2.Permission
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.tbruyelle.rxpermissions2.RxPermissions
;
import
com.ydl.ydlcommon.utils.DeviceTool
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.avchatkit.AVChatKit
;
import
com.yidianling.im.R
;
import
com.yidianling.avchatkit.common.imageview.HeadImageView
;
import
com.yidianling.avchatkit.common.imageview.HeadImageView
;
import
com.yidianling.avchatkit.common.permission.BaseMPermission
;
import
com.yidianling.avchatkit.common.permission.BaseMPermission
;
import
com.yidianling.avchatkit.common.util.ScreenUtil
;
import
com.yidianling.avchatkit.common.util.ScreenUtil
;
...
@@ -38,7 +38,7 @@ import com.yidianling.avchatkit.controll.AVChatController;
...
@@ -38,7 +38,7 @@ import com.yidianling.avchatkit.controll.AVChatController;
import
com.yidianling.avchatkit.module.AVChatControllerCallback
;
import
com.yidianling.avchatkit.module.AVChatControllerCallback
;
import
com.yidianling.avchatkit.module.AVSwitchListener
;
import
com.yidianling.avchatkit.module.AVSwitchListener
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.y
dl.ydlcommon.utils.DeviceTool
;
import
com.y
idianling.im.R
;
import
java.util.List
;
import
java.util.List
;
...
@@ -334,10 +334,6 @@ public class AVChatVideoUI implements View.OnClickListener, ToggleListener {
...
@@ -334,10 +334,6 @@ public class AVChatVideoUI implements View.OnClickListener, ToggleListener {
videoInit
=
true
;
videoInit
=
true
;
}
}
public
void
onResume
()
{
surfaceViewFixBefore43
(
smallSizePreviewLayout
,
largeSizePreviewLayout
);
}
public
void
onDestroy
()
{
public
void
onDestroy
()
{
if
(
time
!=
null
)
{
if
(
time
!=
null
)
{
time
.
stop
();
time
.
stop
();
...
@@ -848,20 +844,5 @@ public class AVChatVideoUI implements View.OnClickListener, ToggleListener {
...
@@ -848,20 +844,5 @@ public class AVChatVideoUI implements View.OnClickListener, ToggleListener {
return
avChatData
;
return
avChatData
;
}
}
private
void
surfaceViewFixBefore43
(
ViewGroup
front
,
ViewGroup
back
)
{
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR2
)
{
if
(
back
.
getChildCount
()
>
0
)
{
View
child
=
back
.
getChildAt
(
0
);
back
.
removeView
(
child
);
back
.
addView
(
child
);
}
if
(
front
.
getChildCount
()
>
0
)
{
View
child
=
front
.
getChildAt
(
0
);
front
.
removeView
(
child
);
front
.
addView
(
child
);
}
}
}
}
}
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
View file @
5e2fb2d5
package
com
.
yidianling
.
im
.
session
.
viewholder
;
package
com
.
yidianling
.
im
.
session
.
viewholder
;
import
android.os.Build
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -180,28 +179,22 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
...
@@ -180,28 +179,22 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
if
(
multipleAnswers
.
size
()>
0
){
if
(
multipleAnswers
.
size
()>
0
){
confirm_multiple_choice
.
setEnabled
(
true
);
confirm_multiple_choice
.
setEnabled
(
true
);
confirm_multiple_choice
.
setText
(
String
.
format
(
"确定(%d)"
,
multipleAnswers
.
size
()));
confirm_multiple_choice
.
setText
(
String
.
format
(
"确定(%d)"
,
multipleAnswers
.
size
()));
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
confirm_multiple_choice
.
setBackground
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
im_background_18dp_1da1f2
));
confirm_multiple_choice
.
setBackground
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
im_background_18dp_1da1f2
));
}
}
else
{
}
else
{
confirm_multiple_choice
.
setEnabled
(
false
);
confirm_multiple_choice
.
setEnabled
(
false
);
confirm_multiple_choice
.
setText
(
"确定"
);
confirm_multiple_choice
.
setText
(
"确定"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
confirm_multiple_choice
.
setBackground
(
context
.
getDrawable
(
R
.
drawable
.
im_background_18dp_ebebeb
));
confirm_multiple_choice
.
setBackground
(
context
.
getDrawable
(
R
.
drawable
.
im_background_18dp_ebebeb
));
}
}
}
}
}
}
else
{
}
else
{
//可点击
//可点击
if
(!
singleOrMultipletype
.
contains
(
"radio"
)){
if
(!
singleOrMultipletype
.
contains
(
"radio"
)){
confirm_multiple_choice
.
setEnabled
(
false
);
confirm_multiple_choice
.
setEnabled
(
false
);
confirm_multiple_choice
.
setText
(
"确定"
);
confirm_multiple_choice
.
setText
(
"确定"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
confirm_multiple_choice
.
setBackground
(
context
.
getDrawable
(
R
.
drawable
.
im_background_18dp_ebebeb
));
confirm_multiple_choice
.
setBackground
(
context
.
getDrawable
(
R
.
drawable
.
im_background_18dp_ebebeb
));
}
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LogUtil
.
e
(
"aaaaa"
+
e
.
getLocalizedMessage
());
LogUtil
.
e
(
"aaaaa"
+
e
.
getLocalizedMessage
());
}
}
...
@@ -365,16 +358,12 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
...
@@ -365,16 +358,12 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
confirm_multiple_choice
.
setText
(
String
.
format
(
"确定(%d)"
,
selectedStr
.
size
()));
confirm_multiple_choice
.
setText
(
String
.
format
(
"确定(%d)"
,
selectedStr
.
size
()));
if
(
selectedStr
.
size
()
>
0
)
{
if
(
selectedStr
.
size
()
>
0
)
{
confirm_multiple_choice
.
setEnabled
(
true
);
confirm_multiple_choice
.
setEnabled
(
true
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
confirm_multiple_choice
.
setBackground
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
im_background_18dp_1da1f2
));
confirm_multiple_choice
.
setBackground
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
im_background_18dp_1da1f2
));
}
}
else
{
}
else
{
confirm_multiple_choice
.
setEnabled
(
false
);
confirm_multiple_choice
.
setEnabled
(
false
);
confirm_multiple_choice
.
setText
(
"确定"
);
confirm_multiple_choice
.
setText
(
"确定"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
confirm_multiple_choice
.
setBackground
(
context
.
getDrawable
(
R
.
drawable
.
im_background_18dp_ebebeb
));
confirm_multiple_choice
.
setBackground
(
context
.
getDrawable
(
R
.
drawable
.
im_background_18dp_ebebeb
));
}
}
}
stringBuffer
.
delete
(
3
,
stringBuffer
.
length
());
stringBuffer
.
delete
(
3
,
stringBuffer
.
length
());
for
(
int
i
=
0
;
i
<
selectedStr
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
selectedStr
.
size
();
i
++)
{
stringBuffer
.
append
(
"、"
).
append
(
selectedStr
.
get
(
i
));
stringBuffer
.
append
(
"、"
).
append
(
selectedStr
.
get
(
i
));
...
...
m-im/src/main/java/com/yidianling/uikit/business/contact/selector/viewholder/ContactsSelectHolder.java
View file @
5e2fb2d5
package
com
.
yidianling
.
uikit
.
business
.
contact
.
selector
.
viewholder
;
package
com
.
yidianling
.
uikit
.
business
.
contact
.
selector
.
viewholder
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.yidianling.im.R
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.common.ui.imageview.HeadImageView
;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.business.contact.core.item.ContactItem
;
import
com.yidianling.uikit.business.contact.core.item.ContactItem
;
import
com.yidianling.uikit.business.contact.core.model.ContactDataAdapter
;
import
com.yidianling.uikit.business.contact.core.model.ContactDataAdapter
;
import
com.yidianling.uikit.business.contact.core.model.IContact
;
import
com.yidianling.uikit.business.contact.core.model.IContact
;
import
com.yidianling.uikit.business.contact.core.viewholder.AbsContactViewHolder
;
import
com.yidianling.uikit.business.contact.core.viewholder.AbsContactViewHolder
;
import
com.yidianling.uikit.business.contact.selector.adapter.ContactSelectAdapter
;
import
com.yidianling.uikit.business.contact.selector.adapter.ContactSelectAdapter
;
import
com.yidianling.nimbase.common.ui.imageview.HeadImageView
;
public
class
ContactsSelectHolder
extends
AbsContactViewHolder
<
ContactItem
>
{
public
class
ContactsSelectHolder
extends
AbsContactViewHolder
<
ContactItem
>
{
private
final
boolean
multi
;
private
final
boolean
multi
;
...
@@ -79,10 +78,6 @@ public class ContactsSelectHolder extends AbsContactViewHolder<ContactItem> {
...
@@ -79,10 +78,6 @@ public class ContactsSelectHolder extends AbsContactViewHolder<ContactItem> {
}
}
private
void
setBackground
(
View
view
,
Drawable
drawable
)
{
private
void
setBackground
(
View
view
,
Drawable
drawable
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
view
.
setBackground
(
drawable
);
view
.
setBackground
(
drawable
);
}
else
{
view
.
setBackgroundDrawable
(
drawable
);
}
}
}
}
}
m-im/src/main/java/com/yidianling/uikit/business/session/activity/CaptureVideoActivity.java
View file @
5e2fb2d5
package
com
.
yidianling
.
uikit
.
business
.
session
.
activity
;
package
com
.
yidianling
.
uikit
.
business
.
session
.
activity
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
...
@@ -24,6 +23,7 @@ import android.widget.ImageView;
...
@@ -24,6 +23,7 @@ import android.widget.ImageView;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.yidianling.im.R
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
com.yidianling.nimbase.common.activity.ToolBarOptions
;
import
com.yidianling.nimbase.common.activity.ToolBarOptions
;
import
com.yidianling.nimbase.common.activity.UI
;
import
com.yidianling.nimbase.common.activity.UI
;
...
@@ -32,7 +32,6 @@ import com.yidianling.nimbase.common.ui.dialog.EasyAlertDialogHelper;
...
@@ -32,7 +32,6 @@ import com.yidianling.nimbase.common.ui.dialog.EasyAlertDialogHelper;
import
com.yidianling.nimbase.common.util.file.AttachmentStore
;
import
com.yidianling.nimbase.common.util.file.AttachmentStore
;
import
com.yidianling.nimbase.common.util.log.LogUtil
;
import
com.yidianling.nimbase.common.util.log.LogUtil
;
import
com.yidianling.nimbase.common.util.sys.TimeUtil
;
import
com.yidianling.nimbase.common.util.sys.TimeUtil
;
import
com.yidianling.im.R
;
import
java.io.File
;
import
java.io.File
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -203,17 +202,15 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -203,17 +202,15 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
});
});
}
}
@TargetApi
(
9
)
private
void
switchCamera
()
{
private
void
switchCamera
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
cameraId
=
(
cameraId
+
1
)
%
Camera
.
getNumberOfCameras
();
cameraId
=
(
cameraId
+
1
)
%
Camera
.
getNumberOfCameras
();
}
resizeSurfaceView
();
resizeSurfaceView
();
shutdownCamera
();
shutdownCamera
();
initCamera
();
initCamera
();
startPreview
();
startPreview
();
}
}
@Override
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
...
@@ -221,6 +218,7 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -221,6 +218,7 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
WindowManager
.
LayoutParams
.
FLAG_KEEP_SCREEN_ON
);
WindowManager
.
LayoutParams
.
FLAG_KEEP_SCREEN_ON
);
}
}
@Override
public
void
onPause
()
{
public
void
onPause
()
{
super
.
onPause
();
super
.
onPause
();
...
@@ -366,12 +364,10 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -366,12 +364,10 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
backCameraSize
.
clear
();
backCameraSize
.
clear
();
frontCameraSize
.
clear
();
frontCameraSize
.
clear
();
getVideoPreviewSize
(
false
);
getVideoPreviewSize
(
false
);
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
if
(
Camera
.
getNumberOfCameras
()
>=
2
)
{
if
(
Camera
.
getNumberOfCameras
()
>=
2
)
{
getVideoPreviewSize
(
true
);
getVideoPreviewSize
(
true
);
}
}
}
}
}
private
Point
currentUsePoint
=
null
;
private
Point
currentUsePoint
=
null
;
...
@@ -419,15 +415,7 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -419,15 +415,7 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
profile
.
videoCodec
=
MediaRecorder
.
VideoEncoder
.
H264
;
profile
.
videoCodec
=
MediaRecorder
.
VideoEncoder
.
H264
;
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
14
)
{
profile
.
audioCodec
=
MediaRecorder
.
AudioEncoder
.
AAC
;
}
else
{
if
(
Build
.
DISPLAY
!=
null
&&
Build
.
DISPLAY
.
indexOf
(
"MIUI"
)
>=
0
)
{
profile
.
audioCodec
=
MediaRecorder
.
AudioEncoder
.
AAC
;
profile
.
audioCodec
=
MediaRecorder
.
AudioEncoder
.
AAC
;
}
else
{
profile
.
audioCodec
=
MediaRecorder
.
AudioEncoder
.
AMR_NB
;
}
}
mediaRecorder
.
setProfile
(
profile
);
mediaRecorder
.
setProfile
(
profile
);
}
else
{
}
else
{
mediaRecorder
.
setOutputFormat
(
MediaRecorder
.
OutputFormat
.
MPEG_4
);
mediaRecorder
.
setOutputFormat
(
MediaRecorder
.
OutputFormat
.
MPEG_4
);
...
@@ -439,12 +427,10 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -439,12 +427,10 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
private
void
setVideoOrientation
()
{
private
void
setVideoOrientation
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
Camera
.
CameraInfo
info
=
new
Camera
.
CameraInfo
();
Camera
.
CameraInfo
info
=
new
Camera
.
CameraInfo
();
Camera
.
getCameraInfo
(
cameraId
,
info
);
Camera
.
getCameraInfo
(
cameraId
,
info
);
mediaRecorder
.
setOrientationHint
(
info
.
orientation
);
mediaRecorder
.
setOrientationHint
(
info
.
orientation
);
}
}
}
public
void
updateRecordUI
()
{
public
void
updateRecordUI
()
{
if
(
recording
)
{
if
(
recording
)
{
...
@@ -591,16 +577,12 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -591,16 +577,12 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
*/
*/
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
public
void
checkMultiCamera
()
{
public
void
checkMultiCamera
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
if
(
Camera
.
getNumberOfCameras
()
>
1
)
{
if
(
Camera
.
getNumberOfCameras
()
>
1
)
{
multiCamera
=
true
;
multiCamera
=
true
;
switchCamera
.
setVisibility
(
View
.
VISIBLE
);
switchCamera
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
}
else
{
switchCamera
.
setVisibility
(
View
.
GONE
);
switchCamera
.
setVisibility
(
View
.
GONE
);
}
}
}
else
{
switchCamera
.
setVisibility
(
View
.
GONE
);
}
}
}
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
...
@@ -628,11 +610,9 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -628,11 +610,9 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
private
void
setCameraParameters
()
{
private
void
setCameraParameters
()
{
Camera
.
Parameters
params
=
camera
.
getParameters
();
Camera
.
Parameters
params
=
camera
.
getParameters
();
if
(
Build
.
VERSION
.
SDK_INT
>=
15
)
{
if
(
params
.
isVideoStabilizationSupported
())
{
if
(
params
.
isVideoStabilizationSupported
())
{
params
.
setVideoStabilization
(
true
);
params
.
setVideoStabilization
(
true
);
}
}
}
List
<
String
>
focusMode
=
params
.
getSupportedFocusModes
();
List
<
String
>
focusMode
=
params
.
getSupportedFocusModes
();
if
(
focusMode
.
contains
(
Camera
.
Parameters
.
FOCUS_MODE_CONTINUOUS_VIDEO
))
{
if
(
focusMode
.
contains
(
Camera
.
Parameters
.
FOCUS_MODE_CONTINUOUS_VIDEO
))
{
...
@@ -711,12 +691,10 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
...
@@ -711,12 +691,10 @@ public class CaptureVideoActivity extends UI implements SurfaceHolder.Callback {
public
int
setCameraDisplayOrientation
(
Context
context
,
int
cameraId
,
Camera
camera
)
{
public
int
setCameraDisplayOrientation
(
Context
context
,
int
cameraId
,
Camera
camera
)
{
int
orientation
=
90
;
int
orientation
=
90
;
boolean
front
=
(
cameraId
==
1
);
boolean
front
=
(
cameraId
==
1
);
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
Camera
.
CameraInfo
info
=
new
Camera
.
CameraInfo
();
Camera
.
CameraInfo
info
=
new
Camera
.
CameraInfo
();
Camera
.
getCameraInfo
(
cameraId
,
info
);
Camera
.
getCameraInfo
(
cameraId
,
info
);
orientation
=
info
.
orientation
;
orientation
=
info
.
orientation
;
front
=
(
info
.
facing
==
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
front
=
(
info
.
facing
==
Camera
.
CameraInfo
.
CAMERA_FACING_FRONT
);
}
WindowManager
manager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
WindowManager
manager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
int
rotation
=
manager
.
getDefaultDisplay
().
getRotation
();
int
rotation
=
manager
.
getDefaultDisplay
().
getRotation
();
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/helper/VideoMessageHelper.java
View file @
5e2fb2d5
...
@@ -5,12 +5,10 @@ import android.content.ActivityNotFoundException;
...
@@ -5,12 +5,10 @@ import android.content.ActivityNotFoundException;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
com.yidianling.im.R
;
import
com.yidianling.im.R
;
import
com.yidianling.uikit.business.session.activity.CaptureVideoActivity
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
com.yidianling.nimbase.common.ui.dialog.CustomAlertDialog
;
import
com.yidianling.nimbase.common.ui.dialog.CustomAlertDialog
;
import
com.yidianling.nimbase.common.util.C
;
import
com.yidianling.nimbase.common.util.C
;
...
@@ -20,6 +18,7 @@ import com.yidianling.nimbase.common.util.storage.StorageType;
...
@@ -20,6 +18,7 @@ import com.yidianling.nimbase.common.util.storage.StorageType;
import
com.yidianling.nimbase.common.util.storage.StorageUtil
;
import
com.yidianling.nimbase.common.util.storage.StorageUtil
;
import
com.yidianling.nimbase.common.util.string.MD5
;
import
com.yidianling.nimbase.common.util.string.MD5
;
import
com.yidianling.nimbase.common.util.string.StringUtil
;
import
com.yidianling.nimbase.common.util.string.StringUtil
;
import
com.yidianling.uikit.business.session.activity.CaptureVideoActivity
;
import
java.io.File
;
import
java.io.File
;
...
@@ -91,11 +90,7 @@ public class VideoMessageHelper {
...
@@ -91,11 +90,7 @@ public class VideoMessageHelper {
* 从本地相册中选择视频
* 从本地相册中选择视频
*/
*/
protected
void
chooseVideoFromLocal
()
{
protected
void
chooseVideoFromLocal
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
chooseVideoFromLocalKitKat
();
chooseVideoFromLocalKitKat
();
}
else
{
chooseVideoFromLocalBeforeKitKat
();
}
}
}
/**
/**
...
...
m-im/src/main/java/com/yidianling/uikit/business/team/activity/NormalTeamInfoActivity.java
View file @
5e2fb2d5
...
@@ -3,7 +3,6 @@ package com.yidianling.uikit.business.team.activity;
...
@@ -3,7 +3,6 @@ package com.yidianling.uikit.business.team.activity;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
...
@@ -521,9 +520,6 @@ public class NormalTeamInfoActivity extends UI implements OnClickListener, TAdap
...
@@ -521,9 +520,6 @@ public class NormalTeamInfoActivity extends UI implements OnClickListener, TAdap
}
}
}
}
// 为了解决2.3系统,移除用户后刷新界面不显示的问题
// 为了解决2.3系统,移除用户后刷新界面不显示的问题
if
(
Build
.
VERSION
.
SDK_INT
<
11
)
{
adapter
.
setMode
(
TeamMemberAdapter
.
Mode
.
NORMAL
);
}
adapter
.
notifyDataSetChanged
();
adapter
.
notifyDataSetChanged
();
}
}
...
...
m-muse/src/main/java/com/yidianling/muse/activity/ChooseMusicActivity.kt
View file @
5e2fb2d5
...
@@ -5,7 +5,6 @@ import android.content.Context
...
@@ -5,7 +5,6 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.content.res.Resources
import
android.content.res.Resources
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
...
@@ -82,9 +81,7 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -82,9 +81,7 @@ class ChooseMusicActivity : BaseActivity() {
mWebSettings
.
textZoom
=
100
//设置字体不跟随字体变化而变化
mWebSettings
.
textZoom
=
100
//设置字体不跟随字体变化而变化
mWebSettings
.
allowFileAccessFromFileURLs
=
true
mWebSettings
.
allowFileAccessFromFileURLs
=
true
mWebSettings
.
blockNetworkImage
=
false
// 解决图片不显示
mWebSettings
.
blockNetworkImage
=
false
// 解决图片不显示
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
mWebSettings
.
mixedContentMode
=
WebSettings
.
LOAD_DEFAULT
mWebSettings
.
mixedContentMode
=
WebSettings
.
LOAD_NORMAL
}
wv_choose_music
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
wv_choose_music
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
wv_choose_music
.
addJavascriptInterface
(
jtoJHandle
,
"javascriptHandler"
)
wv_choose_music
.
addJavascriptInterface
(
jtoJHandle
,
"javascriptHandler"
)
...
@@ -98,11 +95,7 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -98,11 +95,7 @@ class ChooseMusicActivity : BaseActivity() {
super
.
onPageFinished
(
view
,
url
)
super
.
onPageFinished
(
view
,
url
)
}
}
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
,
request
:
WebResourceRequest
):
Boolean
{
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
,
request
:
WebResourceRequest
):
Boolean
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
loadUrl
(
request
.
url
.
toString
(),
view
)
loadUrl
(
request
.
url
.
toString
(),
view
)
}
else
{
loadUrl
(
request
.
toString
(),
view
)
}
return
true
return
true
}
}
}
}
...
...
m-muse/src/main/java/com/yidianling/muse/dialog/ChooseMusicDialog.kt
View file @
5e2fb2d5
...
@@ -5,7 +5,6 @@ import android.app.Activity
...
@@ -5,7 +5,6 @@ import android.app.Activity
import
android.app.Dialog
import
android.app.Dialog
import
android.content.res.Resources
import
android.content.res.Resources
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.Gravity
import
android.view.Gravity
...
@@ -14,10 +13,8 @@ import android.view.WindowManager
...
@@ -14,10 +13,8 @@ import android.view.WindowManager
import
android.webkit.WebSettings
import
android.webkit.WebSettings
import
com.ydl.utils.WebUrlParamsUtils
import
com.ydl.utils.WebUrlParamsUtils
import
com.ydl.webview.H5Params
import
com.ydl.webview.H5Params
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.muse.R
import
com.yidianling.muse.R
import
com.yidianling.muse.activity.PlayMeditationActivity
import
kotlinx.android.synthetic.main.dialog_choose_music.*
import
kotlinx.android.synthetic.main.dialog_choose_music.*
/**
/**
...
@@ -63,9 +60,7 @@ class ChooseMusicDialog(activity: Activity,h5Params: H5Params) : Dialog(activity
...
@@ -63,9 +60,7 @@ class ChooseMusicDialog(activity: Activity,h5Params: H5Params) : Dialog(activity
mWebSettings
.
textZoom
=
100
//设置字体不跟随字体变化而变化
mWebSettings
.
textZoom
=
100
//设置字体不跟随字体变化而变化
mWebSettings
.
allowFileAccessFromFileURLs
=
true
mWebSettings
.
allowFileAccessFromFileURLs
=
true
mWebSettings
.
blockNetworkImage
=
false
// 解决图片不显示
mWebSettings
.
blockNetworkImage
=
false
// 解决图片不显示
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
mWebSettings
.
mixedContentMode
=
WebSettings
.
LOAD_NORMAL
mWebSettings
.
mixedContentMode
=
WebSettings
.
LOAD_NORMAL
}
wv_choose_music
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
wv_choose_music
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
// val jsInterface = JsInterface(mActivity as PlayMeditationActivity)
// val jsInterface = JsInterface(mActivity as PlayMeditationActivity)
// wv_choose_music.addJavascriptInterface(jsInterface, "javascriptHandler")
// wv_choose_music.addJavascriptInterface(jsInterface, "javascriptHandler")
...
...
m-muse/src/main/java/com/yidianling/muse/utils/MeditationFloatPermissionUtil.kt
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.app.Activity
...
@@ -4,7 +4,6 @@ import android.app.Activity
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.provider.Settings
import
android.provider.Settings
object
MeditationFloatPermissionUtil
{
object
MeditationFloatPermissionUtil
{
...
@@ -13,15 +12,13 @@ object MeditationFloatPermissionUtil {
...
@@ -13,15 +12,13 @@ object MeditationFloatPermissionUtil {
private
fun
commonROMPermissionCheck
(
context
:
Context
?):
Boolean
{
private
fun
commonROMPermissionCheck
(
context
:
Context
?):
Boolean
{
var
result
=
true
var
result
=
true
if
(
Build
.
VERSION
.
SDK_INT
>=
23
){
try
{
try
{
val
clazz
:
Class
<*>
=
Settings
::
class
.
java
val
clazz
:
Class
<*>
=
Settings
::
class
.
java
val
canDrawOverlays
=
clazz
.
getDeclaredMethod
(
"canDrawOverlays"
,
Context
::
class
.
java
)
val
canDrawOverlays
=
clazz
.
getDeclaredMethod
(
"canDrawOverlays"
,
Context
::
class
.
java
)
result
=
canDrawOverlays
.
invoke
(
null
,
context
)
as
Boolean
result
=
canDrawOverlays
.
invoke
(
null
,
context
)
as
Boolean
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
}
}
}
return
result
return
result
}
}
...
...
m-tests/src/main/java/com/yidianling/tests/home/TestHomeActivity.kt
View file @
5e2fb2d5
package
com.yidianling.tests.home
package
com.yidianling.tests.home
import
android.os.Build
import
androidx.core.content.ContextCompat
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import
com.google.gson.Gson
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.google.gson.reflect.TypeToken
import
com.ydl.ydlcommon.base.BaseMvpActivity
import
com.ydl.ydlcommon.base.BaseMvpActivity
...
@@ -103,14 +102,13 @@ class TestHomeActivity : BaseMvpActivity<ITestHomeContract.View,ITestHomeContrac
...
@@ -103,14 +102,13 @@ class TestHomeActivity : BaseMvpActivity<ITestHomeContract.View,ITestHomeContrac
* 初始化状态栏位置
* 初始化状态栏位置
*/
*/
private
fun
initStatus
()
{
private
fun
initStatus
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//4.4以下不支持状态栏变色
//4.4以下不支持状态栏变色
StatusBarUtils
.
setTransparentForImageView
(
this
,
null
)
StatusBarUtils
.
setTransparentForImageView
(
this
,
null
)
val
statusBarHeight
=
StatusBarUtils
.
getStatusBarHeight
(
this
)
val
statusBarHeight
=
StatusBarUtils
.
getStatusBarHeight
(
this
)
val
lp1
=
rl_tests_title_layout
.
layoutParams
as
LinearLayout
.
LayoutParams
val
lp1
=
rl_tests_title_layout
.
layoutParams
as
LinearLayout
.
LayoutParams
lp1
.
height
=
(
RxImageTool
.
dp2px
(
48f
)
+
statusBarHeight
)
lp1
.
height
=
(
RxImageTool
.
dp2px
(
48f
)
+
statusBarHeight
)
rl_tests_title_layout
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
rl_tests_title_layout
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
}
}
}
//路由传递过来的参数
//路由传递过来的参数
...
...
m-user/build.gradle
View file @
5e2fb2d5
...
@@ -14,7 +14,6 @@ android {
...
@@ -14,7 +14,6 @@ android {
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
buildToolsVersion
rootProject
.
ext
.
android
[
"buildToolsVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
...
...
m-user/src/main/java/com/yidianling/user/mine/NotificationsSettingActivity.java
View file @
5e2fb2d5
...
@@ -171,14 +171,8 @@ public class NotificationsSettingActivity extends BaseActivity {
...
@@ -171,14 +171,8 @@ public class NotificationsSettingActivity extends BaseActivity {
private
void
getAppDetailSettingIntent
(
Context
context
)
{
private
void
getAppDetailSettingIntent
(
Context
context
)
{
Intent
localIntent
=
new
Intent
();
Intent
localIntent
=
new
Intent
();
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
getPackageName
(),
null
));
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
getPackageName
(),
null
));
}
else
if
(
Build
.
VERSION
.
SDK_INT
<=
8
)
{
localIntent
.
setAction
(
Intent
.
ACTION_VIEW
);
localIntent
.
setClassName
(
"com.android.settings"
,
"com.android.settings.InstalledAppDetails"
);
localIntent
.
putExtra
(
"com.android.settings.ApplicationPkgName"
,
getPackageName
());
}
startActivity
(
localIntent
);
startActivity
(
localIntent
);
}
}
...
...
m-user/src/main/java/com/yidianling/user/mine/ReceiveRedPacketActivity.kt
View file @
5e2fb2d5
...
@@ -2,7 +2,6 @@ package com.yidianling.user.mine
...
@@ -2,7 +2,6 @@ package com.yidianling.user.mine
import
android.app.Activity
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.os.Build
import
android.text.SpannableStringBuilder
import
android.text.SpannableStringBuilder
import
android.text.Spanned
import
android.text.Spanned
import
android.text.TextUtils
import
android.text.TextUtils
...
@@ -139,14 +138,13 @@ class ReceiveRedPacketActivity : BaseActivity(),View.OnClickListener {
...
@@ -139,14 +138,13 @@ class ReceiveRedPacketActivity : BaseActivity(),View.OnClickListener {
* 初始化状态栏位置
* 初始化状态栏位置
*/
*/
private
fun
initStatus
()
{
private
fun
initStatus
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//4.4以下不支持状态栏变色
//4.4以下不支持状态栏变色
StatusBarUtils
.
setTransparentForImageView
(
this
,
null
)
StatusBarUtils
.
setTransparentForImageView
(
this
,
null
)
val
statusBarHeight
=
StatusBarUtils
.
getStatusBarHeight
(
this
)
val
statusBarHeight
=
StatusBarUtils
.
getStatusBarHeight
(
this
)
val
lp1
=
title_bar
.
layoutParams
as
LinearLayout
.
LayoutParams
val
lp1
=
title_bar
.
layoutParams
as
LinearLayout
.
LayoutParams
lp1
.
height
=
(
RxImageTool
.
dp2px
(
45f
)
+
statusBarHeight
)
lp1
.
height
=
(
RxImageTool
.
dp2px
(
45f
)
+
statusBarHeight
)
title_bar
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
title_bar
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
}
}
}
override
fun
initDataAndEvent
()
{
override
fun
initDataAndEvent
()
{
initStatus
()
initStatus
()
...
...
m-user/src/main/java/com/yidianling/user/safePrivate/FingerPrintUtil.kt
View file @
5e2fb2d5
...
@@ -2,7 +2,6 @@ package com.yidianling.user.safePrivate
...
@@ -2,7 +2,6 @@ package com.yidianling.user.safePrivate
import
android.app.KeyguardManager
import
android.app.KeyguardManager
import
android.content.Context
import
android.content.Context
import
android.os.Build
import
androidx.core.hardware.fingerprint.FingerprintManagerCompat
import
androidx.core.hardware.fingerprint.FingerprintManagerCompat
import
androidx.core.os.CancellationSignal
import
androidx.core.os.CancellationSignal
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.base.BaseApp
...
@@ -70,21 +69,15 @@ class FingerPrintUtil {
...
@@ -70,21 +69,15 @@ class FingerPrintUtil {
}
}
private
fun
init
()
{
private
fun
init
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
if
(
manager
==
null
&&
keyManager
==
null
)
{
if
(
manager
==
null
&&
keyManager
==
null
)
{
manager
=
FingerprintManagerCompat
.
from
(
context
)
manager
=
FingerprintManagerCompat
.
from
(
context
)
keyManager
=
context
.
getSystemService
(
Context
.
KEYGUARD_SERVICE
)
as
KeyguardManager
keyManager
=
context
.
getSystemService
(
Context
.
KEYGUARD_SERVICE
)
as
KeyguardManager
}
}
}
}
}
//硬件设备是否支持指纹解锁功能
//硬件设备是否支持指纹解锁功能
fun
isFingerPrintAvaliable
():
Boolean
?
{
fun
isFingerPrintAvaliable
():
Boolean
?
{
return
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
return
manager
?.
isHardwareDetected
manager
?.
isHardwareDetected
}
else
{
false
}
}
}
//判断是否有锁屏密码
//判断是否有锁屏密码
...
@@ -95,22 +88,21 @@ class FingerPrintUtil {
...
@@ -95,22 +88,21 @@ class FingerPrintUtil {
// 判断设备是否录入指纹,貌似APP无法直接唤醒指纹设置页面
// 判断设备是否录入指纹,貌似APP无法直接唤醒指纹设置页面
fun
isHaveFingerPrint
():
Boolean
?
{
fun
isHaveFingerPrint
():
Boolean
?
{
return
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
return
manager
?.
hasEnrolledFingerprints
()
manager
?.
hasEnrolledFingerprints
()
}
else
{
false
}
}
}
// 开始识别指纹
// 开始识别指纹
// 参数分别是:防止第三方恶意攻击的包装类,CancellationSignal对象,flags,回调对象,handle
// 参数分别是:防止第三方恶意攻击的包装类,CancellationSignal对象,flags,回调对象,handle
fun
startFingerPrint
(
call
:
FingerCallback
)
{
fun
startFingerPrint
(
call
:
FingerCallback
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
if
(
mCancellationSignal
==
null
)
{
if
(
mCancellationSignal
==
null
)
{
mCancellationSignal
=
CancellationSignal
()
mCancellationSignal
=
CancellationSignal
()
}
}
manager
?.
authenticate
(
null
,
0
,
mCancellationSignal
,
object
:
FingerprintManagerCompat
.
AuthenticationCallback
()
{
manager
?.
authenticate
(
null
,
0
,
mCancellationSignal
,
object
:
FingerprintManagerCompat
.
AuthenticationCallback
()
{
override
fun
onAuthenticationError
(
errorCode
:
Int
,
errString
:
CharSequence
)
{
override
fun
onAuthenticationError
(
errorCode
:
Int
,
errString
:
CharSequence
)
{
super
.
onAuthenticationError
(
errorCode
,
errString
)
super
.
onAuthenticationError
(
errorCode
,
errString
)
call
.
onAuthenticationError
()
call
.
onAuthenticationError
()
...
@@ -128,17 +120,16 @@ class FingerPrintUtil {
...
@@ -128,17 +120,16 @@ class FingerPrintUtil {
call
.
onAuthenticationFailed
()
call
.
onAuthenticationFailed
()
LogUtil
.
d
(
"指纹识别失败"
)
LogUtil
.
d
(
"指纹识别失败"
)
}
}
},
null
)
},
}
null
)
}
}
//停止指纹监听
//停止指纹监听
fun
cancelFingerListener
()
{
fun
cancelFingerListener
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
mCancellationSignal
?.
cancel
()
mCancellationSignal
?.
cancel
()
mCancellationSignal
=
null
mCancellationSignal
=
null
}
}
}
private
object
Inner
{
private
object
Inner
{
val
finger
=
FingerPrintUtil
()
val
finger
=
FingerPrintUtil
()
...
...
m-user/src/main/java/com/yidianling/user/ui/login/SecretActivity.kt
View file @
5e2fb2d5
...
@@ -2,7 +2,6 @@ package com.yidianling.user.ui.login
...
@@ -2,7 +2,6 @@ package com.yidianling.user.ui.login
import
android.app.Activity
import
android.app.Activity
import
android.content.Intent
import
android.content.Intent
import
android.os.Build
import
android.text.Html
import
android.text.Html
import
android.view.KeyEvent
import
android.view.KeyEvent
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseActivity
...
@@ -110,11 +109,10 @@ class SecretActivity : BaseActivity() {
...
@@ -110,11 +109,10 @@ class SecretActivity : BaseActivity() {
}
}
private
fun
initStatus
()
{
private
fun
initStatus
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//4.4以下不支持状态栏变色
//4.4以下不支持状态栏变色
StatusBarUtils
.
setTransparentForImageView
(
this
,
null
)
StatusBarUtils
.
setTransparentForImageView
(
this
,
null
)
StatusBarUtils
.
statusBarLightMode
(
this
)
StatusBarUtils
.
statusBarLightMode
(
this
)
}
}
}
private
fun
agreeAction
()
{
private
fun
agreeAction
()
{
SharedPreferencesEditor
.
putString
(
"hasAgreeSecret"
,
"true"
)
SharedPreferencesEditor
.
putString
(
"hasAgreeSecret"
,
"true"
)
...
...
m-user/src/main/java/com/yidianling/user/ui/login/VerificationCodeActivity.kt
View file @
5e2fb2d5
...
@@ -5,7 +5,6 @@ import android.app.Activity
...
@@ -5,7 +5,6 @@ import android.app.Activity
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.view.animation.AnimationUtils
import
android.view.animation.AnimationUtils
...
@@ -278,11 +277,9 @@ class VerificationCodeActivity :
...
@@ -278,11 +277,9 @@ class VerificationCodeActivity :
override
fun
verificationErrorCode
()
{
override
fun
verificationErrorCode
()
{
//验证码异常回调
//验证码异常回调
verify_code
.
highlightSingleFieldType
=
HighlightType
.
ALL_FIELDS
verify_code
.
highlightSingleFieldType
=
HighlightType
.
ALL_FIELDS
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
verify_code
.
highlightPaintColor
=
getColor
(
R
.
color
.
user_bgcolorred
)
verify_code
.
highlightPaintColor
=
getColor
(
R
.
color
.
user_bgcolorred
)
verify_code
.
setText
(
""
)
verify_code
.
setText
(
""
)
}
verify_code
.
invalidate
()
verify_code
.
invalidate
()
dismissProgressDialog
()
dismissProgressDialog
()
val
shake
=
AnimationUtils
.
loadAnimation
(
this
,
R
.
anim
.
user_shake_input
)
//加载动画资源文件
val
shake
=
AnimationUtils
.
loadAnimation
(
this
,
R
.
anim
.
user_shake_input
)
//加载动画资源文件
...
...
m-user/src/main/java/com/yidianling/user/widget/PinField/SquarePinField.kt
View file @
5e2fb2d5
...
@@ -11,7 +11,6 @@ import `in`.srain.cube.util.LocalDisplay.dp2px
...
@@ -11,7 +11,6 @@ import `in`.srain.cube.util.LocalDisplay.dp2px
import
android.content.Context
import
android.content.Context
import
android.graphics.Canvas
import
android.graphics.Canvas
import
android.graphics.Paint
import
android.graphics.Paint
import
android.os.Build
import
android.util.AttributeSet
import
android.util.AttributeSet
import
com.yidianling.user.R
import
com.yidianling.user.R
...
@@ -110,10 +109,18 @@ class SquarePinField : PinField{
...
@@ -110,10 +109,18 @@ class SquarePinField : PinField{
}
}
private
fun
drawRect
(
canvas
:
Canvas
?,
paddedX1
:
Float
,
paddedY1
:
Float
,
paddedX2
:
Float
,
paddedY2
:
Float
,
paint
:
Paint
){
private
fun
drawRect
(
canvas
:
Canvas
?,
paddedX1
:
Float
,
paddedY1
:
Float
,
paddedX2
:
Float
,
paddedY2
:
Float
,
paint
:
Paint
){
if
(
cornerRadius
>
0
&&
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
){
if
(
cornerRadius
>
0
)
{
canvas
?.
drawRoundRect
(
paddedX1
,
paddedY1
-
20f
,
paddedX2
+
20f
,
paddedY2
,
cornerRadius
,
cornerRadius
,
paint
)
canvas
?.
drawRoundRect
(
}
else
{
paddedX1
,
canvas
?.
drawRect
(
paddedX1
,
paddedY1
,
paddedX2
,
paddedY2
,
paint
)
paddedY1
-
20f
,
paddedX2
+
20f
,
paddedY2
,
cornerRadius
,
cornerRadius
,
paint
)
}
else
{
canvas
?.
drawRect
(
paddedX1
,
paddedY1
,
paddedX2
,
paddedY2
,
paint
)
}
}
}
}
}
}
\ No newline at end of file
ydl-media/build.gradle
View file @
5e2fb2d5
...
@@ -10,12 +10,11 @@ kapt {
...
@@ -10,12 +10,11 @@ kapt {
}
}
}
}
android
{
android
{
compileSdkVersion
28
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
21
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
28
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
...
...
ydl-media/src/main/java/com/ydl/media/audio/manager/MediaSessionManager.kt
View file @
5e2fb2d5
...
@@ -2,7 +2,6 @@ package com.ydl.media.audio.manager
...
@@ -2,7 +2,6 @@ package com.ydl.media.audio.manager
import
android.content.Context
import
android.content.Context
import
android.graphics.Bitmap
import
android.graphics.Bitmap
import
android.os.Build
import
android.support.v4.media.MediaMetadataCompat
import
android.support.v4.media.MediaMetadataCompat
import
android.support.v4.media.session.MediaSessionCompat
import
android.support.v4.media.session.MediaSessionCompat
import
android.support.v4.media.session.PlaybackStateCompat
import
android.support.v4.media.session.PlaybackStateCompat
...
@@ -92,10 +91,6 @@ class MediaSessionManager private constructor() {
...
@@ -92,10 +91,6 @@ class MediaSessionManager private constructor() {
MediaMetadataCompat
.
METADATA_KEY_ALBUM_ART
,
bitmap
MediaMetadataCompat
.
METADATA_KEY_ALBUM_ART
,
bitmap
)
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
// TODO: 2019-10-26 by:HaoRui
// metaData.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, AppCache.get().getLocalMusicList().size());
}
mediaSession
?.
setMetadata
(
metaData
.
build
())
mediaSession
?.
setMetadata
(
metaData
.
build
())
}
}
})
})
...
...
ydl-net/build.gradle
View file @
5e2fb2d5
...
@@ -5,12 +5,11 @@ apply plugin: 'kotlin-kapt'
...
@@ -5,12 +5,11 @@ apply plugin: 'kotlin-kapt'
apply
from:
"../publish.gradle"
apply
from:
"../publish.gradle"
android
{
android
{
compileSdkVersion
28
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
21
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
28
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
...
...
ydl-pay/build.gradle
View file @
5e2fb2d5
...
@@ -5,12 +5,11 @@ apply plugin: 'kotlin-android-extensions'
...
@@ -5,12 +5,11 @@ apply plugin: 'kotlin-android-extensions'
apply
from:
"../publish.gradle"
apply
from:
"../publish.gradle"
android
{
android
{
compileSdkVersion
28
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
21
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
28
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/common/http/utils/NetUtils.java
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.content.Context;
...
@@ -4,7 +4,6 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.ConnectivityManager
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.net.NetworkInfo
;
import
android.os.Build
;
import
android.telephony.TelephonyManager
;
import
android.telephony.TelephonyManager
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
...
@@ -318,11 +317,7 @@ public class NetUtils {
...
@@ -318,11 +317,7 @@ public class NetUtils {
* @param context 上下文
* @param context 上下文
*/
*/
public
static
void
openWirelessSettings
(
Context
context
)
{
public
static
void
openWirelessSettings
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>
10
)
{
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
}
else
{
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_WIRELESS_SETTINGS
));
}
}
}
/**
/**
...
...
ydl-pay/src/main/java/com/yidianling/ydl_pay/common/http/utils/RxDeviceTool.java
View file @
5e2fb2d5
...
@@ -11,7 +11,6 @@ import android.content.res.Configuration;
...
@@ -11,7 +11,6 @@ import android.content.res.Configuration;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
import
android.provider.Settings
;
import
android.telephony.TelephonyManager
;
import
android.telephony.TelephonyManager
;
import
android.util.DisplayMetrics
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -332,7 +331,6 @@ public class RxDeviceTool {
...
@@ -332,7 +331,6 @@ public class RxDeviceTool {
*/
*/
public
static
boolean
checkPermission
(
Context
context
,
String
permission
)
{
public
static
boolean
checkPermission
(
Context
context
,
String
permission
)
{
boolean
result
=
false
;
boolean
result
=
false
;
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
try
{
try
{
Class
clazz
=
Class
.
forName
(
"android.content.Context"
);
Class
clazz
=
Class
.
forName
(
"android.content.Context"
);
Method
method
=
clazz
.
getMethod
(
"checkSelfPermission"
,
String
.
class
);
Method
method
=
clazz
.
getMethod
(
"checkSelfPermission"
,
String
.
class
);
...
@@ -341,12 +339,6 @@ public class RxDeviceTool {
...
@@ -341,12 +339,6 @@ public class RxDeviceTool {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
result
=
false
;
result
=
false
;
}
}
}
else
{
PackageManager
pm
=
context
.
getPackageManager
();
if
(
pm
.
checkPermission
(
permission
,
context
.
getPackageName
())
==
PackageManager
.
PERMISSION_GRANTED
)
{
result
=
true
;
}
}
return
result
;
return
result
;
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/crash/Cockroach.java
View file @
5e2fb2d5
...
@@ -5,11 +5,17 @@ import android.os.Build;
...
@@ -5,11 +5,17 @@ import android.os.Build;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.os.Message
;
import
android.os.Message
;
import
com.ydl.ydlcommon.actions.crash.compat.*
;
import
me.weishu.reflection.Reflection
;
import
com.ydl.ydlcommon.actions.crash.compat.ActivityKillerV21_V23
;
import
com.ydl.ydlcommon.actions.crash.compat.ActivityKillerV24_V25
;
import
com.ydl.ydlcommon.actions.crash.compat.ActivityKillerV26
;
import
com.ydl.ydlcommon.actions.crash.compat.ActivityKillerV28
;
import
com.ydl.ydlcommon.actions.crash.compat.IActivityKiller
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
me.weishu.reflection.Reflection
;
/**
/**
* Created by wanjian on 2017/2/14.
* Created by wanjian on 2017/2/14.
...
@@ -61,18 +67,14 @@ public final class Cockroach {
...
@@ -61,18 +67,14 @@ public final class Cockroach {
*/
*/
private
static
void
initActivityKiller
()
{
private
static
void
initActivityKiller
()
{
//各版本android的ActivityManager获取方式,finishActivity的参数,token(binder对象)的获取不一样
//各版本android的ActivityManager获取方式,finishActivity的参数,token(binder对象)的获取不一样
if
(
Build
.
VERSION
.
SDK_INT
>=
28
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
P
)
{
sActivityKiller
=
new
ActivityKillerV28
();
sActivityKiller
=
new
ActivityKillerV28
();
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
26
)
{
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
sActivityKiller
=
new
ActivityKillerV26
();
sActivityKiller
=
new
ActivityKillerV26
();
}
else
if
(
Build
.
VERSION
.
SDK_INT
==
25
||
Build
.
VERSION
.
SDK_INT
==
24
)
{
}
else
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
N_MR1
||
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
N
)
{
sActivityKiller
=
new
ActivityKillerV24_V25
();
sActivityKiller
=
new
ActivityKillerV24_V25
();
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
21
&&
Build
.
VERSION
.
SDK_INT
<=
23
)
{
}
else
{
sActivityKiller
=
new
ActivityKillerV21_V23
();
sActivityKiller
=
new
ActivityKillerV21_V23
();
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
15
&&
Build
.
VERSION
.
SDK_INT
<=
20
)
{
sActivityKiller
=
new
ActivityKillerV15_V20
();
}
else
if
(
Build
.
VERSION
.
SDK_INT
<
15
)
{
sActivityKiller
=
new
ActivityKillerV15_V20
();
}
}
try
{
try
{
...
@@ -103,7 +105,7 @@ public final class Cockroach {
...
@@ -103,7 +105,7 @@ public final class Cockroach {
callbackField
.
set
(
mhHandler
,
new
Handler
.
Callback
()
{
callbackField
.
set
(
mhHandler
,
new
Handler
.
Callback
()
{
@Override
@Override
public
boolean
handleMessage
(
Message
msg
)
{
public
boolean
handleMessage
(
Message
msg
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
28
)
{
//android P 生命周期全部走这
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
P
)
{
//android P 生命周期全部走这
final
int
EXECUTE_TRANSACTION
=
159
;
final
int
EXECUTE_TRANSACTION
=
159
;
if
(
msg
.
what
==
EXECUTE_TRANSACTION
)
{
if
(
msg
.
what
==
EXECUTE_TRANSACTION
)
{
try
{
try
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/actions/imagepicker/BrowsePicturesActivity.java
View file @
5e2fb2d5
...
@@ -5,14 +5,10 @@ import android.content.Context;
...
@@ -5,14 +5,10 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
androidx.fragment.app.FragmentPagerAdapter
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
...
@@ -20,6 +16,10 @@ import android.view.WindowManager;
...
@@ -20,6 +16,10 @@ import android.view.WindowManager;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.fragment.app.FragmentPagerAdapter
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.luck.picture.lib.photoview.PhotoView
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.miracle.view.imageeditor.utils.FileUtils
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydl_image.module.GlideApp
;
...
@@ -208,12 +208,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
...
@@ -208,12 +208,10 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
}
}
private
void
initWindows
()
{
private
void
initWindows
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
private
Handler
mHandler
=
new
Handler
()
{
private
Handler
mHandler
=
new
Handler
()
{
@SuppressLint
({
"WrongConstant"
,
"HandlerLeak"
})
@SuppressLint
({
"WrongConstant"
,
"HandlerLeak"
})
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/bean/StatusBarOptions.kt
View file @
5e2fb2d5
package
com.ydl.ydlcommon.bean
package
com.ydl.ydlcommon.bean
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
com.ydl.ydlcommon.R
import
com.ydl.ydlcommon.base.BaseApp
/**
/**
* Created by haorui on 2019-08-15.
* Created by haorui on 2019-08-15.
...
@@ -14,14 +11,10 @@ class StatusBarOptions {
...
@@ -14,14 +11,10 @@ class StatusBarOptions {
var
statusBarDarkMode
:
Boolean
=
false
var
statusBarDarkMode
:
Boolean
=
false
var
statusColor
:
String
?=
null
var
statusColor
:
String
?=
null
get
()
{
get
()
{
if
(
field
!=
null
){
return
if
(
field
!=
null
)
{
return
field
field
}
else
{
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
"#FFFFFF"
return
"#FFFFFF"
}
// return "#"+Integer.toHexString(ContextCompat.getColor(BaseApp.getApp(), R.color.platform_main_theme))
return
BaseApp
.
getApp
().
resources
.
getString
(
0
+
R
.
color
.
platform_main_theme
);
}
}
}
}
var
bottomStatusColor
:
Int
=
Color
.
parseColor
(
"#00000000"
)
//底部颜色默认透明色,个别页面自己设置即可
var
bottomStatusColor
:
Int
=
Color
.
parseColor
(
"#00000000"
)
//底部颜色默认透明色,个别页面自己设置即可
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/AndroidSystemHelper.kt
View file @
5e2fb2d5
...
@@ -177,12 +177,8 @@ class AndroidSystemHelper {
...
@@ -177,12 +177,8 @@ class AndroidSystemHelper {
val
heightDifference
=
usableHeightSansKeyboard
-
usableHeightNow
val
heightDifference
=
usableHeightSansKeyboard
-
usableHeightNow
if
(
heightDifference
>
usableHeightSansKeyboard
/
4
)
{
if
(
heightDifference
>
usableHeightSansKeyboard
/
4
)
{
// keyboard probably just became visible
// keyboard probably just became visible
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
frameLayoutParams
.
height
=
//frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
usableHeightSansKeyboard
-
heightDifference
+
statusBarHeight
frameLayoutParams
.
height
=
usableHeightSansKeyboard
-
heightDifference
+
statusBarHeight
}
else
{
frameLayoutParams
.
height
=
usableHeightSansKeyboard
-
heightDifference
}
}
else
{
}
else
{
frameLayoutParams
.
height
=
contentHeight
frameLayoutParams
.
height
=
contentHeight
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/ApkInstallTool.kt
View file @
5e2fb2d5
...
@@ -9,9 +9,8 @@ import android.os.Build
...
@@ -9,9 +9,8 @@ import android.os.Build
import
android.provider.Settings
import
android.provider.Settings
import
androidx.core.content.FileProvider
import
androidx.core.content.FileProvider
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.yidianling.common.tools.ToastUtil
import
com.ydl.ydlcommon.bean.VersionData
import
com.ydl.ydlcommon.bean.VersionData
import
com.yidianling.common.tools.ToastUtil
import
java.io.File
import
java.io.File
import
java.io.FileOutputStream
import
java.io.FileOutputStream
import
java.io.IOException
import
java.io.IOException
...
@@ -50,14 +49,14 @@ class ApkInstallTool {
...
@@ -50,14 +49,14 @@ class ApkInstallTool {
* 判断是否是8.0,8.0需要处理未知应用来源权限问题,否则直接安装
* 判断是否是8.0,8.0需要处理未知应用来源权限问题,否则直接安装
*/
*/
private
fun
checkIsAndroidO
(
context
:
Activity
?)
{
private
fun
checkIsAndroidO
(
context
:
Activity
?)
{
if
(
context
==
null
)
return
if
(
context
==
null
)
return
if
(
Build
.
VERSION
.
SDK_INT
>=
26
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
val
b
=
context
.
packageManager
.
canRequestPackageInstalls
()
val
b
=
context
.
packageManager
.
canRequestPackageInstalls
()
if
(
b
)
{
if
(
b
)
{
startDownload
()
//安装应用的逻辑
startDownload
()
//安装应用的逻辑
}
else
{
}
else
{
//请求安装未知应用来源的权限
//请求安装未知应用来源的权限
context
.
runOnUiThread
{
context
.
runOnUiThread
{
RxPermissions
(
context
)
RxPermissions
(
context
)
.
requestEach
(
Manifest
.
permission
.
REQUEST_INSTALL_PACKAGES
)
.
requestEach
(
Manifest
.
permission
.
REQUEST_INSTALL_PACKAGES
)
.
subscribe
{
permission
->
.
subscribe
{
permission
->
...
@@ -99,15 +98,23 @@ class ApkInstallTool {
...
@@ -99,15 +98,23 @@ class ApkInstallTool {
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
)
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
)
// 由于没有在Activity环境下启动Activity,设置下面的标签
// 由于没有在Activity环境下启动Activity,设置下面的标签
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
{
//判读版本是否在7.0以上
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
//判读版本是否在7.0以上
//参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致 参数3 共享的文件
//参数1 上下文, 参数2 Provider主机地址 和配置文件中保持一致 参数3 共享的文件
val
apkUri
=
context
?.
let
{
FileProvider
.
getUriForFile
(
it
,
"${it.applicationContext.packageName}.fileprovider"
,
file
)
}
val
apkUri
=
context
?.
let
{
FileProvider
.
getUriForFile
(
it
,
"${it.applicationContext.packageName}.fileprovider"
,
file
)
}
//添加这一句表示对目标应用临时授权该Uri所代表的文件
//添加这一句表示对目标应用临时授权该Uri所代表的文件
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
intent
.
setDataAndType
(
apkUri
,
"application/vnd.android.package-archive"
)
intent
.
setDataAndType
(
apkUri
,
"application/vnd.android.package-archive"
)
}
else
{
}
else
{
intent
.
setDataAndType
(
Uri
.
fromFile
(
file
),
intent
.
setDataAndType
(
"application/vnd.android.package-archive"
)
Uri
.
fromFile
(
file
),
"application/vnd.android.package-archive"
)
}
}
context
?.
startActivity
(
intent
)
context
?.
startActivity
(
intent
)
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/DeviceTool.java
View file @
5e2fb2d5
package
com
.
ydl
.
ydlcommon
.
utils
;
package
com
.
ydl
.
ydlcommon
.
utils
;
import
static
com
.
umeng
.
socialize
.
utils
.
ContextUtil
.
getPackageName
;
import
android.Manifest
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Activity
;
...
@@ -36,8 +38,6 @@ import java.util.Collections;
...
@@ -36,8 +38,6 @@ import java.util.Collections;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
umeng
.
socialize
.
utils
.
ContextUtil
.
getPackageName
;
public
class
DeviceTool
{
public
class
DeviceTool
{
public
static
void
openPersisonSetting
(
Activity
activity
)
{
public
static
void
openPersisonSetting
(
Activity
activity
)
{
...
@@ -75,14 +75,8 @@ public class DeviceTool {
...
@@ -75,14 +75,8 @@ public class DeviceTool {
private
static
Intent
getAppDetailSettingIntent
()
{
private
static
Intent
getAppDetailSettingIntent
()
{
Intent
localIntent
=
new
Intent
();
Intent
localIntent
=
new
Intent
();
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
getPackageName
(),
null
));
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
getPackageName
(),
null
));
}
else
if
(
Build
.
VERSION
.
SDK_INT
<=
8
)
{
localIntent
.
setAction
(
Intent
.
ACTION_VIEW
);
localIntent
.
setClassName
(
"com.android.settings"
,
"com.android.settings.InstalledAppDetails"
);
localIntent
.
putExtra
(
"com.android.settings.ApplicationPkgName"
,
getPackageName
());
}
return
localIntent
;
return
localIntent
;
}
}
...
@@ -275,14 +269,10 @@ public class DeviceTool {
...
@@ -275,14 +269,10 @@ public class DeviceTool {
public
static
String
getMac
(
Context
context
)
{
public
static
String
getMac
(
Context
context
)
{
if
(
checkHasAgreeSecret
())
{
if
(
checkHasAgreeSecret
())
{
String
strMac
=
null
;
String
strMac
=
null
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
M
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
strMac
=
getLocalMacAddressFromWifiInfo
(
context
);
return
strMac
;
}
else
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
&&
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
strMac
=
getMacAddress
(
context
);
strMac
=
getMacAddress
(
context
);
return
strMac
;
return
strMac
;
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
}
else
{
if
(!
TextUtils
.
isEmpty
(
getMacAddress
()))
{
if
(!
TextUtils
.
isEmpty
(
getMacAddress
()))
{
strMac
=
getMacAddress
();
strMac
=
getMacAddress
();
return
strMac
;
return
strMac
;
...
@@ -463,12 +453,6 @@ public class DeviceTool {
...
@@ -463,12 +453,6 @@ public class DeviceTool {
public
static
String
getMacAddress
(
Context
context
)
{
public
static
String
getMacAddress
(
Context
context
)
{
if
(
checkHasAgreeSecret
())
{
if
(
checkHasAgreeSecret
())
{
// 如果是6.0以下,直接通过wifimanager获取
// 如果是6.0以下,直接通过wifimanager获取
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
M
)
{
String
macAddress0
=
getMacAddress0
(
context
);
if
(!
TextUtils
.
isEmpty
(
macAddress0
))
{
return
macAddress0
;
}
}
String
str
=
""
;
String
str
=
""
;
String
macSerial
=
""
;
String
macSerial
=
""
;
try
{
try
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/DeviceUtils.kt
View file @
5e2fb2d5
...
@@ -42,9 +42,6 @@ class DeviceUtils private constructor() {
...
@@ -42,9 +42,6 @@ class DeviceUtils private constructor() {
val
NETTYPE_WIFI
=
0
x01
val
NETTYPE_WIFI
=
0
x01
val
NETTYPE_CMWAP
=
0
x02
val
NETTYPE_CMWAP
=
0
x02
val
NETTYPE_CMNET
=
0
x03
val
NETTYPE_CMNET
=
0
x03
var
GTE_HC
:
Boolean
=
false
var
GTE_ICS
:
Boolean
=
false
var
PRE_HC
:
Boolean
=
false
private
var
_hasBigScreen
:
Boolean
?
=
null
private
var
_hasBigScreen
:
Boolean
?
=
null
private
var
_hasCamera
:
Boolean
?
=
null
private
var
_hasCamera
:
Boolean
?
=
null
private
var
_isTablet
:
Boolean
?
=
null
private
var
_isTablet
:
Boolean
?
=
null
...
@@ -52,9 +49,6 @@ class DeviceUtils private constructor() {
...
@@ -52,9 +49,6 @@ class DeviceUtils private constructor() {
var
displayDensity
=
0.0f
var
displayDensity
=
0.0f
init
{
init
{
GTE_ICS
=
Build
.
VERSION
.
SDK_INT
>=
14
GTE_HC
=
Build
.
VERSION
.
SDK_INT
>=
11
PRE_HC
=
Build
.
VERSION
.
SDK_INT
<
11
}
}
/**
/**
...
@@ -147,17 +141,6 @@ class DeviceUtils private constructor() {
...
@@ -147,17 +141,6 @@ class DeviceUtils private constructor() {
screenWidth
=
metrics
.
widthPixels
screenWidth
=
metrics
.
widthPixels
screenHeight
=
metrics
.
heightPixels
screenHeight
=
metrics
.
heightPixels
// includes window decorations (statusbar bar/menu bar)
// includes window decorations (statusbar bar/menu bar)
if
(
Build
.
VERSION
.
SDK_INT
>=
14
&&
Build
.
VERSION
.
SDK_INT
<
17
)
try
{
screenWidth
=
Display
::
class
.
java
.
getMethod
(
"getRawWidth"
)
.
invoke
(
d
)
as
Int
screenHeight
=
Display
::
class
.
java
.
getMethod
(
"getRawHeight"
).
invoke
(
d
)
as
Int
}
catch
(
ignored
:
Exception
)
{
}
// includes window decorations (statusbar bar/menu bar)
if
(
Build
.
VERSION
.
SDK_INT
>=
17
)
try
{
try
{
val
realSize
=
Point
()
val
realSize
=
Point
()
Display
::
class
.
java
.
getMethod
(
"getRealSize"
,
Point
::
class
.
java
).
invoke
(
Display
::
class
.
java
.
getMethod
(
"getRealSize"
,
Point
::
class
.
java
).
invoke
(
...
@@ -250,14 +233,7 @@ class DeviceUtils private constructor() {
...
@@ -250,14 +233,7 @@ class DeviceUtils private constructor() {
* @return
* @return
*/
*/
fun
hasHardwareMenuKey
(
context
:
Context
):
Boolean
{
fun
hasHardwareMenuKey
(
context
:
Context
):
Boolean
{
var
flag
=
false
return
ViewConfiguration
.
get
(
context
).
hasPermanentMenuKey
()
if
(
PRE_HC
)
flag
=
true
else
if
(
GTE_ICS
)
{
flag
=
ViewConfiguration
.
get
(
context
).
hasPermanentMenuKey
()
}
else
flag
=
false
return
flag
}
}
/**
/**
...
@@ -270,10 +246,7 @@ class DeviceUtils private constructor() {
...
@@ -270,10 +246,7 @@ class DeviceUtils private constructor() {
val
flag
:
Boolean
val
flag
:
Boolean
val
manager
=
val
manager
=
context
.
applicationContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
)
as
ConnectivityManager
context
.
applicationContext
.
getSystemService
(
Context
.
CONNECTIVITY_SERVICE
)
as
ConnectivityManager
if
(
manager
!=
null
&&
manager
.
activeNetworkInfo
!=
null
)
flag
=
manager
.
activeNetworkInfo
!=
null
flag
=
true
else
flag
=
false
return
flag
return
flag
}
}
...
@@ -297,10 +270,6 @@ class DeviceUtils private constructor() {
...
@@ -297,10 +270,6 @@ class DeviceUtils private constructor() {
return
false
return
false
}
}
fun
hideAnimatedView
(
view
:
View
?)
{
if
(
PRE_HC
&&
view
!=
null
)
view
.
setPadding
(
view
.
width
,
0
,
0
,
0
)
}
/**
/**
* 隐藏软键盘
* 隐藏软键盘
...
@@ -362,10 +331,6 @@ class DeviceUtils private constructor() {
...
@@ -362,10 +331,6 @@ class DeviceUtils private constructor() {
return
_isTablet
!!
return
_isTablet
!!
}
}
fun
showAnimatedView
(
view
:
View
?)
{
if
(
PRE_HC
&&
view
!=
null
)
view
.
setPadding
(
0
,
0
,
0
,
0
)
}
fun
showSoftKeyboard
(
dialog
:
Dialog
)
{
fun
showSoftKeyboard
(
dialog
:
Dialog
)
{
dialog
.
window
!!
.
setSoftInputMode
(
4
)
dialog
.
window
!!
.
setSoftInputMode
(
4
)
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/FileUtils.java
View file @
5e2fb2d5
...
@@ -16,9 +16,10 @@ import android.os.Build;
...
@@ -16,9 +16,10 @@ import android.os.Build;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.provider.DocumentsContract
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
androidx.core.content.FileProvider
;
import
android.util.Log
;
import
android.util.Log
;
import
androidx.core.content.FileProvider
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -295,7 +296,7 @@ public class FileUtils {
...
@@ -295,7 +296,7 @@ public class FileUtils {
throw
new
NullPointerException
();
throw
new
NullPointerException
();
}
}
Uri
uri
;
Uri
uri
;
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
uri
=
FileProvider
.
getUriForFile
(
context
.
getApplicationContext
(),
"com.honjane.providerdemo.fileprovider"
,
file
);
uri
=
FileProvider
.
getUriForFile
(
context
.
getApplicationContext
(),
"com.honjane.providerdemo.fileprovider"
,
file
);
}
else
{
}
else
{
uri
=
Uri
.
fromFile
(
file
);
uri
=
Uri
.
fromFile
(
file
);
...
@@ -407,9 +408,8 @@ public class FileUtils {
...
@@ -407,9 +408,8 @@ public class FileUtils {
*/
*/
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
public
static
String
getPathByUri4kitkat
(
final
Context
context
,
final
Uri
uri
)
{
public
static
String
getPathByUri4kitkat
(
final
Context
context
,
final
Uri
uri
)
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
// DocumentProvider
// DocumentProvider
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
if
(
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
if
(
Utils
.
isExternalStorageDocument
(
uri
))
{
// ExternalStorageProvider
if
(
Utils
.
isExternalStorageDocument
(
uri
))
{
// ExternalStorageProvider
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
[]
split
=
docId
.
split
(
":"
);
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/KeyboardChangeListener.java
View file @
5e2fb2d5
package
com
.
ydl
.
ydlcommon
.
utils
;
package
com
.
ydl
.
ydlcommon
.
utils
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.os.Build
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewTreeObserver
;
import
android.view.ViewTreeObserver
;
...
@@ -91,9 +90,7 @@ public class KeyboardChangeListener implements ViewTreeObserver.OnGlobalLayoutLi
...
@@ -91,9 +90,7 @@ public class KeyboardChangeListener implements ViewTreeObserver.OnGlobalLayoutLi
public
void
destroy
()
{
public
void
destroy
()
{
if
(
mContentView
!=
null
)
{
if
(
mContentView
!=
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
mContentView
.
getViewTreeObserver
().
removeOnGlobalLayoutListener
(
this
);
mContentView
.
getViewTreeObserver
().
removeOnGlobalLayoutListener
(
this
);
}
}
}
}
}
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/StatusBarUtils.kt
View file @
5e2fb2d5
...
@@ -6,17 +6,17 @@ import android.app.Dialog
...
@@ -6,17 +6,17 @@ import android.app.Dialog
import
android.content.Context
import
android.content.Context
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.os.Build
import
android.view.View
import
android.view.ViewGroup
import
android.view.WindowManager
import
android.widget.FrameLayout
import
android.widget.LinearLayout
import
androidx.annotation.ColorInt
import
androidx.annotation.ColorInt
import
androidx.annotation.IntRange
import
androidx.annotation.IntRange
import
androidx.annotation.LayoutRes
import
androidx.annotation.LayoutRes
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.drawerlayout.widget.DrawerLayout
import
androidx.drawerlayout.widget.DrawerLayout
import
android.view.View
import
android.view.ViewGroup
import
android.view.WindowManager
import
android.widget.FrameLayout
import
android.widget.LinearLayout
import
com.ydl.ydlcommon.R
import
com.ydl.ydlcommon.R
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.RxImageTool
...
@@ -32,14 +32,12 @@ class StatusBarUtils {
...
@@ -32,14 +32,12 @@ class StatusBarUtils {
fun
setWindowStatusBarColor
(
activity
:
Activity
,
colorResId
:
Int
)
{
fun
setWindowStatusBarColor
(
activity
:
Activity
,
colorResId
:
Int
)
{
try
{
try
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
val
window
=
activity
.
window
val
window
=
activity
.
window
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
statusBarColor
=
ContextCompat
.
getColor
(
activity
,
colorResId
)
window
.
statusBarColor
=
ContextCompat
.
getColor
(
activity
,
colorResId
)
//底部导航栏
//底部导航栏
//window.setNavigationBarColor(activity.getResources().getColor(colorResId));
//window.setNavigationBarColor(activity.getResources().getColor(colorResId));
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
}
}
...
@@ -48,14 +46,12 @@ class StatusBarUtils {
...
@@ -48,14 +46,12 @@ class StatusBarUtils {
fun
setWindowStatusBarColor
(
dialog
:
Dialog
,
colorResId
:
Int
)
{
fun
setWindowStatusBarColor
(
dialog
:
Dialog
,
colorResId
:
Int
)
{
try
{
try
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
val
window
=
dialog
.
window
val
window
=
dialog
.
window
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
?
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
window
.
statusBarColor
=
ContextCompat
.
getColor
(
dialog
.
context
,
colorResId
)
window
?
.
statusBarColor
=
ContextCompat
.
getColor
(
dialog
.
context
,
colorResId
)
//底部导航栏
//底部导航栏
//window.setNavigationBarColor(activity.getResources().getColor(colorResId));
//window.setNavigationBarColor(activity.getResources().getColor(colorResId));
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
}
}
...
@@ -92,36 +88,10 @@ class StatusBarUtils {
...
@@ -92,36 +88,10 @@ class StatusBarUtils {
*/
*/
fun
setColor
(
activity
:
Activity
,
@ColorInt
color
:
Int
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
fun
setColor
(
activity
:
Activity
,
@ColorInt
color
:
Int
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
statusBarColor
=
activity
.
window
.
statusBarColor
=
calculateStatusColor
(
color
,
statusBarAlpha
)
calculateStatusColor
(
color
,
statusBarAlpha
)
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
val
decorView
=
activity
.
window
.
decorView
as
ViewGroup
val
fakeStatusBarView
=
decorView
.
findViewById
<
View
>(
FAKE_STATUS_BAR_VIEW_ID
)
if
(
fakeStatusBarView
!=
null
)
{
if
(
fakeStatusBarView
.
visibility
==
View
.
GONE
)
{
fakeStatusBarView
.
visibility
=
View
.
VISIBLE
}
fakeStatusBarView
.
setBackgroundColor
(
calculateStatusColor
(
color
,
statusBarAlpha
)
)
}
else
{
decorView
.
addView
(
createStatusBarView
(
activity
,
color
,
statusBarAlpha
)
)
}
setRootView
(
activity
)
}
}
}
/**
/**
...
@@ -149,34 +119,18 @@ class StatusBarUtils {
...
@@ -149,34 +119,18 @@ class StatusBarUtils {
activity
:
Activity
,
@ColorInt
color
:
Int
,
activity
:
Activity
,
@ColorInt
color
:
Int
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
val
contentView
=
activity
.
findViewById
<
View
>(
android
.
R
.
id
.
content
)
as
ViewGroup
val
contentView
=
activity
.
findViewById
<
View
>(
android
.
R
.
id
.
content
)
as
ViewGroup
val
rootView
=
contentView
.
getChildAt
(
0
)
val
rootView
=
contentView
.
getChildAt
(
0
)
val
statusBarHeight
=
val
statusBarHeight
=
getStatusBarHeight
(
activity
)
getStatusBarHeight
(
activity
)
if
(
rootView
!=
null
&&
rootView
is
CoordinatorLayout
)
{
if
(
rootView
!=
null
&&
rootView
is
CoordinatorLayout
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
rootView
.
fitsSystemWindows
=
false
contentView
.
setBackgroundColor
(
calculateStatusColor
(
color
,
statusBarAlpha
)
)
val
isNeedRequestLayout
=
contentView
.
paddingTop
<
statusBarHeight
if
(
isNeedRequestLayout
)
{
contentView
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
rootView
.
post
{
rootView
.
requestLayout
()
}
}
}
else
{
rootView
.
setStatusBarBackgroundColor
(
rootView
.
setStatusBarBackgroundColor
(
calculateStatusColor
(
calculateStatusColor
(
color
,
color
,
statusBarAlpha
statusBarAlpha
)
)
)
)
}
}
else
{
}
else
{
contentView
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
contentView
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
contentView
.
setBackgroundColor
(
contentView
.
setBackgroundColor
(
...
@@ -188,7 +142,6 @@ class StatusBarUtils {
...
@@ -188,7 +142,6 @@ class StatusBarUtils {
}
}
setTransparentForWindow
(
activity
)
setTransparentForWindow
(
activity
)
}
}
}
/**
/**
* 设置状态栏纯色 不加半透明效果
* 设置状态栏纯色 不加半透明效果
...
@@ -208,9 +161,6 @@ class StatusBarUtils {
...
@@ -208,9 +161,6 @@ class StatusBarUtils {
*/
*/
@Deprecated
(
""
)
@Deprecated
(
""
)
fun
setColorDiff
(
activity
:
Activity
,
@ColorInt
color
:
Int
)
{
fun
setColorDiff
(
activity
:
Activity
,
@ColorInt
color
:
Int
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
transparentStatusBar
(
activity
)
transparentStatusBar
(
activity
)
val
contentView
=
activity
.
findViewById
<
View
>(
android
.
R
.
id
.
content
)
as
ViewGroup
val
contentView
=
activity
.
findViewById
<
View
>(
android
.
R
.
id
.
content
)
as
ViewGroup
// 移除半透明矩形,以免叠加
// 移除半透明矩形,以免叠加
...
@@ -256,9 +206,6 @@ class StatusBarUtils {
...
@@ -256,9 +206,6 @@ class StatusBarUtils {
* @param statusBarAlpha 状态栏透明度
* @param statusBarAlpha 状态栏透明度
*/
*/
fun
setTranslucent
(
activity
:
Activity
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
fun
setTranslucent
(
activity
:
Activity
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
setTransparent
(
activity
)
setTransparent
(
activity
)
addTranslucentView
(
activity
,
statusBarAlpha
)
addTranslucentView
(
activity
,
statusBarAlpha
)
}
}
...
@@ -273,9 +220,6 @@ class StatusBarUtils {
...
@@ -273,9 +220,6 @@ class StatusBarUtils {
* @param statusBarAlpha 状态栏透明度
* @param statusBarAlpha 状态栏透明度
*/
*/
fun
setTranslucentForCoordinatorLayout
(
activity
:
Activity
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
fun
setTranslucentForCoordinatorLayout
(
activity
:
Activity
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
transparentStatusBar
(
activity
)
transparentStatusBar
(
activity
)
addTranslucentView
(
activity
,
statusBarAlpha
)
addTranslucentView
(
activity
,
statusBarAlpha
)
}
}
...
@@ -286,9 +230,6 @@ class StatusBarUtils {
...
@@ -286,9 +230,6 @@ class StatusBarUtils {
* @param activity 需要设置的activity
* @param activity 需要设置的activity
*/
*/
fun
setTransparent
(
activity
:
Activity
)
{
fun
setTransparent
(
activity
:
Activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
transparentStatusBar
(
activity
)
transparentStatusBar
(
activity
)
setRootView
(
activity
)
setRootView
(
activity
)
}
}
...
@@ -303,12 +244,10 @@ class StatusBarUtils {
...
@@ -303,12 +244,10 @@ class StatusBarUtils {
*/
*/
@Deprecated
(
""
)
@Deprecated
(
""
)
fun
setTranslucentDiff
(
activity
:
Activity
)
{
fun
setTranslucentDiff
(
activity
:
Activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
// 设置状态栏透明
// 设置状态栏透明
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
setRootView
(
activity
)
setRootView
(
activity
)
}
}
}
/**
/**
* 为DrawerLayout 布局设置状态栏变色
* 为DrawerLayout 布局设置状态栏变色
...
@@ -354,16 +293,9 @@ class StatusBarUtils {
...
@@ -354,16 +293,9 @@ class StatusBarUtils {
activity
:
Activity
,
drawerLayout
:
DrawerLayout
,
@ColorInt
color
:
Int
,
activity
:
Activity
,
drawerLayout
:
DrawerLayout
,
@ColorInt
color
:
Int
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
}
else
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
// 生成一个状态栏大小的矩形
// 生成一个状态栏大小的矩形
// 添加 statusBarView 到布局中
// 添加 statusBarView 到布局中
val
contentLayout
=
drawerLayout
.
getChildAt
(
0
)
as
ViewGroup
val
contentLayout
=
drawerLayout
.
getChildAt
(
0
)
as
ViewGroup
...
@@ -418,7 +350,6 @@ class StatusBarUtils {
...
@@ -418,7 +350,6 @@ class StatusBarUtils {
*/
*/
@Deprecated
(
""
)
@Deprecated
(
""
)
fun
setColorForDrawerLayoutDiff
(
activity
:
Activity
,
drawerLayout
:
DrawerLayout
,
@ColorInt
color
:
Int
)
{
fun
setColorForDrawerLayoutDiff
(
activity
:
Activity
,
drawerLayout
:
DrawerLayout
,
@ColorInt
color
:
Int
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
// 生成一个状态栏大小的矩形
// 生成一个状态栏大小的矩形
val
contentLayout
=
drawerLayout
.
getChildAt
(
0
)
as
ViewGroup
val
contentLayout
=
drawerLayout
.
getChildAt
(
0
)
as
ViewGroup
...
@@ -439,12 +370,15 @@ class StatusBarUtils {
...
@@ -439,12 +370,15 @@ class StatusBarUtils {
createStatusBarView
(
createStatusBarView
(
activity
,
activity
,
color
color
),
0
)
),
0
)
}
}
// 内容布局不是 LinearLayout 时,设置padding top
// 内容布局不是 LinearLayout 时,设置padding top
if
(
contentLayout
!
is
LinearLayout
&&
contentLayout
.
getChildAt
(
1
)
!=
null
)
{
if
(
contentLayout
!
is
LinearLayout
&&
contentLayout
.
getChildAt
(
1
)
!=
null
)
{
contentLayout
.
getChildAt
(
1
).
setPadding
(
0
,
contentLayout
.
getChildAt
(
1
).
setPadding
(
getStatusBarHeight
(
activity
),
0
,
0
)
0
,
getStatusBarHeight
(
activity
),
0
,
0
)
}
}
// 设置属性
// 设置属性
setDrawerLayoutProperty
(
setDrawerLayoutProperty
(
...
@@ -452,7 +386,6 @@ class StatusBarUtils {
...
@@ -452,7 +386,6 @@ class StatusBarUtils {
contentLayout
contentLayout
)
)
}
}
}
/**
/**
* 为 DrawerLayout 布局设置状态栏透明
* 为 DrawerLayout 布局设置状态栏透明
...
@@ -478,9 +411,6 @@ class StatusBarUtils {
...
@@ -478,9 +411,6 @@ class StatusBarUtils {
activity
:
Activity
,
drawerLayout
:
DrawerLayout
,
activity
:
Activity
,
drawerLayout
:
DrawerLayout
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
)
{
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
setTransparentForDrawerLayout
(
setTransparentForDrawerLayout
(
activity
,
activity
,
drawerLayout
drawerLayout
...
@@ -495,22 +425,17 @@ class StatusBarUtils {
...
@@ -495,22 +425,17 @@ class StatusBarUtils {
* @param drawerLayout DrawerLayout
* @param drawerLayout DrawerLayout
*/
*/
fun
setTransparentForDrawerLayout
(
activity
:
Activity
,
drawerLayout
:
DrawerLayout
)
{
fun
setTransparentForDrawerLayout
(
activity
:
Activity
,
drawerLayout
:
DrawerLayout
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
}
else
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
val
contentLayout
=
drawerLayout
.
getChildAt
(
0
)
as
ViewGroup
val
contentLayout
=
drawerLayout
.
getChildAt
(
0
)
as
ViewGroup
// 内容布局不是 LinearLayout 时,设置padding top
// 内容布局不是 LinearLayout 时,设置padding top
if
(
contentLayout
!
is
LinearLayout
&&
contentLayout
.
getChildAt
(
1
)
!=
null
)
{
if
(
contentLayout
!
is
LinearLayout
&&
contentLayout
.
getChildAt
(
1
)
!=
null
)
{
contentLayout
.
getChildAt
(
1
).
setPadding
(
0
,
contentLayout
.
getChildAt
(
1
).
setPadding
(
getStatusBarHeight
(
activity
),
0
,
0
)
0
,
getStatusBarHeight
(
activity
),
0
,
0
)
}
}
// 设置属性
// 设置属性
...
@@ -525,7 +450,6 @@ class StatusBarUtils {
...
@@ -525,7 +450,6 @@ class StatusBarUtils {
*/
*/
@Deprecated
(
""
)
@Deprecated
(
""
)
fun
setTranslucentForDrawerLayoutDiff
(
activity
:
Activity
,
drawerLayout
:
DrawerLayout
)
{
fun
setTranslucentForDrawerLayoutDiff
(
activity
:
Activity
,
drawerLayout
:
DrawerLayout
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
// 设置状态栏透明
// 设置状态栏透明
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
// 设置内容布局属性
// 设置内容布局属性
...
@@ -538,7 +462,6 @@ class StatusBarUtils {
...
@@ -538,7 +462,6 @@ class StatusBarUtils {
// 设置 DrawerLayout 属性
// 设置 DrawerLayout 属性
drawerLayout
.
fitsSystemWindows
=
false
drawerLayout
.
fitsSystemWindows
=
false
}
}
}
/**
/**
* 为头部是 ImageView 的界面设置状态栏全透明
* 为头部是 ImageView 的界面设置状态栏全透明
...
@@ -579,9 +502,6 @@ class StatusBarUtils {
...
@@ -579,9 +502,6 @@ class StatusBarUtils {
activity
:
Activity
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
,
activity
:
Activity
,
@IntRange
(
from
=
0
,
to
=
255
)
statusBarAlpha
:
Int
,
needOffsetView
:
View
?
needOffsetView
:
View
?
)
{
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
}
setTransparentForWindow
(
activity
)
setTransparentForWindow
(
activity
)
addTranslucentView
(
activity
,
statusBarAlpha
)
addTranslucentView
(
activity
,
statusBarAlpha
)
if
(
needOffsetView
!=
null
)
{
if
(
needOffsetView
!=
null
)
{
...
@@ -644,9 +564,6 @@ class StatusBarUtils {
...
@@ -644,9 +564,6 @@ class StatusBarUtils {
statusBarAlpha
,
statusBarAlpha
,
needOffsetView
needOffsetView
)
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
&&
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
clearPreviousSetting
(
activity
)
}
}
}
/**
/**
...
@@ -761,33 +678,20 @@ class StatusBarUtils {
...
@@ -761,33 +678,20 @@ class StatusBarUtils {
* 设置透明
* 设置透明
*/
*/
private
fun
setTransparentForWindow
(
activity
:
Activity
)
{
private
fun
setTransparentForWindow
(
activity
:
Activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
activity
.
window
activity
.
window
.
decorView
.
systemUiVisibility
=
.
decorView
.
systemUiVisibility
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
or
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
or
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
activity
.
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
}
}
/**
/**
* 使状态栏透明
* 使状态栏透明
*/
*/
@TargetApi
(
Build
.
VERSION_CODES
.
KITKAT
)
private
fun
transparentStatusBar
(
activity
:
Activity
)
{
private
fun
transparentStatusBar
(
activity
:
Activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
)
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
)
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
activity
.
window
.
statusBarColor
=
Color
.
TRANSPARENT
}
else
{
activity
.
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
)
}
}
}
/**
/**
...
@@ -857,7 +761,6 @@ class StatusBarUtils {
...
@@ -857,7 +761,6 @@ class StatusBarUtils {
*/
*/
fun
statusBarLightMode
(
activity
:
Activity
):
Int
{
fun
statusBarLightMode
(
activity
:
Activity
):
Int
{
var
result
=
0
var
result
=
0
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
if
(
setStatusBarLightMode
(
activity
,
true
))
{
if
(
setStatusBarLightMode
(
activity
,
true
))
{
result
=
ANDROID_M
result
=
ANDROID_M
}
}
...
@@ -870,7 +773,6 @@ class StatusBarUtils {
...
@@ -870,7 +773,6 @@ class StatusBarUtils {
)
{
)
{
result
=
FLYME
result
=
FLYME
}
}
}
return
result
return
result
}
}
...
@@ -909,7 +811,6 @@ class StatusBarUtils {
...
@@ -909,7 +811,6 @@ class StatusBarUtils {
}
}
fun
setStatusBarLightMode
(
activity
:
Activity
,
isFontColorDark
:
Boolean
):
Boolean
{
fun
setStatusBarLightMode
(
activity
:
Activity
,
isFontColorDark
:
Boolean
):
Boolean
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
if
(
isFontColorDark
)
{
if
(
isFontColorDark
)
{
// 沉浸式
// 沉浸式
activity
.
window
.
decorView
.
systemUiVisibility
=
activity
.
window
.
decorView
.
systemUiVisibility
=
...
@@ -920,8 +821,6 @@ class StatusBarUtils {
...
@@ -920,8 +821,6 @@ class StatusBarUtils {
}
}
return
true
return
true
}
}
return
false
}
fun
setMIUIStatusBarLightMode
(
activity
:
Activity
,
isFontColorDark
:
Boolean
):
Boolean
{
fun
setMIUIStatusBarLightMode
(
activity
:
Activity
,
isFontColorDark
:
Boolean
):
Boolean
{
val
window
=
activity
.
window
val
window
=
activity
.
window
...
@@ -1061,19 +960,17 @@ class StatusBarUtils {
...
@@ -1061,19 +960,17 @@ class StatusBarUtils {
containerView
:
View
,
containerView
:
View
,
statusBarOptions
:
StatusBarOptions
statusBarOptions
:
StatusBarOptions
):
View
?
{
):
View
?
{
var
statusView
:
View
?=
null
var
statusView
:
View
?
=
null
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
statusView
=
containerView
.
findViewById
<
View
>(
R
.
id
.
view_status_place_holder
)
statusView
=
containerView
.
findViewById
<
View
>(
R
.
id
.
view_status_place_holder
)
statusView
?.
setBackgroundColor
(
Color
.
parseColor
(
statusBarOptions
.
statusColor
))
statusView
?.
setBackgroundColor
(
Color
.
parseColor
(
statusBarOptions
.
statusColor
))
val
statusBarHeight
=
val
statusBarHeight
=
getStatusBarHeight
(
context
)
getStatusBarHeight
(
context
)
statusView
?.
let
{
statusView
?.
let
{
val
layoutParams
=
statusView
?.
getLayoutParams
()
as
LinearLayout
.
LayoutParams
val
layoutParams
=
statusView
.
layoutParams
as
LinearLayout
.
LayoutParams
layoutParams
.
height
=
statusBarHeight
layoutParams
.
height
=
statusBarHeight
statusView
?
.
layoutParams
=
layoutParams
statusView
.
layoutParams
=
layoutParams
}
}
setTransparentForImageView
(
context
,
null
)
setTransparentForImageView
(
context
,
null
)
}
if
(
statusBarOptions
.
statusBarDarkMode
)
{
if
(
statusBarOptions
.
statusBarDarkMode
)
{
statusBarLightMode
(
context
)
statusBarLightMode
(
context
)
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/Utils.java
View file @
5e2fb2d5
package
com
.
ydl
.
ydlcommon
.
utils
;
package
com
.
ydl
.
ydlcommon
.
utils
;
import
android.annotation.TargetApi
;
import
android.content.ContentUris
;
import
android.content.ContentUris
;
import
android.content.Context
;
import
android.content.Context
;
import
android.database.Cursor
;
import
android.database.Cursor
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.provider.DocumentsContract
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
...
@@ -68,13 +66,9 @@ public class Utils {
...
@@ -68,13 +66,9 @@ public class Utils {
* @param uri The Uri to query.
* @param uri The Uri to query.
* @author paulburke
* @author paulburke
*/
*/
@TargetApi
(
Build
.
VERSION_CODES
.
KITKAT
)
public
static
String
getPath
(
final
Context
context
,
final
Uri
uri
)
{
public
static
String
getPath
(
final
Context
context
,
final
Uri
uri
)
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
// DocumentProvider
// DocumentProvider
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
if
(
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
// ExternalStorageProvider
// ExternalStorageProvider
if
(
isExternalStorageDocument
(
uri
))
{
if
(
isExternalStorageDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/statusBar/FlymeStatusbarUtils.java
View file @
5e2fb2d5
package
com
.
ydl
.
ydlcommon
.
utils
.
statusBar
;
package
com
.
ydl
.
ydlcommon
.
utils
.
statusBar
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.os.Build
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
...
@@ -101,9 +100,7 @@ public class FlymeStatusbarUtils {
...
@@ -101,9 +100,7 @@ public class FlymeStatusbarUtils {
public
static
void
setStatusBarDarkIcon
(
Window
window
,
int
color
)
{
public
static
void
setStatusBarDarkIcon
(
Window
window
,
int
color
)
{
try
{
try
{
setStatusBarColor
(
window
,
color
);
setStatusBarColor
(
window
,
color
);
if
(
Build
.
VERSION
.
SDK_INT
>
22
)
{
setStatusBarDarkIcon
(
window
.
getDecorView
(),
true
);
setStatusBarDarkIcon
(
window
.
getDecorView
(),
true
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -186,14 +183,10 @@ public class FlymeStatusbarUtils {
...
@@ -186,14 +183,10 @@ public class FlymeStatusbarUtils {
* @param dark 是否深色 true为深色 false 为白色
* @param dark 是否深色 true为深色 false 为白色
*/
*/
public
static
void
setStatusBarDarkIcon
(
Window
window
,
boolean
dark
)
{
public
static
void
setStatusBarDarkIcon
(
Window
window
,
boolean
dark
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
23
)
{
changeMeizuFlag
(
window
.
getAttributes
(),
"MEIZU_FLAG_DARK_STATUS_BAR_ICON"
,
dark
);
}
else
{
View
decorView
=
window
.
getDecorView
();
View
decorView
=
window
.
getDecorView
();
setStatusBarDarkIcon
(
decorView
,
dark
);
setStatusBarDarkIcon
(
decorView
,
dark
);
setStatusBarColor
(
window
,
0
);
setStatusBarColor
(
window
,
0
);
}
}
}
private
static
void
setStatusBarDarkIcon
(
Activity
activity
,
boolean
dark
,
boolean
flag
)
{
private
static
void
setStatusBarDarkIcon
(
Activity
activity
,
boolean
dark
,
boolean
flag
)
{
if
(
mSetStatusBarDarkIcon
!=
null
)
{
if
(
mSetStatusBarDarkIcon
!=
null
)
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/utils/statusBar/StatusBarUtil.java
View file @
5e2fb2d5
...
@@ -30,7 +30,6 @@ public class StatusBarUtil {
...
@@ -30,7 +30,6 @@ public class StatusBarUtil {
* @param color 状态栏颜色值
* @param color 状态栏颜色值
*/
*/
public
static
void
setColor
(
Activity
activity
,
int
color
)
{
public
static
void
setColor
(
Activity
activity
,
int
color
)
{
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// 设置状态栏透明
// 设置状态栏透明
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
// 生成一个状态栏大小的矩形
// 生成一个状态栏大小的矩形
...
@@ -42,7 +41,6 @@ public class StatusBarUtil {
...
@@ -42,7 +41,6 @@ public class StatusBarUtil {
ViewGroup
rootView
=
(
ViewGroup
)
((
ViewGroup
)
activity
.
findViewById
(
android
.
R
.
id
.
content
)).
getChildAt
(
0
);
ViewGroup
rootView
=
(
ViewGroup
)
((
ViewGroup
)
activity
.
findViewById
(
android
.
R
.
id
.
content
)).
getChildAt
(
0
);
rootView
.
setFitsSystemWindows
(
true
);
rootView
.
setFitsSystemWindows
(
true
);
rootView
.
setClipToPadding
(
true
);
rootView
.
setClipToPadding
(
true
);
// }
}
}
/**
/**
...
@@ -74,12 +72,11 @@ public class StatusBarUtil {
...
@@ -74,12 +72,11 @@ public class StatusBarUtil {
* 修改状态栏为全透明
* 修改状态栏为全透明
*/
*/
public
static
void
setTranslucent
(
Window
window
)
{
public
static
void
setTranslucent
(
Window
window
)
{
if
(
null
==
window
)
return
;
if
(
null
==
window
)
{
return
;
}
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
else
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
}
...
@@ -101,17 +98,15 @@ public class StatusBarUtil {
...
@@ -101,17 +98,15 @@ public class StatusBarUtil {
*/
*/
public
static
int
statusBarDarkMode
(
Activity
activity
)
{
public
static
int
statusBarDarkMode
(
Activity
activity
)
{
int
result
=
0
;
int
result
=
0
;
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if
(
mIUISetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
if
(
mIUISetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
result
=
1
;
result
=
1
;
}
else
if
(
isFlyme
())
{
}
else
if
(
isFlyme
())
{
FlymeStatusbarUtils
.
setStatusBarDarkIcon
(
activity
,
true
);
FlymeStatusbarUtils
.
setStatusBarDarkIcon
(
activity
,
true
);
result
=
2
;
result
=
2
;
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
}
else
{
setAndroidNativeLightStatusBar
(
activity
.
getWindow
(),
true
);
setAndroidNativeLightStatusBar
(
activity
.
getWindow
(),
true
);
result
=
3
;
result
=
3
;
}
}
// }
return
result
;
return
result
;
}
}
...
@@ -123,17 +118,15 @@ public class StatusBarUtil {
...
@@ -123,17 +118,15 @@ public class StatusBarUtil {
*/
*/
public
static
int
statusBarLightMode
(
Activity
activity
)
{
public
static
int
statusBarLightMode
(
Activity
activity
)
{
int
result
=
0
;
int
result
=
0
;
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if
(
mIUISetStatusBarLightMode
(
activity
.
getWindow
(),
false
))
{
if
(
mIUISetStatusBarLightMode
(
activity
.
getWindow
(),
false
))
{
result
=
1
;
result
=
1
;
}
else
if
(
isFlyme
())
{
}
else
if
(
isFlyme
())
{
FlymeStatusbarUtils
.
setStatusBarDarkIcon
(
activity
,
false
);
FlymeStatusbarUtils
.
setStatusBarDarkIcon
(
activity
,
false
);
result
=
2
;
result
=
2
;
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
}
else
{
setAndroidNativeLightStatusBar
(
activity
.
getWindow
(),
false
);
setAndroidNativeLightStatusBar
(
activity
.
getWindow
(),
false
);
result
=
3
;
result
=
3
;
}
}
// }
return
result
;
return
result
;
}
}
...
@@ -194,14 +187,12 @@ public class StatusBarUtil {
...
@@ -194,14 +187,12 @@ public class StatusBarUtil {
}
}
result
=
true
;
result
=
true
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
//开发版 7.7.13 及以后版本采用了系统API,旧方法无效但不会报错,所以两个方式都要加上
//开发版 7.7.13 及以后版本采用了系统API,旧方法无效但不会报错,所以两个方式都要加上
if
(
dark
)
{
if
(
dark
)
{
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
}
else
{
}
else
{
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -212,10 +203,7 @@ public class StatusBarUtil {
...
@@ -212,10 +203,7 @@ public class StatusBarUtil {
private
static
void
setAndroidNativeLightStatusBar
(
Window
window
,
boolean
dark
)
{
private
static
void
setAndroidNativeLightStatusBar
(
Window
window
,
boolean
dark
)
{
View
decor
=
window
.
getDecorView
();
View
decor
=
window
.
getDecorView
();
if
(
dark
)
{
if
(
dark
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
decor
.
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
decor
.
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
else
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
);
}
else
{
}
else
{
decor
.
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
decor
.
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/view/BaseViewHolder.java
View file @
5e2fb2d5
...
@@ -4,22 +4,21 @@ import android.annotation.SuppressLint;
...
@@ -4,22 +4,21 @@ import android.annotation.SuppressLint;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.text.SpannableStringBuilder
;
import
android.text.SpannableStringBuilder
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.SparseArray
;
import
android.util.SparseArray
;
import
android.view.View
;
import
android.view.View
;
import
android.view.animation.AlphaAnimation
;
import
android.widget.Checkable
;
import
android.widget.Checkable
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.ydl.ydl_image.config.ISimpleImageOpConfig
;
import
com.ydl.ydl_image.config.ISimpleImageOpConfig
;
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
;
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
;
import
com.ydl.ydl_image.manager.YDLImageCacheManager
;
import
com.ydl.ydl_image.manager.YDLImageCacheManager
;
import
com.ydl.ydlcommon.view.widgets.RoundImageView
;
import
com.ydl.ydlcommon.R
;
import
com.ydl.ydlcommon.R
;
import
com.ydl.ydlcommon.view.widgets.RoundImageView
;
public
class
BaseViewHolder
extends
RecyclerView
.
ViewHolder
{
public
class
BaseViewHolder
extends
RecyclerView
.
ViewHolder
{
...
@@ -182,15 +181,7 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
...
@@ -182,15 +181,7 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
public
BaseViewHolder
setAlpha
(
int
viewId
,
float
value
)
{
public
BaseViewHolder
setAlpha
(
int
viewId
,
float
value
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
getView
(
viewId
).
setAlpha
(
value
);
getView
(
viewId
).
setAlpha
(
value
);
}
else
{
// Pre-honeycomb hack to set Alpha value
AlphaAnimation
alpha
=
new
AlphaAnimation
(
value
,
value
);
alpha
.
setDuration
(
0
);
alpha
.
setFillAfter
(
true
);
getView
(
viewId
).
startAnimation
(
alpha
);
}
return
this
;
return
this
;
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/view/SlidingTabLayout.java
View file @
5e2fb2d5
...
@@ -17,11 +17,6 @@
...
@@ -17,11 +17,6 @@
package
com
.
ydl
.
ydlcommon
.
view
;
package
com
.
ydl
.
ydlcommon
.
view
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
import
androidx.fragment.app.Fragment
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.Gravity
;
...
@@ -31,6 +26,10 @@ import android.view.ViewGroup;
...
@@ -31,6 +26,10 @@ import android.view.ViewGroup;
import
android.widget.HorizontalScrollView
;
import
android.widget.HorizontalScrollView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.fragment.app.Fragment
;
import
androidx.viewpager.widget.PagerAdapter
;
import
androidx.viewpager.widget.ViewPager
;
import
com.yidianling.common.tools.RxDeviceTool
;
import
com.yidianling.common.tools.RxDeviceTool
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -193,19 +192,15 @@ public class SlidingTabLayout extends HorizontalScrollView {
...
@@ -193,19 +192,15 @@ public class SlidingTabLayout extends HorizontalScrollView {
textView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
TAB_VIEW_TEXT_SIZE_SP
);
textView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
TAB_VIEW_TEXT_SIZE_SP
);
textView
.
setTextColor
(
textColor
);
textView
.
setTextColor
(
textColor
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
// If we're running on Honeycomb or newer, then we can use the Theme's
// If we're running on Honeycomb or newer, then we can use the Theme's
// selectableItemBackground to ensure that the View has a pressed state
// selectableItemBackground to ensure that the View has a pressed state
TypedValue
outValue
=
new
TypedValue
();
TypedValue
outValue
=
new
TypedValue
();
getContext
().
getTheme
().
resolveAttribute
(
android
.
R
.
attr
.
selectableItemBackground
,
getContext
().
getTheme
().
resolveAttribute
(
android
.
R
.
attr
.
selectableItemBackground
,
outValue
,
true
);
outValue
,
true
);
textView
.
setBackgroundResource
(
outValue
.
resourceId
);
textView
.
setBackgroundResource
(
outValue
.
resourceId
);
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ICE_CREAM_SANDWICH
)
{
// If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
// If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
textView
.
setAllCaps
(
true
);
textView
.
setAllCaps
(
true
);
}
int
padding
=
(
int
)
(
TAB_VIEW_PADDING_DIPS
*
getResources
().
getDisplayMetrics
().
density
);
int
padding
=
(
int
)
(
TAB_VIEW_PADDING_DIPS
*
getResources
().
getDisplayMetrics
().
density
);
int
paddingBottomTop
=
(
int
)
(
PADDING_BOTTOM_TOP_DIPS
*
getResources
().
getDisplayMetrics
().
density
);
int
paddingBottomTop
=
(
int
)
(
PADDING_BOTTOM_TOP_DIPS
*
getResources
().
getDisplayMetrics
().
density
);
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/view/verticaltablayout/TabView.java
View file @
5e2fb2d5
...
@@ -5,8 +5,6 @@ import android.content.res.TypedArray;
...
@@ -5,8 +5,6 @@ import android.content.res.TypedArray;
import
android.graphics.Typeface
;
import
android.graphics.Typeface
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.os.Build
;
import
androidx.annotation.Px
;
import
androidx.annotation.RequiresApi
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.widget.Checkable
;
import
android.widget.Checkable
;
...
@@ -14,6 +12,9 @@ import android.widget.FrameLayout;
...
@@ -14,6 +12,9 @@ import android.widget.FrameLayout;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.Px
;
import
androidx.annotation.RequiresApi
;
import
com.ydl.ydlcommon.utils.DisplayUtils
;
import
com.ydl.ydlcommon.utils.DisplayUtils
;
/**
/**
...
@@ -36,11 +37,7 @@ public class TabView extends FrameLayout implements Checkable {
...
@@ -36,11 +37,7 @@ public class TabView extends FrameLayout implements Checkable {
mTabTitle
=
new
TabTitle
.
Builder
().
build
();
mTabTitle
=
new
TabTitle
.
Builder
().
build
();
initView
();
initView
();
int
[]
attrs
;
int
[]
attrs
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
attrs
=
new
int
[]{
android
.
R
.
attr
.
selectableItemBackgroundBorderless
};
attrs
=
new
int
[]{
android
.
R
.
attr
.
selectableItemBackgroundBorderless
};
}
else
{
attrs
=
new
int
[]{
android
.
R
.
attr
.
selectableItemBackground
};
}
TypedArray
a
=
mContext
.
getTheme
().
obtainStyledAttributes
(
attrs
);
TypedArray
a
=
mContext
.
getTheme
().
obtainStyledAttributes
(
attrs
);
mDefaultBackground
=
a
.
getDrawable
(
0
);
mDefaultBackground
=
a
.
getDrawable
(
0
);
a
.
recycle
();
a
.
recycle
();
...
@@ -169,11 +166,7 @@ public class TabView extends FrameLayout implements Checkable {
...
@@ -169,11 +166,7 @@ public class TabView extends FrameLayout implements Checkable {
@Override
@Override
public
void
setBackground
(
Drawable
background
)
{
public
void
setBackground
(
Drawable
background
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
super
.
setBackground
(
background
);
super
.
setBackground
(
background
);
}
else
{
super
.
setBackgroundDrawable
(
background
);
}
}
}
@Override
@Override
...
...
ydl-resource/build.gradle
View file @
5e2fb2d5
...
@@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
...
@@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
//apply from: "../publish.gradle"
//apply from: "../publish.gradle"
android
{
android
{
compileSdkVersion
28
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
21
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
28
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
flavorDimensions
"versionCode"
//Flavor 维度信息
flavorDimensions
"versionCode"
//Flavor 维度信息
}
}
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/TUIThemeManager.java
View file @
5e2fb2d5
...
@@ -3,7 +3,6 @@ package com.tencent.qcloud.tuicore;
...
@@ -3,7 +3,6 @@ package com.tencent.qcloud.tuicore;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.Application
;
import
android.app.Application
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
...
@@ -177,7 +176,7 @@ public class TUIThemeManager {
...
@@ -177,7 +176,7 @@ public class TUIThemeManager {
}
}
resources
.
updateConfiguration
(
configuration
,
null
);
resources
.
updateConfiguration
(
configuration
,
null
);
if
(
Build
.
VERSION
.
SDK_INT
>=
25
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N_MR1
)
{
context
=
context
.
createConfigurationContext
(
configuration
);
context
=
context
.
createConfigurationContext
(
configuration
);
context
.
getResources
().
updateConfiguration
(
configuration
,
context
.
getResources
().
updateConfiguration
(
configuration
,
resources
.
getDisplayMetrics
());
resources
.
getDisplayMetrics
());
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/calling/trtccalling/model/util/PermissionUtil.java
View file @
5e2fb2d5
...
@@ -31,11 +31,7 @@ public class PermissionUtil {
...
@@ -31,11 +31,7 @@ public class PermissionUtil {
}
else
if
(
BrandUtil
.
isBrandVivo
())
{
}
else
if
(
BrandUtil
.
isBrandVivo
())
{
return
isVivoBgStartPermissionAllowed
(
context
);
return
isVivoBgStartPermissionAllowed
(
context
);
}
else
{
}
else
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
return
Settings
.
canDrawOverlays
(
context
);
return
Settings
.
canDrawOverlays
(
context
);
}
else
{
return
hasPermissionBelowMarshmallow
(
context
);
}
}
}
}
}
...
@@ -43,11 +39,7 @@ public class PermissionUtil {
...
@@ -43,11 +39,7 @@ public class PermissionUtil {
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
O
)
{
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
O
)
{
return
hasPermissionForO
(
context
);
return
hasPermissionForO
(
context
);
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
return
Settings
.
canDrawOverlays
(
context
);
return
Settings
.
canDrawOverlays
(
context
);
}
else
{
return
hasPermissionBelowMarshmallow
(
context
);
}
}
}
/**
/**
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/calling/videocall/TRTCBaseActivity.java
View file @
5e2fb2d5
...
@@ -2,11 +2,11 @@ package com.tencent.qcloud.tuicore.calling.videocall;
...
@@ -2,11 +2,11 @@ package com.tencent.qcloud.tuicore.calling.videocall;
import
android.Manifest
;
import
android.Manifest
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.app.ActivityCompat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,7 +19,6 @@ public abstract class TRTCBaseActivity extends AppCompatActivity {
...
@@ -19,7 +19,6 @@ public abstract class TRTCBaseActivity extends AppCompatActivity {
protected
abstract
void
onPermissionGranted
();
protected
abstract
void
onPermissionGranted
();
protected
boolean
checkPermission
()
{
protected
boolean
checkPermission
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
List
<
String
>
permissions
=
new
ArrayList
<>();
List
<
String
>
permissions
=
new
ArrayList
<>();
if
(
PackageManager
.
PERMISSION_GRANTED
!=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
))
{
if
(
PackageManager
.
PERMISSION_GRANTED
!=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
))
{
permissions
.
add
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
permissions
.
add
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
...
@@ -39,7 +38,6 @@ public abstract class TRTCBaseActivity extends AppCompatActivity {
...
@@ -39,7 +38,6 @@ public abstract class TRTCBaseActivity extends AppCompatActivity {
REQ_PERMISSION_CODE
);
REQ_PERMISSION_CODE
);
return
false
;
return
false
;
}
}
}
return
true
;
return
true
;
}
}
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/util/FileUtil.java
View file @
5e2fb2d5
...
@@ -28,7 +28,6 @@ import java.io.File;
...
@@ -28,7 +28,6 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -128,11 +127,8 @@ public class FileUtil {
...
@@ -128,11 +127,8 @@ public class FileUtil {
* 专为Android4.4以上设计的从Uri获取文件路径
* 专为Android4.4以上设计的从Uri获取文件路径
*/
*/
public
static
String
getPath
(
final
Context
context
,
final
Uri
uri
)
{
public
static
String
getPath
(
final
Context
context
,
final
Uri
uri
)
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
// DocumentProvider
// DocumentProvider
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
if
(
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
// ExternalStorageProvider
// ExternalStorageProvider
if
(
isExternalStorageDocument
(
uri
))
{
if
(
isExternalStorageDocument
(
uri
))
{
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/util/PopWindowUtil.java
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.app.Activity;
...
@@ -4,7 +4,6 @@ import android.app.Activity;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.drawable.ColorDrawable
;
import
android.graphics.drawable.ColorDrawable
;
import
android.os.Build
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
...
@@ -16,10 +15,8 @@ import com.tencent.qcloud.tuicore.R;
...
@@ -16,10 +15,8 @@ import com.tencent.qcloud.tuicore.R;
public
class
PopWindowUtil
{
public
class
PopWindowUtil
{
public
static
AlertDialog
buildFullScreenDialog
(
Activity
activity
)
{
public
static
AlertDialog
buildFullScreenDialog
(
Activity
activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
if
(
activity
.
isDestroyed
())
if
(
activity
.
isDestroyed
())
return
null
;
return
null
;
}
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
activity
,
R
.
style
.
TUIKit_AlertDialogStyle
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
activity
,
R
.
style
.
TUIKit_AlertDialogStyle
);
builder
.
setTitle
(
""
);
builder
.
setTitle
(
""
);
builder
.
setCancelable
(
true
);
builder
.
setCancelable
(
true
);
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/util/StatusBarUtil.java
View file @
5e2fb2d5
package
com
.
tencent
.
qcloud
.
tuicore
.
util
;
package
com
.
tencent
.
qcloud
.
tuicore
.
util
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
...
@@ -24,22 +22,13 @@ public class StatusBarUtil {
...
@@ -24,22 +22,13 @@ public class StatusBarUtil {
*/
*/
@SuppressLint
(
"ObsoleteSdkInt"
)
@SuppressLint
(
"ObsoleteSdkInt"
)
@TargetApi
(
19
)
public
static
void
transparencyBar
(
Activity
activity
)
{
public
static
void
transparencyBar
(
Activity
activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
Window
window
=
activity
.
getWindow
();
Window
window
=
activity
.
getWindow
();
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
window
.
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
window
=
activity
.
getWindow
();
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
/**
/**
...
@@ -53,22 +42,19 @@ public class StatusBarUtil {
...
@@ -53,22 +42,19 @@ public class StatusBarUtil {
public
static
int
StatusBarLightMode
(
Activity
activity
)
{
public
static
int
StatusBarLightMode
(
Activity
activity
)
{
int
result
=
0
;
int
result
=
0
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
if
(
MIUISetStatusBarLightMode
(
activity
,
true
))
{
if
(
MIUISetStatusBarLightMode
(
activity
,
true
))
{
//小米
//小米
result
=
1
;
result
=
1
;
}
else
if
(
FlymeSetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
}
else
if
(
FlymeSetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
//魅族
//魅族
result
=
2
;
result
=
2
;
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
}
else
{
//6.0以上
//6.0以上
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
result
=
3
;
result
=
3
;
}
}
}
return
result
;
return
result
;
}
}
...
@@ -139,7 +125,6 @@ public class StatusBarUtil {
...
@@ -139,7 +125,6 @@ public class StatusBarUtil {
extraFlagField
.
invoke
(
window
,
0
,
darkModeFlag
);
//清除黑色字体
extraFlagField
.
invoke
(
window
,
0
,
darkModeFlag
);
//清除黑色字体
}
}
result
=
true
;
result
=
true
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
//开发版 7.7.13 及以后版本采用了系统API,旧方法无效但不会报错,所以两个方式都要加上
//开发版 7.7.13 及以后版本采用了系统API,旧方法无效但不会报错,所以两个方式都要加上
if
(
dark
)
{
if
(
dark
)
{
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
...
@@ -147,11 +132,8 @@ public class StatusBarUtil {
...
@@ -147,11 +132,8 @@ public class StatusBarUtil {
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_VISIBLE
);
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_VISIBLE
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxBarTool.java
View file @
5e2fb2d5
...
@@ -5,15 +5,11 @@ import android.annotation.TargetApi;
...
@@ -5,15 +5,11 @@ import android.annotation.TargetApi;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
com.readystatesoftware.systembartint.SystemBarTintManager
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
...
@@ -47,11 +43,9 @@ public class RxBarTool {
...
@@ -47,11 +43,9 @@ public class RxBarTool {
* @param activity activity
* @param activity activity
*/
*/
public
static
void
setTransparentStatusBar
(
Activity
activity
)
{
public
static
void
setTransparentStatusBar
(
Activity
activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
//透明状态栏
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
//透明状态栏
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
);
//透明导航栏
activity
.
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
);
//透明导航栏
}
}
}
/**
/**
* 隐藏Title
* 隐藏Title
...
@@ -126,8 +120,7 @@ public class RxBarTool {
...
@@ -126,8 +120,7 @@ public class RxBarTool {
* @param isSettingPanel {@code true}: 打开设置<br>{@code false}: 打开通知
* @param isSettingPanel {@code true}: 打开设置<br>{@code false}: 打开通知
*/
*/
public
static
void
showNotificationBar
(
Context
context
,
boolean
isSettingPanel
)
{
public
static
void
showNotificationBar
(
Context
context
,
boolean
isSettingPanel
)
{
String
methodName
=
(
Build
.
VERSION
.
SDK_INT
<=
16
)
?
"expand"
String
methodName
=
isSettingPanel
?
"expandSettingsPanel"
:
"expandNotificationsPanel"
;
:
(
isSettingPanel
?
"expandSettingsPanel"
:
"expandNotificationsPanel"
);
invokePanels
(
context
,
methodName
);
invokePanels
(
context
,
methodName
);
}
}
...
@@ -138,7 +131,7 @@ public class RxBarTool {
...
@@ -138,7 +131,7 @@ public class RxBarTool {
* @param context 上下文
* @param context 上下文
*/
*/
public
static
void
hideNotificationBar
(
Context
context
)
{
public
static
void
hideNotificationBar
(
Context
context
)
{
String
methodName
=
(
Build
.
VERSION
.
SDK_INT
<=
16
)
?
"collapse"
:
"collapsePanels"
;
String
methodName
=
"collapsePanels"
;
invokePanels
(
context
,
methodName
);
invokePanels
(
context
,
methodName
);
}
}
...
@@ -176,7 +169,7 @@ public class RxBarTool {
...
@@ -176,7 +169,7 @@ public class RxBarTool {
*/
*/
@TargetApi
(
19
)
@TargetApi
(
19
)
public
static
void
transparencyBar
(
Activity
activity
)
{
public
static
void
transparencyBar
(
Activity
activity
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
{
Window
window
=
activity
.
getWindow
();
Window
window
=
activity
.
getWindow
();
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
window
.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
|
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
);
|
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
);
...
@@ -186,10 +179,6 @@ public class RxBarTool {
...
@@ -186,10 +179,6 @@ public class RxBarTool {
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setStatusBarColor
(
Color
.
TRANSPARENT
);
window
.
setNavigationBarColor
(
Color
.
TRANSPARENT
);
window
.
setNavigationBarColor
(
Color
.
TRANSPARENT
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
window
=
activity
.
getWindow
();
window
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
,
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_STATUS
);
}
}
}
}
...
@@ -201,17 +190,9 @@ public class RxBarTool {
...
@@ -201,17 +190,9 @@ public class RxBarTool {
*/
*/
public
static
void
setStatusBarColor
(
Activity
activity
,
int
colorId
)
{
public
static
void
setStatusBarColor
(
Activity
activity
,
int
colorId
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
Window
window
=
activity
.
getWindow
();
Window
window
=
activity
.
getWindow
();
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window
.
setStatusBarColor
(
activity
.
getResources
().
getColor
(
colorId
));
window
.
setStatusBarColor
(
activity
.
getResources
().
getColor
(
colorId
));
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明
transparencyBar
(
activity
);
SystemBarTintManager
tintManager
=
new
SystemBarTintManager
(
activity
);
tintManager
.
setStatusBarTintEnabled
(
true
);
tintManager
.
setStatusBarTintResource
(
colorId
);
}
}
}
/**
/**
...
@@ -223,16 +204,14 @@ public class RxBarTool {
...
@@ -223,16 +204,14 @@ public class RxBarTool {
*/
*/
public
static
int
StatusBarLightMode
(
Activity
activity
)
{
public
static
int
StatusBarLightMode
(
Activity
activity
)
{
int
result
=
0
;
int
result
=
0
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
if
(
MIUISetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
if
(
MIUISetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
result
=
1
;
result
=
1
;
}
else
if
(
FlymeSetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
}
else
if
(
FlymeSetStatusBarLightMode
(
activity
.
getWindow
(),
true
))
{
result
=
2
;
result
=
2
;
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
}
else
{
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
activity
.
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
result
=
3
;
result
=
3
;
}
}
}
return
result
;
return
result
;
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxDataTool.java
View file @
5e2fb2d5
package
com
.
yidianling
.
common
.
tools
;
package
com
.
yidianling
.
common
.
tools
;
import
android.os.Build
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.
BYTE
;
import
androidx.annotation.Nullable
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.
GB
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.
KB
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.
MB
;
import
android.util.SparseArray
;
import
android.util.SparseArray
;
import
android.util.SparseBooleanArray
;
import
android.util.SparseBooleanArray
;
import
android.util.SparseIntArray
;
import
android.util.SparseIntArray
;
import
android.util.SparseLongArray
;
import
android.util.SparseLongArray
;
import
androidx.annotation.Nullable
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -20,8 +25,6 @@ import java.util.Collection;
...
@@ -20,8 +25,6 @@ import java.util.Collection;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.*;
/**
/**
* Created by vondear on 2016/1/24.
* Created by vondear on 2016/1/24.
* 数据处理相关
* 数据处理相关
...
@@ -90,11 +93,9 @@ public class RxDataTool {
...
@@ -90,11 +93,9 @@ public class RxDataTool {
if
(
obj
instanceof
SparseIntArray
&&
((
SparseIntArray
)
obj
).
size
()
==
0
)
{
if
(
obj
instanceof
SparseIntArray
&&
((
SparseIntArray
)
obj
).
size
()
==
0
)
{
return
true
;
return
true
;
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR2
)
{
if
(
obj
instanceof
SparseLongArray
&&
((
SparseLongArray
)
obj
).
size
()
==
0
)
{
if
(
obj
instanceof
SparseLongArray
&&
((
SparseLongArray
)
obj
).
size
()
==
0
)
{
return
true
;
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxDeviceTool.java
View file @
5e2fb2d5
...
@@ -14,7 +14,6 @@ import android.net.Uri;
...
@@ -14,7 +14,6 @@ import android.net.Uri;
import
android.net.wifi.WifiInfo
;
import
android.net.wifi.WifiInfo
;
import
android.net.wifi.WifiManager
;
import
android.net.wifi.WifiManager
;
import
android.os.Build
;
import
android.os.Build
;
import
android.provider.Settings
;
import
android.telephony.TelephonyManager
;
import
android.telephony.TelephonyManager
;
import
android.util.DisplayMetrics
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -358,7 +357,6 @@ public class RxDeviceTool {
...
@@ -358,7 +357,6 @@ public class RxDeviceTool {
*/
*/
public
static
boolean
checkPermission
(
Context
context
,
String
permission
)
{
public
static
boolean
checkPermission
(
Context
context
,
String
permission
)
{
boolean
result
=
false
;
boolean
result
=
false
;
if
(
Build
.
VERSION
.
SDK_INT
>=
23
)
{
try
{
try
{
Class
clazz
=
Class
.
forName
(
"android.content.Context"
);
Class
clazz
=
Class
.
forName
(
"android.content.Context"
);
Method
method
=
clazz
.
getMethod
(
"checkSelfPermission"
,
String
.
class
);
Method
method
=
clazz
.
getMethod
(
"checkSelfPermission"
,
String
.
class
);
...
@@ -367,12 +365,6 @@ public class RxDeviceTool {
...
@@ -367,12 +365,6 @@ public class RxDeviceTool {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
result
=
false
;
result
=
false
;
}
}
}
else
{
PackageManager
pm
=
context
.
getPackageManager
();
if
(
pm
.
checkPermission
(
permission
,
context
.
getPackageName
())
==
PackageManager
.
PERMISSION_GRANTED
)
{
result
=
true
;
}
}
return
result
;
return
result
;
}
}
/**
/**
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxFileTool.java
View file @
5e2fb2d5
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
*/
*/
package
com
.
yidianling
.
common
.
tools
;
package
com
.
yidianling
.
common
.
tools
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.
KB
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
...
@@ -29,10 +31,11 @@ import android.os.Environment;
...
@@ -29,10 +31,11 @@ import android.os.Environment;
import
android.os.StatFs
;
import
android.os.StatFs
;
import
android.provider.DocumentsContract
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
androidx.core.content.FileProvider
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.util.Log
;
import
androidx.core.content.FileProvider
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
...
@@ -59,8 +62,6 @@ import java.util.Collections;
...
@@ -59,8 +62,6 @@ import java.util.Collections;
import
java.util.List
;
import
java.util.List
;
import
java.util.Vector
;
import
java.util.Vector
;
import
static
com
.
yidianling
.
common
.
tools
.
RxConstTool
.
KB
;
//import android.util.Log;
//import android.util.Log;
/**
/**
...
@@ -393,13 +394,8 @@ public class RxFileTool {
...
@@ -393,13 +394,8 @@ public class RxFileTool {
File
path
=
getRootPath
();
File
path
=
getRootPath
();
StatFs
stat
=
new
StatFs
(
path
.
getPath
());
StatFs
stat
=
new
StatFs
(
path
.
getPath
());
long
blockSize
,
availableBlocks
;
long
blockSize
,
availableBlocks
;
if
(
Build
.
VERSION
.
SDK_INT
>=
18
)
{
blockSize
=
stat
.
getBlockSizeLong
();
blockSize
=
stat
.
getBlockSizeLong
();
availableBlocks
=
stat
.
getAvailableBlocksLong
();
availableBlocks
=
stat
.
getAvailableBlocksLong
();
}
else
{
blockSize
=
stat
.
getBlockSize
();
availableBlocks
=
stat
.
getAvailableBlocks
();
}
return
availableBlocks
*
blockSize
;
return
availableBlocks
*
blockSize
;
}
}
...
@@ -411,13 +407,8 @@ public class RxFileTool {
...
@@ -411,13 +407,8 @@ public class RxFileTool {
public
static
long
getDirSize
(
String
path
)
{
public
static
long
getDirSize
(
String
path
)
{
StatFs
stat
=
new
StatFs
(
path
);
StatFs
stat
=
new
StatFs
(
path
);
long
blockSize
,
availableBlocks
;
long
blockSize
,
availableBlocks
;
if
(
Build
.
VERSION
.
SDK_INT
>=
18
)
{
blockSize
=
stat
.
getBlockSizeLong
();
blockSize
=
stat
.
getBlockSizeLong
();
availableBlocks
=
stat
.
getAvailableBlocksLong
();
availableBlocks
=
stat
.
getAvailableBlocksLong
();
}
else
{
blockSize
=
stat
.
getBlockSize
();
availableBlocks
=
stat
.
getAvailableBlocks
();
}
return
availableBlocks
*
blockSize
;
return
availableBlocks
*
blockSize
;
}
}
...
@@ -1797,7 +1788,7 @@ public class RxFileTool {
...
@@ -1797,7 +1788,7 @@ public class RxFileTool {
*/
*/
public
static
Uri
getUriForFile
(
Context
mContext
,
File
file
)
{
public
static
Uri
getUriForFile
(
Context
mContext
,
File
file
)
{
Uri
fileUri
=
null
;
Uri
fileUri
=
null
;
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
fileUri
=
FileProvider
.
getUriForFile
(
mContext
,
mContext
.
getPackageName
()
+
".fileprovider"
,
file
);
fileUri
=
FileProvider
.
getUriForFile
(
mContext
,
mContext
.
getPackageName
()
+
".fileprovider"
,
file
);
}
else
{
}
else
{
fileUri
=
Uri
.
fromFile
(
file
);
fileUri
=
Uri
.
fromFile
(
file
);
...
@@ -1843,13 +1834,9 @@ public class RxFileTool {
...
@@ -1843,13 +1834,9 @@ public class RxFileTool {
return
new
File
(
RxPhotoTool
.
getImageAbsolutePath
(
context
,
uri
));
return
new
File
(
RxPhotoTool
.
getImageAbsolutePath
(
context
,
uri
));
}
}
@TargetApi
(
19
)
public
static
String
getPathFromUri
(
final
Context
context
,
final
Uri
uri
)
{
public
static
String
getPathFromUri
(
final
Context
context
,
final
Uri
uri
)
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
// DocumentProvider
// DocumentProvider
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
if
(
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
// ExternalStorageProvider
// ExternalStorageProvider
if
(
isExternalStorageDocument
(
uri
))
{
if
(
isExternalStorageDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxImageTool.java
View file @
5e2fb2d5
package
com
.
yidianling
.
common
.
tools
;
package
com
.
yidianling
.
common
.
tools
;
import
android.animation.ObjectAnimator
;
import
android.animation.ObjectAnimator
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
...
@@ -28,7 +27,6 @@ import android.graphics.drawable.Drawable;
...
@@ -28,7 +27,6 @@ import android.graphics.drawable.Drawable;
import
android.media.ExifInterface
;
import
android.media.ExifInterface
;
import
android.media.ThumbnailUtils
;
import
android.media.ThumbnailUtils
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.renderscript.Allocation
;
import
android.renderscript.Allocation
;
import
android.renderscript.Element
;
import
android.renderscript.Element
;
import
android.renderscript.RenderScript
;
import
android.renderscript.RenderScript
;
...
@@ -885,11 +883,7 @@ public class RxImageTool {
...
@@ -885,11 +883,7 @@ public class RxImageTool {
paint
.
setColorFilter
(
filter
);
paint
.
setColorFilter
(
filter
);
canvas
.
scale
(
scale
,
scale
);
canvas
.
scale
(
scale
,
scale
);
canvas
.
drawBitmap
(
scaleBitmap
,
0
,
0
,
paint
);
canvas
.
drawBitmap
(
scaleBitmap
,
0
,
0
,
paint
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
scaleBitmap
=
renderScriptBlur
(
scaleBitmap
,
radius
);
scaleBitmap
=
renderScriptBlur
(
scaleBitmap
,
radius
);
}
else
{
scaleBitmap
=
stackBlur
(
scaleBitmap
,
(
int
)
radius
,
true
);
}
if
(
scale
==
1
)
return
scaleBitmap
;
if
(
scale
==
1
)
return
scaleBitmap
;
Bitmap
ret
=
Bitmap
.
createScaledBitmap
(
scaleBitmap
,
width
,
height
,
true
);
Bitmap
ret
=
Bitmap
.
createScaledBitmap
(
scaleBitmap
,
width
,
height
,
true
);
if
(
scaleBitmap
!=
null
&&
!
scaleBitmap
.
isRecycled
())
scaleBitmap
.
recycle
();
if
(
scaleBitmap
!=
null
&&
!
scaleBitmap
.
isRecycled
())
scaleBitmap
.
recycle
();
...
@@ -905,9 +899,10 @@ public class RxImageTool {
...
@@ -905,9 +899,10 @@ public class RxImageTool {
* @param radius 模糊度(0...25)
* @param radius 模糊度(0...25)
* @return 模糊后的图片
* @return 模糊后的图片
*/
*/
@TargetApi
(
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
public
static
Bitmap
renderScriptBlur
(
Bitmap
src
,
float
radius
)
{
public
static
Bitmap
renderScriptBlur
(
Bitmap
src
,
float
radius
)
{
if
(
isEmptyBitmap
(
src
))
return
null
;
if
(
isEmptyBitmap
(
src
))
{
return
null
;
}
RenderScript
rs
=
null
;
RenderScript
rs
=
null
;
try
{
try
{
rs
=
RenderScript
.
create
(
RxTool
.
getContext
());
rs
=
RenderScript
.
create
(
RxTool
.
getContext
());
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxIntentTool.java
View file @
5e2fb2d5
...
@@ -128,14 +128,8 @@ public class RxIntentTool {
...
@@ -128,14 +128,8 @@ public class RxIntentTool {
public
static
Intent
getAppDetailsSettingsIntent
(
Context
mContext
)
{
public
static
Intent
getAppDetailsSettingsIntent
(
Context
mContext
)
{
Intent
localIntent
=
new
Intent
();
Intent
localIntent
=
new
Intent
();
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
mContext
.
getPackageName
(),
null
));
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
mContext
.
getPackageName
(),
null
));
}
else
if
(
Build
.
VERSION
.
SDK_INT
<=
8
)
{
localIntent
.
setAction
(
Intent
.
ACTION_VIEW
);
localIntent
.
setClassName
(
"com.android.settings"
,
"com.android.settings.InstalledAppDetails"
);
localIntent
.
putExtra
(
"com.android.settings.ApplicationPkgName"
,
mContext
.
getPackageName
());
}
return
localIntent
;
return
localIntent
;
}
}
...
@@ -148,14 +142,8 @@ public class RxIntentTool {
...
@@ -148,14 +142,8 @@ public class RxIntentTool {
public
static
Intent
getAppDetailsSettingsIntent
(
String
packageName
)
{
public
static
Intent
getAppDetailsSettingsIntent
(
String
packageName
)
{
Intent
localIntent
=
new
Intent
();
Intent
localIntent
=
new
Intent
();
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
localIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
Build
.
VERSION
.
SDK_INT
>=
9
)
{
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setAction
(
"android.settings.APPLICATION_DETAILS_SETTINGS"
);
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
packageName
,
null
));
localIntent
.
setData
(
Uri
.
fromParts
(
"package"
,
packageName
,
null
));
}
else
if
(
Build
.
VERSION
.
SDK_INT
<=
8
)
{
localIntent
.
setAction
(
Intent
.
ACTION_VIEW
);
localIntent
.
setClassName
(
"com.android.settings"
,
"com.android.settings.InstalledAppDetails"
);
localIntent
.
putExtra
(
"com.android.settings.ApplicationPkgName"
,
packageName
);
}
return
localIntent
;
return
localIntent
;
}
}
}
}
ydl-utils/src/main/java/com/yidianling/common/tools/RxNetTool.java
View file @
5e2fb2d5
...
@@ -2,17 +2,14 @@ package com.yidianling.common.tools;
...
@@ -2,17 +2,14 @@ package com.yidianling.common.tools;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.location.LocationManager
;
import
android.net.ConnectivityManager
;
import
android.net.ConnectivityManager
;
import
android.net.NetworkInfo
;
import
android.net.NetworkInfo
;
import
android.os.Build
;
import
android.telephony.TelephonyManager
;
import
android.telephony.TelephonyManager
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.util.List
;
/**
/**
...
@@ -320,11 +317,7 @@ public class RxNetTool {
...
@@ -320,11 +317,7 @@ public class RxNetTool {
* @param context 上下文
* @param context 上下文
*/
*/
public
static
void
openWirelessSettings
(
Context
context
)
{
public
static
void
openWirelessSettings
(
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
>
10
)
{
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_SETTINGS
));
}
else
{
context
.
startActivity
(
new
Intent
(
android
.
provider
.
Settings
.
ACTION_WIRELESS_SETTINGS
));
}
}
}
/**
/**
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxPhotoTool.java
View file @
5e2fb2d5
package
com
.
yidianling
.
common
.
tools
;
package
com
.
yidianling
.
common
.
tools
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
getDataColumn
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isDownloadsDocument
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isExternalStorageDocument
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isGooglePhotosUri
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isMediaDocument
;
import
android.Manifest
;
import
android.Manifest
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.ContentResolver
;
import
android.content.ContentResolver
;
import
android.content.ContentUris
;
import
android.content.ContentUris
;
...
@@ -14,22 +19,16 @@ import android.net.Uri;
...
@@ -14,22 +19,16 @@ import android.net.Uri;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.provider.DocumentsContract
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
androidx.core.app.ActivityCompat
;
import
androidx.fragment.app.Fragment
;
import
androidx.core.content.ContextCompat
;
import
android.util.Log
;
import
android.util.Log
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
androidx.fragment.app.Fragment
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.Locale
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
getDataColumn
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isDownloadsDocument
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isExternalStorageDocument
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isGooglePhotosUri
;
import
static
com
.
yidianling
.
common
.
tools
.
RxFileTool
.
isMediaDocument
;
/**
/**
* Created by vondear on 2016/1/24.
* Created by vondear on 2016/1/24.
*/
*/
...
@@ -217,11 +216,11 @@ public class RxPhotoTool {
...
@@ -217,11 +216,11 @@ public class RxPhotoTool {
* @author yaoxing
* @author yaoxing
* @date 2014-10-12
* @date 2014-10-12
*/
*/
@TargetApi
(
19
)
public
static
String
getImageAbsolutePath
(
Context
context
,
Uri
imageUri
)
{
public
static
String
getImageAbsolutePath
(
Context
context
,
Uri
imageUri
)
{
if
(
context
==
null
||
imageUri
==
null
)
if
(
context
==
null
||
imageUri
==
null
)
{
return
null
;
return
null
;
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
KITKAT
&&
DocumentsContract
.
isDocumentUri
(
context
,
imageUri
))
{
}
if
(
DocumentsContract
.
isDocumentUri
(
context
,
imageUri
))
{
if
(
isExternalStorageDocument
(
imageUri
))
{
if
(
isExternalStorageDocument
(
imageUri
))
{
String
docId
=
DocumentsContract
.
getDocumentId
(
imageUri
);
String
docId
=
DocumentsContract
.
getDocumentId
(
imageUri
);
String
[]
split
=
docId
.
split
(
":"
);
String
[]
split
=
docId
.
split
(
":"
);
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/RxProcessTool.java
deleted
100644 → 0
View file @
901d7e61
package
com
.
yidianling
.
common
.
tools
;
/**
* Created by vondear on 2016/12/21.
*/
public
class
RxProcessTool
{
/**
* 获取前台线程包名
* <p>当不是查看当前App,且SDK大于21时,
* 需添加权限 {@code <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>}</p>
*
* @return 前台应用包名
*/
// public static String getForegroundProcessName(Context context) {
// ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// List<ActivityManager.RunningAppProcessInfo> infos = manager.getRunningAppProcesses();
// if (infos != null && infos.size() != 0) {
// for (ActivityManager.RunningAppProcessInfo info : infos) {
// if (info.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
// return info.processName;
// }
// }
// }
// if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.LOLLIPOP) {
// PackageManager packageManager = context.getPackageManager();
// Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
// List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
//// System.out.println(list);
// if (list.size() > 0) {// 有"有权查看使用权限的应用"选项
// try {
// ApplicationInfo info = packageManager.getApplicationInfo(context.getPackageName(), 0);
// AppOpsManager aom = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
// if (aom.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, info.uid, info.packageName) != AppOpsManager.MODE_ALLOWED) {
// context.startActivity(intent);
// }
// if (aom.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, info.uid, info.packageName) != AppOpsManager.MODE_ALLOWED) {
// Log.d("getForegroundApp", "没有打开\"有权查看使用权限的应用\"选项");
// return null;
// }
// UsageStatsManager usageStatsManager = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE);
// long endTime = System.currentTimeMillis();
// long beginTime = endTime - 86400000 * 7;
// List<UsageStats> usageStatses = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, beginTime, endTime);
// if (usageStatses == null || usageStatses.isEmpty()) return null;
// UsageStats recentStats = null;
// for (UsageStats usageStats : usageStatses) {
// if (recentStats == null || usageStats.getLastTimeUsed() > recentStats.getLastTimeUsed()) {
// recentStats = usageStats;
// }
// }
// return recentStats == null ? null : recentStats.getPackageName();
// } catch (PackageManager.NameNotFoundException e) {
// e.printStackTrace();
// }
// } else {
// Log.d("getForegroundApp", "无\"有权查看使用权限的应用\"选项");
// }
// }
// return null;
// }
/**
* 获取后台服务进程
* <p>需添加权限 {@code <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>}</p>
*
* @return 后台服务进程
*/
// public static Set<String> getAllBackgroundProcesses(Context context) {
// ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// List<ActivityManager.RunningAppProcessInfo> infos = am.getRunningAppProcesses();
// Set<String> set = new HashSet<>();
// for (ActivityManager.RunningAppProcessInfo info : infos) {
// Collections.addAll(set, info.pkgList);
// }
// return set;
// }
/**
* 杀死后台服务进程
* <p>需添加权限 {@code <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>}</p>
*
* @return 被暂时杀死的服务集合
*/
// public static Set<String> killAllBackgroundProcesses(Context context) {
// ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// List<ActivityManager.RunningAppProcessInfo> infos = am.getRunningAppProcesses();
// Set<String> set = new HashSet<>();
// for (ActivityManager.RunningAppProcessInfo info : infos) {
// for (String pkg : info.pkgList) {
// am.killBackgroundProcesses(pkg);
// set.add(pkg);
// }
// }
// infos = am.getRunningAppProcesses();
// for (ActivityManager.RunningAppProcessInfo info : infos) {
// for (String pkg : info.pkgList) {
// set.remove(pkg);
// }
// }
// return set;
// }
/**
* 杀死后台服务进程
* <p>需添加权限 {@code <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>}</p>
*
* @param packageName 包名
* @return {@code true}: 杀死成功<br>{@code false}: 杀死失败
*/
// public static boolean killBackgroundProcesses(Context context, String packageName) {
// if (RxDataTool.isNullString(packageName)) return false;
// ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
// List<ActivityManager.RunningAppProcessInfo> infos = am.getRunningAppProcesses();
// if (infos == null || infos.size() == 0) return true;
// for (ActivityManager.RunningAppProcessInfo info : infos) {
// if (Arrays.asList(info.pkgList).contains(packageName)) {
// am.killBackgroundProcesses(packageName);
// }
// }
// infos = am.getRunningAppProcesses();
// if (infos == null || infos.size() == 0) return true;
// for (ActivityManager.RunningAppProcessInfo info : infos) {
// if (Arrays.asList(info.pkgList).contains(packageName)) {
// return false;
// }
// }
// return true;
// }
}
ydl-utils/src/main/java/com/yidianling/common/tools/RxWebViewTool.java
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.content.Context;
...
@@ -4,7 +4,6 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.view.View
;
import
android.view.View
;
import
android.webkit.DownloadListener
;
import
android.webkit.DownloadListener
;
import
android.webkit.WebSettings
;
import
android.webkit.WebSettings
;
...
@@ -19,27 +18,17 @@ public class RxWebViewTool {
...
@@ -19,27 +18,17 @@ public class RxWebViewTool {
public
static
void
initWebView
(
final
Context
context
,
final
WebView
webBase
)
{
public
static
void
initWebView
(
final
Context
context
,
final
WebView
webBase
)
{
WebSettings
webSettings
=
webBase
.
getSettings
();
WebSettings
webSettings
=
webBase
.
getSettings
();
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
webSettings
.
setCacheMode
(
WebSettings
.
LOAD_CACHE_ELSE_NETWORK
);
//加载缓存否则网络
webSettings
.
setCacheMode
(
WebSettings
.
LOAD_CACHE_ELSE_NETWORK
);
//加载缓存否则网络
}
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
webSettings
.
setLoadsImagesAutomatically
(
true
);
//图片自动缩放 打开
webSettings
.
setLoadsImagesAutomatically
(
true
);
//图片自动缩放 打开
}
else
{
webSettings
.
setLoadsImagesAutomatically
(
false
);
//图片自动缩放 关闭
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
HONEYCOMB
)
{
webBase
.
setLayerType
(
View
.
LAYER_TYPE_SOFTWARE
,
null
);
//软件解码
webBase
.
setLayerType
(
View
.
LAYER_TYPE_SOFTWARE
,
null
);
//软件解码
}
webBase
.
setLayerType
(
View
.
LAYER_TYPE_HARDWARE
,
null
);
//硬件解码
webBase
.
setLayerType
(
View
.
LAYER_TYPE_HARDWARE
,
null
);
//硬件解码
// webSettings.setAllowContentAccess(true);
// webSettings.setAllowContentAccess(true);
// webSettings.setAllowFileAccessFromFileURLs(true);
// webSettings.setAllowFileAccessFromFileURLs(true);
// webSettings.setAppCacheEnabled(true);
// webSettings.setAppCacheEnabled(true);
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}*/
// setMediaPlaybackRequiresUserGesture(boolean require) //是否需要用户手势来播放Media,默认true
// setMediaPlaybackRequiresUserGesture(boolean require) //是否需要用户手势来播放Media,默认true
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/keyboard/DisplayMetricsHolder.java
View file @
5e2fb2d5
...
@@ -10,16 +10,12 @@
...
@@ -10,16 +10,12 @@
package
com
.
yidianling
.
common
.
tools
.
keyboard
;
package
com
.
yidianling
.
common
.
tools
.
keyboard
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
import
android.util.DisplayMetrics
;
import
android.util.DisplayMetrics
;
import
android.view.Display
;
import
android.view.Display
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
org.jetbrains.annotations.Nullable
;
import
org.jetbrains.annotations.Nullable
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
/**
/**
* Holds an instance of the current DisplayMetrics so we don't have to thread it through all the
* Holds an instance of the current DisplayMetrics so we don't have to thread it through all the
* classes that need it.
* classes that need it.
...
@@ -64,28 +60,7 @@ public class DisplayMetricsHolder {
...
@@ -64,28 +60,7 @@ public class DisplayMetricsHolder {
// The real metrics include system decor elements (e.g. soft menu bar).
// The real metrics include system decor elements (e.g. soft menu bar).
//
//
// See: http://developer.android.com/reference/android/view/Display.html#getRealMetrics(android.util.DisplayMetrics)
// See: http://developer.android.com/reference/android/view/Display.html#getRealMetrics(android.util.DisplayMetrics)
if
(
Build
.
VERSION
.
SDK_INT
>=
17
)
{
display
.
getRealMetrics
(
screenDisplayMetrics
);
display
.
getRealMetrics
(
screenDisplayMetrics
);
}
else
{
// For 14 <= API level <= 16, we need to invoke getRawHeight and getRawWidth to get the real dimensions.
// Since react-native only supports API level 16+ we don't have to worry about other cases.
//
// Reflection exceptions are rethrown at runtime.
//
// See: http://stackoverflow.com/questions/14341041/how-to-get-real-screen-height-and-width/23861333#23861333
try
{
Method
mGetRawH
=
Display
.
class
.
getMethod
(
"getRawHeight"
);
Method
mGetRawW
=
Display
.
class
.
getMethod
(
"getRawWidth"
);
screenDisplayMetrics
.
widthPixels
=
(
Integer
)
mGetRawW
.
invoke
(
display
);
screenDisplayMetrics
.
heightPixels
=
(
Integer
)
mGetRawH
.
invoke
(
display
);
}
catch
(
InvocationTargetException
e
)
{
throw
new
RuntimeException
(
"Error getting real dimensions for API level < 17"
,
e
);
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
"Error getting real dimensions for API level < 17"
,
e
);
}
catch
(
NoSuchMethodException
e
)
{
throw
new
RuntimeException
(
"Error getting real dimensions for API level < 17"
,
e
);
}
}
DisplayMetricsHolder
.
setScreenDisplayMetrics
(
screenDisplayMetrics
);
DisplayMetricsHolder
.
setScreenDisplayMetrics
(
screenDisplayMetrics
);
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/tools/support/toast/ToastCompat.java
View file @
5e2fb2d5
...
@@ -6,11 +6,12 @@ import android.app.Application;
...
@@ -6,11 +6,12 @@ import android.app.Application;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
import
android.os.Build
;
import
android.os.Build
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.StringRes
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.StringRes
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
/**
/**
...
@@ -171,7 +172,7 @@ public final class ToastCompat extends Toast {
...
@@ -171,7 +172,7 @@ public final class ToastCompat extends Toast {
private
static
void
setContextCompat
(
@NonNull
View
view
,
@NonNull
Context
context
)
{
private
static
void
setContextCompat
(
@NonNull
View
view
,
@NonNull
Context
context
)
{
if
(
Build
.
VERSION
.
SDK_INT
==
25
)
{
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
N_MR1
)
{
try
{
try
{
Field
field
=
View
.
class
.
getDeclaredField
(
"mContext"
);
Field
field
=
View
.
class
.
getDeclaredField
(
"mContext"
);
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
...
...
ydl-utils/src/main/java/com/yidianling/common/view/dialog/RxDialog.java
View file @
5e2fb2d5
...
@@ -3,7 +3,6 @@ package com.yidianling.common.view.dialog;
...
@@ -3,7 +3,6 @@ package com.yidianling.common.view.dialog;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager.LayoutParams
;
import
android.view.WindowManager.LayoutParams
;
...
@@ -74,9 +73,6 @@ public class RxDialog extends Dialog {
...
@@ -74,9 +73,6 @@ public class RxDialog extends Dialog {
* 隐藏头部导航栏状态栏
* 隐藏头部导航栏状态栏
*/
*/
public
void
skipTools
()
{
public
void
skipTools
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
19
)
{
return
;
}
getWindow
().
setFlags
(
LayoutParams
.
FLAG_FULLSCREEN
,
LayoutParams
.
FLAG_FULLSCREEN
);
getWindow
().
setFlags
(
LayoutParams
.
FLAG_FULLSCREEN
,
LayoutParams
.
FLAG_FULLSCREEN
);
}
}
...
@@ -85,12 +81,14 @@ public class RxDialog extends Dialog {
...
@@ -85,12 +81,14 @@ public class RxDialog extends Dialog {
*/
*/
public
void
setFullScreen
()
{
public
void
setFullScreen
()
{
Window
window
=
getWindow
();
Window
window
=
getWindow
();
if
(
window
!=
null
)
{
window
.
getDecorView
().
setPadding
(
0
,
0
,
0
,
0
);
window
.
getDecorView
().
setPadding
(
0
,
0
,
0
,
0
);
LayoutParams
lp
=
window
.
getAttributes
();
LayoutParams
lp
=
window
.
getAttributes
();
lp
.
width
=
LayoutParams
.
FILL
_PARENT
;
lp
.
width
=
LayoutParams
.
MATCH
_PARENT
;
lp
.
height
=
LayoutParams
.
FILL
_PARENT
;
lp
.
height
=
LayoutParams
.
MATCH
_PARENT
;
window
.
setAttributes
(
lp
);
window
.
setAttributes
(
lp
);
}
}
}
/**
/**
* 设置宽度match_parent
* 设置宽度match_parent
...
...
ydl-utils/src/main/java/com/yidianling/common/view/popupwindows/tools/RxPopupViewBackgroundConstructor.java
View file @
5e2fb2d5
package
com
.
yidianling
.
common
.
view
.
popupwindows
.
tools
;
package
com
.
yidianling
.
common
.
view
.
popupwindows
.
tools
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.PorterDuff
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.view.View
;
import
android.view.View
;
import
com.yidianling.common.R
;
import
com.yidianling.common.R
;
...
@@ -109,26 +107,15 @@ class RxPopupViewBackgroundConstructor {
...
@@ -109,26 +107,15 @@ class RxPopupViewBackgroundConstructor {
}
}
private
static
void
setViewBackground
(
View
view
,
Drawable
drawable
)
{
private
static
void
setViewBackground
(
View
view
,
Drawable
drawable
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
view
.
setBackground
(
drawable
);
view
.
setBackground
(
drawable
);
}
else
{
view
.
setBackgroundDrawable
(
drawable
);
}
}
}
private
static
Drawable
getTintedDrawable
(
Context
context
,
int
drawableRes
,
int
color
)
{
private
static
Drawable
getTintedDrawable
(
Context
context
,
int
drawableRes
,
int
color
)
{
Drawable
drawable
;
Drawable
drawable
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
drawable
=
context
.
getResources
().
getDrawable
(
drawableRes
,
null
);
drawable
=
context
.
getResources
().
getDrawable
(
drawableRes
,
null
);
if
(
drawable
!=
null
)
{
if
(
drawable
!=
null
)
{
drawable
.
setTint
(
color
);
drawable
.
setTint
(
color
);
}
}
}
else
{
drawable
=
context
.
getResources
().
getDrawable
(
drawableRes
);
if
(
drawable
!=
null
)
{
drawable
.
setColorFilter
(
color
,
PorterDuff
.
Mode
.
SRC_ATOP
);
}
}
return
drawable
;
return
drawable
;
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/view/popupwindows/tools/RxPopupViewManager.java
View file @
5e2fb2d5
...
@@ -5,13 +5,13 @@ import android.animation.AnimatorListenerAdapter;
...
@@ -5,13 +5,13 @@ import android.animation.AnimatorListenerAdapter;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.graphics.Outline
;
import
android.graphics.Outline
;
import
android.graphics.Point
;
import
android.graphics.Point
;
import
android.os.Build
;
import
androidx.annotation.NonNull
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewOutlineProvider
;
import
android.view.ViewOutlineProvider
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
com.yidianling.common.tools.RxAnimationTool
;
import
com.yidianling.common.tools.RxAnimationTool
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -129,7 +129,6 @@ public class RxPopupViewManager {
...
@@ -129,7 +129,6 @@ public class RxPopupViewManager {
}
}
private
void
setTipViewElevation
(
TextView
tipView
,
RxPopupView
rxPopupView
)
{
private
void
setTipViewElevation
(
TextView
tipView
,
RxPopupView
rxPopupView
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
if
(
rxPopupView
.
getElevation
()
>
0
)
{
if
(
rxPopupView
.
getElevation
()
>
0
)
{
ViewOutlineProvider
viewOutlineProvider
=
new
ViewOutlineProvider
()
{
ViewOutlineProvider
viewOutlineProvider
=
new
ViewOutlineProvider
()
{
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
...
@@ -142,7 +141,6 @@ public class RxPopupViewManager {
...
@@ -142,7 +141,6 @@ public class RxPopupViewManager {
tipView
.
setElevation
(
rxPopupView
.
getElevation
());
tipView
.
setElevation
(
rxPopupView
.
getElevation
());
}
}
}
}
}
private
void
switchToolTipSidePosition
(
RxPopupView
rxPopupView
)
{
private
void
switchToolTipSidePosition
(
RxPopupView
rxPopupView
)
{
if
(
rxPopupView
.
positionedLeftTo
())
{
if
(
rxPopupView
.
positionedLeftTo
())
{
...
...
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/RxIconRoundProgressBar.java
View file @
5e2fb2d5
...
@@ -3,7 +3,6 @@ package com.yidianling.common.view.roundprogressbar;
...
@@ -3,7 +3,6 @@ package com.yidianling.common.view.roundprogressbar;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
import
android.graphics.drawable.GradientDrawable
;
import
android.graphics.drawable.GradientDrawable
;
import
android.os.Build
;
import
android.os.Parcel
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
...
@@ -100,11 +99,7 @@ public class RxIconRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -100,11 +99,7 @@ public class RxIconRoundProgressBar extends RxBaseRoundProgressBar implements Vi
else
else
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
0
,
0
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
0
,
0
});
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
0
,
0
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
0
,
0
});
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
layoutProgress
.
setBackground
(
backgroundDrawable
);
layoutProgress
.
setBackground
(
backgroundDrawable
);
}
else
{
layoutProgress
.
setBackgroundDrawable
(
backgroundDrawable
);
}
float
ratio
=
max
/
progress
;
float
ratio
=
max
/
progress
;
int
progressWidth
=
(
int
)
((
totalWidth
-
((
padding
*
2
)
+
ivProgressIcon
.
getWidth
()))
/
ratio
);
int
progressWidth
=
(
int
)
((
totalWidth
-
((
padding
*
2
)
+
ivProgressIcon
.
getWidth
()))
/
ratio
);
...
@@ -146,11 +141,7 @@ public class RxIconRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -146,11 +141,7 @@ public class RxIconRoundProgressBar extends RxBaseRoundProgressBar implements Vi
GradientDrawable
iconBackgroundDrawable
=
createGradientDrawable
(
colorIconBackground
);
GradientDrawable
iconBackgroundDrawable
=
createGradientDrawable
(
colorIconBackground
);
int
radius
=
getRadius
()
-
(
getPadding
()
/
2
);
int
radius
=
getRadius
()
-
(
getPadding
()
/
2
);
iconBackgroundDrawable
.
setCornerRadii
(
new
float
[]{
radius
,
radius
,
0
,
0
,
0
,
0
,
radius
,
radius
});
iconBackgroundDrawable
.
setCornerRadii
(
new
float
[]{
radius
,
radius
,
0
,
0
,
0
,
0
,
radius
,
radius
});
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
ivProgressIcon
.
setBackground
(
iconBackgroundDrawable
);
ivProgressIcon
.
setBackground
(
iconBackgroundDrawable
);
}
else
{
ivProgressIcon
.
setBackgroundDrawable
(
iconBackgroundDrawable
);
}
}
}
public
int
getIconImageResource
()
{
public
int
getIconImageResource
()
{
...
...
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/RxRoundProgressBar.java
View file @
5e2fb2d5
...
@@ -20,7 +20,6 @@ package com.yidianling.common.view.roundprogressbar;
...
@@ -20,7 +20,6 @@ package com.yidianling.common.view.roundprogressbar;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.drawable.GradientDrawable
;
import
android.graphics.drawable.GradientDrawable
;
import
android.os.Build
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
...
@@ -61,11 +60,7 @@ public class RxRoundProgressBar extends RxBaseRoundProgressBar {
...
@@ -61,11 +60,7 @@ public class RxRoundProgressBar extends RxBaseRoundProgressBar {
GradientDrawable
backgroundDrawable
=
createGradientDrawable
(
colorProgress
);
GradientDrawable
backgroundDrawable
=
createGradientDrawable
(
colorProgress
);
int
newRadius
=
radius
-
(
padding
/
2
);
int
newRadius
=
radius
-
(
padding
/
2
);
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
});
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
});
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
layoutProgress
.
setBackground
(
backgroundDrawable
);
layoutProgress
.
setBackground
(
backgroundDrawable
);
}
else
{
layoutProgress
.
setBackgroundDrawable
(
backgroundDrawable
);
}
float
ratio
=
max
/
progress
;
float
ratio
=
max
/
progress
;
int
progressWidth
=
(
int
)
((
totalWidth
-
(
padding
*
2
))
/
ratio
);
int
progressWidth
=
(
int
)
((
totalWidth
-
(
padding
*
2
))
/
ratio
);
...
...
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/RxTextRoundProgressBar.java
View file @
5e2fb2d5
...
@@ -4,7 +4,6 @@ import android.content.Context;
...
@@ -4,7 +4,6 @@ import android.content.Context;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.drawable.GradientDrawable
;
import
android.graphics.drawable.GradientDrawable
;
import
android.os.Build
;
import
android.os.Parcel
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.os.Parcelable
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
...
@@ -69,11 +68,7 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -69,11 +68,7 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
GradientDrawable
backgroundDrawable
=
createGradientDrawable
(
colorProgress
);
GradientDrawable
backgroundDrawable
=
createGradientDrawable
(
colorProgress
);
int
newRadius
=
radius
-
(
padding
/
2
);
int
newRadius
=
radius
-
(
padding
/
2
);
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
});
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
});
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
layoutProgress
.
setBackground
(
backgroundDrawable
);
layoutProgress
.
setBackground
(
backgroundDrawable
);
}
else
{
layoutProgress
.
setBackgroundDrawable
(
backgroundDrawable
);
}
float
ratio
=
max
/
progress
;
float
ratio
=
max
/
progress
;
int
progressWidth
=
(
int
)
((
totalWidth
-
(
padding
*
2
))
/
ratio
);
int
progressWidth
=
(
int
)
((
totalWidth
-
(
padding
*
2
))
/
ratio
);
...
@@ -110,18 +105,6 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -110,18 +105,6 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
}
}
private
void
drawTextProgressPosition
()
{
private
void
drawTextProgressPosition
()
{
// tvProgress.setVisibility(View.INVISIBLE);
// tvProgress.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
// @SuppressWarnings("deprecation")
// @Override
// public void onGlobalLayout() {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
// tvProgress.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// else
// tvProgress.getViewTreeObserver().removeGlobalOnLayoutListener(this);
// setTextProgressAlign();
// }
// });
clearTextProgressAlign
();
clearTextProgressAlign
();
int
textProgressWidth
=
tvProgress
.
getMeasuredWidth
()
+
(
getTextProgressMargin
()
*
2
);
int
textProgressWidth
=
tvProgress
.
getMeasuredWidth
()
+
(
getTextProgressMargin
()
*
2
);
float
ratio
=
getMax
()
/
getProgress
();
float
ratio
=
getMax
()
/
getProgress
();
...
@@ -133,40 +116,16 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -133,40 +116,16 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
}
}
}
}
// private void setTextProgressAlign() {
// tvProgress.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
// @SuppressWarnings("deprecation")
// @Override
// public void onGlobalLayout() {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
// tvProgress.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// else
// tvProgress.getViewTreeObserver().removeGlobalOnLayoutListener(this);
// tvProgress.setVisibility(View.VISIBLE);
// }
// });
// int textProgressWidth = tvProgress.getMeasuredWidth() + (getTextProgressMargin() * 2);
// float ratio = getMax() / getProgress();
// int progressWidth = (int) ((getLayoutWidth() - (getPadding() * 2)) / ratio);
// if (textProgressWidth + textProgressMargin < progressWidth) {
// alignTextProgressInsideProgress();
// } else {
// alignTextProgressOutsideProgress();
// }
// }
private
void
clearTextProgressAlign
()
{
private
void
clearTextProgressAlign
()
{
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
tvProgress
.
getLayoutParams
();
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
tvProgress
.
getLayoutParams
();
params
.
addRule
(
RelativeLayout
.
ALIGN_LEFT
,
0
);
params
.
addRule
(
RelativeLayout
.
ALIGN_LEFT
,
0
);
params
.
addRule
(
RelativeLayout
.
ALIGN_RIGHT
,
0
);
params
.
addRule
(
RelativeLayout
.
ALIGN_RIGHT
,
0
);
params
.
addRule
(
RelativeLayout
.
LEFT_OF
,
0
);
params
.
addRule
(
RelativeLayout
.
LEFT_OF
,
0
);
params
.
addRule
(
RelativeLayout
.
RIGHT_OF
,
0
);
params
.
addRule
(
RelativeLayout
.
RIGHT_OF
,
0
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
params
.
removeRule
(
RelativeLayout
.
START_OF
);
params
.
removeRule
(
RelativeLayout
.
START_OF
);
params
.
removeRule
(
RelativeLayout
.
END_OF
);
params
.
removeRule
(
RelativeLayout
.
END_OF
);
params
.
removeRule
(
RelativeLayout
.
ALIGN_START
);
params
.
removeRule
(
RelativeLayout
.
ALIGN_START
);
params
.
removeRule
(
RelativeLayout
.
ALIGN_END
);
params
.
removeRule
(
RelativeLayout
.
ALIGN_END
);
}
tvProgress
.
setLayoutParams
(
params
);
tvProgress
.
setLayoutParams
(
params
);
}
}
...
@@ -174,11 +133,9 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -174,11 +133,9 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
tvProgress
.
getLayoutParams
();
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
tvProgress
.
getLayoutParams
();
if
(
isReverse
())
{
if
(
isReverse
())
{
params
.
addRule
(
RelativeLayout
.
ALIGN_LEFT
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
ALIGN_LEFT
,
R
.
id
.
layout_progress
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
params
.
addRule
(
RelativeLayout
.
ALIGN_START
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
ALIGN_START
,
R
.
id
.
layout_progress
);
}
else
{
}
else
{
params
.
addRule
(
RelativeLayout
.
ALIGN_RIGHT
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
ALIGN_RIGHT
,
R
.
id
.
layout_progress
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
params
.
addRule
(
RelativeLayout
.
ALIGN_END
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
ALIGN_END
,
R
.
id
.
layout_progress
);
}
}
tvProgress
.
setLayoutParams
(
params
);
tvProgress
.
setLayoutParams
(
params
);
...
@@ -188,11 +145,9 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -188,11 +145,9 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
tvProgress
.
getLayoutParams
();
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
tvProgress
.
getLayoutParams
();
if
(
isReverse
())
{
if
(
isReverse
())
{
params
.
addRule
(
RelativeLayout
.
LEFT_OF
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
LEFT_OF
,
R
.
id
.
layout_progress
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
params
.
addRule
(
RelativeLayout
.
START_OF
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
START_OF
,
R
.
id
.
layout_progress
);
}
else
{
}
else
{
params
.
addRule
(
RelativeLayout
.
RIGHT_OF
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
RIGHT_OF
,
R
.
id
.
layout_progress
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
params
.
addRule
(
RelativeLayout
.
END_OF
,
R
.
id
.
layout_progress
);
params
.
addRule
(
RelativeLayout
.
END_OF
,
R
.
id
.
layout_progress
);
}
}
tvProgress
.
setLayoutParams
(
params
);
tvProgress
.
setLayoutParams
(
params
);
...
@@ -245,10 +200,7 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
...
@@ -245,10 +200,7 @@ public class RxTextRoundProgressBar extends RxBaseRoundProgressBar implements Vi
@Override
@Override
public
void
onGlobalLayout
()
{
public
void
onGlobalLayout
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
tvProgress
.
getViewTreeObserver
().
removeOnGlobalLayoutListener
(
this
);
tvProgress
.
getViewTreeObserver
().
removeOnGlobalLayoutListener
(
this
);
else
tvProgress
.
getViewTreeObserver
().
removeGlobalOnLayoutListener
(
this
);
drawTextProgressPosition
();
drawTextProgressPosition
();
}
}
...
...
ydl-utils/src/main/java/com/yidianling/common/view/roundprogressbar/common/RxBaseRoundProgressBar.java
View file @
5e2fb2d5
...
@@ -165,11 +165,7 @@ public abstract class RxBaseRoundProgressBar extends LinearLayout {
...
@@ -165,11 +165,7 @@ public abstract class RxBaseRoundProgressBar extends LinearLayout {
GradientDrawable
backgroundDrawable
=
createGradientDrawable
(
colorBackground
);
GradientDrawable
backgroundDrawable
=
createGradientDrawable
(
colorBackground
);
int
newRadius
=
radius
-
(
padding
/
2
);
int
newRadius
=
radius
-
(
padding
/
2
);
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
});
backgroundDrawable
.
setCornerRadii
(
new
float
[]{
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
,
newRadius
});
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN
)
{
layoutBackground
.
setBackground
(
backgroundDrawable
);
layoutBackground
.
setBackground
(
backgroundDrawable
);
}
else
{
layoutBackground
.
setBackgroundDrawable
(
backgroundDrawable
);
}
}
}
// Create an empty color rectangle gradient drawable
// Create an empty color rectangle gradient drawable
...
@@ -200,12 +196,10 @@ public abstract class RxBaseRoundProgressBar extends LinearLayout {
...
@@ -200,12 +196,10 @@ public abstract class RxBaseRoundProgressBar extends LinearLayout {
if
(
isReverse
)
{
if
(
isReverse
)
{
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_RIGHT
);
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_RIGHT
);
// For support with RTL on API 17 or more
// For support with RTL on API 17 or more
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_END
);
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_END
);
}
else
{
}
else
{
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
);
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
);
// For support with RTL on API 17 or more
// For support with RTL on API 17 or more
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_START
);
progressParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_START
);
}
}
layoutProgress
.
setLayoutParams
(
progressParams
);
layoutProgress
.
setLayoutParams
(
progressParams
);
...
@@ -217,15 +211,10 @@ public abstract class RxBaseRoundProgressBar extends LinearLayout {
...
@@ -217,15 +211,10 @@ public abstract class RxBaseRoundProgressBar extends LinearLayout {
// Remove all of relative align rule
// Remove all of relative align rule
private
void
removeLayoutParamsRule
(
RelativeLayout
.
LayoutParams
layoutParams
)
{
private
void
removeLayoutParamsRule
(
RelativeLayout
.
LayoutParams
layoutParams
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_RIGHT
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_RIGHT
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_END
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_END
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_START
);
layoutParams
.
removeRule
(
RelativeLayout
.
ALIGN_PARENT_START
);
}
else
{
layoutParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_RIGHT
,
0
);
layoutParams
.
addRule
(
RelativeLayout
.
ALIGN_PARENT_LEFT
,
0
);
}
}
}
@SuppressLint
(
"NewApi"
)
@SuppressLint
(
"NewApi"
)
...
...
ydl-utils/src/main/java/com/yidianling/common/view/sidebar/WaveSideBarView.java
View file @
5e2fb2d5
...
@@ -8,7 +8,6 @@ import android.graphics.Color;
...
@@ -8,7 +8,6 @@ import android.graphics.Color;
import
android.graphics.Paint
;
import
android.graphics.Paint
;
import
android.graphics.Path
;
import
android.graphics.Path
;
import
android.graphics.RectF
;
import
android.graphics.RectF
;
import
android.os.Build
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
...
@@ -293,9 +292,7 @@ public class WaveSideBarView extends View {
...
@@ -293,9 +292,7 @@ public class WaveSideBarView extends View {
mBallPath
.
reset
();
mBallPath
.
reset
();
mBallPath
.
addCircle
(
mBallCentreX
,
mCenterY
,
mBallRadius
,
Path
.
Direction
.
CW
);
mBallPath
.
addCircle
(
mBallCentreX
,
mCenterY
,
mBallRadius
,
Path
.
Direction
.
CW
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
mBallPath
.
op
(
mWavePath
,
Path
.
Op
.
DIFFERENCE
);
mBallPath
.
op
(
mWavePath
,
Path
.
Op
.
DIFFERENCE
);
}
mBallPath
.
close
();
mBallPath
.
close
();
canvas
.
drawPath
(
mBallPath
,
mWavePaint
);
canvas
.
drawPath
(
mBallPath
,
mWavePaint
);
...
...
ydl-webview/build.gradle
View file @
5e2fb2d5
...
@@ -9,12 +9,11 @@ kapt {
...
@@ -9,12 +9,11 @@ kapt {
}
}
}
}
android
{
android
{
compileSdkVersion
28
compileSdkVersion
rootProject
.
ext
.
android
[
"compileSdkVersion"
]
defaultConfig
{
defaultConfig
{
minSdkVersion
21
minSdkVersion
rootProject
.
ext
.
android
[
"minSdkVersion"
]
targetSdkVersion
28
targetSdkVersion
rootProject
.
ext
.
android
[
"targetSdkVersion"
]
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
...
...
ydl-webview/src/main/java/com/ydl/utils/ProxyCheckUtils.kt
View file @
5e2fb2d5
package
com.ydl.utils
package
com.ydl.utils
import
android.content.Context
import
android.content.Context
import
android.net.Proxy
import
android.os.Build
import
android.text.TextUtils
import
android.text.TextUtils
/**
/**
...
@@ -16,17 +14,10 @@ object ProxyCheckUtils {
...
@@ -16,17 +14,10 @@ object ProxyCheckUtils {
* return 当前网络是否开启了代理
* return 当前网络是否开启了代理
*/
*/
fun
isWifiProxy
(
context
:
Context
):
Boolean
{
fun
isWifiProxy
(
context
:
Context
):
Boolean
{
val
IS_ICS_OR_LATER
:
Boolean
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ICE_CREAM_SANDWICH
val
proxyAddress
:
String
=
System
.
getProperty
(
"http.proxyHost"
)
?:
""
val
proxyAddress
:
String
val
proxyPort
:
Int
if
(
IS_ICS_OR_LATER
)
{
proxyAddress
=
System
.
getProperty
(
"http.proxyHost"
)
?:
""
val
portStr
=
System
.
getProperty
(
"http.proxyPort"
)
val
portStr
=
System
.
getProperty
(
"http.proxyPort"
)
proxyPort
=
(
portStr
?:
"-1"
).
toInt
()
val
proxyPort
=
(
portStr
?:
"-1"
).
toInt
()
}
else
{
proxyAddress
=
Proxy
.
getHost
(
context
)
proxyPort
=
Proxy
.
getPort
(
context
)
}
return
!
TextUtils
.
isEmpty
(
proxyAddress
)
&&
proxyPort
!=
-
1
return
!
TextUtils
.
isEmpty
(
proxyAddress
)
&&
proxyPort
!=
-
1
}
}
}
}
\ No newline at end of file
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
View file @
5e2fb2d5
package
com
.
ydl
.
webview
;
package
com
.
ydl
.
webview
;
import
static
android
.
view
.
View
.
GONE
;
import
static
android
.
view
.
View
.
VISIBLE
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
...
@@ -84,9 +87,6 @@ import in.srain.cube.views.ptr.header.MaterialHeader;
...
@@ -84,9 +87,6 @@ import in.srain.cube.views.ptr.header.MaterialHeader;
import
io.reactivex.Observable
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
static
android
.
view
.
View
.
GONE
;
import
static
android
.
view
.
View
.
VISIBLE
;
/**
/**
* 通用h5显示页面
* 通用h5显示页面
* 跳转此h5页面,请使用唯一参数 H5ParamsBaseActivity
* 跳转此h5页面,请使用唯一参数 H5ParamsBaseActivity
...
@@ -679,9 +679,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
...
@@ -679,9 +679,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
setting
.
setLayoutAlgorithm
(
WebSettings
.
LayoutAlgorithm
.
NARROW_COLUMNS
);
setting
.
setLayoutAlgorithm
(
WebSettings
.
LayoutAlgorithm
.
NARROW_COLUMNS
);
setting
.
setLoadWithOverviewMode
(
true
);
setting
.
setLoadWithOverviewMode
(
true
);
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
setting
.
setMixedContentMode
(
WebSettings
.
LOAD_NORMAL
);
setting
.
setMixedContentMode
(
WebSettings
.
LOAD_NORMAL
);
}
wv_content
.
setScrollBarStyle
(
View
.
SCROLLBARS_INSIDE_OVERLAY
);
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
wv_content
.
setScrollBarStyle
(
View
.
SCROLLBARS_INSIDE_OVERLAY
);
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
tb_title
.
setImageListener
(
v
->
{
tb_title
.
setImageListener
(
v
->
{
if
(
h5Params
.
isSplash
())
{
if
(
h5Params
.
isSplash
())
{
...
...
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