Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fastcoding
/
commonProject
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangkai
2024-11-21 16:13:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
18ffa10ac598069cb021ff5ed1c90a9b1d19c44c
18ffa10a
1 parent
fdb037f1
添加语音播报跳转
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1008 additions
and
471 deletions
app/build.gradle
base_comment/src/main/res/mipmap-xxhdpi/icon_pause_button.png
lib_base/src/main/java/com/wd/common/utils/CalendarUtil.java
lib_base/src/main/java/com/wd/common/utils/LunarCalender.java
lib_base/src/main/java/com/wd/common/utils/ProcessUtils.java
module_musicplayer/src/main/java/com/wd/musicplayer/ui/activity/AudioChannelActivity.java
module_musicplayer/src/main/java/com/wd/musicplayer/ui/page/DrawerFragment.java
module_musicplayer/src/main/java/com/wd/musicplayer/ui/page/adapter/PlaylistRecommendationAdapter.java
module_musicplayer/src/main/res/layout/adapter_play_recommendation.xml
module_musicplayer/src/main/res/layout/fragment_drawer.xml
module_musicplayer/src/main/res/values/strings.xml
app/build.gradle
View file @
18ffa10
...
...
@@ -45,6 +45,11 @@ android {
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
buildFeatures
{
dataBinding
true
viewBinding
true
}
}
repositories
{
...
...
base_comment/src/main/res/mipmap-xxhdpi/icon_pause_button.png
0 → 100644
View file @
18ffa10
18.9 KB
lib_base/src/main/java/com/wd/common/utils/CalendarUtil.java
0 → 100644
View file @
18ffa10
package
com
.
wd
.
common
.
utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
* <b>描述</b>: 日历转换工具类:阴历和阳历日期互换(阴历日期范围19000101~20491229)<br>
* @author liu 2015-1-5
*/
public
class
CalendarUtil
{
// private static final Logger logger = LoggerFactory.getLogger(CalendarUtil.class);
// 计算阴历日期参照1900年到2049年
private
final
static
int
[]
LUNAR_INFO
=
{
0x04bd8
,
0x04ae0
,
0x0a570
,
0x054d5
,
0x0d260
,
0x0d950
,
0x16554
,
0x056a0
,
0x09ad0
,
0x055d2
,
0x04ae0
,
0x0a5b6
,
0x0a4d0
,
0x0d250
,
0x1d255
,
0x0b540
,
0x0d6a0
,
0x0ada2
,
0x095b0
,
0x14977
,
0x04970
,
0x0a4b0
,
0x0b4b5
,
0x06a50
,
0x06d40
,
0x1ab54
,
0x02b60
,
0x09570
,
0x052f2
,
0x04970
,
0x06566
,
0x0d4a0
,
0x0ea50
,
0x06e95
,
0x05ad0
,
0x02b60
,
0x186e3
,
0x092e0
,
0x1c8d7
,
0x0c950
,
0x0d4a0
,
0x1d8a6
,
0x0b550
,
0x056a0
,
0x1a5b4
,
0x025d0
,
0x092d0
,
0x0d2b2
,
0x0a950
,
0x0b557
,
0x06ca0
,
0x0b550
,
0x15355
,
0x04da0
,
0x0a5d0
,
0x14573
,
0x052d0
,
0x0a9a8
,
0x0e950
,
0x06aa0
,
0x0aea6
,
0x0ab50
,
0x04b60
,
0x0aae4
,
0x0a570
,
0x05260
,
0x0f263
,
0x0d950
,
0x05b57
,
0x056a0
,
0x096d0
,
0x04dd5
,
0x04ad0
,
0x0a4d0
,
0x0d4d4
,
0x0d250
,
0x0d558
,
0x0b540
,
0x0b5a0
,
0x195a6
,
0x095b0
,
0x049b0
,
0x0a974
,
0x0a4b0
,
0x0b27a
,
0x06a50
,
0x06d40
,
0x0af46
,
0x0ab60
,
0x09570
,
0x04af5
,
0x04970
,
0x064b0
,
0x074a3
,
0x0ea50
,
0x06b58
,
0x055c0
,
0x0ab60
,
0x096d5
,
0x092e0
,
0x0c960
,
0x0d954
,
0x0d4a0
,
0x0da50
,
0x07552
,
0x056a0
,
0x0abb7
,
0x025d0
,
0x092d0
,
0x0cab5
,
0x0a950
,
0x0b4a0
,
0x0baa4
,
0x0ad50
,
0x055d9
,
0x04ba0
,
0x0a5b0
,
0x15176
,
0x052b0
,
0x0a930
,
0x07954
,
0x06aa0
,
0x0ad50
,
0x05b52
,
0x04b60
,
0x0a6e6
,
0x0a4e0
,
0x0d260
,
0x0ea65
,
0x0d530
,
0x05aa0
,
0x076a3
,
0x096d0
,
0x04bd7
,
0x04ad0
,
0x0a4d0
,
0x1d0b6
,
0x0d250
,
0x0d520
,
0x0dd45
,
0x0b5a0
,
0x056d0
,
0x055b2
,
0x049b0
,
0x0a577
,
0x0a4b0
,
0x0aa50
,
0x1b255
,
0x06d20
,
0x0ada0
};
// 允许输入的最小年份
private
final
static
int
MIN_YEAR
=
1900
;
// 允许输入的最大年份
private
final
static
int
MAX_YEAR
=
2049
;
// 当年是否有闰月
private
static
boolean
isLeapYear
;
// 阳历日期计算起点
private
final
static
String
START_DATE
=
"19000130"
;
/**
* 计算阴历 {@code year}年闰哪个月 1-12 , 没闰传回 0
* @param year 阴历年
* @return (int)月份
* @author liu 2015-1-5
*/
private
static
int
getLeapMonth
(
int
year
)
{
return
(
int
)
(
LUNAR_INFO
[
year
-
1900
]
&
0xf
);
}
/**
* 计算阴历{@code year}年闰月多少天
* @param year 阴历年
* @return (int)天数
* @author liu 2015-1-5
*/
private
static
int
getLeapMonthDays
(
int
year
)
{
if
(
getLeapMonth
(
year
)!=
0
){
if
((
LUNAR_INFO
[
year
-
1900
]
&
0xf0000
)==
0
){
return
29
;
}
else
{
return
30
;
}
}
else
{
return
0
;
}
}
/**
* 计算阴历{@code lunarYeay}年{@code month}月的天数
* @param lunarYeay 阴历年
* @param month 阴历月
* @return (int)该月天数
* @throws Exception
* @author liu 2015-1-5
*/
private
static
int
getMonthDays
(
int
lunarYeay
,
int
month
)
throws
Exception
{
if
((
month
>
31
)
||
(
month
<
0
))
{
throw
(
new
Exception
(
"月份有错!"
));
}
// 0X0FFFF[0000 {1111 1111 1111} 1111]中间12位代表12个月,1为大月,0为小月
int
bit
=
1
<<
(
16
-
month
);
if
(((
LUNAR_INFO
[
lunarYeay
-
1900
]
&
0x0
FFFF
)&
bit
)==
0
){
return
29
;
}
else
{
return
30
;
}
}
/**
* 计算阴历{@code year}年的总天数
* @param year 阴历年
* @return (int)总天数
* @author liu 2015-1-5
*/
private
static
int
getYearDays
(
int
year
)
{
int
sum
=
29
*
12
;
for
(
int
i
=
0x8000
;
i
>=
0x8
;
i
>>=
1
){
if
((
LUNAR_INFO
[
year
-
1900
]&
0xfff0
&
i
)!=
0
){
sum
++;
}
}
return
sum
+
getLeapMonthDays
(
year
);
}
/**
* 计算两个阳历日期相差的天数。计算不准确,已经废弃
* @param startDate 开始时间
* @param endDate 截至时间
* @return (int)天数
* @author liu 2015-1-5
*/
@Deprecated
private
static
int
daysBetween2
(
Date
startDate
,
Date
endDate
)
{
long
between_days
=(
endDate
.
getTime
()-
startDate
.
getTime
())/(
1000
*
3600
*
24
);
return
Integer
.
parseInt
(
String
.
valueOf
(
between_days
));
}
/**
* 计算两个阳历日期相差的天数。
* @param startDate 开始时间
* @param endDate 截至时间
* @return (int)天数
* @author liu 2017-3-2
*/
private
static
int
daysBetween
(
Date
startDate
,
Date
endDate
)
{
int
days
=
0
;
//将转换的两个时间对象转换成Calendar对象
Calendar
can1
=
Calendar
.
getInstance
();
can1
.
setTime
(
startDate
);
Calendar
can2
=
Calendar
.
getInstance
();
can2
.
setTime
(
endDate
);
//拿出两个年份
int
year1
=
can1
.
get
(
Calendar
.
YEAR
);
int
year2
=
can2
.
get
(
Calendar
.
YEAR
);
//天数
Calendar
can
=
null
;
//如果can1 < can2
//减去小的时间在这一年已经过了的天数
//加上大的时间已过的天数
if
(
can1
.
before
(
can2
)){
days
-=
can1
.
get
(
Calendar
.
DAY_OF_YEAR
);
days
+=
can2
.
get
(
Calendar
.
DAY_OF_YEAR
);
can
=
can1
;
}
else
{
days
-=
can2
.
get
(
Calendar
.
DAY_OF_YEAR
);
days
+=
can1
.
get
(
Calendar
.
DAY_OF_YEAR
);
can
=
can2
;
}
for
(
int
i
=
0
;
i
<
Math
.
abs
(
year2
-
year1
);
i
++)
{
//获取小的时间当前年的总天数
days
+=
can
.
getActualMaximum
(
Calendar
.
DAY_OF_YEAR
);
//再计算下一年。
can
.
add
(
Calendar
.
YEAR
,
1
);
}
return
days
;
}
/**
* 检查阴历日期是否合法
* @param lunarYear 阴历年
* @param lunarMonth 阴历月
* @param lunarDay 阴历日
* @param leapMonthFlag 闰月标志
* @throws Exception
*/
private
static
void
checkLunarDate
(
int
lunarYear
,
int
lunarMonth
,
int
lunarDay
,
boolean
leapMonthFlag
)
throws
Exception
{
if
((
lunarYear
<
MIN_YEAR
)
||
(
lunarYear
>
MAX_YEAR
))
{
throw
(
new
Exception
(
"非法农历年份!"
));
}
if
((
lunarMonth
<
1
)
||
(
lunarMonth
>
12
))
{
throw
(
new
Exception
(
"非法农历月份!"
));
}
if
((
lunarDay
<
1
)
||
(
lunarDay
>
30
))
{
// 中国的月最多30天
throw
(
new
Exception
(
"非法农历天数!"
));
}
int
leap
=
getLeapMonth
(
lunarYear
);
// 计算该年应该闰哪个月
if
((
leapMonthFlag
==
true
)
&&
(
lunarMonth
!=
leap
))
{
throw
(
new
Exception
(
"非法闰月!"
));
}
}
/**
* 阴历转换为阳历
* @param lunarDate 阴历日期,格式YYYYMMDD
* @param leapMonthFlag 是否为闰月
* @return 阳历日期,格式:YYYYMMDD
* @throws Exception
* @author liu 2015-1-5
*/
public
static
String
lunarToSolar
(
String
lunarDate
,
boolean
leapMonthFlag
)
throws
Exception
{
int
lunarYear
=
Integer
.
parseInt
(
lunarDate
.
substring
(
0
,
4
));
int
lunarMonth
=
Integer
.
parseInt
(
lunarDate
.
substring
(
4
,
6
));
int
lunarDay
=
Integer
.
parseInt
(
lunarDate
.
substring
(
6
,
8
));
checkLunarDate
(
lunarYear
,
lunarMonth
,
lunarDay
,
leapMonthFlag
);
int
offset
=
0
;
for
(
int
i
=
MIN_YEAR
;
i
<
lunarYear
;
i
++)
{
int
yearDaysCount
=
getYearDays
(
i
);
// 求阴历某年天数
offset
+=
yearDaysCount
;
}
//计算该年闰几月
int
leapMonth
=
getLeapMonth
(
lunarYear
);
if
(
leapMonthFlag
&
leapMonth
!=
lunarMonth
){
throw
(
new
Exception
(
"您输入的闰月标志有误!"
));
}
//当年没有闰月或月份早于闰月或和闰月同名的月份
if
(
leapMonth
==
0
||
(
lunarMonth
<
leapMonth
)
||
(
lunarMonth
==
leapMonth
&&
!
leapMonthFlag
)){
for
(
int
i
=
1
;
i
<
lunarMonth
;
i
++)
{
int
tempMonthDaysCount
=
getMonthDays
(
lunarYear
,
i
);
offset
+=
tempMonthDaysCount
;
}
// 检查日期是否大于最大天
if
(
lunarDay
>
getMonthDays
(
lunarYear
,
lunarMonth
))
{
throw
(
new
Exception
(
"不合法的农历日期!"
));
}
offset
+=
lunarDay
;
// 加上当月的天数
}
else
{
//当年有闰月,且月份晚于或等于闰月
for
(
int
i
=
1
;
i
<
lunarMonth
;
i
++)
{
int
tempMonthDaysCount
=
getMonthDays
(
lunarYear
,
i
);
offset
+=
tempMonthDaysCount
;
}
if
(
lunarMonth
>
leapMonth
)
{
int
temp
=
getLeapMonthDays
(
lunarYear
);
// 计算闰月天数
offset
+=
temp
;
// 加上闰月天数
if
(
lunarDay
>
getMonthDays
(
lunarYear
,
lunarMonth
))
{
throw
(
new
Exception
(
"不合法的农历日期!"
));
}
offset
+=
lunarDay
;
}
else
{
// 如果需要计算的是闰月,则应首先加上与闰月对应的普通月的天数
// 计算月为闰月
int
temp
=
getMonthDays
(
lunarYear
,
lunarMonth
);
// 计算非闰月天数
offset
+=
temp
;
if
(
lunarDay
>
getLeapMonthDays
(
lunarYear
))
{
throw
(
new
Exception
(
"不合法的农历日期!"
));
}
offset
+=
lunarDay
;
}
}
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
myDate
=
null
;
myDate
=
formatter
.
parse
(
START_DATE
);
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
myDate
);
c
.
add
(
Calendar
.
DATE
,
offset
);
myDate
=
c
.
getTime
();
return
formatter
.
format
(
myDate
);
}
/**
* 阳历日期转换为阴历日期
* @param solarDate 阳历日期,格式YYYYMMDD
* @return 阴历日期
* @throws Exception
* @author liu 2015-1-5
*/
public
static
int
[]
solarToLunar
(
String
solarDate
)
throws
Exception
{
int
i
;
int
temp
=
0
;
int
lunarYear
;
int
lunarMonth
;
//农历月份
int
lunarDay
;
//农历当月第几天
boolean
leapMonthFlag
=
false
;
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
myDate
=
null
;
Date
startDate
=
null
;
try
{
myDate
=
formatter
.
parse
(
solarDate
);
startDate
=
formatter
.
parse
(
START_DATE
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
int
offset
=
daysBetween
(
startDate
,
myDate
);
for
(
i
=
MIN_YEAR
;
i
<=
MAX_YEAR
;
i
++){
temp
=
getYearDays
(
i
);
//求当年农历年天数
if
(
offset
-
temp
<
1
){
break
;
}
else
{
offset
-=
temp
;
}
}
lunarYear
=
i
;
int
leapMonth
=
getLeapMonth
(
lunarYear
);
//计算该年闰哪个月
//设定当年是否有闰月
if
(
leapMonth
>
0
){
isLeapYear
=
true
;
}
else
{
isLeapYear
=
false
;
}
for
(
i
=
1
;
i
<=
12
;
i
++)
{
if
(
i
==
leapMonth
+
1
&&
isLeapYear
){
temp
=
getLeapMonthDays
(
lunarYear
);
isLeapYear
=
false
;
leapMonthFlag
=
true
;
i
--;
}
else
{
temp
=
getMonthDays
(
lunarYear
,
i
);
}
offset
-=
temp
;
if
(
offset
<=
0
){
break
;
}
}
offset
+=
temp
;
lunarMonth
=
i
;
lunarDay
=
offset
;
int
[]
date
=
new
int
[]{
lunarYear
,
lunarMonth
,
lunarDay
};
return
date
;
}
}
\ No newline at end of file
...
...
lib_base/src/main/java/com/wd/common/utils/LunarCalender.java
0 → 100644
View file @
18ffa10
package
com
.
wd
.
common
.
utils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
* 中国农历工具类
*
* @author qts
* @data 2023/7/27.
*/
public
class
LunarCalender
{
private
int
year
;
// 农历的年份
private
int
month
;
private
int
day
;
private
String
lunarMonth
;
// 农历的月份
private
boolean
leap
;
public
int
leapMonth
=
0
;
// 闰的是哪个月
final
static
String
chineseNumber
[]
=
{
"正"
,
"二"
,
"三"
,
"四"
,
"五"
,
"六"
,
"七"
,
"八"
,
"九"
,
"十"
,
"冬"
,
"腊"
};
static
SimpleDateFormat
chineseDateFormat
=
new
SimpleDateFormat
(
"yyyy年MM月dd日"
);
final
static
long
[]
lunarInfo
=
new
long
[]{
0x4bd8
,
0x4ae0
,
0xa570
,
0x54d5
,
0xd260
,
0xd950
,
0x5554
,
0x56af
,
0x9ad0
,
0x55d2
,
0x4ae0
,
0xa5b6
,
0xa4d0
,
0xd250
,
0xd255
,
0xb54f
,
0xd6a0
,
0xada2
,
0x95b0
,
0x4977
,
0x497f
,
0xa4b0
,
0xb4b5
,
0x6a50
,
0x6d40
,
0xab54
,
0x2b6f
,
0x9570
,
0x52f2
,
0x4970
,
0x6566
,
0xd4a0
,
0xea50
,
0x6a95
,
0x5adf
,
0x2b60
,
0x86e3
,
0x92ef
,
0xc8d7
,
0xc95f
,
0xd4a0
,
0xd8a6
,
0xb55f
,
0x56a0
,
0xa5b4
,
0x25df
,
0x92d0
,
0xd2b2
,
0xa950
,
0xb557
,
0x6ca0
,
0xb550
,
0x5355
,
0x4daf
,
0xa5b0
,
0x4573
,
0x52bf
,
0xa9a8
,
0xe950
,
0x6aa0
,
0xaea6
,
0xab50
,
0x4b60
,
0xaae4
,
0xa570
,
0x5260
,
0xf263
,
0xd950
,
0x5b57
,
0x56a0
,
0x96d0
,
0x4dd5
,
0x4ad0
,
0xa4d0
,
0xd4d4
,
0xd250
,
0xd558
,
0xb540
,
0xb6a0
,
0x95a6
,
0x95bf
,
0x49b0
,
0xa974
,
0xa4b0
,
0xb27a
,
0x6a50
,
0x6d40
,
0xaf46
,
0xab60
,
0x9570
,
0x4af5
,
0x4970
,
0x64b0
,
0x74a3
,
0xea50
,
0x6b58
,
0x5ac0
,
0xab60
,
0x96d5
,
0x92e0
,
0xc960
,
0xd954
,
0xd4a0
,
0xda50
,
0x7552
,
0x56a0
,
0xabb7
,
0x25d0
,
0x92d0
,
0xcab5
,
0xa950
,
0xb4a0
,
0xbaa4
,
0xad50
,
0x55d9
,
0x4ba0
,
0xa5b0
,
0x5176
,
0x52bf
,
0xa930
,
0x7954
,
0x6aa0
,
0xad50
,
0x5b52
,
0x4b60
,
0xa6e6
,
0xa4e0
,
0xd260
,
0xea65
,
0xd530
,
0x5aa0
,
0x76a3
,
0x96d0
,
0x4afb
,
0x4ad0
,
0xa4d0
,
0xd0b6
,
0xd25f
,
0xd520
,
0xdd45
,
0xb5a0
,
0x56d0
,
0x55b2
,
0x49b0
,
0xa577
,
0xa4b0
,
0xaa50
,
0xb255
,
0x6d2f
,
0xada0
,
0x4b63
,
0x937f
,
0x49f8
,
0x4970
,
0x64b0
,
0x68a6
,
0xea5f
,
0x6b20
,
0xa6c4
,
0xaaef
,
0x92e0
,
0xd2e3
,
0xc960
,
0xd557
,
0xd4a0
,
0xda50
,
0x5d55
,
0x56a0
,
0xa6d0
,
0x55d4
,
0x52d0
,
0xa9b8
,
0xa950
,
0xb4a0
,
0xb6a6
,
0xad50
,
0x55a0
,
0xaba4
,
0xa5b0
,
0x52b0
,
0xb273
,
0x6930
,
0x7337
,
0x6aa0
,
0xad50
,
0x4b55
,
0x4b6f
,
0xa570
,
0x54e4
,
0xd260
,
0xe968
,
0xd520
,
0xdaa0
,
0x6aa6
,
0x56df
,
0x4ae0
,
0xa9d4
,
0xa4d0
,
0xd150
,
0xf252
,
0xd520
};
final
static
String
[]
Gan
=
new
String
[]{
"甲"
,
"乙"
,
"丙"
,
"丁"
,
"戊"
,
"己"
,
"庚"
,
"辛"
,
"壬"
,
"癸"
};
final
static
String
[]
Zhi
=
new
String
[]{
"子"
,
"丑"
,
"寅"
,
"卯"
,
"辰"
,
"巳"
,
"午"
,
"未"
,
"申"
,
"酉"
,
"戌"
,
"亥"
};
// ====== 传回农历 y年的总天数 1900--2100
public
int
yearDays
(
int
y
)
{
int
i
,
sum
=
348
;
for
(
i
=
0x8000
;
i
>
0x8
;
i
>>=
1
)
{
if
((
lunarInfo
[
y
-
1900
]
&
i
)
!=
0
)
{
sum
+=
1
;
}
}
return
(
sum
+
leapDays
(
y
));
}
// ====== 传回农历 y年闰月的天数
public
int
leapDays
(
int
y
)
{
if
(
leapMonth
(
y
)
!=
0
)
{
if
((
lunarInfo
[
y
-
1899
]
&
0xf
)
!=
0
)
{
return
30
;
}
else
{
return
29
;
}
}
else
{
return
0
;
}
}
// ====== 传回农历 y年闰哪个月 1-12 , 没闰传回 0
public
int
leapMonth
(
int
y
)
{
long
var
=
lunarInfo
[
y
-
1900
]
&
0xf
;
return
(
int
)
(
var
==
0xf
?
0
:
var
);
}
// ====== 传回农历 y年m月的总天数
public
int
monthDays
(
int
y
,
int
m
)
{
if
((
lunarInfo
[
y
-
1900
]
&
(
0x10000
>>
m
))
==
0
)
{
return
29
;
}
else
{
return
30
;
}
}
// ====== 传回农历 y年的生肖
public
String
animalsYear
(
int
year
)
{
final
String
[]
Animals
=
new
String
[]{
"鼠"
,
"牛"
,
"虎"
,
"兔"
,
"龙"
,
"蛇"
,
"马"
,
"羊"
,
"猴"
,
"鸡"
,
"狗"
,
"猪"
};
return
Animals
[(
year
-
4
)
%
12
]
+
"年"
;
}
// ====== 传入 月日的offset 传回干支, 0=甲子
final
private
static
String
cyclicalm
(
int
num
)
{
return
(
Gan
[
num
%
10
]
+
Zhi
[
num
%
12
]);
}
// ====== 传入 offset 传回干支, 0=甲子
final
public
String
cyclical
(
int
year
,
int
month
,
int
day
)
{
int
num
=
year
-
1900
+
36
;
//立春日期
int
term2
=
sTerm
(
year
,
2
);
if
(
month
>
2
||
(
month
==
2
&&
day
>=
term2
))
{
num
=
num
+
0
;
}
else
{
num
=
num
-
1
;
}
return
(
cyclicalm
(
num
));
}
public
static
String
getChinaDayString
(
int
day
)
{
//将农历day日格式化成农历表示的字符串
String
chineseTen
[]
=
{
"初"
,
"十"
,
"廿"
,
"三"
};
String
chineseDay
[]
=
{
"一"
,
"二"
,
"三"
,
"四"
,
"五"
,
"六"
,
"七"
,
"八"
,
"九"
,
"十"
};
String
var
=
""
;
if
(
day
!=
20
&&
day
!=
30
)
{
var
=
chineseTen
[(
int
)
((
day
-
1
)
/
10
)]
+
chineseDay
[(
int
)
((
day
-
1
)
%
10
)];
}
else
if
(
day
!=
20
)
{
var
=
chineseTen
[(
int
)
(
day
/
10
)]
+
"十"
;
}
else
{
var
=
"二十"
;
}
return
var
;
}
/*
* 计算公历nY年nM月nD日和bY年bM月bD日渐相差多少天
* */
public
int
getDaysOfTwoDate
(
int
bY
,
int
bM
,
int
bD
,
int
nY
,
int
nM
,
int
nD
)
{
Date
baseDate
=
null
;
Date
nowaday
=
null
;
try
{
baseDate
=
chineseDateFormat
.
parse
(
bY
+
"年"
+
bM
+
"月"
+
bD
+
"日"
);
nowaday
=
chineseDateFormat
.
parse
(
nY
+
"年"
+
nM
+
"月"
+
nD
+
"日"
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
int
offset
=
0
;
if
(
nowaday
!=
null
&&
baseDate
!=
null
)
{
// 求出相差的天数
offset
=
(
int
)
((
nowaday
.
getTime
()
-
baseDate
.
getTime
())
/
86400000L
);
}
return
offset
;
}
/*农历lunYear年lunMonth月lunDay日
* isLeap 当前年月是否是闰月
* 从农历日期转换成公历日期
* */
public
Calendar
getSunDate
(
int
lunYear
,
int
lunMonth
,
int
lunDay
,
boolean
isLeap
)
{
//公历1900年1月31日为1900年正月初一
int
years
=
lunYear
-
1900
;
int
days
=
0
;
for
(
int
i
=
0
;
i
<
years
;
i
++)
{
days
+=
yearDays
(
1900
+
i
);
//农历某年总天数
}
for
(
int
i
=
1
;
i
<
lunMonth
;
i
++)
{
days
+=
monthDays
(
lunYear
,
i
);
}
if
(
leapMonth
(
lunYear
)
!=
0
&&
lunMonth
>
leapMonth
(
lunYear
))
{
days
+=
leapDays
(
lunYear
);
//lunYear年闰月天数
}
if
(
isLeap
)
{
days
+=
monthDays
(
lunYear
,
lunMonth
);
//lunYear年lunMonth月 闰月
}
days
+=
lunDay
;
days
=
days
-
1
;
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
Calendar
.
YEAR
,
1900
);
cal
.
set
(
Calendar
.
MONTH
,
0
);
cal
.
set
(
Calendar
.
DAY_OF_MONTH
,
31
);
cal
.
add
(
Calendar
.
DATE
,
days
);
/*
Date date=cal.getTime();
int year_c = cal.get(Calendar.YEAR);
int month_c = cal.get(Calendar.MONTH)+1;
int day_c = cal.get(Calendar.DAY_OF_MONTH);
*/
return
cal
;
}
public
String
getLunarString
(
int
year
,
int
month
,
int
day
)
{
int
var
=
getLunarDateINT
(
year
,
month
,
day
);
int
lYear
=
(
int
)
var
/
10000
;
int
lMonth
=
(
int
)
(
var
%
10000
)
/
100
;
int
lDay
=
var
-
lYear
*
10000
-
lMonth
*
100
;
String
lunY
=
cyclical
(
year
,
month
,
day
)
+
"年"
;
String
lunM
=
""
;
int
testMonth
=
getSunDate
(
lYear
,
lMonth
,
lDay
,
false
).
get
(
Calendar
.
MONTH
)
+
1
;
if
(
testMonth
!=
month
)
{
lunM
=
"闰"
;
}
lunM
+=
chineseNumber
[(
lMonth
-
1
)
%
12
]
+
"月"
;
//int leap = leapMonth(lYear);
String
lunD
=
getChinaDayString
(
lDay
);
int
animalsYear
=
0
;
int
term2
=
sTerm
(
year
,
2
);
//立春
if
(
month
>
2
||
(
month
==
2
&&
day
>=
term2
))
{
animalsYear
=
year
;
}
else
{
animalsYear
=
year
-
1
;
}
return
lunY
+
lunM
+
lunD
;
}
/*
* 将公历year年month月day日转换成农历
* 返回格式为20140506(int)
* */
public
int
getLunarDateINT
(
int
year
,
int
month
,
int
day
)
{
int
iYear
,
LYear
,
LMonth
,
LDay
,
daysOfYear
=
0
;
// 求出和1900年1月31日相差的天数
//year =1908;
//month = 3;
//day =3;
int
offset
=
getDaysOfTwoDate
(
1900
,
1
,
31
,
year
,
month
,
day
);
//Log.i("--ss--","公历:"+year+"-"+month+"-"+day+":"+offset);
// 用offset减去每农历年的天数
// 计算当天是农历第几天
// i最终结果是农历的年份
// offset是当年的第几天
for
(
iYear
=
1900
;
iYear
<
2100
&&
offset
>
0
;
iYear
++)
{
daysOfYear
=
yearDays
(
iYear
);
offset
-=
daysOfYear
;
//Log.i("--ss--","农历:"+iYear+":"+daysOfYear+"/"+offset);
}
if
(
offset
<
0
)
{
offset
+=
daysOfYear
;
iYear
--;
//Log.i("--ss--","农历:"+iYear+":"+daysOfYear+"/"+offset);
}
// 农历年份
LYear
=
iYear
;
leapMonth
=
leapMonth
(
iYear
);
// 闰哪个月,1-12
leap
=
false
;
// 用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天
int
iMonth
=
1
,
daysOfMonth
=
0
;
for
(
iMonth
=
1
;
iMonth
<
13
&&
offset
>
0
;
iMonth
++)
{
// 闰月
if
(
leapMonth
>
0
&&
iMonth
==
(
leapMonth
+
1
)
&&
!
leap
)
{
--
iMonth
;
leap
=
true
;
daysOfMonth
=
leapDays
(
iYear
);
}
else
{
daysOfMonth
=
monthDays
(
iYear
,
iMonth
);
}
// 解除闰月
if
(
leap
&&
iMonth
==
(
leapMonth
+
1
))
{
leap
=
false
;
}
offset
-=
daysOfMonth
;
//Log.i("--ss--","农历:"+iYear+"-"+iMonth+":"+daysOfMonth+"/"+offset);
}
// offset为0时,并且刚才计算的月份是闰月,要校正
if
(
offset
==
0
&&
leapMonth
>
0
&&
iMonth
==
leapMonth
+
1
)
{
if
(
leap
)
{
leap
=
false
;
}
else
{
leap
=
true
;
--
iMonth
;
}
}
// offset小于0时,也要校正
if
(
offset
<
0
)
{
offset
+=
daysOfMonth
;
--
iMonth
;
//Log.i("--ss--","农历:"+iYear+"-"+iMonth+":"+daysOfMonth+"/"+offset);
}
LMonth
=
iMonth
;
LDay
=
offset
+
1
;
//Log.i("--ss--","农历:"+LYear+"-"+LMonth+"-"+LDay);
return
LYear
*
10000
+
LMonth
*
100
+
LDay
;
}
public
String
toString
()
{
if
(
chineseNumber
[(
month
-
1
)
%
12
]
==
"正"
&&
getChinaDayString
(
day
)
==
"初一"
)
{
return
"农历"
+
year
+
"年"
;
}
else
if
(
getChinaDayString
(
day
)
==
"初一"
)
{
return
chineseNumber
[(
month
-
1
)
%
12
]
+
"月"
;
}
else
{
return
getChinaDayString
(
day
);
}
// return year + "年" + (leap ? "闰" : "") + chineseNumber[month - 1] +
// "月" + getChinaDayString(day);
}
/*
* public static void main(String[] args) { System.out.println(new
* LunarCalendar().getLunarDate(2012, 1, 23)); }
*/
public
int
getLeapMonth
()
{
return
leapMonth
;
}
public
void
setLeapMonth
(
int
leapMonth
)
{
this
.
leapMonth
=
leapMonth
;
}
/**
* 得到当前日期对应的阴历月份
*
* @return
*/
public
String
getLunarMonth
()
{
return
lunarMonth
;
}
public
void
setLunarMonth
(
String
lunarMonth
)
{
this
.
lunarMonth
=
lunarMonth
;
}
/**
* 得到当前年对应的农历年份
*
* @return
*/
public
int
getYear
()
{
return
year
;
}
public
void
setYear
(
int
year
)
{
this
.
year
=
year
;
}
private
int
sTerm
(
int
y
,
int
n
)
{
int
[]
sTermInfo
=
new
int
[]{
0
,
21208
,
42467
,
63836
,
85337
,
107014
,
128867
,
150921
,
173149
,
195551
,
218072
,
240693
,
263343
,
285989
,
308563
,
331033
,
353350
,
375494
,
397447
,
419210
,
440795
,
462224
,
483532
,
504758
};
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
1900
,
0
,
6
,
2
,
5
,
0
);
long
temp
=
cal
.
getTime
().
getTime
();
cal
.
setTime
(
new
Date
((
long
)
((
31556925974.7
*
(
y
-
1900
)
+
sTermInfo
[
n
]
*
60000L
)
+
temp
)));
int
a
=
cal
.
get
(
Calendar
.
DAY_OF_MONTH
);
return
a
;
}
public
static
String
convertToLunarTianGan
(
int
year
)
{
String
[]
tianGan
=
{
"甲"
,
"乙"
,
"丙"
,
"丁"
,
"戊"
,
"己"
,
"庚"
,
"辛"
,
"壬"
,
"癸"
};
int
index
=
(
year
-
4
)
%
10
;
return
tianGan
[
index
];
}
public
static
String
convertToLunarDiZhi
(
int
year
)
{
String
[]
diZhi
=
{
"子"
,
"丑"
,
"寅"
,
"卯"
,
"辰"
,
"巳"
,
"午"
,
"未"
,
"申"
,
"酉"
,
"戌"
,
"亥"
};
int
index
=
(
year
-
4
)
%
12
;
return
diZhi
[
index
];
}
public
static
String
convertToChineseMonth
(
int
month
)
{
String
[]
chineseMonths
=
{
"正月"
,
"二月"
,
"三月"
,
"四月"
,
"五月"
,
"六月"
,
"七月"
,
"八月"
,
"九月"
,
"十月"
,
"冬月"
,
"腊月"
};
return
chineseMonths
[
month
-
1
];
}
}
\ No newline at end of file
...
...
lib_base/src/main/java/com/wd/common/utils/ProcessUtils.java
View file @
18ffa10
...
...
@@ -1290,7 +1290,7 @@ public class ProcessUtils implements IntentConstants {
}
else
if
(
CHANNEL_ID_VOICE
.
equals
(
channelId
))
{
jump
=
true
;
// 音频频道
//
goTestAudio(tabBean.getPageId(), channelId);
goTestAudio
(
tabBean
.
getPageId
(),
channelId
);
}
return
jump
;
...
...
module_musicplayer/src/main/java/com/wd/musicplayer/ui/activity/AudioChannelActivity.java
View file @
18ffa10
...
...
@@ -10,10 +10,12 @@ import android.widget.FrameLayout;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.annotation.Nullable
;
import
androidx.core.widget.NestedScrollView
;
import
androidx.lifecycle.Observer
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wd.base.log.Logger
;
...
...
@@ -22,22 +24,16 @@ import com.wd.basemusic.utils.BarUtils;
import
com.wd.capability.network.BaseObserver
;
import
com.wd.capability.network.bean.MetaBean
;
import
com.wd.capability.network.cachedata.CacheData
;
import
com.wd.foundation.wdkit.adv.CornerAdvLogic
;
import
com.wd.foundation.wdkit.constant.EventConstants
;
import
com.wd.capability.router.data.ActionBean
;
import
com.wd.common.base.BaseActivity
;
import
com.wd.common.constant.RegionNameConstants
;
import
com.wd.common.constant.RouterConstants
;
import
com.wd.foundation.wdkit.dialog.EasterEggsDialog
;
import
com.wd.foundation.wdkit.dialog.PopUpsUtils
;
import
com.wd.common.floatingview.FloatWindow
;
import
com.wd.common.interfaces.AudioChannelBack
;
import
com.wd.common.utils.CalendarUtil
;
import
com.wd.common.utils.CommonNetUtils
;
import
com.wd.common.utils.LunarCalender
;
import
com.wd.common.utils.ProcessUtils
;
import
com.wd.common.utils.ToolsUtil
;
import
com.wd.foundation.wdkit.utils.StatusBarUtil
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
import
com.wd.foundation.wdkit.view.DefaultView
;
import
com.wd.foundation.bean.analytics.ActionConstants
;
import
com.wd.foundation.bean.analytics.TraceBean
;
import
com.wd.foundation.bean.analytics.TrackContentBean
;
...
...
@@ -51,27 +47,35 @@ import com.wd.foundation.bean.music.bean.VoicePlayerBean;
import
com.wd.foundation.bean.pop.PopUpsBean
;
import
com.wd.foundation.bean.response.AudioPlaybackQuantityBean
;
import
com.wd.foundation.bean.response.NewsDetailBean
;
import
com.wd.musicplayer.R
;
import
com.wd.musicplayer.data.bean.MusicAlbum
;
import
com.wd.musicplayer.player.PlayerManager
;
import
com.wd.musicplayer.ui.dialog.PlayListDialog
;
import
com.wd.musicplayer.ui.page.adapter.PlaylistRecommendationAdapter
;
import
com.wd.musicplayer.ui.page.adapter.SelectedColumnsAdapter
;
import
com.wd.foundation.bean.utils.TimeUtil
;
import
com.wd.foundation.wdkit.adv.CornerAdvLogic
;
import
com.wd.foundation.wdkit.constant.Constants
;
import
com.wd.foundation.wdkit.constant.DefaultViewConstant
;
import
com.wd.foundation.wdkit.constant.EventConstants
;
import
com.wd.foundation.wdkit.constant.IntentConstants
;
import
com.wd.foundation.wdkit.dialog.EasterEggsDialog
;
import
com.wd.foundation.wdkit.dialog.PopUpsUtils
;
import
com.wd.foundation.wdkit.json.GsonUtils
;
import
com.wd.foundation.wdkit.statusbar.StatusBarStyleEnum
;
import
com.wd.foundation.wdkit.utils.CommonUtil
;
import
com.wd.foundation.wdkit.utils.ScreenUtils
;
import
com.wd.foundation.wdkit.utils.SpUtils
;
import
com.wd.foundation.wdkit.utils.StatusBarUtil
;
import
com.wd.foundation.wdkit.utils.ToastNightUtil
;
import
com.wd.foundation.wdkit.view.DefaultView
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
import
com.wd.foundation.wdkitcore.livedata.LiveDataBus
;
import
com.wd.foundation.wdkitcore.tools.HostUtil
;
import
com.wd.foundation.wdkitcore.tools.JsonUtils
;
import
com.wd.foundation.wdkitcore.tools.ResUtils
;
import
com.wd.foundation.wdkitcore.tools.StringUtils
;
import
com.wd.musicplayer.R
;
import
com.wd.musicplayer.data.bean.MusicAlbum
;
import
com.wd.musicplayer.player.PlayerManager
;
import
com.wd.musicplayer.ui.dialog.PlayListDialog
;
import
com.wd.musicplayer.ui.page.adapter.PlaylistRecommendationAdapter
;
import
com.wd.musicplayer.ui.page.adapter.SelectedColumnsAdapter
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -139,13 +143,13 @@ public class AudioChannelActivity extends BaseActivity {
private
View
vline
;
/**
* 骨架图
*
*
/
*/
private
FrameLayout
skeletondiagram
;
private
NestedScrollView
nsv
;
private
TextView
jrtjtitle
,
showmore
,
chinesecalendar
,
calendar1
,
jxtitle
,
calendar
,
tvtopname
;
private
ImageView
iv_bg
,
playModeIcon
,
iv_closeinner
,
iv_close
;
private
RecyclerView
layout_fra_sound_seminar
,
layout_selected_columns
;
private
RelativeLayout
rltopinner
,
rltop
;
private
TextView
jrtjtitle
,
showmore
,
chinesecalendar
,
calendar1
,
jxtitle
,
calendar
,
tvtopname
;
private
ImageView
iv_bg
,
playModeIcon
,
iv_closeinner
,
iv_close
;
private
RecyclerView
layout_fra_sound_seminar
,
layout_selected_columns
;
private
RelativeLayout
rltopinner
,
rltop
;
private
int
mDistance
=
0
;
private
float
alpha
;
...
...
@@ -165,11 +169,11 @@ public class AudioChannelActivity extends BaseActivity {
@Override
protected
void
onNoDoubleClick
(
View
v
)
{
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
iv_closeinner
||
id
==
R
.
id
.
iv_close
)
{
if
(
id
==
R
.
id
.
iv_closeinner
||
id
==
R
.
id
.
iv_close
)
{
close
();
}
else
if
(
id
==
R
.
id
.
iv_play_buttone
)
{
}
else
if
(
id
==
R
.
id
.
iv_play_buttone
)
{
togglePlay
();
}
else
if
(
id
==
R
.
id
.
tv_special_column_more
)
{
}
else
if
(
id
==
R
.
id
.
tv_special_column_more
)
{
more
();
}
}
...
...
@@ -189,7 +193,7 @@ public class AudioChannelActivity extends BaseActivity {
nsv
=
findViewById
(
R
.
id
.
nsv
);
iv_bg
=
findViewById
(
R
.
id
.
iv_bg
);
RelativeLayout
.
LayoutParams
params
=
(
RelativeLayout
.
LayoutParams
)
iv_bg
.
getLayoutParams
();
params
.
height
=
ScreenUtils
.
getRealWidth
()
*
440
/
375
;
params
.
height
=
ScreenUtils
.
getRealWidth
()
*
440
/
375
;
iv_bg
.
setLayoutParams
(
params
);
playModeIcon
=
findViewById
(
R
.
id
.
iv_play_buttone
);
jrtjtitle
=
findViewById
(
R
.
id
.
tv_tltle
);
...
...
@@ -217,34 +221,34 @@ public class AudioChannelActivity extends BaseActivity {
// 夜间模式下,顶部图片的前景色
RelativeLayout
.
LayoutParams
nightBgParams
=
(
RelativeLayout
.
LayoutParams
)
iv_night_bg
.
getLayoutParams
();
nightBgParams
.
height
=
ScreenUtils
.
getRealWidth
()*
440
/
375
;
iv_night_bg
.
setVisibility
(
SpUtils
.
isNightMode
()?
View
.
VISIBLE
:
View
.
GONE
);
nightBgParams
.
height
=
ScreenUtils
.
getRealWidth
()
*
440
/
375
;
iv_night_bg
.
setVisibility
(
SpUtils
.
isNightMode
()
?
View
.
VISIBLE
:
View
.
GONE
);
//今日推荐列表
playlistRecommendationAdapter
=
new
PlaylistRecommendationAdapter
(
this
);
playlistRecommendationAdapter
=
new
PlaylistRecommendationAdapter
(
R
.
layout
.
adapter_play_recommendation
);
playlistRecommendationAdapter
.
setOnItemClickListener
((
viewId
,
item
,
position
)
->
{
VoicePlayerBean
voicePlayerBean
=
mMusicAlbum
.
getMusics
().
get
(
position
);
if
(
voicePlayerBean
.
getAudioDetailBean
()
==
null
||
CommonUtil
.
isEmpty
(
voicePlayerBean
.
getAudioDetailBean
().
getAudioList
())
||
TextUtils
.
isEmpty
(
voicePlayerBean
.
getAudioDetailBean
().
getNewsType
())
||
TextUtils
.
isEmpty
(
voicePlayerBean
.
getAudioDetailBean
().
getNewsId
())){
ToastNightUtil
.
showTopShort
(
"无音频数据"
,
ScreenUtils
.
getRealHeight
()/
2
);
||
TextUtils
.
isEmpty
(
voicePlayerBean
.
getAudioDetailBean
().
getNewsType
())
||
TextUtils
.
isEmpty
(
voicePlayerBean
.
getAudioDetailBean
().
getNewsId
()))
{
ToastNightUtil
.
showTopShort
(
"无音频数据"
,
ScreenUtils
.
getRealHeight
()
/
2
);
return
;
}
//更新播放器内容
if
(
PlayerManager
.
getInstance
().
getAlbum
()
==
null
||
TextUtils
.
isEmpty
(
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
())
||
if
(
PlayerManager
.
getInstance
().
getAlbum
()
==
null
||
TextUtils
.
isEmpty
(
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
())
||
!
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
().
equals
(
mMusicAlbum
.
getAlbumId
()))
{
//如果是同一个,则继续播放
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
isSameObject
(
voicePlayerBean
))
{
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
isSameObject
(
voicePlayerBean
))
{
PlayerManager
.
getInstance
().
playAudio
();
}
else
{
}
else
{
PlayerManager
.
getInstance
().
singleListChange
();
//加载数据
PlayerManager
.
getInstance
().
loadAlbum
(
mMusicAlbum
,
position
);
}
}
else
{
}
else
{
//如果是同一个,则继续播放
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
isSameObject
(
voicePlayerBean
))
{
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
isSameObject
(
voicePlayerBean
))
{
PlayerManager
.
getInstance
().
playAudio
();
}
else
{
}
else
{
PlayerManager
.
getInstance
().
singleListChange
();
PlayerManager
.
getInstance
().
playAudio
(
position
);
}
...
...
@@ -264,14 +268,14 @@ public class AudioChannelActivity extends BaseActivity {
nsv
.
setOnScrollChangeListener
(
new
NestedScrollView
.
OnScrollChangeListener
()
{
@Override
public
void
onScrollChange
(
NestedScrollView
v
,
int
scrollX
,
int
scrollY
,
int
oldScrollX
,
int
oldScrollY
)
{
mDistance
+=
(
scrollY
-
oldScrollY
);
float
percent
=
Math
.
abs
(
mDistance
*
1
f
/
200
);
if
(
percent
>
1
){
percent
=
1
;
}
setAlpha
(
percent
*
255
);
mDistance
+=
(
scrollY
-
oldScrollY
);
float
percent
=
Math
.
abs
(
mDistance
*
1
f
/
200
);
if
(
percent
>
1
)
{
percent
=
1
;
}
});
setAlpha
(
percent
*
255
);
}
});
// 缺省页重试按钮
defaultView
.
setRetryBtnClickListener
(
new
DefaultView
.
RetryClickListener
()
{
...
...
@@ -290,7 +294,7 @@ public class AudioChannelActivity extends BaseActivity {
}
private
void
setAlpha
(
float
alpha
)
{
if
(
alpha
==
this
.
alpha
){
if
(
alpha
==
this
.
alpha
)
{
return
;
}
this
.
alpha
=
alpha
;
...
...
@@ -306,11 +310,12 @@ public class AudioChannelActivity extends BaseActivity {
super
.
onResume
();
updateTodaysRecommendation
();
StatusBarUtil
.
setStatusBarStyle
(
SpUtils
.
isNightMode
()?
StatusBarStyleEnum
.
FULLSCREEN_LIGHT_ENUM
:
StatusBarStyleEnum
.
FULLSCREEN_DARK_ENUM
,
this
);
StatusBarUtil
.
setStatusBarStyle
(
SpUtils
.
isNightMode
()
?
StatusBarStyleEnum
.
FULLSCREEN_LIGHT_ENUM
:
StatusBarStyleEnum
.
FULLSCREEN_DARK_ENUM
,
this
);
VoicePlayerBean
currentMusic
=
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
();
boolean
hasMusic
=
false
;
if
(
currentMusic
!=
null
&&
!
TextUtils
.
isEmpty
(
currentMusic
.
getUrl
())
&&
voicePlayerBeansTodaysRecommendation
!=
null
&&
voicePlayerBeansTodaysRecommendation
.
size
()>
0
){
if
(
currentMusic
!=
null
&&
!
TextUtils
.
isEmpty
(
currentMusic
.
getUrl
())
&&
voicePlayerBeansTodaysRecommendation
!=
null
&&
voicePlayerBeansTodaysRecommendation
.
size
()
>
0
)
{
//设置必须的audioList
for
(
VoicePlayerBean
voicePlayerBean
:
voicePlayerBeansTodaysRecommendation
)
{
if
(
currentMusic
.
isSameObject
(
voicePlayerBean
))
{
...
...
@@ -320,14 +325,14 @@ public class AudioChannelActivity extends BaseActivity {
}
}
if
(
hasMusic
&&
PlayerManager
.
getInstance
().
isPlaying
())
{
if
(
hasMusic
&&
PlayerManager
.
getInstance
().
isPlaying
())
{
//设置顶部播放按钮为已播放样式
// playModeIcon.setImageResource(R.mipmap.icon_pause_button);
// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_pause_button);
playModeIcon
.
setImageResource
(
R
.
mipmap
.
icon_pause_button
);
playModeIcon
.
setTag
(
R
.
id
.
res_clicktag
,
R
.
mipmap
.
icon_pause_button
);
}
else
{
//设置顶部播放按钮为已暂停样式
// playModeIcon.setImageResource(R.mipmap.icon_player_button);
// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_player_button);
playModeIcon
.
setImageResource
(
R
.
mipmap
.
icon_player_button
);
playModeIcon
.
setTag
(
R
.
id
.
res_clicktag
,
R
.
mipmap
.
icon_player_button
);
}
}
...
...
@@ -338,11 +343,11 @@ public class AudioChannelActivity extends BaseActivity {
if
(
voicePlayerBeansTodaysRecommendation
!=
null
&&
voicePlayerBeansTodaysRecommendation
.
size
()
>
0
)
{
// VoicePlayerBean currentVoicePlayerBean = PlayerManager.getInstance().getCurrentPlayingMusic();
// if (currentVoicePlayerBean != null && currentVoicePlayerBean.getUrl() != null) {
playlistRecommendationAdapter
.
notifyDataSetChanged
();
//推荐列表弹窗如果展示了,也更新推荐列表弹窗
if
(
playListDialog
!=
null
&&
playListDialog
.
isShowing
())
{
playListDialog
.
attachData
();
}
playlistRecommendationAdapter
.
notifyDataSetChanged
();
//推荐列表弹窗如果展示了,也更新推荐列表弹窗
if
(
playListDialog
!=
null
&&
playListDialog
.
isShowing
())
{
playListDialog
.
attachData
();
}
// }
}
}
...
...
@@ -356,15 +361,15 @@ public class AudioChannelActivity extends BaseActivity {
PlayerManager
.
getInstance
().
getDispatcher
().
output
(
this
,
playerEvent
->
{
if
(
playerEvent
.
eventId
==
PlayerEvent
.
EVENT_CHANGE_MUSIC
)
{
playlistRecommendationAdapter
.
setTopause
(
playerEvent
.
toPause
);
if
(
playListDialog
!=
null
)
{
if
(
playListDialog
!=
null
)
{
playListDialog
.
setTopause
(
playerEvent
.
toPause
);
}
updateTodaysRecommendation
();
}
else
if
(
playerEvent
.
eventId
==
PlayerEvent
.
EVENT_PLAY_STATUS
)
{
// playModeIcon.setImageResource(playerEvent.toPause ? R.mipmap.icon_player_button : R.mipmap.icon_pause_button);
// playModeIcon.setTag(R.id.res_clicktag,playerEvent.toPause ? R.mipmap.icon_player_button : R.mipmap.icon_pause_button);
playModeIcon
.
setImageResource
(
playerEvent
.
toPause
?
R
.
mipmap
.
icon_player_button
:
R
.
mipmap
.
icon_pause_button
);
playModeIcon
.
setTag
(
R
.
id
.
res_clicktag
,
playerEvent
.
toPause
?
R
.
mipmap
.
icon_player_button
:
R
.
mipmap
.
icon_pause_button
);
playlistRecommendationAdapter
.
setTopause
(
playerEvent
.
toPause
);
if
(
playListDialog
!=
null
)
{
if
(
playListDialog
!=
null
)
{
playListDialog
.
setTopause
(
playerEvent
.
toPause
);
}
updateTodaysRecommendation
();
...
...
@@ -378,9 +383,9 @@ public class AudioChannelActivity extends BaseActivity {
String
date
=
dateFormat
.
format
(
new
Date
());
int
[]
dateList
;
try
{
// dateList = CalendarUtil.solarToLunar(date);
// chinesecalendar.setText(LunarCalender.convertToChineseMonth(dateList[1]) +
// LunarCalender.getChinaDayString(dateList[2]));
dateList
=
CalendarUtil
.
solarToLunar
(
date
);
chinesecalendar
.
setText
(
LunarCalender
.
convertToChineseMonth
(
dateList
[
1
])
+
LunarCalender
.
getChinaDayString
(
dateList
[
2
]));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -391,17 +396,17 @@ public class AudioChannelActivity extends BaseActivity {
//时间转换后:yyyy-MM-dd-HHmmssSSS
String
serverTime
=
""
;
if
(
HostUtil
.
serverTime
==
0
)
{
serverTime
=
TimeUtil
.
getDateTimeFromMillisecond
(
System
.
currentTimeMillis
());
}
else
{
if
(
HostUtil
.
serverTime
==
0
)
{
serverTime
=
TimeUtil
.
getDateTimeFromMillisecond
(
System
.
currentTimeMillis
());
}
else
{
try
{
serverTime
=
TimeUtil
.
getDateTimeFromMillisecond
(
HostUtil
.
serverTime
);
serverTime
=
TimeUtil
.
getDateTimeFromMillisecond
(
HostUtil
.
serverTime
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
String
[]
split
=
serverTime
.
split
(
"-"
);
if
(
split
!=
null
&&
split
.
length
>
1
)
{
if
(
split
!=
null
&&
split
.
length
>
1
)
{
calendar
.
setText
(
split
[
1
]);
calendar1
.
setText
(
split
[
2
]);
}
...
...
@@ -412,8 +417,8 @@ public class AudioChannelActivity extends BaseActivity {
public
void
onChanged
(
Boolean
aBoolean
)
{
forLiveDataBus
=
1
;
VoicePlayerBean
currentMusic
=
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
();
if
(
currentMusic
!=
null
&&
!
TextUtils
.
isEmpty
(
currentMusic
.
getUrl
())
&&
voicePlayerBeansTodaysRecommendation
!=
null
&&
voicePlayerBeansTodaysRecommendation
.
size
()>
0
){
if
(
currentMusic
!=
null
&&
!
TextUtils
.
isEmpty
(
currentMusic
.
getUrl
())
&&
voicePlayerBeansTodaysRecommendation
!=
null
&&
voicePlayerBeansTodaysRecommendation
.
size
()
>
0
)
{
//设置必须的audioList
for
(
VoicePlayerBean
voicePlayerBean
:
voicePlayerBeansTodaysRecommendation
)
{
if
(
currentMusic
.
isSameObject
(
voicePlayerBean
))
{
...
...
@@ -460,19 +465,19 @@ public class AudioChannelActivity extends BaseActivity {
channelId
=
jsonObject
.
getString
(
IntentConstants
.
PARAM_CHANNEL_ID
);
//设置缓存数据
CacheData
localCacheDataPage
=
CacheData
.
getLocalCacheData
(
CacheData
.
audioChannelCacheKey
);
if
(
localCacheDataPage
!=
null
&&
!
TextUtils
.
isEmpty
(
localCacheDataPage
.
getNetWorkData
()))
{
if
(
localCacheDataPage
!=
null
&&
!
TextUtils
.
isEmpty
(
localCacheDataPage
.
getNetWorkData
()))
{
dealPageInfo
(
GsonUtils
.
fromJson
(
localCacheDataPage
.
getNetWorkData
(),
PageBean
.
class
));
hasUseCache
=
true
;
}
else
{
}
else
{
skeletondiagram
.
setVisibility
(
View
.
VISIBLE
);
}
CacheData
localCacheTodaysRecommendation
=
CacheData
.
getLocalCacheData
(
CacheData
.
audioChannelCacheKey
+
0
);
if
(
localCacheTodaysRecommendation
!=
null
&&
!
TextUtils
.
isEmpty
(
localCacheTodaysRecommendation
.
getNetWorkData
())){
CacheData
localCacheTodaysRecommendation
=
CacheData
.
getLocalCacheData
(
CacheData
.
audioChannelCacheKey
+
0
);
if
(
localCacheTodaysRecommendation
!=
null
&&
!
TextUtils
.
isEmpty
(
localCacheTodaysRecommendation
.
getNetWorkData
()))
{
dealTodaysRecommendation
(
GsonUtils
.
fromJson
(
localCacheTodaysRecommendation
.
getNetWorkData
(),
GroupBean
.
class
));
hasUseCache
=
true
;
}
CacheData
localCacheSelectedColumns
=
CacheData
.
getLocalCacheData
(
CacheData
.
audioChannelCacheKey
+
1
);
if
(
localCacheSelectedColumns
!=
null
&&
!
TextUtils
.
isEmpty
(
localCacheSelectedColumns
.
getNetWorkData
())){
CacheData
localCacheSelectedColumns
=
CacheData
.
getLocalCacheData
(
CacheData
.
audioChannelCacheKey
+
1
);
if
(
localCacheSelectedColumns
!=
null
&&
!
TextUtils
.
isEmpty
(
localCacheSelectedColumns
.
getNetWorkData
()))
{
dealSelectedColumns
(
GsonUtils
.
fromJson
(
localCacheSelectedColumns
.
getNetWorkData
(),
GroupBean
.
class
));
hasUseCache
=
true
;
}
...
...
@@ -481,12 +486,12 @@ public class AudioChannelActivity extends BaseActivity {
CommonNetUtils
.
getInstance
().
loadAudioChannelData
(
channelId
,
pageId
,
new
AudioChannelBack
()
{
@Override
public
void
loadAudioChannelSuccess
(
PageBean
pageBean
,
MetaBean
metaBean
,
String
msg
,
int
code
)
{
if
(
null
==
pageBean
){
if
(
null
==
pageBean
)
{
return
;
}
skeletondiagram
.
setVisibility
(
View
.
GONE
);
// 新旧数据md5值对比,本地无md5说明没有缓存数据
if
(
localCacheDataPage
==
null
||
localCacheDataPage
.
md5
==
null
||
!
localCacheDataPage
.
md5
.
equals
(
metaBean
.
getMd5
()))
{
if
(
localCacheDataPage
==
null
||
localCacheDataPage
.
md5
==
null
||
!
localCacheDataPage
.
md5
.
equals
(
metaBean
.
getMd5
()))
{
// 更新缓存数据
CacheData
.
saveDataToPreference
(
CacheData
.
audioChannelCacheKey
,
pageBean
,
metaBean
.
getMd5
());
dealPageInfo
(
pageBean
);
...
...
@@ -495,13 +500,13 @@ public class AudioChannelActivity extends BaseActivity {
@Override
public
void
loadTodaysRecommendationSuccess
(
GroupBean
groupBean
,
MetaBean
metaBean
,
String
msg
,
int
code
)
{
if
(
null
==
groupBean
){
if
(
null
==
groupBean
)
{
return
;
}
// 新旧数据md5值对比
if
(
localCacheTodaysRecommendation
==
null
||
localCacheTodaysRecommendation
.
md5
==
null
||
!
localCacheTodaysRecommendation
.
md5
.
equals
(
metaBean
.
getMd5
()))
{
if
(
localCacheTodaysRecommendation
==
null
||
localCacheTodaysRecommendation
.
md5
==
null
||
!
localCacheTodaysRecommendation
.
md5
.
equals
(
metaBean
.
getMd5
()))
{
// 更新缓存数据
CacheData
.
saveDataToPreference
(
CacheData
.
audioChannelCacheKey
+
0
,
groupBean
,
metaBean
.
getMd5
());
CacheData
.
saveDataToPreference
(
CacheData
.
audioChannelCacheKey
+
0
,
groupBean
,
metaBean
.
getMd5
());
//今日推荐
dealTodaysRecommendation
(
groupBean
);
}
...
...
@@ -510,35 +515,35 @@ public class AudioChannelActivity extends BaseActivity {
@Override
public
void
loadSelectedColumnsSuccess
(
GroupBean
groupBean
,
MetaBean
metaBean
,
String
msg
,
int
code
)
{
if
(
null
==
groupBean
){
if
(
null
==
groupBean
)
{
return
;
}
// 新旧数据md5值对比
if
(
localCacheSelectedColumns
==
null
||
localCacheSelectedColumns
.
md5
==
null
||
!
localCacheSelectedColumns
.
md5
.
equals
(
metaBean
.
getMd5
()))
{
if
(
localCacheSelectedColumns
==
null
||
localCacheSelectedColumns
.
md5
==
null
||
!
localCacheSelectedColumns
.
md5
.
equals
(
metaBean
.
getMd5
()))
{
// 更新缓存数据
CacheData
.
saveDataToPreference
(
CacheData
.
audioChannelCacheKey
+
1
,
groupBean
,
metaBean
.
getMd5
());
CacheData
.
saveDataToPreference
(
CacheData
.
audioChannelCacheKey
+
1
,
groupBean
,
metaBean
.
getMd5
());
dealSelectedColumns
(
groupBean
);
}
}
@Override
public
void
loadFail
()
{
if
(
finalHasUseCache
){
if
(
finalHasUseCache
)
{
return
;
}
skeletondiagram
.
setVisibility
(
View
.
GONE
);
// 展示缺省页
defaultView
.
show
(
DefaultViewConstant
.
TYPE_GET_CONTENT_FAILED_VIDEO
,
true
,
false
);
defaultView
.
show
(
DefaultViewConstant
.
TYPE_GET_CONTENT_FAILED_VIDEO
,
true
,
false
);
defaultView
.
setBackground
(
ResUtils
.
getDrawable
(
R
.
color
.
white
));
}
@Override
public
void
noNetwork
()
{
if
(
finalHasUseCache
){
if
(
finalHasUseCache
)
{
return
;
}
// 展示缺省页
defaultView
.
show
(
DefaultViewConstant
.
TYPE_NO_NETWORK
,
true
,
false
);
defaultView
.
show
(
DefaultViewConstant
.
TYPE_NO_NETWORK
,
true
,
false
);
defaultView
.
setBackground
(
ResUtils
.
getDrawable
(
R
.
color
.
white
));
}
});
...
...
@@ -564,7 +569,7 @@ public class AudioChannelActivity extends BaseActivity {
}
//添加挂角
advLogic
(
pageBean
,
false
);
advLogic
(
pageBean
,
false
);
//添加彩蛋
handlerPopUps
(
pageBean
);
...
...
@@ -581,7 +586,7 @@ public class AudioChannelActivity extends BaseActivity {
simpleAudioThemeBean
.
contentBean
=
mSelectedColumnsGroupBean
.
getComps
().
get
(
i
).
getOperDataList
().
get
(
0
);
simpleAudioThemeBeanList
.
add
(
simpleAudioThemeBean
);
}
ProcessUtils
.
JumpToAudioTopic
(
simpleAudioThemeBeanList
,
selectPosition
);
ProcessUtils
.
JumpToAudioTopic
(
simpleAudioThemeBeanList
,
selectPosition
);
}
/**
...
...
@@ -611,11 +616,11 @@ public class AudioChannelActivity extends BaseActivity {
@Override
protected
void
onSuccess
(
List
<
AudioPlaybackQuantityBean
>
audioPlaybackQuantityBeans
)
{
if
(
audioPlaybackQuantityBeans
!=
null
&&
audioPlaybackQuantityBeans
.
size
()
>
0
){
for
(
AudioPlaybackQuantityBean
audioPlaybackQuantityBean:
audioPlaybackQuantityBeans
){
if
(
audioPlaybackQuantityBean
!=
null
&&
!
TextUtils
.
isEmpty
(
audioPlaybackQuantityBean
.
getTopicId
())){
for
(
int
i
=
0
;
i
<
groupBean
.
getComps
().
size
();
i
++){
if
(
audioPlaybackQuantityBean
.
getTopicId
().
equals
(
groupBean
.
getComps
().
get
(
i
).
getOperDataList
().
get
(
0
).
getObjectId
())){
if
(
audioPlaybackQuantityBeans
!=
null
&&
audioPlaybackQuantityBeans
.
size
()
>
0
)
{
for
(
AudioPlaybackQuantityBean
audioPlaybackQuantityBean
:
audioPlaybackQuantityBeans
)
{
if
(
audioPlaybackQuantityBean
!=
null
&&
!
TextUtils
.
isEmpty
(
audioPlaybackQuantityBean
.
getTopicId
()))
{
for
(
int
i
=
0
;
i
<
groupBean
.
getComps
().
size
();
i
++)
{
if
(
audioPlaybackQuantityBean
.
getTopicId
().
equals
(
groupBean
.
getComps
().
get
(
i
).
getOperDataList
().
get
(
0
).
getObjectId
()))
{
groupBean
.
getComps
().
get
(
i
).
getOperDataList
().
get
(
0
).
localFieldCommon
=
audioPlaybackQuantityBean
.
getWeightViews
();
}
}
...
...
@@ -626,7 +631,7 @@ public class AudioChannelActivity extends BaseActivity {
}
}
});
if
(
mPageBean
!=
null
)
{
if
(
mPageBean
!=
null
)
{
playlistSelectedTopicsAdapter
.
setPageId
(
mPageBean
.
getId
());
playlistSelectedTopicsAdapter
.
setPageName
(
mPageBean
.
getName
());
}
...
...
@@ -635,11 +640,11 @@ public class AudioChannelActivity extends BaseActivity {
}
}
private
void
contentExposureBuriedPoints
(
ContentBean
contentBean
)
{
private
void
contentExposureBuriedPoints
(
ContentBean
contentBean
)
{
// 内容曝光
TrackContentBean
trackContentBean
=
new
TrackContentBean
();
trackContentBean
.
contentBeantoBean
(
contentBean
,
null
);
if
(
mPageBean
!=
null
){
trackContentBean
.
contentBeantoBean
(
contentBean
,
null
);
if
(
mPageBean
!=
null
)
{
trackContentBean
.
setPage_name
(
mPageBean
.
getName
());
trackContentBean
.
setPage_id
(
mPageBean
.
getId
());
}
...
...
@@ -649,9 +654,9 @@ public class AudioChannelActivity extends BaseActivity {
//所属区域regionName,播报为5
trackContentBean
.
setRegion_name
(
RegionNameConstants
.
AUDIO
);
//埋点增频道id
trackContentBean
.
setChannelSourceId
(
StringUtils
.
isEmpty
(
channelId
)?
trackContentBean
.
setChannelSourceId
(
StringUtils
.
isEmpty
(
channelId
)
?
ProcessUtils
.
CHANNEL_ID_VOICE
:
channelId
);
trackContentBean
.
setContentShowChannelId
(
StringUtils
.
isEmpty
(
channelId
)?
trackContentBean
.
setContentShowChannelId
(
StringUtils
.
isEmpty
(
channelId
)
?
ProcessUtils
.
CHANNEL_ID_VOICE
:
channelId
);
//内容曝光
// CommonTrack.getInstance().contentShowTrack(trackContentBean);
...
...
@@ -672,8 +677,8 @@ public class AudioChannelActivity extends BaseActivity {
for
(
CompBean
compBean
:
groupBean
.
getComps
())
{
if
(
compBean
.
getOperDataList
()
!=
null
&&
compBean
.
getOperDataList
().
size
()
>
0
)
{
ContentBean
contentBean
=
compBean
.
getOperDataList
().
get
(
0
);
index
=
index
+
1
;
if
(
index
<
4
){
index
=
index
+
1
;
if
(
index
<
4
)
{
contentExposureBuriedPoints
(
contentBean
);
}
voicePlayerBeansTodaysRecommendation
.
add
(
contentBeanToVoicePlayerBean
(
contentBean
));
...
...
@@ -690,24 +695,24 @@ public class AudioChannelActivity extends BaseActivity {
//设置必须的audioList
for
(
VoicePlayerBean
voicePlayerBean
:
voicePlayerBeansTodaysRecommendation
)
{
if
(
voicePlayerBean
.
getAudioDetailBean
()
==
null
)
{
if
(
voicePlayerBean
.
getAudioDetailBean
()
==
null
)
{
voicePlayerBean
.
setAudioDetailBean
(
new
NewsDetailBean
());
}
voicePlayerBean
.
getAudioDetailBean
().
setAudioList
(
audioList
);
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
isSameObject
(
voicePlayerBean
))
{
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
isSameObject
(
voicePlayerBean
))
{
if
(
PlayerManager
.
getInstance
().
isPlaying
())
{
//设置顶部播放按钮为已播放样式
// playModeIcon.setImageResource(R.mipmap.icon_pause_button);
// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_pause_button);
playModeIcon
.
setImageResource
(
R
.
mipmap
.
icon_pause_button
);
playModeIcon
.
setTag
(
R
.
id
.
res_clicktag
,
R
.
mipmap
.
icon_pause_button
);
}
else
{
//设置顶部播放按钮为已暂停样式
// playModeIcon.setImageResource(R.mipmap.icon_player_button);
// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_player_button);
playModeIcon
.
setImageResource
(
R
.
mipmap
.
icon_player_button
);
playModeIcon
.
setTag
(
R
.
id
.
res_clicktag
,
R
.
mipmap
.
icon_player_button
);
}
}
}
//更新数据
playlistRecommendationAdapter
.
submitList
(
voicePlayerBeansTodaysRecommendationTree
);
playlistRecommendationAdapter
.
replaceData
(
voicePlayerBeansTodaysRecommendationTree
);
if
(
voicePlayerBeansTodaysRecommendation
.
size
()
>
3
)
{
showmore
.
setVisibility
(
View
.
VISIBLE
);
vline
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -716,85 +721,85 @@ public class AudioChannelActivity extends BaseActivity {
vline
.
setVisibility
(
View
.
GONE
);
}
//创建播放器相关数据
mMusicAlbum
=
new
MusicAlbum
(
groupBean
,
voicePlayerBeansTodaysRecommendation
,
4
);
mMusicAlbum
=
new
MusicAlbum
(
groupBean
,
voicePlayerBeansTodaysRecommendation
,
4
);
mMusicAlbum
.
setAlbumId
(
groupBean
.
getId
());
}
}
public
void
previous
()
{
PlayerManager
.
getInstance
().
playPrevious
();
}
public
void
previous
()
{
PlayerManager
.
getInstance
().
playPrevious
();
}
public
void
togglePlay
()
{
if
(
mMusicAlbum
==
null
){
// ToastNightUtil.showShort(ResUtils.getString(R.string.audio_no_content));
return
;
}
boolean
hasMusic
=
false
;
//更新播放器内容
if
(
PlayerManager
.
getInstance
().
getAlbum
()
==
null
||
TextUtils
.
isEmpty
(
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
())
||
!
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
().
equals
(
mMusicAlbum
.
getAlbumId
()))
{
VoicePlayerBean
voicePlayerBean
=
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
();
if
(
voicePlayerBean
!=
null
&&
mMusicAlbum
!=
null
&&
mMusicAlbum
.
getMusics
()
!=
null
&&
mMusicAlbum
.
getMusics
().
size
()>
0
){
for
(
VoicePlayerBean
v
:
mMusicAlbum
.
getMusics
()){
if
(
voicePlayerBean
.
isSameObject
(
v
)){
hasMusic
=
true
;
}
public
void
togglePlay
()
{
if
(
mMusicAlbum
==
null
)
{
ToastNightUtil
.
showShort
(
ResUtils
.
getString
(
R
.
string
.
audio_no_content
));
return
;
}
boolean
hasMusic
=
false
;
//更新播放器内容
if
(
PlayerManager
.
getInstance
().
getAlbum
()
==
null
||
TextUtils
.
isEmpty
(
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
())
||
!
PlayerManager
.
getInstance
().
getAlbum
().
getAlbumId
().
equals
(
mMusicAlbum
.
getAlbumId
()))
{
VoicePlayerBean
voicePlayerBean
=
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
();
if
(
voicePlayerBean
!=
null
&&
mMusicAlbum
!=
null
&&
mMusicAlbum
.
getMusics
()
!=
null
&&
mMusicAlbum
.
getMusics
().
size
()
>
0
)
{
for
(
VoicePlayerBean
v
:
mMusicAlbum
.
getMusics
())
{
if
(
voicePlayerBean
.
isSameObject
(
v
))
{
hasMusic
=
true
;
}
}
if
(!
hasMusic
){
PlayerManager
.
getInstance
().
singleListChange
();
PlayerManager
.
getInstance
().
loadAlbum
(
mMusicAlbum
);
}
}
if
(!
isStart
)
{
isStart
=
true
;
if
(!
hasMusic
)
{
PlayerManager
.
getInstance
().
singleListChange
();
PlayerManager
.
getInstance
().
loadAlbum
(
mMusicAlbum
);
}
boolean
ispause
;
if
(
playModeIcon
.
getTag
(
R
.
id
.
res_clicktag
)
==
null
||
(
int
)
playModeIcon
.
getTag
(
R
.
id
.
res_clicktag
)
==
R
.
mipmap
.
icon_player_button
)
{
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
getType
()
!=
4
){
ispause
=
false
;
PlayerManager
.
getInstance
().
playAudio
();
}
else
{
ispause
=
true
;
PlayerManager
.
getInstance
().
pauseAudio
();
PlayerManager
.
getInstance
().
togglePlay
();
}
if
(
FloatWindow
.
get
()
!=
null
&&
!
FloatWindow
.
get
().
isShow
())
{
PlayerManager
.
getInstance
().
setFirstPlayAudio
();
}
FloatWindow
.
get
().
forceShow
(
AudioChannelActivity
.
this
);
}
if
(!
isStart
)
{
isStart
=
true
;
}
boolean
ispause
;
if
(
playModeIcon
.
getTag
(
R
.
id
.
res_clicktag
)
==
null
||
(
int
)
playModeIcon
.
getTag
(
R
.
id
.
res_clicktag
)
==
R
.
mipmap
.
icon_player_button
)
{
if
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
()
!=
null
&&
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
().
getType
()
!=
4
)
{
ispause
=
false
;
PlayerManager
.
getInstance
().
playAudio
();
}
else
{
ispause
=
true
;
PlayerManager
.
getInstance
().
pauseAudio
();
PlayerManager
.
getInstance
().
togglePlay
();
}
if
(!
hasMusic
&&
!
ispause
){
PlayerManager
.
getInstance
().
unfoldAnimation
();
if
(
FloatWindow
.
get
()
!=
null
&&
!
FloatWindow
.
get
().
isShow
())
{
PlayerManager
.
getInstance
().
setFirstPlayAudio
();
}
FloatWindow
.
get
().
forceShow
(
AudioChannelActivity
.
this
);
}
else
{
ispause
=
true
;
PlayerManager
.
getInstance
().
pauseAudio
();
}
public
void
next
()
{
PlayerManager
.
getInstance
().
playNext
();
if
(!
hasMusic
&&
!
ispause
)
{
PlayerManager
.
getInstance
().
unfoldAnimation
();
}
}
public
void
next
()
{
PlayerManager
.
getInstance
().
playNext
();
}
public
void
more
()
{
playListDialog
=
new
PlayListDialog
(
AudioChannelActivity
.
this
,
1
,
mMusicAlbum
);
playListDialog
.
show
();
}
public
void
more
()
{
playListDialog
=
new
PlayListDialog
(
AudioChannelActivity
.
this
,
1
,
mMusicAlbum
);
playListDialog
.
show
();
public
void
close
()
{
finish
();
}
}
public
void
close
()
{
finish
();
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
//页面浏览
TrackContentBean
trackContentBean
=
new
TrackContentBean
();
if
(
mPageBean
!=
null
)
{
if
(
mPageBean
!=
null
)
{
trackContentBean
.
setPage_name
(
mPageBean
.
getName
());
trackContentBean
.
setPage_id
(
mPageBean
.
getId
());
}
...
...
@@ -802,7 +807,7 @@ public class AudioChannelActivity extends BaseActivity {
//所属区域regionName,播报为5
trackContentBean
.
setRegion_name
(
RegionNameConstants
.
AUDIO
);
//埋点增频道id
trackContentBean
.
setChannelSourceId
(
StringUtils
.
isEmpty
(
channelId
)?
trackContentBean
.
setChannelSourceId
(
StringUtils
.
isEmpty
(
channelId
)
?
ProcessUtils
.
CHANNEL_ID_VOICE
:
channelId
);
// CommonTrack.getInstance().channelExposureTrack(trackContentBean);
...
...
@@ -818,12 +823,12 @@ public class AudioChannelActivity extends BaseActivity {
/**
* 调用挂角广告逻辑
*/
private
void
advLogic
(
PageBean
pageBean
,
boolean
isResume
)
{
private
void
advLogic
(
PageBean
pageBean
,
boolean
isResume
)
{
if
(
cornerAdvLogic
!=
null
)
{
if
(
getWindow
()
!=
null
)
{
Window
window
=
getWindow
();
cornerAdvLogic
.
setDragViewType
(
0
);
cornerAdvLogic
.
handlerAdLogic
(
this
,
pageBean
,
false
,
window
,
isResume
);
cornerAdvLogic
.
handlerAdLogic
(
this
,
pageBean
,
false
,
window
,
isResume
);
}
}
}
...
...
@@ -885,13 +890,13 @@ public class AudioChannelActivity extends BaseActivity {
public
VoicePlayerBean
contentBeanToVoicePlayerBean
(
ContentBean
contentBean
)
{
VoicePlayerBean
voicePlayerBean
=
new
VoicePlayerBean
();
voicePlayerBean
.
contentBean
=
contentBean
;
if
(
mPageBean
!=
null
)
{
if
(
mPageBean
!=
null
)
{
voicePlayerBean
.
pageId
=
mPageBean
.
getId
();
voicePlayerBean
.
pageName
=
mPageBean
.
getName
();
}
voicePlayerBean
.
setContentType
(
contentBean
.
getObjectType
());
TraceBean
traceBean
=
new
TraceBean
();
TraceBean
traceBean
=
new
TraceBean
();
traceBean
.
sceneId
=
contentBean
.
getSceneId
();
traceBean
.
subSceneId
=
contentBean
.
getSubSceneId
();
traceBean
.
traceId
=
contentBean
.
getTraceId
();
...
...
module_musicplayer/src/main/java/com/wd/musicplayer/ui/page/DrawerFragment.java
deleted
100644 → 0
View file @
fdb037f
/*
* Copyright 2018-present KunMinX
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
wd
.
musicplayer
.
ui
.
page
;
import
android.os.Bundle
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.lifecycle.ViewModel
;
;
import
com.kunminx.architecture.ui.page.DataBindingConfig
;
import
com.kunminx.architecture.ui.state.State
;
import
com.wd.basemusic.ui.page.BaseFragment
;
import
com.wd.musicplayer.BR
;
import
com.wd.musicplayer.R
;
import
com.wd.musicplayer.data.bean.LibraryInfo
;
import
com.wd.musicplayer.domain.request.InfoRequester
;
import
com.wd.musicplayer.ui.page.adapter.DrawerAdapter
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Author :张泽昊
* @Email :1064771680@qq.com
* @Date :on 2023/7/7 17:49.
* @Description :测试界面
*/
public
class
DrawerFragment
extends
BaseFragment
{
private
DrawerViewModel
mStates
;
private
InfoRequester
mInfoRequester
;
@Override
protected
void
initViewModel
()
{
mStates
=
getFragmentScopeViewModel
(
DrawerViewModel
.
class
);
mInfoRequester
=
getFragmentScopeViewModel
(
InfoRequester
.
class
);
}
@Override
protected
DataBindingConfig
getDataBindingConfig
()
{
return
new
DataBindingConfig
(
R
.
layout
.
fragment_drawer
,
BR
.
vm
,
mStates
)
.
addBindingParam
(
BR
.
click
,
new
ClickProxy
())
.
addBindingParam
(
BR
.
adapter
,
new
DrawerAdapter
(
getContext
()));
}
@Override
public
void
onViewCreated
(
@NonNull
View
view
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
mInfoRequester
.
getLibraryResult
().
observe
(
getViewLifecycleOwner
(),
dataResult
->
{
if
(!
dataResult
.
getResponseStatus
().
isSuccess
())
{
return
;
}
if
(
dataResult
.
getResult
()
!=
null
)
{
mStates
.
list
.
set
(
dataResult
.
getResult
());
}
});
if
(
mInfoRequester
.
getLibraryResult
().
getValue
()
==
null
)
{
mInfoRequester
.
requestLibraryInfo
();
}
}
public
class
ClickProxy
{
public
void
logoClick
()
{
openUrlInBrowser
(
getString
(
R
.
string
.
github_project
));
}
}
public
static
class
DrawerViewModel
extends
ViewModel
{
public
final
State
<
List
<
LibraryInfo
>>
list
=
new
State
<>(
new
ArrayList
<>());
}
}
module_musicplayer/src/main/java/com/wd/musicplayer/ui/page/adapter/PlaylistRecommendationAdapter.java
View file @
18ffa10
...
...
@@ -16,64 +16,102 @@
package
com
.
wd
.
musicplayer
.
ui
.
page
.
adapter
;
import
android.content.Context
;
import
android.graphics.Typeface
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.widget.AppCompatImageView
;
import
androidx.core.content.ContextCompat
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.airbnb.lottie.LottieAnimationView
;
import
com.airbnb.lottie.LottieDrawable
;
import
com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.wd.common.floatingview.FloatWindow
;
import
com.wd.foundation.bean.music.bean.VoicePlayerBean
;
import
com.wd.musicplayer.R
;
import
com.wd.musicplayer.databinding.AdapterPlayRecommendationBinding
;
import
com.wd.musicplayer.player.PlayerManager
;
import
com.wd.musicplayer.ui.activity.AudioChannelActivity
;
import
com.wd.foundation.bean.music.bean.VoicePlayerBean
;
/**
* Create by KunMinX at 20/4/19
*/
public
class
PlaylistRecommendationAdapter
extends
SimpleDataBindingAdapter
<
VoicePlayerBean
,
AdapterPlayRecommendationBinding
>
{
private
boolean
topause
=
true
;
public
PlaylistRecommendationAdapter
(
Context
context
)
{
super
(
context
,
R
.
layout
.
adapter_play_recommendation
,
DiffUtils
.
getInstance
().
getVoicePlayerBeanItemCallback
());
}
public
class
PlaylistRecommendationAdapter
extends
BaseQuickAdapter
<
VoicePlayerBean
,
BaseViewHolder
>
{
private
boolean
topause
=
true
;
@Override
protected
void
onBindItem
(
AdapterPlayRecommendationBinding
binding
,
VoicePlayerBean
item
,
RecyclerView
.
ViewHolder
holder
)
{
binding
.
setAlbum
(
item
);
binding
.
textView2
.
setText
(
item
.
getTitle
());
if
(
item
.
isSameObject
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
())
&&
FloatWindow
.
get
()!=
null
&&
!
FloatWindow
.
get
().
getColseed
()){
binding
.
lottieplaytag
.
setAnimation
(
"playlistrecommendationgif.json"
);
binding
.
lottieplaytag
.
setRepeatCount
(
LottieDrawable
.
INFINITE
);
if
(
topause
){
if
(
PlayerManager
.
getInstance
().
isPlaying
()){
binding
.
lottieplaytag
.
playAnimation
();
}
else
{
binding
.
lottieplaytag
.
pauseAnimation
();
}
}
else
{
binding
.
lottieplaytag
.
playAnimation
();
}
public
PlaylistRecommendationAdapter
(
int
layoutResId
)
{
super
(
layoutResId
);
}
binding
.
ivPlayStatus
.
setVisibility
(
View
.
GONE
);
@Override
protected
void
convert
(
@NonNull
BaseViewHolder
holder
,
VoicePlayerBean
item
)
{
TextView
textView2
=
holder
.
getView
(
R
.
id
.
textView2
);
LottieAnimationView
lottieAnimationView
=
holder
.
getView
(
R
.
id
.
lottieplaytag
);
AppCompatImageView
ivPlayStatus
=
holder
.
getView
(
R
.
id
.
iv_play_status
);
textView2
.
setText
(
item
.
getTitle
());
if
(
item
.
isSameObject
(
PlayerManager
.
getInstance
().
getCurrentPlayingMusic
())
&&
FloatWindow
.
get
()
!=
null
&&
!
FloatWindow
.
get
().
getColseed
())
{
lottieAnimationView
.
setAnimation
(
"playlistrecommendationgif.json"
);
lottieAnimationView
.
setRepeatCount
(
LottieDrawable
.
INFINITE
);
if
(
topause
)
{
if
(
PlayerManager
.
getInstance
().
isPlaying
())
{
lottieAnimationView
.
playAnimation
();
}
else
{
lottieAnimationView
.
pauseAnimation
();
}
}
else
{
lottieAnimationView
.
playAnimation
();
}
ivPlayStatus
.
setVisibility
(
View
.
GONE
);
lottieAnimationView
.
setVisibility
(
View
.
VISIBLE
);
textView2
.
setTextColor
(
ContextCompat
.
getColor
(
textView2
.
getContext
(),
R
.
color
.
res_color_common_C1
));
textView2
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
);
}
else
{
ivPlayStatus
.
setVisibility
(
View
.
VISIBLE
);
lottieAnimationView
.
setVisibility
(
View
.
GONE
);
ivPlayStatus
.
setImageResource
(
R
.
mipmap
.
icon_play_stop
);
textView2
.
setTextColor
(
ContextCompat
.
getColor
(
textView2
.
getContext
(),
R
.
color
.
res_color_common_C1
));
textView2
.
setTypeface
(
Typeface
.
DEFAULT
);
}
}
binding
.
lottieplaytag
.
setVisibility
(
View
.
VISIBLE
);
binding
.
textView2
.
setTextColor
(
ContextCompat
.
getColor
(
binding
.
getRoot
().
getContext
(),
R
.
color
.
res_color_common_C1
));
binding
.
textView2
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
);
}
else
{
binding
.
ivPlayStatus
.
setVisibility
(
View
.
VISIBLE
);
binding
.
lottieplaytag
.
setVisibility
(
View
.
GONE
);
binding
.
ivPlayStatus
.
setImageResource
(
R
.
mipmap
.
icon_play_stop
);
binding
.
textView2
.
setTextColor
(
ContextCompat
.
getColor
(
binding
.
getRoot
().
getContext
(),
R
.
color
.
res_color_common_C1
));
binding
.
textView2
.
setTypeface
(
Typeface
.
DEFAULT
);
// public PlaylistRecommendationAdapter(Context context) {
// super(context, R.layout.adapter_play_recommendation, DiffUtils.getInstance().getVoicePlayerBeanItemCallback());
// }
//
// @Override
// protected void onBindItem(AdapterPlayRecommendationBinding binding, VoicePlayerBean item, RecyclerView.ViewHolder holder) {
// binding.setAlbum(item);
// binding.textView2.setText(item.getTitle());
// if (item.isSameObject(PlayerManager.getInstance().getCurrentPlayingMusic()) && FloatWindow.get()!= null && !FloatWindow.get().getColseed()){
// binding.lottieplaytag.setAnimation("playlistrecommendationgif.json");
// binding.lottieplaytag.setRepeatCount(LottieDrawable.INFINITE);
// if(topause){
// if(PlayerManager.getInstance().isPlaying()){
// binding.lottieplaytag.playAnimation();
// }else{
// binding.lottieplaytag.pauseAnimation();
// }
// }else{
// binding.lottieplaytag.playAnimation();
// }
//
// binding.ivPlayStatus.setVisibility(View.GONE);
//
// binding.lottieplaytag.setVisibility(View.VISIBLE);
// binding.textView2.setTextColor(ContextCompat.getColor( binding.getRoot().getContext(), R.color.res_color_common_C1));
// binding.textView2.setTypeface(Typeface.DEFAULT_BOLD);
// }else {
// binding.ivPlayStatus.setVisibility(View.VISIBLE);
// binding.lottieplaytag.setVisibility(View.GONE);
// binding.ivPlayStatus.setImageResource(R.mipmap.icon_play_stop);
// binding.textView2.setTextColor(ContextCompat.getColor( binding.getRoot().getContext(), R.color.res_color_common_C1));
// binding.textView2.setTypeface(Typeface.DEFAULT);
// }
// }
public
void
setTopause
(
boolean
topause
)
{
this
.
topause
=
topause
;
}
}
public
void
setTopause
(
boolean
topause
){
this
.
topause
=
topause
;
}
}
...
...
module_musicplayer/src/main/res/layout/adapter_play_recommendation.xml
View file @
18ffa10
...
...
@@ -14,66 +14,52 @@
~ limitations under the License.
-->
<
l
ayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
androidx.constraintlayout.widget.ConstraintL
ayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
>
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/root_view"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/rmrb_dp50"
tools:background=
"@color/res_color_common_C8"
>
<data>
<variable
name=
"album"
type=
"com.wd.foundation.bean.music.bean.VoicePlayerBean"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/root_view"
<TextView
android:id=
"@+id/textView2"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/rmrb_dp50"
tools:background=
"@color/res_color_common_C8"
>
<TextView
android:id=
"@+id/textView2"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:text=
"jhghjggj"
android:textColor=
"#212228"
android:textSize=
"@dimen/rmrb_dp17"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/iv_play_status"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_marginStart=
"@dimen/rmrb_dp52"
android:layout_marginEnd=
"@dimen/rmrb_dp16"
android:maxLines=
"1"
android:ellipsize=
"end"
/>
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/rmrb_dp52"
android:layout_marginEnd=
"@dimen/rmrb_dp16"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"#212228"
android:textSize=
"@dimen/rmrb_dp17"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/iv_play_status"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"jhghjggj"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_play_status"
android:layout_width=
"@dimen/rmrb_dp24"
android:layout_height=
"@dimen/rmrb_dp24"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
android:layout_marginStart=
"@dimen/rmrb_dp16"
android:src=
"@mipmap/icon_play_stop"
android:scaleType=
"fitXY"
/>
<!--playlistrecommendationgif.json -->
<com.airbnb.lottie.LottieAnimationView
android:id=
"@+id/lottieplaytag"
android:layout_width=
"@dimen/rmrb_dp24"
android:layout_height=
"@dimen/rmrb_dp24"
android:layout_marginStart=
"@dimen/rmrb_dp16"
app:lottie_autoPlay=
"false"
app:lottie_loop=
"false"
android:visibility=
"gone"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_play_status"
android:layout_width=
"@dimen/rmrb_dp24"
android:layout_height=
"@dimen/rmrb_dp24"
android:layout_marginStart=
"@dimen/rmrb_dp16"
android:scaleType=
"fitXY"
android:src=
"@mipmap/icon_play_stop"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<!--playlistrecommendationgif.json -->
<com.airbnb.lottie.LottieAnimationView
android:id=
"@+id/lottieplaytag"
android:layout_width=
"@dimen/rmrb_dp24"
android:layout_height=
"@dimen/rmrb_dp24"
android:layout_marginStart=
"@dimen/rmrb_dp16"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:lottie_autoPlay=
"false"
app:lottie_loop=
"false"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...
...
module_musicplayer/src/main/res/layout/fragment_drawer.xml
deleted
100644 → 0
View file @
fdb037f
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018-present KunMinX
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"vm"
type=
"com.wd.musicplayer.ui.page.DrawerFragment.DrawerViewModel"
/>
<variable
name=
"click"
type=
"com.wd.musicplayer.ui.page.DrawerFragment.ClickProxy"
/>
<variable
name=
"adapter"
type=
"androidx.recyclerview.widget.RecyclerView.Adapter"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/res_color_common_C8"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_logo"
android:layout_width=
"100dp"
android:layout_height=
"100dp"
android:layout_marginTop=
"40dp"
android:onClick=
"@{()->click.logoClick()}"
android:src=
"@drawable/ic_launcher"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_app"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:background=
"?attr/selectableItemBackground"
android:onClick=
"@{()->click.logoClick()}"
android:text=
"@string/app_name"
android:textColor=
"@color/black"
android:textSize=
"20sp"
android:textStyle=
"bold"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/iv_logo"
/>
<TextView
android:id=
"@+id/tv_summary"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:background=
"?attr/selectableItemBackground"
android:onClick=
"@{()->click.logoClick()}"
android:text=
"@string/app_summary"
android:textColor=
"@color/light_gray"
android:textSize=
"12sp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_app"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv"
adapter=
"@{adapter}"
submitList=
"@{vm.list}"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_marginTop=
"24dp"
app:layoutManager=
"com.kunminx.binding_recyclerview.layout_manager.WrapContentLinearLayoutManager"
app:layout_constraintBottom_toTopOf=
"@+id/tv_copyright"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_summary"
/>
<TextView
android:id=
"@+id/tv_copyright"
android:layout_width=
"0dp"
android:layout_height=
"48dp"
android:background=
"?attr/selectableItemBackground"
android:gravity=
"center"
android:onClick=
"@{()->click.logoClick()}"
android:text=
"@string/Copyright"
android:textColor=
"@color/light_gray"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/rv"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
module_musicplayer/src/main/res/values/strings.xml
View file @
18ffa10
...
...
@@ -20,6 +20,8 @@
<string
name=
"recently"
>
最近播放
</string>
<string
name=
"best_practice"
>
</string>
<!--音频没有播放内容-->
<string
name=
"audio_no_content"
>
暂无可播放内容
</string>
<string
name=
"app_summary"
>
</string>
<string
name=
"project_title"
>
</string>
...
...
Please
register
or
login
to post a comment