Showing
11 changed files
with
915 additions
and
378 deletions
| @@ -45,6 +45,11 @@ android { | @@ -45,6 +45,11 @@ android { | ||
| 45 | sourceCompatibility JavaVersion.VERSION_1_8 | 45 | sourceCompatibility JavaVersion.VERSION_1_8 |
| 46 | targetCompatibility JavaVersion.VERSION_1_8 | 46 | targetCompatibility JavaVersion.VERSION_1_8 |
| 47 | } | 47 | } |
| 48 | + | ||
| 49 | + buildFeatures { | ||
| 50 | + dataBinding true | ||
| 51 | + viewBinding true | ||
| 52 | + } | ||
| 48 | } | 53 | } |
| 49 | 54 | ||
| 50 | repositories { | 55 | repositories { |
18.9 KB
| 1 | +package com.wd.common.utils; | ||
| 2 | + | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.text.SimpleDateFormat; | ||
| 5 | +import java.util.Calendar; | ||
| 6 | +import java.util.Date; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * <b>描述</b>: 日历转换工具类:阴历和阳历日期互换(阴历日期范围19000101~20491229)<br> | ||
| 10 | + * @author liu 2015-1-5 | ||
| 11 | + */ | ||
| 12 | +public class CalendarUtil { | ||
| 13 | + // private static final Logger logger = LoggerFactory.getLogger(CalendarUtil.class); | ||
| 14 | + // 计算阴历日期参照1900年到2049年 | ||
| 15 | + private final static int[] LUNAR_INFO = { | ||
| 16 | + 0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2, | ||
| 17 | + 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977, | ||
| 18 | + 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970, | ||
| 19 | + 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950, | ||
| 20 | + 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557, | ||
| 21 | + 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0, | ||
| 22 | + 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0, | ||
| 23 | + 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6, | ||
| 24 | + 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570, | ||
| 25 | + 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0, | ||
| 26 | + 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5, | ||
| 27 | + 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930, | ||
| 28 | + 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530, | ||
| 29 | + 0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45, | ||
| 30 | + 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0 | ||
| 31 | + }; | ||
| 32 | + | ||
| 33 | + // 允许输入的最小年份 | ||
| 34 | + private final static int MIN_YEAR = 1900; | ||
| 35 | + // 允许输入的最大年份 | ||
| 36 | + private final static int MAX_YEAR = 2049; | ||
| 37 | + // 当年是否有闰月 | ||
| 38 | + private static boolean isLeapYear; | ||
| 39 | + // 阳历日期计算起点 | ||
| 40 | + private final static String START_DATE = "19000130"; | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 计算阴历 {@code year}年闰哪个月 1-12 , 没闰传回 0 | ||
| 45 | + * @param year 阴历年 | ||
| 46 | + * @return (int)月份 | ||
| 47 | + * @author liu 2015-1-5 | ||
| 48 | + */ | ||
| 49 | + private static int getLeapMonth(int year) { | ||
| 50 | + return (int) (LUNAR_INFO[year - 1900] & 0xf); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 计算阴历{@code year}年闰月多少天 | ||
| 55 | + * @param year 阴历年 | ||
| 56 | + * @return (int)天数 | ||
| 57 | + * @author liu 2015-1-5 | ||
| 58 | + */ | ||
| 59 | + private static int getLeapMonthDays(int year) { | ||
| 60 | + if(getLeapMonth(year)!=0){ | ||
| 61 | + if((LUNAR_INFO[year - 1900] & 0xf0000)==0){ | ||
| 62 | + return 29; | ||
| 63 | + }else { | ||
| 64 | + return 30; | ||
| 65 | + } | ||
| 66 | + }else{ | ||
| 67 | + return 0; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 计算阴历{@code lunarYeay}年{@code month}月的天数 | ||
| 73 | + * @param lunarYeay 阴历年 | ||
| 74 | + * @param month 阴历月 | ||
| 75 | + * @return (int)该月天数 | ||
| 76 | + * @throws Exception | ||
| 77 | + * @author liu 2015-1-5 | ||
| 78 | + */ | ||
| 79 | + private static int getMonthDays(int lunarYeay, int month) throws Exception { | ||
| 80 | + if ((month > 31) || (month < 0)) { | ||
| 81 | + throw(new Exception("月份有错!")); | ||
| 82 | + } | ||
| 83 | + // 0X0FFFF[0000 {1111 1111 1111} 1111]中间12位代表12个月,1为大月,0为小月 | ||
| 84 | + int bit = 1 << (16-month); | ||
| 85 | + if(((LUNAR_INFO[lunarYeay - 1900] & 0x0FFFF)&bit)==0){ | ||
| 86 | + return 29; | ||
| 87 | + }else { | ||
| 88 | + return 30; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * 计算阴历{@code year}年的总天数 | ||
| 94 | + * @param year 阴历年 | ||
| 95 | + * @return (int)总天数 | ||
| 96 | + * @author liu 2015-1-5 | ||
| 97 | + */ | ||
| 98 | + private static int getYearDays(int year) { | ||
| 99 | + int sum = 29*12; | ||
| 100 | + for(int i=0x8000;i>=0x8;i>>=1){ | ||
| 101 | + if((LUNAR_INFO[year-1900]&0xfff0&i)!=0){ | ||
| 102 | + sum++; | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + return sum+getLeapMonthDays(year); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * 计算两个阳历日期相差的天数。计算不准确,已经废弃 | ||
| 110 | + * @param startDate 开始时间 | ||
| 111 | + * @param endDate 截至时间 | ||
| 112 | + * @return (int)天数 | ||
| 113 | + * @author liu 2015-1-5 | ||
| 114 | + */ | ||
| 115 | + @Deprecated | ||
| 116 | + private static int daysBetween2(Date startDate, Date endDate) { | ||
| 117 | + long between_days=(endDate.getTime()-startDate.getTime())/(1000*3600*24); | ||
| 118 | + | ||
| 119 | + return Integer.parseInt(String.valueOf(between_days)); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 计算两个阳历日期相差的天数。 | ||
| 124 | + * @param startDate 开始时间 | ||
| 125 | + * @param endDate 截至时间 | ||
| 126 | + * @return (int)天数 | ||
| 127 | + * @author liu 2017-3-2 | ||
| 128 | + */ | ||
| 129 | + private static int daysBetween(Date startDate, Date endDate) { | ||
| 130 | + int days = 0; | ||
| 131 | + //将转换的两个时间对象转换成Calendar对象 | ||
| 132 | + Calendar can1 = Calendar.getInstance(); | ||
| 133 | + can1.setTime(startDate); | ||
| 134 | + Calendar can2 = Calendar.getInstance(); | ||
| 135 | + can2.setTime(endDate); | ||
| 136 | + //拿出两个年份 | ||
| 137 | + int year1 = can1.get(Calendar.YEAR); | ||
| 138 | + int year2 = can2.get(Calendar.YEAR); | ||
| 139 | + //天数 | ||
| 140 | + | ||
| 141 | + Calendar can = null; | ||
| 142 | + //如果can1 < can2 | ||
| 143 | + //减去小的时间在这一年已经过了的天数 | ||
| 144 | + //加上大的时间已过的天数 | ||
| 145 | + if(can1.before(can2)){ | ||
| 146 | + days -= can1.get(Calendar.DAY_OF_YEAR); | ||
| 147 | + days += can2.get(Calendar.DAY_OF_YEAR); | ||
| 148 | + can = can1; | ||
| 149 | + }else{ | ||
| 150 | + days -= can2.get(Calendar.DAY_OF_YEAR); | ||
| 151 | + days += can1.get(Calendar.DAY_OF_YEAR); | ||
| 152 | + can = can2; | ||
| 153 | + } | ||
| 154 | + for (int i = 0; i < Math.abs(year2-year1); i++) { | ||
| 155 | + //获取小的时间当前年的总天数 | ||
| 156 | + days += can.getActualMaximum(Calendar.DAY_OF_YEAR); | ||
| 157 | + //再计算下一年。 | ||
| 158 | + can.add(Calendar.YEAR, 1); | ||
| 159 | + } | ||
| 160 | + return days; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * 检查阴历日期是否合法 | ||
| 165 | + * @param lunarYear 阴历年 | ||
| 166 | + * @param lunarMonth 阴历月 | ||
| 167 | + * @param lunarDay 阴历日 | ||
| 168 | + * @param leapMonthFlag 闰月标志 | ||
| 169 | + * @throws Exception | ||
| 170 | + */ | ||
| 171 | + private static void checkLunarDate(int lunarYear, int lunarMonth, int lunarDay, boolean leapMonthFlag) throws Exception { | ||
| 172 | + if ((lunarYear < MIN_YEAR) || (lunarYear > MAX_YEAR)) { | ||
| 173 | + throw(new Exception("非法农历年份!")); | ||
| 174 | + } | ||
| 175 | + if ((lunarMonth < 1) || (lunarMonth > 12)) { | ||
| 176 | + throw(new Exception("非法农历月份!")); | ||
| 177 | + } | ||
| 178 | + if ((lunarDay < 1) || (lunarDay > 30)) { // 中国的月最多30天 | ||
| 179 | + throw(new Exception("非法农历天数!")); | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + int leap = getLeapMonth(lunarYear);// 计算该年应该闰哪个月 | ||
| 183 | + if ((leapMonthFlag == true) && (lunarMonth != leap)) { | ||
| 184 | + throw(new Exception("非法闰月!")); | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + /** | ||
| 189 | + * 阴历转换为阳历 | ||
| 190 | + * @param lunarDate 阴历日期,格式YYYYMMDD | ||
| 191 | + * @param leapMonthFlag 是否为闰月 | ||
| 192 | + * @return 阳历日期,格式:YYYYMMDD | ||
| 193 | + * @throws Exception | ||
| 194 | + * @author liu 2015-1-5 | ||
| 195 | + */ | ||
| 196 | + public static String lunarToSolar(String lunarDate, boolean leapMonthFlag) throws Exception{ | ||
| 197 | + int lunarYear = Integer.parseInt(lunarDate.substring(0, 4)); | ||
| 198 | + int lunarMonth = Integer.parseInt(lunarDate.substring(4, 6)); | ||
| 199 | + int lunarDay = Integer.parseInt(lunarDate.substring(6, 8)); | ||
| 200 | + | ||
| 201 | + checkLunarDate(lunarYear, lunarMonth, lunarDay, leapMonthFlag); | ||
| 202 | + | ||
| 203 | + int offset = 0; | ||
| 204 | + | ||
| 205 | + for (int i = MIN_YEAR; i < lunarYear; i++) { | ||
| 206 | + int yearDaysCount = getYearDays(i); // 求阴历某年天数 | ||
| 207 | + offset += yearDaysCount; | ||
| 208 | + } | ||
| 209 | + //计算该年闰几月 | ||
| 210 | + int leapMonth = getLeapMonth(lunarYear); | ||
| 211 | + | ||
| 212 | + if(leapMonthFlag & leapMonth != lunarMonth){ | ||
| 213 | + throw(new Exception("您输入的闰月标志有误!")); | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + //当年没有闰月或月份早于闰月或和闰月同名的月份 | ||
| 217 | + if(leapMonth==0|| (lunarMonth < leapMonth) || (lunarMonth==leapMonth && !leapMonthFlag)){ | ||
| 218 | + for (int i = 1; i < lunarMonth; i++) { | ||
| 219 | + int tempMonthDaysCount = getMonthDays(lunarYear, i); | ||
| 220 | + offset += tempMonthDaysCount; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + // 检查日期是否大于最大天 | ||
| 224 | + if (lunarDay > getMonthDays(lunarYear, lunarMonth)) { | ||
| 225 | + throw(new Exception("不合法的农历日期!")); | ||
| 226 | + } | ||
| 227 | + offset += lunarDay; // 加上当月的天数 | ||
| 228 | + }else{//当年有闰月,且月份晚于或等于闰月 | ||
| 229 | + for (int i = 1; i < lunarMonth; i++) { | ||
| 230 | + int tempMonthDaysCount = getMonthDays(lunarYear, i); | ||
| 231 | + offset += tempMonthDaysCount; | ||
| 232 | + } | ||
| 233 | + if (lunarMonth>leapMonth) { | ||
| 234 | + int temp = getLeapMonthDays(lunarYear); // 计算闰月天数 | ||
| 235 | + offset += temp; // 加上闰月天数 | ||
| 236 | + | ||
| 237 | + if (lunarDay > getMonthDays(lunarYear, lunarMonth)) { | ||
| 238 | + throw(new Exception("不合法的农历日期!")); | ||
| 239 | + } | ||
| 240 | + offset += lunarDay; | ||
| 241 | + }else { // 如果需要计算的是闰月,则应首先加上与闰月对应的普通月的天数 | ||
| 242 | + // 计算月为闰月 | ||
| 243 | + int temp = getMonthDays(lunarYear, lunarMonth); // 计算非闰月天数 | ||
| 244 | + offset += temp; | ||
| 245 | + | ||
| 246 | + if (lunarDay > getLeapMonthDays(lunarYear)) { | ||
| 247 | + throw(new Exception("不合法的农历日期!")); | ||
| 248 | + } | ||
| 249 | + offset += lunarDay; | ||
| 250 | + } | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); | ||
| 254 | + Date myDate = null; | ||
| 255 | + myDate = formatter.parse(START_DATE); | ||
| 256 | + Calendar c = Calendar.getInstance(); | ||
| 257 | + c.setTime(myDate); | ||
| 258 | + c.add(Calendar.DATE, offset); | ||
| 259 | + myDate = c.getTime(); | ||
| 260 | + | ||
| 261 | + return formatter.format(myDate); | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + /** | ||
| 265 | + * 阳历日期转换为阴历日期 | ||
| 266 | + * @param solarDate 阳历日期,格式YYYYMMDD | ||
| 267 | + * @return 阴历日期 | ||
| 268 | + * @throws Exception | ||
| 269 | + * @author liu 2015-1-5 | ||
| 270 | + */ | ||
| 271 | + public static int[] solarToLunar(String solarDate) throws Exception{ | ||
| 272 | + int i; | ||
| 273 | + int temp = 0; | ||
| 274 | + int lunarYear; | ||
| 275 | + int lunarMonth; //农历月份 | ||
| 276 | + int lunarDay; //农历当月第几天 | ||
| 277 | + boolean leapMonthFlag =false; | ||
| 278 | + | ||
| 279 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); | ||
| 280 | + Date myDate = null; | ||
| 281 | + Date startDate = null; | ||
| 282 | + try { | ||
| 283 | + myDate = formatter.parse(solarDate); | ||
| 284 | + startDate = formatter.parse(START_DATE); | ||
| 285 | + } catch (ParseException e) { | ||
| 286 | + e.printStackTrace(); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + int offset = daysBetween(startDate,myDate); | ||
| 290 | + | ||
| 291 | + for (i = MIN_YEAR; i <= MAX_YEAR; i++){ | ||
| 292 | + temp = getYearDays(i); //求当年农历年天数 | ||
| 293 | + if (offset - temp < 1){ | ||
| 294 | + break; | ||
| 295 | + }else{ | ||
| 296 | + offset -= temp; | ||
| 297 | + } | ||
| 298 | + } | ||
| 299 | + lunarYear = i; | ||
| 300 | + | ||
| 301 | + int leapMonth = getLeapMonth(lunarYear);//计算该年闰哪个月 | ||
| 302 | + //设定当年是否有闰月 | ||
| 303 | + if (leapMonth > 0){ | ||
| 304 | + isLeapYear = true; | ||
| 305 | + }else{ | ||
| 306 | + isLeapYear = false; | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + for (i = 1; i<=12; i++) { | ||
| 310 | + if(i==leapMonth+1 && isLeapYear){ | ||
| 311 | + temp = getLeapMonthDays(lunarYear); | ||
| 312 | + isLeapYear = false; | ||
| 313 | + leapMonthFlag = true; | ||
| 314 | + i--; | ||
| 315 | + }else{ | ||
| 316 | + temp = getMonthDays(lunarYear, i); | ||
| 317 | + } | ||
| 318 | + offset -= temp; | ||
| 319 | + if(offset<=0){ | ||
| 320 | + break; | ||
| 321 | + } | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + offset += temp; | ||
| 325 | + lunarMonth = i; | ||
| 326 | + lunarDay = offset; | ||
| 327 | + | ||
| 328 | + int[] date = new int[]{lunarYear,lunarMonth,lunarDay}; | ||
| 329 | + return date; | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | +} |
| 1 | +package com.wd.common.utils; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import java.text.ParseException; | ||
| 5 | +import java.text.SimpleDateFormat; | ||
| 6 | +import java.util.Calendar; | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 中国农历工具类 | ||
| 11 | + * | ||
| 12 | + * @author qts | ||
| 13 | + * @data 2023/7/27. | ||
| 14 | + */ | ||
| 15 | +public class LunarCalender { | ||
| 16 | + private int year; // 农历的年份 | ||
| 17 | + private int month; | ||
| 18 | + private int day; | ||
| 19 | + private String lunarMonth; // 农历的月份 | ||
| 20 | + private boolean leap; | ||
| 21 | + public int leapMonth = 0; // 闰的是哪个月 | ||
| 22 | + | ||
| 23 | + final static String chineseNumber[] = {"正", "二", "三", "四", "五", "六", "七", | ||
| 24 | + "八", "九", "十", "冬", "腊"}; | ||
| 25 | + static SimpleDateFormat chineseDateFormat = new SimpleDateFormat( | ||
| 26 | + "yyyy年MM月dd日"); | ||
| 27 | + final static long[] lunarInfo = new long[]{ | ||
| 28 | + 0x4bd8, 0x4ae0, 0xa570, 0x54d5, 0xd260, 0xd950, 0x5554, 0x56af, 0x9ad0, 0x55d2, | ||
| 29 | + 0x4ae0, 0xa5b6, 0xa4d0, 0xd250, 0xd255, 0xb54f, 0xd6a0, 0xada2, 0x95b0, 0x4977, | ||
| 30 | + 0x497f, 0xa4b0, 0xb4b5, 0x6a50, 0x6d40, 0xab54, 0x2b6f, 0x9570, 0x52f2, 0x4970, | ||
| 31 | + 0x6566, 0xd4a0, 0xea50, 0x6a95, 0x5adf, 0x2b60, 0x86e3, 0x92ef, 0xc8d7, 0xc95f, | ||
| 32 | + 0xd4a0, 0xd8a6, 0xb55f, 0x56a0, 0xa5b4, 0x25df, 0x92d0, 0xd2b2, 0xa950, 0xb557, | ||
| 33 | + 0x6ca0, 0xb550, 0x5355, 0x4daf, 0xa5b0, 0x4573, 0x52bf, 0xa9a8, 0xe950, 0x6aa0, | ||
| 34 | + 0xaea6, 0xab50, 0x4b60, 0xaae4, 0xa570, 0x5260, 0xf263, 0xd950, 0x5b57, 0x56a0, | ||
| 35 | + 0x96d0, 0x4dd5, 0x4ad0, 0xa4d0, 0xd4d4, 0xd250, 0xd558, 0xb540, 0xb6a0, 0x95a6, | ||
| 36 | + 0x95bf, 0x49b0, 0xa974, 0xa4b0, 0xb27a, 0x6a50, 0x6d40, 0xaf46, 0xab60, 0x9570, | ||
| 37 | + 0x4af5, 0x4970, 0x64b0, 0x74a3, 0xea50, 0x6b58, 0x5ac0, 0xab60, 0x96d5, 0x92e0, | ||
| 38 | + 0xc960, 0xd954, 0xd4a0, 0xda50, 0x7552, 0x56a0, 0xabb7, 0x25d0, 0x92d0, 0xcab5, | ||
| 39 | + 0xa950, 0xb4a0, 0xbaa4, 0xad50, 0x55d9, 0x4ba0, 0xa5b0, 0x5176, 0x52bf, 0xa930, | ||
| 40 | + 0x7954, 0x6aa0, 0xad50, 0x5b52, 0x4b60, 0xa6e6, 0xa4e0, 0xd260, 0xea65, 0xd530, | ||
| 41 | + 0x5aa0, 0x76a3, 0x96d0, 0x4afb, 0x4ad0, 0xa4d0, 0xd0b6, 0xd25f, 0xd520, 0xdd45, | ||
| 42 | + 0xb5a0, 0x56d0, 0x55b2, 0x49b0, 0xa577, 0xa4b0, 0xaa50, 0xb255, 0x6d2f, 0xada0, | ||
| 43 | + 0x4b63, 0x937f, 0x49f8, 0x4970, 0x64b0, 0x68a6, 0xea5f, 0x6b20, 0xa6c4, 0xaaef, | ||
| 44 | + 0x92e0, 0xd2e3, 0xc960, 0xd557, 0xd4a0, 0xda50, 0x5d55, 0x56a0, 0xa6d0, 0x55d4, | ||
| 45 | + 0x52d0, 0xa9b8, 0xa950, 0xb4a0, 0xb6a6, 0xad50, 0x55a0, 0xaba4, 0xa5b0, 0x52b0, | ||
| 46 | + 0xb273, 0x6930, 0x7337, 0x6aa0, 0xad50, 0x4b55, 0x4b6f, 0xa570, 0x54e4, 0xd260, | ||
| 47 | + 0xe968, 0xd520, 0xdaa0, 0x6aa6, 0x56df, 0x4ae0, 0xa9d4, 0xa4d0, 0xd150, 0xf252, | ||
| 48 | + 0xd520}; | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + final static String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", "己", "庚", | ||
| 52 | + "辛", "壬", "癸"}; | ||
| 53 | + final static String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", "巳", "午", | ||
| 54 | + "未", "申", "酉", "戌", "亥"}; | ||
| 55 | + | ||
| 56 | + // ====== 传回农历 y年的总天数 1900--2100 | ||
| 57 | + public int yearDays(int y) { | ||
| 58 | + int i, sum = 348; | ||
| 59 | + for (i = 0x8000; i > 0x8; i >>= 1) { | ||
| 60 | + if ((lunarInfo[y - 1900] & i) != 0) { | ||
| 61 | + sum += 1; | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + return (sum + leapDays(y)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + // ====== 传回农历 y年闰月的天数 | ||
| 68 | + public int leapDays(int y) { | ||
| 69 | + if (leapMonth(y) != 0) { | ||
| 70 | + if ((lunarInfo[y - 1899] & 0xf) != 0) { | ||
| 71 | + return 30; | ||
| 72 | + } else { | ||
| 73 | + return 29; | ||
| 74 | + } | ||
| 75 | + } else { | ||
| 76 | + return 0; | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + // ====== 传回农历 y年闰哪个月 1-12 , 没闰传回 0 | ||
| 81 | + public int leapMonth(int y) { | ||
| 82 | + long var = lunarInfo[y - 1900] & 0xf; | ||
| 83 | + return (int) (var == 0xf ? 0 : var); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + // ====== 传回农历 y年m月的总天数 | ||
| 87 | + public int monthDays(int y, int m) { | ||
| 88 | + if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0) { | ||
| 89 | + return 29; | ||
| 90 | + } else { | ||
| 91 | + return 30; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + // ====== 传回农历 y年的生肖 | ||
| 96 | + public String animalsYear(int year) { | ||
| 97 | + final String[] Animals = new String[]{"鼠", "牛", "虎", "兔", "龙", "蛇", | ||
| 98 | + "马", "羊", "猴", "鸡", "狗", "猪"}; | ||
| 99 | + return Animals[(year - 4) % 12] + "年"; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + // ====== 传入 月日的offset 传回干支, 0=甲子 | ||
| 103 | + final private static String cyclicalm(int num) { | ||
| 104 | + return (Gan[num % 10] + Zhi[num % 12]); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + // ====== 传入 offset 传回干支, 0=甲子 | ||
| 108 | + final public String cyclical(int year, int month, int day) { | ||
| 109 | + int num = year - 1900 + 36; | ||
| 110 | + //立春日期 | ||
| 111 | + int term2 = sTerm(year, 2); | ||
| 112 | + if (month > 2 || (month == 2 && day >= term2)) { | ||
| 113 | + num = num + 0; | ||
| 114 | + } else { | ||
| 115 | + num = num - 1; | ||
| 116 | + } | ||
| 117 | + return (cyclicalm(num)); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public static String getChinaDayString(int day) {//将农历day日格式化成农历表示的字符串 | ||
| 121 | + String chineseTen[] = {"初", "十", "廿", "三"}; | ||
| 122 | + String chineseDay[] = {"一", "二", "三", "四", "五", "六", "七", | ||
| 123 | + "八", "九", "十"}; | ||
| 124 | + String var = ""; | ||
| 125 | + if (day != 20 && day != 30) { | ||
| 126 | + var = chineseTen[(int) ((day - 1) / 10)] + chineseDay[(int) ((day - 1) % 10)]; | ||
| 127 | + } else if (day != 20) { | ||
| 128 | + var = chineseTen[(int) (day / 10)] + "十"; | ||
| 129 | + } else { | ||
| 130 | + var = "二十"; | ||
| 131 | + } | ||
| 132 | + return var; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /* | ||
| 136 | + * 计算公历nY年nM月nD日和bY年bM月bD日渐相差多少天 | ||
| 137 | + * */ | ||
| 138 | + public int getDaysOfTwoDate(int bY, int bM, int bD, int nY, int nM, int nD) { | ||
| 139 | + Date baseDate = null; | ||
| 140 | + Date nowaday = null; | ||
| 141 | + try { | ||
| 142 | + baseDate = chineseDateFormat.parse(bY + "年" + bM + "月" + bD + "日"); | ||
| 143 | + nowaday = chineseDateFormat.parse(nY + "年" + nM + "月" + nD + "日"); | ||
| 144 | + } catch (ParseException e) { | ||
| 145 | + e.printStackTrace(); | ||
| 146 | + } | ||
| 147 | + int offset = 0; | ||
| 148 | + if(nowaday != null && baseDate !=null) { | ||
| 149 | + // 求出相差的天数 | ||
| 150 | + offset = (int) ((nowaday.getTime() - baseDate.getTime()) / 86400000L); | ||
| 151 | + } | ||
| 152 | + return offset; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + /*农历lunYear年lunMonth月lunDay日 | ||
| 156 | + * isLeap 当前年月是否是闰月 | ||
| 157 | + * 从农历日期转换成公历日期 | ||
| 158 | + * */ | ||
| 159 | + public Calendar getSunDate(int lunYear, int lunMonth, int lunDay, boolean isLeap) { | ||
| 160 | + //公历1900年1月31日为1900年正月初一 | ||
| 161 | + int years = lunYear - 1900; | ||
| 162 | + int days = 0; | ||
| 163 | + for (int i = 0; i < years; i++) { | ||
| 164 | + days += yearDays(1900 + i);//农历某年总天数 | ||
| 165 | + } | ||
| 166 | + for (int i = 1; i < lunMonth; i++) { | ||
| 167 | + days += monthDays(lunYear, i); | ||
| 168 | + } | ||
| 169 | + if (leapMonth(lunYear) != 0 && lunMonth > leapMonth(lunYear)) { | ||
| 170 | + days += leapDays(lunYear);//lunYear年闰月天数 | ||
| 171 | + } | ||
| 172 | + if (isLeap) { | ||
| 173 | + days += monthDays(lunYear, lunMonth);//lunYear年lunMonth月 闰月 | ||
| 174 | + } | ||
| 175 | + days += lunDay; | ||
| 176 | + days = days - 1; | ||
| 177 | + Calendar cal = Calendar.getInstance(); | ||
| 178 | + cal.set(Calendar.YEAR, 1900); | ||
| 179 | + cal.set(Calendar.MONTH, 0); | ||
| 180 | + cal.set(Calendar.DAY_OF_MONTH, 31); | ||
| 181 | + cal.add(Calendar.DATE, days); | ||
| 182 | + /* | ||
| 183 | + Date date=cal.getTime(); | ||
| 184 | + int year_c = cal.get(Calendar.YEAR); | ||
| 185 | + int month_c = cal.get(Calendar.MONTH)+1; | ||
| 186 | + int day_c = cal.get(Calendar.DAY_OF_MONTH); | ||
| 187 | + */ | ||
| 188 | + return cal; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public String getLunarString(int year, int month, int day) { | ||
| 192 | + | ||
| 193 | + int var = getLunarDateINT(year, month, day); | ||
| 194 | + int lYear = (int) var / 10000; | ||
| 195 | + int lMonth = (int) (var % 10000) / 100; | ||
| 196 | + int lDay = var - lYear * 10000 - lMonth * 100; | ||
| 197 | + String lunY = cyclical(year, month, day) + "年"; | ||
| 198 | + | ||
| 199 | + String lunM = ""; | ||
| 200 | + int testMonth = getSunDate(lYear, lMonth, lDay, false).get(Calendar.MONTH) + 1; | ||
| 201 | + if (testMonth != month) { | ||
| 202 | + lunM = "闰"; | ||
| 203 | + } | ||
| 204 | + lunM += chineseNumber[(lMonth - 1) % 12] + "月"; | ||
| 205 | + //int leap = leapMonth(lYear); | ||
| 206 | + String lunD = getChinaDayString(lDay); | ||
| 207 | + int animalsYear = 0; | ||
| 208 | + int term2 = sTerm(year, 2);//立春 | ||
| 209 | + if (month > 2 || (month == 2 && day >= term2)) { | ||
| 210 | + animalsYear = year; | ||
| 211 | + } else { | ||
| 212 | + animalsYear = year - 1; | ||
| 213 | + } | ||
| 214 | + return lunY + lunM + lunD; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + /* | ||
| 218 | + * 将公历year年month月day日转换成农历 | ||
| 219 | + * 返回格式为20140506(int) | ||
| 220 | + * */ | ||
| 221 | + public int getLunarDateINT(int year, int month, int day) { | ||
| 222 | + int iYear, LYear, LMonth, LDay, daysOfYear = 0; | ||
| 223 | + // 求出和1900年1月31日相差的天数 | ||
| 224 | + //year =1908; | ||
| 225 | + //month = 3; | ||
| 226 | + //day =3; | ||
| 227 | + int offset = getDaysOfTwoDate(1900, 1, 31, year, month, day); | ||
| 228 | + //Log.i("--ss--","公历:"+year+"-"+month+"-"+day+":"+offset); | ||
| 229 | + // 用offset减去每农历年的天数 | ||
| 230 | + // 计算当天是农历第几天 | ||
| 231 | + // i最终结果是农历的年份 | ||
| 232 | + // offset是当年的第几天 | ||
| 233 | + for (iYear = 1900; iYear < 2100 && offset > 0; iYear++) { | ||
| 234 | + daysOfYear = yearDays(iYear); | ||
| 235 | + offset -= daysOfYear; | ||
| 236 | + //Log.i("--ss--","农历:"+iYear+":"+daysOfYear+"/"+offset); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + if (offset < 0) { | ||
| 240 | + offset += daysOfYear; | ||
| 241 | + iYear--; | ||
| 242 | + //Log.i("--ss--","农历:"+iYear+":"+daysOfYear+"/"+offset); | ||
| 243 | + } | ||
| 244 | + // 农历年份 | ||
| 245 | + LYear = iYear; | ||
| 246 | + | ||
| 247 | + leapMonth = leapMonth(iYear); // 闰哪个月,1-12 | ||
| 248 | + leap = false; | ||
| 249 | + | ||
| 250 | + // 用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天 | ||
| 251 | + int iMonth = 1, daysOfMonth = 0; | ||
| 252 | + for (iMonth = 1; iMonth < 13 && offset > 0; iMonth++) { | ||
| 253 | + // 闰月 | ||
| 254 | + if (leapMonth > 0 && iMonth == (leapMonth + 1) && !leap) { | ||
| 255 | + --iMonth; | ||
| 256 | + leap = true; | ||
| 257 | + daysOfMonth = leapDays(iYear); | ||
| 258 | + } else { | ||
| 259 | + daysOfMonth = monthDays(iYear, iMonth); | ||
| 260 | + } | ||
| 261 | + // 解除闰月 | ||
| 262 | + if (leap && iMonth == (leapMonth + 1)) { | ||
| 263 | + leap = false; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + offset -= daysOfMonth; | ||
| 267 | + //Log.i("--ss--","农历:"+iYear+"-"+iMonth+":"+daysOfMonth+"/"+offset); | ||
| 268 | + } | ||
| 269 | + // offset为0时,并且刚才计算的月份是闰月,要校正 | ||
| 270 | + if (offset == 0 && leapMonth > 0 && iMonth == leapMonth + 1) { | ||
| 271 | + if (leap) { | ||
| 272 | + leap = false; | ||
| 273 | + } else { | ||
| 274 | + leap = true; | ||
| 275 | + --iMonth; | ||
| 276 | + } | ||
| 277 | + } | ||
| 278 | + // offset小于0时,也要校正 | ||
| 279 | + if (offset < 0) { | ||
| 280 | + offset += daysOfMonth; | ||
| 281 | + --iMonth; | ||
| 282 | + //Log.i("--ss--","农历:"+iYear+"-"+iMonth+":"+daysOfMonth+"/"+offset); | ||
| 283 | + } | ||
| 284 | + LMonth = iMonth; | ||
| 285 | + LDay = offset + 1; | ||
| 286 | + //Log.i("--ss--","农历:"+LYear+"-"+LMonth+"-"+LDay); | ||
| 287 | + return LYear * 10000 + LMonth * 100 + LDay; | ||
| 288 | + } | ||
| 289 | + public String toString() { | ||
| 290 | + if (chineseNumber[(month - 1) % 12] == "正" && getChinaDayString(day) == "初一") { | ||
| 291 | + return "农历" + year + "年"; | ||
| 292 | + } else if (getChinaDayString(day) == "初一") { | ||
| 293 | + return chineseNumber[(month - 1) % 12] + "月"; | ||
| 294 | + } else { | ||
| 295 | + return getChinaDayString(day); | ||
| 296 | + } | ||
| 297 | + // return year + "年" + (leap ? "闰" : "") + chineseNumber[month - 1] + | ||
| 298 | + // "月" + getChinaDayString(day); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + /* | ||
| 302 | + * public static void main(String[] args) { System.out.println(new | ||
| 303 | + * LunarCalendar().getLunarDate(2012, 1, 23)); } | ||
| 304 | + */ | ||
| 305 | + | ||
| 306 | + public int getLeapMonth() { | ||
| 307 | + return leapMonth; | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + public void setLeapMonth(int leapMonth) { | ||
| 311 | + this.leapMonth = leapMonth; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + /** | ||
| 315 | + * 得到当前日期对应的阴历月份 | ||
| 316 | + * | ||
| 317 | + * @return | ||
| 318 | + */ | ||
| 319 | + public String getLunarMonth() { | ||
| 320 | + return lunarMonth; | ||
| 321 | + } | ||
| 322 | + | ||
| 323 | + public void setLunarMonth(String lunarMonth) { | ||
| 324 | + this.lunarMonth = lunarMonth; | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + /** | ||
| 328 | + * 得到当前年对应的农历年份 | ||
| 329 | + * | ||
| 330 | + * @return | ||
| 331 | + */ | ||
| 332 | + public int getYear() { | ||
| 333 | + return year; | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + public void setYear(int year) { | ||
| 337 | + this.year = year; | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + | ||
| 341 | + private int sTerm(int y, int n) { | ||
| 342 | + int[] sTermInfo = new int[]{0, 21208, 42467, 63836, 85337, 107014, | ||
| 343 | + 128867, 150921, 173149, 195551, 218072, 240693, | ||
| 344 | + 263343, 285989, 308563, 331033, 353350, 375494, | ||
| 345 | + 397447, 419210, 440795, 462224, 483532, 504758}; | ||
| 346 | + Calendar cal = Calendar.getInstance(); | ||
| 347 | + cal.set(1900, 0, 6, 2, 5, 0); | ||
| 348 | + long temp = cal.getTime().getTime(); | ||
| 349 | + cal.setTime(new Date((long) ((31556925974.7 * (y - 1900) + sTermInfo[n] * 60000L) + temp))); | ||
| 350 | + int a = cal.get(Calendar.DAY_OF_MONTH); | ||
| 351 | + return a; | ||
| 352 | + } | ||
| 353 | + | ||
| 354 | + public static String convertToLunarTianGan(int year) { | ||
| 355 | + String[] tianGan = {"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}; | ||
| 356 | + int index = (year - 4) % 10; | ||
| 357 | + return tianGan[index]; | ||
| 358 | + } | ||
| 359 | + public static String convertToLunarDiZhi(int year) { | ||
| 360 | + String[] diZhi = {"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"}; | ||
| 361 | + int index = (year - 4) % 12; | ||
| 362 | + return diZhi[index]; | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + public static String convertToChineseMonth(int month) { | ||
| 366 | + String[] chineseMonths = {"正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "冬月", "腊月"}; | ||
| 367 | + return chineseMonths[month - 1]; | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + | ||
| 371 | + | ||
| 372 | +} |
| @@ -1290,7 +1290,7 @@ public class ProcessUtils implements IntentConstants { | @@ -1290,7 +1290,7 @@ public class ProcessUtils implements IntentConstants { | ||
| 1290 | } else if (CHANNEL_ID_VOICE.equals(channelId)) { | 1290 | } else if (CHANNEL_ID_VOICE.equals(channelId)) { |
| 1291 | jump = true; | 1291 | jump = true; |
| 1292 | // 音频频道 | 1292 | // 音频频道 |
| 1293 | -// goTestAudio(tabBean.getPageId(), channelId); | 1293 | + goTestAudio(tabBean.getPageId(), channelId); |
| 1294 | } | 1294 | } |
| 1295 | 1295 | ||
| 1296 | return jump; | 1296 | return jump; |
| @@ -10,10 +10,12 @@ import android.widget.FrameLayout; | @@ -10,10 +10,12 @@ import android.widget.FrameLayout; | ||
| 10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
| 11 | import android.widget.RelativeLayout; | 11 | import android.widget.RelativeLayout; |
| 12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 13 | + | ||
| 13 | import androidx.annotation.Nullable; | 14 | import androidx.annotation.Nullable; |
| 14 | import androidx.core.widget.NestedScrollView; | 15 | import androidx.core.widget.NestedScrollView; |
| 15 | import androidx.lifecycle.Observer; | 16 | import androidx.lifecycle.Observer; |
| 16 | import androidx.recyclerview.widget.RecyclerView; | 17 | import androidx.recyclerview.widget.RecyclerView; |
| 18 | + | ||
| 17 | import com.alibaba.android.arouter.facade.annotation.Route; | 19 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 18 | import com.alibaba.fastjson.JSONObject; | 20 | import com.alibaba.fastjson.JSONObject; |
| 19 | import com.wd.base.log.Logger; | 21 | import com.wd.base.log.Logger; |
| @@ -22,22 +24,16 @@ import com.wd.basemusic.utils.BarUtils; | @@ -22,22 +24,16 @@ import com.wd.basemusic.utils.BarUtils; | ||
| 22 | import com.wd.capability.network.BaseObserver; | 24 | import com.wd.capability.network.BaseObserver; |
| 23 | import com.wd.capability.network.bean.MetaBean; | 25 | import com.wd.capability.network.bean.MetaBean; |
| 24 | import com.wd.capability.network.cachedata.CacheData; | 26 | import com.wd.capability.network.cachedata.CacheData; |
| 25 | -import com.wd.foundation.wdkit.adv.CornerAdvLogic; | ||
| 26 | -import com.wd.foundation.wdkit.constant.EventConstants; | ||
| 27 | import com.wd.capability.router.data.ActionBean; | 27 | import com.wd.capability.router.data.ActionBean; |
| 28 | import com.wd.common.base.BaseActivity; | 28 | import com.wd.common.base.BaseActivity; |
| 29 | import com.wd.common.constant.RegionNameConstants; | 29 | import com.wd.common.constant.RegionNameConstants; |
| 30 | import com.wd.common.constant.RouterConstants; | 30 | import com.wd.common.constant.RouterConstants; |
| 31 | -import com.wd.foundation.wdkit.dialog.EasterEggsDialog; | ||
| 32 | -import com.wd.foundation.wdkit.dialog.PopUpsUtils; | ||
| 33 | import com.wd.common.floatingview.FloatWindow; | 31 | import com.wd.common.floatingview.FloatWindow; |
| 34 | import com.wd.common.interfaces.AudioChannelBack; | 32 | import com.wd.common.interfaces.AudioChannelBack; |
| 33 | +import com.wd.common.utils.CalendarUtil; | ||
| 35 | import com.wd.common.utils.CommonNetUtils; | 34 | import com.wd.common.utils.CommonNetUtils; |
| 35 | +import com.wd.common.utils.LunarCalender; | ||
| 36 | import com.wd.common.utils.ProcessUtils; | 36 | import com.wd.common.utils.ProcessUtils; |
| 37 | -import com.wd.common.utils.ToolsUtil; | ||
| 38 | -import com.wd.foundation.wdkit.utils.StatusBarUtil; | ||
| 39 | -import com.wd.foundation.wdkit.viewclick.BaseClickListener; | ||
| 40 | -import com.wd.foundation.wdkit.view.DefaultView; | ||
| 41 | import com.wd.foundation.bean.analytics.ActionConstants; | 37 | import com.wd.foundation.bean.analytics.ActionConstants; |
| 42 | import com.wd.foundation.bean.analytics.TraceBean; | 38 | import com.wd.foundation.bean.analytics.TraceBean; |
| 43 | import com.wd.foundation.bean.analytics.TrackContentBean; | 39 | import com.wd.foundation.bean.analytics.TrackContentBean; |
| @@ -51,27 +47,35 @@ import com.wd.foundation.bean.music.bean.VoicePlayerBean; | @@ -51,27 +47,35 @@ import com.wd.foundation.bean.music.bean.VoicePlayerBean; | ||
| 51 | import com.wd.foundation.bean.pop.PopUpsBean; | 47 | import com.wd.foundation.bean.pop.PopUpsBean; |
| 52 | import com.wd.foundation.bean.response.AudioPlaybackQuantityBean; | 48 | import com.wd.foundation.bean.response.AudioPlaybackQuantityBean; |
| 53 | import com.wd.foundation.bean.response.NewsDetailBean; | 49 | import com.wd.foundation.bean.response.NewsDetailBean; |
| 54 | -import com.wd.musicplayer.R; | ||
| 55 | -import com.wd.musicplayer.data.bean.MusicAlbum; | ||
| 56 | -import com.wd.musicplayer.player.PlayerManager; | ||
| 57 | -import com.wd.musicplayer.ui.dialog.PlayListDialog; | ||
| 58 | -import com.wd.musicplayer.ui.page.adapter.PlaylistRecommendationAdapter; | ||
| 59 | -import com.wd.musicplayer.ui.page.adapter.SelectedColumnsAdapter; | ||
| 60 | import com.wd.foundation.bean.utils.TimeUtil; | 50 | import com.wd.foundation.bean.utils.TimeUtil; |
| 51 | +import com.wd.foundation.wdkit.adv.CornerAdvLogic; | ||
| 61 | import com.wd.foundation.wdkit.constant.Constants; | 52 | import com.wd.foundation.wdkit.constant.Constants; |
| 62 | import com.wd.foundation.wdkit.constant.DefaultViewConstant; | 53 | import com.wd.foundation.wdkit.constant.DefaultViewConstant; |
| 54 | +import com.wd.foundation.wdkit.constant.EventConstants; | ||
| 63 | import com.wd.foundation.wdkit.constant.IntentConstants; | 55 | import com.wd.foundation.wdkit.constant.IntentConstants; |
| 56 | +import com.wd.foundation.wdkit.dialog.EasterEggsDialog; | ||
| 57 | +import com.wd.foundation.wdkit.dialog.PopUpsUtils; | ||
| 64 | import com.wd.foundation.wdkit.json.GsonUtils; | 58 | import com.wd.foundation.wdkit.json.GsonUtils; |
| 65 | import com.wd.foundation.wdkit.statusbar.StatusBarStyleEnum; | 59 | import com.wd.foundation.wdkit.statusbar.StatusBarStyleEnum; |
| 66 | import com.wd.foundation.wdkit.utils.CommonUtil; | 60 | import com.wd.foundation.wdkit.utils.CommonUtil; |
| 67 | import com.wd.foundation.wdkit.utils.ScreenUtils; | 61 | import com.wd.foundation.wdkit.utils.ScreenUtils; |
| 68 | import com.wd.foundation.wdkit.utils.SpUtils; | 62 | import com.wd.foundation.wdkit.utils.SpUtils; |
| 63 | +import com.wd.foundation.wdkit.utils.StatusBarUtil; | ||
| 69 | import com.wd.foundation.wdkit.utils.ToastNightUtil; | 64 | import com.wd.foundation.wdkit.utils.ToastNightUtil; |
| 65 | +import com.wd.foundation.wdkit.view.DefaultView; | ||
| 66 | +import com.wd.foundation.wdkit.viewclick.BaseClickListener; | ||
| 70 | import com.wd.foundation.wdkitcore.livedata.LiveDataBus; | 67 | import com.wd.foundation.wdkitcore.livedata.LiveDataBus; |
| 71 | import com.wd.foundation.wdkitcore.tools.HostUtil; | 68 | import com.wd.foundation.wdkitcore.tools.HostUtil; |
| 72 | import com.wd.foundation.wdkitcore.tools.JsonUtils; | 69 | import com.wd.foundation.wdkitcore.tools.JsonUtils; |
| 73 | import com.wd.foundation.wdkitcore.tools.ResUtils; | 70 | import com.wd.foundation.wdkitcore.tools.ResUtils; |
| 74 | import com.wd.foundation.wdkitcore.tools.StringUtils; | 71 | import com.wd.foundation.wdkitcore.tools.StringUtils; |
| 72 | +import com.wd.musicplayer.R; | ||
| 73 | +import com.wd.musicplayer.data.bean.MusicAlbum; | ||
| 74 | +import com.wd.musicplayer.player.PlayerManager; | ||
| 75 | +import com.wd.musicplayer.ui.dialog.PlayListDialog; | ||
| 76 | +import com.wd.musicplayer.ui.page.adapter.PlaylistRecommendationAdapter; | ||
| 77 | +import com.wd.musicplayer.ui.page.adapter.SelectedColumnsAdapter; | ||
| 78 | + | ||
| 75 | import java.text.SimpleDateFormat; | 79 | import java.text.SimpleDateFormat; |
| 76 | import java.util.ArrayList; | 80 | import java.util.ArrayList; |
| 77 | import java.util.Date; | 81 | import java.util.Date; |
| @@ -139,13 +143,13 @@ public class AudioChannelActivity extends BaseActivity { | @@ -139,13 +143,13 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 139 | private View vline; | 143 | private View vline; |
| 140 | /** | 144 | /** |
| 141 | * 骨架图 | 145 | * 骨架图 |
| 142 | - * */ | 146 | + */ |
| 143 | private FrameLayout skeletondiagram; | 147 | private FrameLayout skeletondiagram; |
| 144 | private NestedScrollView nsv; | 148 | private NestedScrollView nsv; |
| 145 | - private TextView jrtjtitle,showmore,chinesecalendar,calendar1,jxtitle,calendar,tvtopname; | ||
| 146 | - private ImageView iv_bg,playModeIcon,iv_closeinner,iv_close; | ||
| 147 | - private RecyclerView layout_fra_sound_seminar,layout_selected_columns; | ||
| 148 | - private RelativeLayout rltopinner,rltop; | 149 | + private TextView jrtjtitle, showmore, chinesecalendar, calendar1, jxtitle, calendar, tvtopname; |
| 150 | + private ImageView iv_bg, playModeIcon, iv_closeinner, iv_close; | ||
| 151 | + private RecyclerView layout_fra_sound_seminar, layout_selected_columns; | ||
| 152 | + private RelativeLayout rltopinner, rltop; | ||
| 149 | private int mDistance = 0; | 153 | private int mDistance = 0; |
| 150 | private float alpha; | 154 | private float alpha; |
| 151 | 155 | ||
| @@ -165,11 +169,11 @@ public class AudioChannelActivity extends BaseActivity { | @@ -165,11 +169,11 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 165 | @Override | 169 | @Override |
| 166 | protected void onNoDoubleClick(View v) { | 170 | protected void onNoDoubleClick(View v) { |
| 167 | int id = v.getId(); | 171 | int id = v.getId(); |
| 168 | - if(id == R.id.iv_closeinner || id == R.id.iv_close){ | 172 | + if (id == R.id.iv_closeinner || id == R.id.iv_close) { |
| 169 | close(); | 173 | close(); |
| 170 | - }else if(id == R.id.iv_play_buttone){ | 174 | + } else if (id == R.id.iv_play_buttone) { |
| 171 | togglePlay(); | 175 | togglePlay(); |
| 172 | - }else if(id == R.id.tv_special_column_more){ | 176 | + } else if (id == R.id.tv_special_column_more) { |
| 173 | more(); | 177 | more(); |
| 174 | } | 178 | } |
| 175 | } | 179 | } |
| @@ -189,7 +193,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -189,7 +193,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 189 | nsv = findViewById(R.id.nsv); | 193 | nsv = findViewById(R.id.nsv); |
| 190 | iv_bg = findViewById(R.id.iv_bg); | 194 | iv_bg = findViewById(R.id.iv_bg); |
| 191 | RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) iv_bg.getLayoutParams(); | 195 | RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) iv_bg.getLayoutParams(); |
| 192 | - params.height = ScreenUtils.getRealWidth()*440/375; | 196 | + params.height = ScreenUtils.getRealWidth() * 440 / 375; |
| 193 | iv_bg.setLayoutParams(params); | 197 | iv_bg.setLayoutParams(params); |
| 194 | playModeIcon = findViewById(R.id.iv_play_buttone); | 198 | playModeIcon = findViewById(R.id.iv_play_buttone); |
| 195 | jrtjtitle = findViewById(R.id.tv_tltle); | 199 | jrtjtitle = findViewById(R.id.tv_tltle); |
| @@ -217,34 +221,34 @@ public class AudioChannelActivity extends BaseActivity { | @@ -217,34 +221,34 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 217 | 221 | ||
| 218 | // 夜间模式下,顶部图片的前景色 | 222 | // 夜间模式下,顶部图片的前景色 |
| 219 | RelativeLayout.LayoutParams nightBgParams = (RelativeLayout.LayoutParams) iv_night_bg.getLayoutParams(); | 223 | RelativeLayout.LayoutParams nightBgParams = (RelativeLayout.LayoutParams) iv_night_bg.getLayoutParams(); |
| 220 | - nightBgParams.height = ScreenUtils.getRealWidth()*440/375; | ||
| 221 | - iv_night_bg.setVisibility(SpUtils.isNightMode()?View.VISIBLE:View.GONE); | 224 | + nightBgParams.height = ScreenUtils.getRealWidth() * 440 / 375; |
| 225 | + iv_night_bg.setVisibility(SpUtils.isNightMode() ? View.VISIBLE : View.GONE); | ||
| 222 | 226 | ||
| 223 | //今日推荐列表 | 227 | //今日推荐列表 |
| 224 | - playlistRecommendationAdapter = new PlaylistRecommendationAdapter(this); | 228 | + playlistRecommendationAdapter = new PlaylistRecommendationAdapter(R.layout.adapter_play_recommendation); |
| 225 | playlistRecommendationAdapter.setOnItemClickListener((viewId, item, position) -> { | 229 | playlistRecommendationAdapter.setOnItemClickListener((viewId, item, position) -> { |
| 226 | VoicePlayerBean voicePlayerBean = mMusicAlbum.getMusics().get(position); | 230 | VoicePlayerBean voicePlayerBean = mMusicAlbum.getMusics().get(position); |
| 227 | if (voicePlayerBean.getAudioDetailBean() == null || CommonUtil.isEmpty(voicePlayerBean.getAudioDetailBean().getAudioList()) | 231 | if (voicePlayerBean.getAudioDetailBean() == null || CommonUtil.isEmpty(voicePlayerBean.getAudioDetailBean().getAudioList()) |
| 228 | - || TextUtils.isEmpty(voicePlayerBean.getAudioDetailBean().getNewsType()) || TextUtils.isEmpty(voicePlayerBean.getAudioDetailBean().getNewsId())){ | ||
| 229 | - ToastNightUtil.showTopShort("无音频数据", ScreenUtils.getRealHeight()/2); | 232 | + || TextUtils.isEmpty(voicePlayerBean.getAudioDetailBean().getNewsType()) || TextUtils.isEmpty(voicePlayerBean.getAudioDetailBean().getNewsId())) { |
| 233 | + ToastNightUtil.showTopShort("无音频数据", ScreenUtils.getRealHeight() / 2); | ||
| 230 | return; | 234 | return; |
| 231 | } | 235 | } |
| 232 | //更新播放器内容 | 236 | //更新播放器内容 |
| 233 | - if (PlayerManager.getInstance().getAlbum() == null|| TextUtils.isEmpty(PlayerManager.getInstance().getAlbum().getAlbumId()) || | 237 | + if (PlayerManager.getInstance().getAlbum() == null || TextUtils.isEmpty(PlayerManager.getInstance().getAlbum().getAlbumId()) || |
| 234 | !PlayerManager.getInstance().getAlbum().getAlbumId().equals(mMusicAlbum.getAlbumId())) { | 238 | !PlayerManager.getInstance().getAlbum().getAlbumId().equals(mMusicAlbum.getAlbumId())) { |
| 235 | //如果是同一个,则继续播放 | 239 | //如果是同一个,则继续播放 |
| 236 | - if(PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().isSameObject(voicePlayerBean)){ | 240 | + if (PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().isSameObject(voicePlayerBean)) { |
| 237 | PlayerManager.getInstance().playAudio(); | 241 | PlayerManager.getInstance().playAudio(); |
| 238 | - }else { | 242 | + } else { |
| 239 | PlayerManager.getInstance().singleListChange(); | 243 | PlayerManager.getInstance().singleListChange(); |
| 240 | //加载数据 | 244 | //加载数据 |
| 241 | PlayerManager.getInstance().loadAlbum(mMusicAlbum, position); | 245 | PlayerManager.getInstance().loadAlbum(mMusicAlbum, position); |
| 242 | } | 246 | } |
| 243 | - }else{ | 247 | + } else { |
| 244 | //如果是同一个,则继续播放 | 248 | //如果是同一个,则继续播放 |
| 245 | - if(PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().isSameObject(voicePlayerBean)){ | 249 | + if (PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().isSameObject(voicePlayerBean)) { |
| 246 | PlayerManager.getInstance().playAudio(); | 250 | PlayerManager.getInstance().playAudio(); |
| 247 | - }else{ | 251 | + } else { |
| 248 | PlayerManager.getInstance().singleListChange(); | 252 | PlayerManager.getInstance().singleListChange(); |
| 249 | PlayerManager.getInstance().playAudio(position); | 253 | PlayerManager.getInstance().playAudio(position); |
| 250 | } | 254 | } |
| @@ -266,10 +270,10 @@ public class AudioChannelActivity extends BaseActivity { | @@ -266,10 +270,10 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 266 | public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { | 270 | public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { |
| 267 | mDistance += (scrollY - oldScrollY); | 271 | mDistance += (scrollY - oldScrollY); |
| 268 | float percent = Math.abs(mDistance * 1f / 200); | 272 | float percent = Math.abs(mDistance * 1f / 200); |
| 269 | - if(percent > 1){ | 273 | + if (percent > 1) { |
| 270 | percent = 1; | 274 | percent = 1; |
| 271 | } | 275 | } |
| 272 | - setAlpha(percent*255); | 276 | + setAlpha(percent * 255); |
| 273 | } | 277 | } |
| 274 | }); | 278 | }); |
| 275 | 279 | ||
| @@ -290,7 +294,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -290,7 +294,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 290 | } | 294 | } |
| 291 | 295 | ||
| 292 | private void setAlpha(float alpha) { | 296 | private void setAlpha(float alpha) { |
| 293 | - if (alpha == this.alpha){ | 297 | + if (alpha == this.alpha) { |
| 294 | return; | 298 | return; |
| 295 | } | 299 | } |
| 296 | this.alpha = alpha; | 300 | this.alpha = alpha; |
| @@ -306,11 +310,12 @@ public class AudioChannelActivity extends BaseActivity { | @@ -306,11 +310,12 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 306 | super.onResume(); | 310 | super.onResume(); |
| 307 | 311 | ||
| 308 | updateTodaysRecommendation(); | 312 | updateTodaysRecommendation(); |
| 309 | - StatusBarUtil.setStatusBarStyle(SpUtils.isNightMode()? StatusBarStyleEnum.FULLSCREEN_LIGHT_ENUM:StatusBarStyleEnum.FULLSCREEN_DARK_ENUM,this); | 313 | + StatusBarUtil.setStatusBarStyle(SpUtils.isNightMode() ? StatusBarStyleEnum.FULLSCREEN_LIGHT_ENUM : |
| 314 | + StatusBarStyleEnum.FULLSCREEN_DARK_ENUM, this); | ||
| 310 | VoicePlayerBean currentMusic = PlayerManager.getInstance().getCurrentPlayingMusic(); | 315 | VoicePlayerBean currentMusic = PlayerManager.getInstance().getCurrentPlayingMusic(); |
| 311 | boolean hasMusic = false; | 316 | boolean hasMusic = false; |
| 312 | - if(currentMusic!= null && !TextUtils.isEmpty(currentMusic.getUrl()) | ||
| 313 | - && voicePlayerBeansTodaysRecommendation!= null && voicePlayerBeansTodaysRecommendation.size()>0){ | 317 | + if (currentMusic != null && !TextUtils.isEmpty(currentMusic.getUrl()) |
| 318 | + && voicePlayerBeansTodaysRecommendation != null && voicePlayerBeansTodaysRecommendation.size() > 0) { | ||
| 314 | //设置必须的audioList | 319 | //设置必须的audioList |
| 315 | for (VoicePlayerBean voicePlayerBean : voicePlayerBeansTodaysRecommendation) { | 320 | for (VoicePlayerBean voicePlayerBean : voicePlayerBeansTodaysRecommendation) { |
| 316 | if (currentMusic.isSameObject(voicePlayerBean)) { | 321 | if (currentMusic.isSameObject(voicePlayerBean)) { |
| @@ -320,14 +325,14 @@ public class AudioChannelActivity extends BaseActivity { | @@ -320,14 +325,14 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 320 | } | 325 | } |
| 321 | } | 326 | } |
| 322 | 327 | ||
| 323 | - if (hasMusic &&PlayerManager.getInstance().isPlaying()) { | 328 | + if (hasMusic && PlayerManager.getInstance().isPlaying()) { |
| 324 | //设置顶部播放按钮为已播放样式 | 329 | //设置顶部播放按钮为已播放样式 |
| 325 | -// playModeIcon.setImageResource(R.mipmap.icon_pause_button); | ||
| 326 | -// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_pause_button); | 330 | + playModeIcon.setImageResource(R.mipmap.icon_pause_button); |
| 331 | + playModeIcon.setTag(R.id.res_clicktag, R.mipmap.icon_pause_button); | ||
| 327 | } else { | 332 | } else { |
| 328 | //设置顶部播放按钮为已暂停样式 | 333 | //设置顶部播放按钮为已暂停样式 |
| 329 | -// playModeIcon.setImageResource(R.mipmap.icon_player_button); | ||
| 330 | -// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_player_button); | 334 | + playModeIcon.setImageResource(R.mipmap.icon_player_button); |
| 335 | + playModeIcon.setTag(R.id.res_clicktag, R.mipmap.icon_player_button); | ||
| 331 | } | 336 | } |
| 332 | } | 337 | } |
| 333 | 338 | ||
| @@ -356,15 +361,15 @@ public class AudioChannelActivity extends BaseActivity { | @@ -356,15 +361,15 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 356 | PlayerManager.getInstance().getDispatcher().output(this, playerEvent -> { | 361 | PlayerManager.getInstance().getDispatcher().output(this, playerEvent -> { |
| 357 | if (playerEvent.eventId == PlayerEvent.EVENT_CHANGE_MUSIC) { | 362 | if (playerEvent.eventId == PlayerEvent.EVENT_CHANGE_MUSIC) { |
| 358 | playlistRecommendationAdapter.setTopause(playerEvent.toPause); | 363 | playlistRecommendationAdapter.setTopause(playerEvent.toPause); |
| 359 | - if(playListDialog != null){ | 364 | + if (playListDialog != null) { |
| 360 | playListDialog.setTopause(playerEvent.toPause); | 365 | playListDialog.setTopause(playerEvent.toPause); |
| 361 | } | 366 | } |
| 362 | updateTodaysRecommendation(); | 367 | updateTodaysRecommendation(); |
| 363 | } else if (playerEvent.eventId == PlayerEvent.EVENT_PLAY_STATUS) { | 368 | } else if (playerEvent.eventId == PlayerEvent.EVENT_PLAY_STATUS) { |
| 364 | -// playModeIcon.setImageResource(playerEvent.toPause ? R.mipmap.icon_player_button : R.mipmap.icon_pause_button); | ||
| 365 | -// playModeIcon.setTag(R.id.res_clicktag,playerEvent.toPause ? R.mipmap.icon_player_button : R.mipmap.icon_pause_button); | 369 | + playModeIcon.setImageResource(playerEvent.toPause ? R.mipmap.icon_player_button : R.mipmap.icon_pause_button); |
| 370 | + playModeIcon.setTag(R.id.res_clicktag, playerEvent.toPause ? R.mipmap.icon_player_button : R.mipmap.icon_pause_button); | ||
| 366 | playlistRecommendationAdapter.setTopause(playerEvent.toPause); | 371 | playlistRecommendationAdapter.setTopause(playerEvent.toPause); |
| 367 | - if(playListDialog != null){ | 372 | + if (playListDialog != null) { |
| 368 | playListDialog.setTopause(playerEvent.toPause); | 373 | playListDialog.setTopause(playerEvent.toPause); |
| 369 | } | 374 | } |
| 370 | updateTodaysRecommendation(); | 375 | updateTodaysRecommendation(); |
| @@ -378,9 +383,9 @@ public class AudioChannelActivity extends BaseActivity { | @@ -378,9 +383,9 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 378 | String date = dateFormat.format(new Date()); | 383 | String date = dateFormat.format(new Date()); |
| 379 | int[] dateList; | 384 | int[] dateList; |
| 380 | try { | 385 | try { |
| 381 | -// dateList = CalendarUtil.solarToLunar(date); | ||
| 382 | -// chinesecalendar.setText(LunarCalender.convertToChineseMonth(dateList[1]) + | ||
| 383 | -// LunarCalender.getChinaDayString(dateList[2])); | 386 | + dateList = CalendarUtil.solarToLunar(date); |
| 387 | + chinesecalendar.setText(LunarCalender.convertToChineseMonth(dateList[1]) + | ||
| 388 | + LunarCalender.getChinaDayString(dateList[2])); | ||
| 384 | 389 | ||
| 385 | } catch (Exception e) { | 390 | } catch (Exception e) { |
| 386 | e.printStackTrace(); | 391 | e.printStackTrace(); |
| @@ -391,9 +396,9 @@ public class AudioChannelActivity extends BaseActivity { | @@ -391,9 +396,9 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 391 | 396 | ||
| 392 | //时间转换后:yyyy-MM-dd-HHmmssSSS | 397 | //时间转换后:yyyy-MM-dd-HHmmssSSS |
| 393 | String serverTime = ""; | 398 | String serverTime = ""; |
| 394 | - if(HostUtil.serverTime == 0) { | 399 | + if (HostUtil.serverTime == 0) { |
| 395 | serverTime = TimeUtil.getDateTimeFromMillisecond(System.currentTimeMillis()); | 400 | serverTime = TimeUtil.getDateTimeFromMillisecond(System.currentTimeMillis()); |
| 396 | - }else{ | 401 | + } else { |
| 397 | try { | 402 | try { |
| 398 | serverTime = TimeUtil.getDateTimeFromMillisecond(HostUtil.serverTime); | 403 | serverTime = TimeUtil.getDateTimeFromMillisecond(HostUtil.serverTime); |
| 399 | } catch (Exception e) { | 404 | } catch (Exception e) { |
| @@ -401,7 +406,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -401,7 +406,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 401 | } | 406 | } |
| 402 | } | 407 | } |
| 403 | String[] split = serverTime.split("-"); | 408 | String[] split = serverTime.split("-"); |
| 404 | - if(split != null && split.length >1) { | 409 | + if (split != null && split.length > 1) { |
| 405 | calendar.setText(split[1]); | 410 | calendar.setText(split[1]); |
| 406 | calendar1.setText(split[2]); | 411 | calendar1.setText(split[2]); |
| 407 | } | 412 | } |
| @@ -412,8 +417,8 @@ public class AudioChannelActivity extends BaseActivity { | @@ -412,8 +417,8 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 412 | public void onChanged(Boolean aBoolean) { | 417 | public void onChanged(Boolean aBoolean) { |
| 413 | forLiveDataBus = 1; | 418 | forLiveDataBus = 1; |
| 414 | VoicePlayerBean currentMusic = PlayerManager.getInstance().getCurrentPlayingMusic(); | 419 | VoicePlayerBean currentMusic = PlayerManager.getInstance().getCurrentPlayingMusic(); |
| 415 | - if(currentMusic!= null && !TextUtils.isEmpty(currentMusic.getUrl()) | ||
| 416 | - && voicePlayerBeansTodaysRecommendation!= null && voicePlayerBeansTodaysRecommendation.size()>0){ | 420 | + if (currentMusic != null && !TextUtils.isEmpty(currentMusic.getUrl()) |
| 421 | + && voicePlayerBeansTodaysRecommendation != null && voicePlayerBeansTodaysRecommendation.size() > 0) { | ||
| 417 | //设置必须的audioList | 422 | //设置必须的audioList |
| 418 | for (VoicePlayerBean voicePlayerBean : voicePlayerBeansTodaysRecommendation) { | 423 | for (VoicePlayerBean voicePlayerBean : voicePlayerBeansTodaysRecommendation) { |
| 419 | if (currentMusic.isSameObject(voicePlayerBean)) { | 424 | if (currentMusic.isSameObject(voicePlayerBean)) { |
| @@ -460,19 +465,19 @@ public class AudioChannelActivity extends BaseActivity { | @@ -460,19 +465,19 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 460 | channelId = jsonObject.getString(IntentConstants.PARAM_CHANNEL_ID); | 465 | channelId = jsonObject.getString(IntentConstants.PARAM_CHANNEL_ID); |
| 461 | //设置缓存数据 | 466 | //设置缓存数据 |
| 462 | CacheData localCacheDataPage = CacheData.getLocalCacheData(CacheData.audioChannelCacheKey); | 467 | CacheData localCacheDataPage = CacheData.getLocalCacheData(CacheData.audioChannelCacheKey); |
| 463 | - if(localCacheDataPage != null && !TextUtils.isEmpty(localCacheDataPage.getNetWorkData())){ | 468 | + if (localCacheDataPage != null && !TextUtils.isEmpty(localCacheDataPage.getNetWorkData())) { |
| 464 | dealPageInfo(GsonUtils.fromJson(localCacheDataPage.getNetWorkData(), PageBean.class)); | 469 | dealPageInfo(GsonUtils.fromJson(localCacheDataPage.getNetWorkData(), PageBean.class)); |
| 465 | hasUseCache = true; | 470 | hasUseCache = true; |
| 466 | - }else{ | 471 | + } else { |
| 467 | skeletondiagram.setVisibility(View.VISIBLE); | 472 | skeletondiagram.setVisibility(View.VISIBLE); |
| 468 | } | 473 | } |
| 469 | - CacheData localCacheTodaysRecommendation = CacheData.getLocalCacheData(CacheData.audioChannelCacheKey+0); | ||
| 470 | - if(localCacheTodaysRecommendation != null && !TextUtils.isEmpty(localCacheTodaysRecommendation.getNetWorkData())){ | 474 | + CacheData localCacheTodaysRecommendation = CacheData.getLocalCacheData(CacheData.audioChannelCacheKey + 0); |
| 475 | + if (localCacheTodaysRecommendation != null && !TextUtils.isEmpty(localCacheTodaysRecommendation.getNetWorkData())) { | ||
| 471 | dealTodaysRecommendation(GsonUtils.fromJson(localCacheTodaysRecommendation.getNetWorkData(), GroupBean.class)); | 476 | dealTodaysRecommendation(GsonUtils.fromJson(localCacheTodaysRecommendation.getNetWorkData(), GroupBean.class)); |
| 472 | hasUseCache = true; | 477 | hasUseCache = true; |
| 473 | } | 478 | } |
| 474 | - CacheData localCacheSelectedColumns = CacheData.getLocalCacheData(CacheData.audioChannelCacheKey+1); | ||
| 475 | - if(localCacheSelectedColumns != null && !TextUtils.isEmpty(localCacheSelectedColumns.getNetWorkData())){ | 479 | + CacheData localCacheSelectedColumns = CacheData.getLocalCacheData(CacheData.audioChannelCacheKey + 1); |
| 480 | + if (localCacheSelectedColumns != null && !TextUtils.isEmpty(localCacheSelectedColumns.getNetWorkData())) { | ||
| 476 | dealSelectedColumns(GsonUtils.fromJson(localCacheSelectedColumns.getNetWorkData(), GroupBean.class)); | 481 | dealSelectedColumns(GsonUtils.fromJson(localCacheSelectedColumns.getNetWorkData(), GroupBean.class)); |
| 477 | hasUseCache = true; | 482 | hasUseCache = true; |
| 478 | } | 483 | } |
| @@ -481,12 +486,12 @@ public class AudioChannelActivity extends BaseActivity { | @@ -481,12 +486,12 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 481 | CommonNetUtils.getInstance().loadAudioChannelData(channelId, pageId, new AudioChannelBack() { | 486 | CommonNetUtils.getInstance().loadAudioChannelData(channelId, pageId, new AudioChannelBack() { |
| 482 | @Override | 487 | @Override |
| 483 | public void loadAudioChannelSuccess(PageBean pageBean, MetaBean metaBean, String msg, int code) { | 488 | public void loadAudioChannelSuccess(PageBean pageBean, MetaBean metaBean, String msg, int code) { |
| 484 | - if (null == pageBean){ | 489 | + if (null == pageBean) { |
| 485 | return; | 490 | return; |
| 486 | } | 491 | } |
| 487 | skeletondiagram.setVisibility(View.GONE); | 492 | skeletondiagram.setVisibility(View.GONE); |
| 488 | // 新旧数据md5值对比,本地无md5说明没有缓存数据 | 493 | // 新旧数据md5值对比,本地无md5说明没有缓存数据 |
| 489 | - if(localCacheDataPage == null || localCacheDataPage.md5 == null || !localCacheDataPage.md5.equals(metaBean.getMd5())){ | 494 | + if (localCacheDataPage == null || localCacheDataPage.md5 == null || !localCacheDataPage.md5.equals(metaBean.getMd5())) { |
| 490 | // 更新缓存数据 | 495 | // 更新缓存数据 |
| 491 | CacheData.saveDataToPreference(CacheData.audioChannelCacheKey, pageBean, metaBean.getMd5()); | 496 | CacheData.saveDataToPreference(CacheData.audioChannelCacheKey, pageBean, metaBean.getMd5()); |
| 492 | dealPageInfo(pageBean); | 497 | dealPageInfo(pageBean); |
| @@ -495,13 +500,13 @@ public class AudioChannelActivity extends BaseActivity { | @@ -495,13 +500,13 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 495 | 500 | ||
| 496 | @Override | 501 | @Override |
| 497 | public void loadTodaysRecommendationSuccess(GroupBean groupBean, MetaBean metaBean, String msg, int code) { | 502 | public void loadTodaysRecommendationSuccess(GroupBean groupBean, MetaBean metaBean, String msg, int code) { |
| 498 | - if (null == groupBean){ | 503 | + if (null == groupBean) { |
| 499 | return; | 504 | return; |
| 500 | } | 505 | } |
| 501 | // 新旧数据md5值对比 | 506 | // 新旧数据md5值对比 |
| 502 | - if(localCacheTodaysRecommendation == null || localCacheTodaysRecommendation.md5 == null || !localCacheTodaysRecommendation.md5.equals(metaBean.getMd5())){ | 507 | + if (localCacheTodaysRecommendation == null || localCacheTodaysRecommendation.md5 == null || !localCacheTodaysRecommendation.md5.equals(metaBean.getMd5())) { |
| 503 | // 更新缓存数据 | 508 | // 更新缓存数据 |
| 504 | - CacheData.saveDataToPreference(CacheData.audioChannelCacheKey+0, groupBean, metaBean.getMd5()); | 509 | + CacheData.saveDataToPreference(CacheData.audioChannelCacheKey + 0, groupBean, metaBean.getMd5()); |
| 505 | //今日推荐 | 510 | //今日推荐 |
| 506 | dealTodaysRecommendation(groupBean); | 511 | dealTodaysRecommendation(groupBean); |
| 507 | } | 512 | } |
| @@ -510,35 +515,35 @@ public class AudioChannelActivity extends BaseActivity { | @@ -510,35 +515,35 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 510 | 515 | ||
| 511 | @Override | 516 | @Override |
| 512 | public void loadSelectedColumnsSuccess(GroupBean groupBean, MetaBean metaBean, String msg, int code) { | 517 | public void loadSelectedColumnsSuccess(GroupBean groupBean, MetaBean metaBean, String msg, int code) { |
| 513 | - if (null == groupBean){ | 518 | + if (null == groupBean) { |
| 514 | return; | 519 | return; |
| 515 | } | 520 | } |
| 516 | // 新旧数据md5值对比 | 521 | // 新旧数据md5值对比 |
| 517 | - if(localCacheSelectedColumns == null || localCacheSelectedColumns.md5 == null || !localCacheSelectedColumns.md5.equals(metaBean.getMd5())){ | 522 | + if (localCacheSelectedColumns == null || localCacheSelectedColumns.md5 == null || !localCacheSelectedColumns.md5.equals(metaBean.getMd5())) { |
| 518 | // 更新缓存数据 | 523 | // 更新缓存数据 |
| 519 | - CacheData.saveDataToPreference(CacheData.audioChannelCacheKey+1, groupBean, metaBean.getMd5()); | 524 | + CacheData.saveDataToPreference(CacheData.audioChannelCacheKey + 1, groupBean, metaBean.getMd5()); |
| 520 | dealSelectedColumns(groupBean); | 525 | dealSelectedColumns(groupBean); |
| 521 | } | 526 | } |
| 522 | } | 527 | } |
| 523 | 528 | ||
| 524 | @Override | 529 | @Override |
| 525 | public void loadFail() { | 530 | public void loadFail() { |
| 526 | - if (finalHasUseCache){ | 531 | + if (finalHasUseCache) { |
| 527 | return; | 532 | return; |
| 528 | } | 533 | } |
| 529 | skeletondiagram.setVisibility(View.GONE); | 534 | skeletondiagram.setVisibility(View.GONE); |
| 530 | // 展示缺省页 | 535 | // 展示缺省页 |
| 531 | - defaultView.show(DefaultViewConstant.TYPE_GET_CONTENT_FAILED_VIDEO,true,false); | 536 | + defaultView.show(DefaultViewConstant.TYPE_GET_CONTENT_FAILED_VIDEO, true, false); |
| 532 | defaultView.setBackground(ResUtils.getDrawable(R.color.white)); | 537 | defaultView.setBackground(ResUtils.getDrawable(R.color.white)); |
| 533 | } | 538 | } |
| 534 | 539 | ||
| 535 | @Override | 540 | @Override |
| 536 | public void noNetwork() { | 541 | public void noNetwork() { |
| 537 | - if (finalHasUseCache){ | 542 | + if (finalHasUseCache) { |
| 538 | return; | 543 | return; |
| 539 | } | 544 | } |
| 540 | // 展示缺省页 | 545 | // 展示缺省页 |
| 541 | - defaultView.show(DefaultViewConstant.TYPE_NO_NETWORK,true,false); | 546 | + defaultView.show(DefaultViewConstant.TYPE_NO_NETWORK, true, false); |
| 542 | defaultView.setBackground(ResUtils.getDrawable(R.color.white)); | 547 | defaultView.setBackground(ResUtils.getDrawable(R.color.white)); |
| 543 | } | 548 | } |
| 544 | }); | 549 | }); |
| @@ -564,7 +569,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -564,7 +569,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 564 | } | 569 | } |
| 565 | 570 | ||
| 566 | //添加挂角 | 571 | //添加挂角 |
| 567 | - advLogic(pageBean,false); | 572 | + advLogic(pageBean, false); |
| 568 | 573 | ||
| 569 | //添加彩蛋 | 574 | //添加彩蛋 |
| 570 | handlerPopUps(pageBean); | 575 | handlerPopUps(pageBean); |
| @@ -581,7 +586,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -581,7 +586,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 581 | simpleAudioThemeBean.contentBean = mSelectedColumnsGroupBean.getComps().get(i).getOperDataList().get(0); | 586 | simpleAudioThemeBean.contentBean = mSelectedColumnsGroupBean.getComps().get(i).getOperDataList().get(0); |
| 582 | simpleAudioThemeBeanList.add(simpleAudioThemeBean); | 587 | simpleAudioThemeBeanList.add(simpleAudioThemeBean); |
| 583 | } | 588 | } |
| 584 | - ProcessUtils.JumpToAudioTopic(simpleAudioThemeBeanList,selectPosition); | 589 | + ProcessUtils.JumpToAudioTopic(simpleAudioThemeBeanList, selectPosition); |
| 585 | } | 590 | } |
| 586 | 591 | ||
| 587 | /** | 592 | /** |
| @@ -611,11 +616,11 @@ public class AudioChannelActivity extends BaseActivity { | @@ -611,11 +616,11 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 611 | 616 | ||
| 612 | @Override | 617 | @Override |
| 613 | protected void onSuccess(List<AudioPlaybackQuantityBean> audioPlaybackQuantityBeans) { | 618 | protected void onSuccess(List<AudioPlaybackQuantityBean> audioPlaybackQuantityBeans) { |
| 614 | - if(audioPlaybackQuantityBeans != null && audioPlaybackQuantityBeans.size() > 0){ | ||
| 615 | - for(AudioPlaybackQuantityBean audioPlaybackQuantityBean:audioPlaybackQuantityBeans){ | ||
| 616 | - if(audioPlaybackQuantityBean != null && !TextUtils.isEmpty(audioPlaybackQuantityBean.getTopicId())){ | ||
| 617 | - for(int i = 0; i < groupBean.getComps().size(); i++){ | ||
| 618 | - if(audioPlaybackQuantityBean.getTopicId().equals(groupBean.getComps().get(i).getOperDataList().get(0).getObjectId())){ | 619 | + if (audioPlaybackQuantityBeans != null && audioPlaybackQuantityBeans.size() > 0) { |
| 620 | + for (AudioPlaybackQuantityBean audioPlaybackQuantityBean : audioPlaybackQuantityBeans) { | ||
| 621 | + if (audioPlaybackQuantityBean != null && !TextUtils.isEmpty(audioPlaybackQuantityBean.getTopicId())) { | ||
| 622 | + for (int i = 0; i < groupBean.getComps().size(); i++) { | ||
| 623 | + if (audioPlaybackQuantityBean.getTopicId().equals(groupBean.getComps().get(i).getOperDataList().get(0).getObjectId())) { | ||
| 619 | groupBean.getComps().get(i).getOperDataList().get(0).localFieldCommon = audioPlaybackQuantityBean.getWeightViews(); | 624 | groupBean.getComps().get(i).getOperDataList().get(0).localFieldCommon = audioPlaybackQuantityBean.getWeightViews(); |
| 620 | } | 625 | } |
| 621 | } | 626 | } |
| @@ -626,7 +631,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -626,7 +631,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 626 | } | 631 | } |
| 627 | } | 632 | } |
| 628 | }); | 633 | }); |
| 629 | - if(mPageBean != null){ | 634 | + if (mPageBean != null) { |
| 630 | playlistSelectedTopicsAdapter.setPageId(mPageBean.getId()); | 635 | playlistSelectedTopicsAdapter.setPageId(mPageBean.getId()); |
| 631 | playlistSelectedTopicsAdapter.setPageName(mPageBean.getName()); | 636 | playlistSelectedTopicsAdapter.setPageName(mPageBean.getName()); |
| 632 | } | 637 | } |
| @@ -638,8 +643,8 @@ public class AudioChannelActivity extends BaseActivity { | @@ -638,8 +643,8 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 638 | private void contentExposureBuriedPoints(ContentBean contentBean) { | 643 | private void contentExposureBuriedPoints(ContentBean contentBean) { |
| 639 | // 内容曝光 | 644 | // 内容曝光 |
| 640 | TrackContentBean trackContentBean = new TrackContentBean(); | 645 | TrackContentBean trackContentBean = new TrackContentBean(); |
| 641 | - trackContentBean.contentBeantoBean(contentBean,null); | ||
| 642 | - if(mPageBean != null){ | 646 | + trackContentBean.contentBeantoBean(contentBean, null); |
| 647 | + if (mPageBean != null) { | ||
| 643 | trackContentBean.setPage_name(mPageBean.getName()); | 648 | trackContentBean.setPage_name(mPageBean.getName()); |
| 644 | trackContentBean.setPage_id(mPageBean.getId()); | 649 | trackContentBean.setPage_id(mPageBean.getId()); |
| 645 | } | 650 | } |
| @@ -649,9 +654,9 @@ public class AudioChannelActivity extends BaseActivity { | @@ -649,9 +654,9 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 649 | //所属区域regionName,播报为5 | 654 | //所属区域regionName,播报为5 |
| 650 | trackContentBean.setRegion_name(RegionNameConstants.AUDIO); | 655 | trackContentBean.setRegion_name(RegionNameConstants.AUDIO); |
| 651 | //埋点增频道id | 656 | //埋点增频道id |
| 652 | - trackContentBean.setChannelSourceId(StringUtils.isEmpty(channelId)? | 657 | + trackContentBean.setChannelSourceId(StringUtils.isEmpty(channelId) ? |
| 653 | ProcessUtils.CHANNEL_ID_VOICE : channelId); | 658 | ProcessUtils.CHANNEL_ID_VOICE : channelId); |
| 654 | - trackContentBean.setContentShowChannelId(StringUtils.isEmpty(channelId)? | 659 | + trackContentBean.setContentShowChannelId(StringUtils.isEmpty(channelId) ? |
| 655 | ProcessUtils.CHANNEL_ID_VOICE : channelId); | 660 | ProcessUtils.CHANNEL_ID_VOICE : channelId); |
| 656 | //内容曝光 | 661 | //内容曝光 |
| 657 | // CommonTrack.getInstance().contentShowTrack(trackContentBean); | 662 | // CommonTrack.getInstance().contentShowTrack(trackContentBean); |
| @@ -672,8 +677,8 @@ public class AudioChannelActivity extends BaseActivity { | @@ -672,8 +677,8 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 672 | for (CompBean compBean : groupBean.getComps()) { | 677 | for (CompBean compBean : groupBean.getComps()) { |
| 673 | if (compBean.getOperDataList() != null && compBean.getOperDataList().size() > 0) { | 678 | if (compBean.getOperDataList() != null && compBean.getOperDataList().size() > 0) { |
| 674 | ContentBean contentBean = compBean.getOperDataList().get(0); | 679 | ContentBean contentBean = compBean.getOperDataList().get(0); |
| 675 | - index = index+1; | ||
| 676 | - if(index < 4){ | 680 | + index = index + 1; |
| 681 | + if (index < 4) { | ||
| 677 | contentExposureBuriedPoints(contentBean); | 682 | contentExposureBuriedPoints(contentBean); |
| 678 | } | 683 | } |
| 679 | voicePlayerBeansTodaysRecommendation.add(contentBeanToVoicePlayerBean(contentBean)); | 684 | voicePlayerBeansTodaysRecommendation.add(contentBeanToVoicePlayerBean(contentBean)); |
| @@ -690,24 +695,24 @@ public class AudioChannelActivity extends BaseActivity { | @@ -690,24 +695,24 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 690 | 695 | ||
| 691 | //设置必须的audioList | 696 | //设置必须的audioList |
| 692 | for (VoicePlayerBean voicePlayerBean : voicePlayerBeansTodaysRecommendation) { | 697 | for (VoicePlayerBean voicePlayerBean : voicePlayerBeansTodaysRecommendation) { |
| 693 | - if(voicePlayerBean.getAudioDetailBean() == null){ | 698 | + if (voicePlayerBean.getAudioDetailBean() == null) { |
| 694 | voicePlayerBean.setAudioDetailBean(new NewsDetailBean()); | 699 | voicePlayerBean.setAudioDetailBean(new NewsDetailBean()); |
| 695 | } | 700 | } |
| 696 | voicePlayerBean.getAudioDetailBean().setAudioList(audioList); | 701 | voicePlayerBean.getAudioDetailBean().setAudioList(audioList); |
| 697 | if (PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().isSameObject(voicePlayerBean)) { | 702 | if (PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().isSameObject(voicePlayerBean)) { |
| 698 | if (PlayerManager.getInstance().isPlaying()) { | 703 | if (PlayerManager.getInstance().isPlaying()) { |
| 699 | //设置顶部播放按钮为已播放样式 | 704 | //设置顶部播放按钮为已播放样式 |
| 700 | -// playModeIcon.setImageResource(R.mipmap.icon_pause_button); | ||
| 701 | -// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_pause_button); | 705 | + playModeIcon.setImageResource(R.mipmap.icon_pause_button); |
| 706 | + playModeIcon.setTag(R.id.res_clicktag, R.mipmap.icon_pause_button); | ||
| 702 | } else { | 707 | } else { |
| 703 | //设置顶部播放按钮为已暂停样式 | 708 | //设置顶部播放按钮为已暂停样式 |
| 704 | -// playModeIcon.setImageResource(R.mipmap.icon_player_button); | ||
| 705 | -// playModeIcon.setTag(R.id.res_clicktag,R.mipmap.icon_player_button); | 709 | + playModeIcon.setImageResource(R.mipmap.icon_player_button); |
| 710 | + playModeIcon.setTag(R.id.res_clicktag, R.mipmap.icon_player_button); | ||
| 706 | } | 711 | } |
| 707 | } | 712 | } |
| 708 | } | 713 | } |
| 709 | //更新数据 | 714 | //更新数据 |
| 710 | - playlistRecommendationAdapter.submitList(voicePlayerBeansTodaysRecommendationTree); | 715 | + playlistRecommendationAdapter.replaceData(voicePlayerBeansTodaysRecommendationTree); |
| 711 | if (voicePlayerBeansTodaysRecommendation.size() > 3) { | 716 | if (voicePlayerBeansTodaysRecommendation.size() > 3) { |
| 712 | showmore.setVisibility(View.VISIBLE); | 717 | showmore.setVisibility(View.VISIBLE); |
| 713 | vline.setVisibility(View.VISIBLE); | 718 | vline.setVisibility(View.VISIBLE); |
| @@ -716,7 +721,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -716,7 +721,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 716 | vline.setVisibility(View.GONE); | 721 | vline.setVisibility(View.GONE); |
| 717 | } | 722 | } |
| 718 | //创建播放器相关数据 | 723 | //创建播放器相关数据 |
| 719 | - mMusicAlbum = new MusicAlbum(groupBean, voicePlayerBeansTodaysRecommendation,4); | 724 | + mMusicAlbum = new MusicAlbum(groupBean, voicePlayerBeansTodaysRecommendation, 4); |
| 720 | mMusicAlbum.setAlbumId(groupBean.getId()); | 725 | mMusicAlbum.setAlbumId(groupBean.getId()); |
| 721 | } | 726 | } |
| 722 | } | 727 | } |
| @@ -726,8 +731,8 @@ public class AudioChannelActivity extends BaseActivity { | @@ -726,8 +731,8 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 726 | } | 731 | } |
| 727 | 732 | ||
| 728 | public void togglePlay() { | 733 | public void togglePlay() { |
| 729 | - if (mMusicAlbum==null){ | ||
| 730 | -// ToastNightUtil.showShort(ResUtils.getString(R.string.audio_no_content)); | 734 | + if (mMusicAlbum == null) { |
| 735 | + ToastNightUtil.showShort(ResUtils.getString(R.string.audio_no_content)); | ||
| 731 | return; | 736 | return; |
| 732 | } | 737 | } |
| 733 | boolean hasMusic = false; | 738 | boolean hasMusic = false; |
| @@ -735,14 +740,14 @@ public class AudioChannelActivity extends BaseActivity { | @@ -735,14 +740,14 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 735 | if (PlayerManager.getInstance().getAlbum() == null || TextUtils.isEmpty(PlayerManager.getInstance().getAlbum().getAlbumId()) || | 740 | if (PlayerManager.getInstance().getAlbum() == null || TextUtils.isEmpty(PlayerManager.getInstance().getAlbum().getAlbumId()) || |
| 736 | !PlayerManager.getInstance().getAlbum().getAlbumId().equals(mMusicAlbum.getAlbumId())) { | 741 | !PlayerManager.getInstance().getAlbum().getAlbumId().equals(mMusicAlbum.getAlbumId())) { |
| 737 | VoicePlayerBean voicePlayerBean = PlayerManager.getInstance().getCurrentPlayingMusic(); | 742 | VoicePlayerBean voicePlayerBean = PlayerManager.getInstance().getCurrentPlayingMusic(); |
| 738 | - if(voicePlayerBean != null && mMusicAlbum != null && mMusicAlbum.getMusics() != null && mMusicAlbum.getMusics().size()>0){ | ||
| 739 | - for(VoicePlayerBean v : mMusicAlbum.getMusics()){ | ||
| 740 | - if(voicePlayerBean.isSameObject(v)){ | 743 | + if (voicePlayerBean != null && mMusicAlbum != null && mMusicAlbum.getMusics() != null && mMusicAlbum.getMusics().size() > 0) { |
| 744 | + for (VoicePlayerBean v : mMusicAlbum.getMusics()) { | ||
| 745 | + if (voicePlayerBean.isSameObject(v)) { | ||
| 741 | hasMusic = true; | 746 | hasMusic = true; |
| 742 | } | 747 | } |
| 743 | } | 748 | } |
| 744 | } | 749 | } |
| 745 | - if(!hasMusic){ | 750 | + if (!hasMusic) { |
| 746 | PlayerManager.getInstance().singleListChange(); | 751 | PlayerManager.getInstance().singleListChange(); |
| 747 | PlayerManager.getInstance().loadAlbum(mMusicAlbum); | 752 | PlayerManager.getInstance().loadAlbum(mMusicAlbum); |
| 748 | } | 753 | } |
| @@ -751,11 +756,11 @@ public class AudioChannelActivity extends BaseActivity { | @@ -751,11 +756,11 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 751 | isStart = true; | 756 | isStart = true; |
| 752 | } | 757 | } |
| 753 | boolean ispause; | 758 | boolean ispause; |
| 754 | - if (playModeIcon.getTag(R.id.res_clicktag) == null || (int)playModeIcon.getTag(R.id.res_clicktag) == R.mipmap.icon_player_button) { | ||
| 755 | - if(PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().getType() != 4){ | 759 | + if (playModeIcon.getTag(R.id.res_clicktag) == null || (int) playModeIcon.getTag(R.id.res_clicktag) == R.mipmap.icon_player_button) { |
| 760 | + if (PlayerManager.getInstance().getCurrentPlayingMusic() != null && PlayerManager.getInstance().getCurrentPlayingMusic().getType() != 4) { | ||
| 756 | ispause = false; | 761 | ispause = false; |
| 757 | PlayerManager.getInstance().playAudio(); | 762 | PlayerManager.getInstance().playAudio(); |
| 758 | - }else{ | 763 | + } else { |
| 759 | ispause = true; | 764 | ispause = true; |
| 760 | PlayerManager.getInstance().pauseAudio(); | 765 | PlayerManager.getInstance().pauseAudio(); |
| 761 | PlayerManager.getInstance().togglePlay(); | 766 | PlayerManager.getInstance().togglePlay(); |
| @@ -769,7 +774,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -769,7 +774,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 769 | ispause = true; | 774 | ispause = true; |
| 770 | PlayerManager.getInstance().pauseAudio(); | 775 | PlayerManager.getInstance().pauseAudio(); |
| 771 | } | 776 | } |
| 772 | - if(!hasMusic && !ispause){ | 777 | + if (!hasMusic && !ispause) { |
| 773 | PlayerManager.getInstance().unfoldAnimation(); | 778 | PlayerManager.getInstance().unfoldAnimation(); |
| 774 | } | 779 | } |
| 775 | } | 780 | } |
| @@ -794,7 +799,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -794,7 +799,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 794 | super.onDestroy(); | 799 | super.onDestroy(); |
| 795 | //页面浏览 | 800 | //页面浏览 |
| 796 | TrackContentBean trackContentBean = new TrackContentBean(); | 801 | TrackContentBean trackContentBean = new TrackContentBean(); |
| 797 | - if(mPageBean != null){ | 802 | + if (mPageBean != null) { |
| 798 | trackContentBean.setPage_name(mPageBean.getName()); | 803 | trackContentBean.setPage_name(mPageBean.getName()); |
| 799 | trackContentBean.setPage_id(mPageBean.getId()); | 804 | trackContentBean.setPage_id(mPageBean.getId()); |
| 800 | } | 805 | } |
| @@ -802,7 +807,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -802,7 +807,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 802 | //所属区域regionName,播报为5 | 807 | //所属区域regionName,播报为5 |
| 803 | trackContentBean.setRegion_name(RegionNameConstants.AUDIO); | 808 | trackContentBean.setRegion_name(RegionNameConstants.AUDIO); |
| 804 | //埋点增频道id | 809 | //埋点增频道id |
| 805 | - trackContentBean.setChannelSourceId(StringUtils.isEmpty(channelId)? | 810 | + trackContentBean.setChannelSourceId(StringUtils.isEmpty(channelId) ? |
| 806 | ProcessUtils.CHANNEL_ID_VOICE : channelId); | 811 | ProcessUtils.CHANNEL_ID_VOICE : channelId); |
| 807 | // CommonTrack.getInstance().channelExposureTrack(trackContentBean); | 812 | // CommonTrack.getInstance().channelExposureTrack(trackContentBean); |
| 808 | 813 | ||
| @@ -818,12 +823,12 @@ public class AudioChannelActivity extends BaseActivity { | @@ -818,12 +823,12 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 818 | /** | 823 | /** |
| 819 | * 调用挂角广告逻辑 | 824 | * 调用挂角广告逻辑 |
| 820 | */ | 825 | */ |
| 821 | - private void advLogic(PageBean pageBean,boolean isResume) { | 826 | + private void advLogic(PageBean pageBean, boolean isResume) { |
| 822 | if (cornerAdvLogic != null) { | 827 | if (cornerAdvLogic != null) { |
| 823 | if (getWindow() != null) { | 828 | if (getWindow() != null) { |
| 824 | Window window = getWindow(); | 829 | Window window = getWindow(); |
| 825 | cornerAdvLogic.setDragViewType(0); | 830 | cornerAdvLogic.setDragViewType(0); |
| 826 | - cornerAdvLogic.handlerAdLogic(this,pageBean, false, window,isResume); | 831 | + cornerAdvLogic.handlerAdLogic(this, pageBean, false, window, isResume); |
| 827 | } | 832 | } |
| 828 | } | 833 | } |
| 829 | } | 834 | } |
| @@ -885,7 +890,7 @@ public class AudioChannelActivity extends BaseActivity { | @@ -885,7 +890,7 @@ public class AudioChannelActivity extends BaseActivity { | ||
| 885 | public VoicePlayerBean contentBeanToVoicePlayerBean(ContentBean contentBean) { | 890 | public VoicePlayerBean contentBeanToVoicePlayerBean(ContentBean contentBean) { |
| 886 | VoicePlayerBean voicePlayerBean = new VoicePlayerBean(); | 891 | VoicePlayerBean voicePlayerBean = new VoicePlayerBean(); |
| 887 | voicePlayerBean.contentBean = contentBean; | 892 | voicePlayerBean.contentBean = contentBean; |
| 888 | - if(mPageBean != null){ | 893 | + if (mPageBean != null) { |
| 889 | voicePlayerBean.pageId = mPageBean.getId(); | 894 | voicePlayerBean.pageId = mPageBean.getId(); |
| 890 | voicePlayerBean.pageName = mPageBean.getName(); | 895 | voicePlayerBean.pageName = mPageBean.getName(); |
| 891 | } | 896 | } |
| 1 | -/* | ||
| 2 | - * Copyright 2018-present KunMinX | ||
| 3 | - * | ||
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | - * you may not use this file except in compliance with the License. | ||
| 6 | - * You may obtain a copy of the License at | ||
| 7 | - * | ||
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | - * | ||
| 10 | - * Unless required by applicable law or agreed to in writing, software | ||
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | - * See the License for the specific language governing permissions and | ||
| 14 | - * limitations under the License. | ||
| 15 | - */ | ||
| 16 | - | ||
| 17 | -package com.wd.musicplayer.ui.page; | ||
| 18 | - | ||
| 19 | -import android.os.Bundle; | ||
| 20 | -import android.view.View; | ||
| 21 | - | ||
| 22 | -import androidx.annotation.NonNull; | ||
| 23 | -import androidx.annotation.Nullable; | ||
| 24 | -import androidx.lifecycle.ViewModel; | ||
| 25 | - | ||
| 26 | -; | ||
| 27 | - | ||
| 28 | - | ||
| 29 | -import com.kunminx.architecture.ui.page.DataBindingConfig; | ||
| 30 | -import com.kunminx.architecture.ui.state.State; | ||
| 31 | -import com.wd.basemusic.ui.page.BaseFragment; | ||
| 32 | -import com.wd.musicplayer.BR; | ||
| 33 | -import com.wd.musicplayer.R; | ||
| 34 | -import com.wd.musicplayer.data.bean.LibraryInfo; | ||
| 35 | -import com.wd.musicplayer.domain.request.InfoRequester; | ||
| 36 | -import com.wd.musicplayer.ui.page.adapter.DrawerAdapter; | ||
| 37 | - | ||
| 38 | -import java.util.ArrayList; | ||
| 39 | -import java.util.List; | ||
| 40 | - | ||
| 41 | -/** | ||
| 42 | - * @Author :张泽昊 | ||
| 43 | - * @Email :1064771680@qq.com | ||
| 44 | - * @Date :on 2023/7/7 17:49. | ||
| 45 | - * @Description :测试界面 | ||
| 46 | - */ | ||
| 47 | -public class DrawerFragment extends BaseFragment { | ||
| 48 | - | ||
| 49 | - private DrawerViewModel mStates; | ||
| 50 | - private InfoRequester mInfoRequester; | ||
| 51 | - | ||
| 52 | - @Override | ||
| 53 | - protected void initViewModel() { | ||
| 54 | - mStates = getFragmentScopeViewModel(DrawerViewModel.class); | ||
| 55 | - mInfoRequester = getFragmentScopeViewModel(InfoRequester.class); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - @Override | ||
| 59 | - protected DataBindingConfig getDataBindingConfig() { | ||
| 60 | - return new DataBindingConfig(R.layout.fragment_drawer, BR.vm, mStates) | ||
| 61 | - .addBindingParam(BR.click, new ClickProxy()) | ||
| 62 | - .addBindingParam(BR.adapter, new DrawerAdapter(getContext())); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - @Override | ||
| 66 | - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
| 67 | - super.onViewCreated(view, savedInstanceState); | ||
| 68 | - | ||
| 69 | - mInfoRequester.getLibraryResult().observe(getViewLifecycleOwner(), dataResult -> { | ||
| 70 | - if (!dataResult.getResponseStatus().isSuccess()) { | ||
| 71 | - return; | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - if (dataResult.getResult() != null) { | ||
| 75 | - mStates.list.set(dataResult.getResult()); | ||
| 76 | - } | ||
| 77 | - }); | ||
| 78 | - | ||
| 79 | - if (mInfoRequester.getLibraryResult().getValue() == null) { | ||
| 80 | - mInfoRequester.requestLibraryInfo(); | ||
| 81 | - } | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public class ClickProxy { | ||
| 85 | - public void logoClick() { | ||
| 86 | - openUrlInBrowser(getString(R.string.github_project)); | ||
| 87 | - } | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - public static class DrawerViewModel extends ViewModel { | ||
| 91 | - public final State<List<LibraryInfo>> list = new State<>(new ArrayList<>()); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | -} |
| @@ -16,63 +16,101 @@ | @@ -16,63 +16,101 @@ | ||
| 16 | 16 | ||
| 17 | package com.wd.musicplayer.ui.page.adapter; | 17 | package com.wd.musicplayer.ui.page.adapter; |
| 18 | 18 | ||
| 19 | -import android.content.Context; | ||
| 20 | import android.graphics.Typeface; | 19 | import android.graphics.Typeface; |
| 21 | -import android.text.TextUtils; | ||
| 22 | import android.view.View; | 20 | import android.view.View; |
| 21 | +import android.widget.TextView; | ||
| 23 | 22 | ||
| 23 | +import androidx.annotation.NonNull; | ||
| 24 | +import androidx.appcompat.widget.AppCompatImageView; | ||
| 24 | import androidx.core.content.ContextCompat; | 25 | import androidx.core.content.ContextCompat; |
| 25 | -import androidx.recyclerview.widget.RecyclerView; | ||
| 26 | 26 | ||
| 27 | +import com.airbnb.lottie.LottieAnimationView; | ||
| 27 | import com.airbnb.lottie.LottieDrawable; | 28 | import com.airbnb.lottie.LottieDrawable; |
| 28 | -import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter; | 29 | +import com.chad.library.adapter.base.BaseQuickAdapter; |
| 30 | +import com.chad.library.adapter.base.BaseViewHolder; | ||
| 29 | import com.wd.common.floatingview.FloatWindow; | 31 | import com.wd.common.floatingview.FloatWindow; |
| 32 | +import com.wd.foundation.bean.music.bean.VoicePlayerBean; | ||
| 30 | import com.wd.musicplayer.R; | 33 | import com.wd.musicplayer.R; |
| 31 | -import com.wd.musicplayer.databinding.AdapterPlayRecommendationBinding; | ||
| 32 | import com.wd.musicplayer.player.PlayerManager; | 34 | import com.wd.musicplayer.player.PlayerManager; |
| 33 | -import com.wd.musicplayer.ui.activity.AudioChannelActivity; | ||
| 34 | -import com.wd.foundation.bean.music.bean.VoicePlayerBean; | ||
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | * Create by KunMinX at 20/4/19 | 37 | * Create by KunMinX at 20/4/19 |
| 38 | */ | 38 | */ |
| 39 | -public class PlaylistRecommendationAdapter extends SimpleDataBindingAdapter<VoicePlayerBean, AdapterPlayRecommendationBinding> { | 39 | +public class PlaylistRecommendationAdapter extends BaseQuickAdapter<VoicePlayerBean, BaseViewHolder> { |
| 40 | private boolean topause = true; | 40 | private boolean topause = true; |
| 41 | - public PlaylistRecommendationAdapter(Context context) { | ||
| 42 | - super(context, R.layout.adapter_play_recommendation, DiffUtils.getInstance().getVoicePlayerBeanItemCallback()); | 41 | + |
| 42 | + public PlaylistRecommendationAdapter(int layoutResId) { | ||
| 43 | + super(layoutResId); | ||
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | @Override | 46 | @Override |
| 46 | - protected void onBindItem(AdapterPlayRecommendationBinding binding, VoicePlayerBean item, RecyclerView.ViewHolder holder) { | ||
| 47 | - binding.setAlbum(item); | ||
| 48 | - binding.textView2.setText(item.getTitle()); | ||
| 49 | - if (item.isSameObject(PlayerManager.getInstance().getCurrentPlayingMusic()) && FloatWindow.get()!= null && !FloatWindow.get().getColseed()){ | ||
| 50 | - binding.lottieplaytag.setAnimation("playlistrecommendationgif.json"); | ||
| 51 | - binding.lottieplaytag.setRepeatCount(LottieDrawable.INFINITE); | ||
| 52 | - if(topause){ | ||
| 53 | - if(PlayerManager.getInstance().isPlaying()){ | ||
| 54 | - binding.lottieplaytag.playAnimation(); | ||
| 55 | - }else{ | ||
| 56 | - binding.lottieplaytag.pauseAnimation(); | 47 | + protected void convert(@NonNull BaseViewHolder holder, VoicePlayerBean item) { |
| 48 | + TextView textView2 = holder.getView(R.id.textView2); | ||
| 49 | + LottieAnimationView lottieAnimationView = holder.getView(R.id.lottieplaytag); | ||
| 50 | + AppCompatImageView ivPlayStatus = holder.getView(R.id.iv_play_status); | ||
| 51 | + textView2.setText(item.getTitle()); | ||
| 52 | + if (item.isSameObject(PlayerManager.getInstance().getCurrentPlayingMusic()) && FloatWindow.get() != null && !FloatWindow.get().getColseed()) { | ||
| 53 | + lottieAnimationView.setAnimation("playlistrecommendationgif.json"); | ||
| 54 | + lottieAnimationView.setRepeatCount(LottieDrawable.INFINITE); | ||
| 55 | + if (topause) { | ||
| 56 | + if (PlayerManager.getInstance().isPlaying()) { | ||
| 57 | + lottieAnimationView.playAnimation(); | ||
| 58 | + } else { | ||
| 59 | + lottieAnimationView.pauseAnimation(); | ||
| 57 | } | 60 | } |
| 58 | - }else{ | ||
| 59 | - binding.lottieplaytag.playAnimation(); | 61 | + } else { |
| 62 | + lottieAnimationView.playAnimation(); | ||
| 60 | } | 63 | } |
| 61 | 64 | ||
| 62 | - binding.ivPlayStatus.setVisibility(View.GONE); | 65 | + ivPlayStatus.setVisibility(View.GONE); |
| 63 | 66 | ||
| 64 | - binding.lottieplaytag.setVisibility(View.VISIBLE); | ||
| 65 | - binding.textView2.setTextColor(ContextCompat.getColor( binding.getRoot().getContext(), R.color.res_color_common_C1)); | ||
| 66 | - binding.textView2.setTypeface(Typeface.DEFAULT_BOLD); | ||
| 67 | - }else { | ||
| 68 | - binding.ivPlayStatus.setVisibility(View.VISIBLE); | ||
| 69 | - binding.lottieplaytag.setVisibility(View.GONE); | ||
| 70 | - binding.ivPlayStatus.setImageResource(R.mipmap.icon_play_stop); | ||
| 71 | - binding.textView2.setTextColor(ContextCompat.getColor( binding.getRoot().getContext(), R.color.res_color_common_C1)); | ||
| 72 | - binding.textView2.setTypeface(Typeface.DEFAULT); | 67 | + lottieAnimationView.setVisibility(View.VISIBLE); |
| 68 | + textView2.setTextColor(ContextCompat.getColor(textView2.getContext(), R.color.res_color_common_C1)); | ||
| 69 | + textView2.setTypeface(Typeface.DEFAULT_BOLD); | ||
| 70 | + } else { | ||
| 71 | + ivPlayStatus.setVisibility(View.VISIBLE); | ||
| 72 | + lottieAnimationView.setVisibility(View.GONE); | ||
| 73 | + ivPlayStatus.setImageResource(R.mipmap.icon_play_stop); | ||
| 74 | + textView2.setTextColor(ContextCompat.getColor(textView2.getContext(), R.color.res_color_common_C1)); | ||
| 75 | + textView2.setTypeface(Typeface.DEFAULT); | ||
| 73 | } | 76 | } |
| 74 | } | 77 | } |
| 75 | - public void setTopause(boolean topause){ | 78 | + |
| 79 | + // public PlaylistRecommendationAdapter(Context context) { | ||
| 80 | +// super(context, R.layout.adapter_play_recommendation, DiffUtils.getInstance().getVoicePlayerBeanItemCallback()); | ||
| 81 | +// } | ||
| 82 | +// | ||
| 83 | +// @Override | ||
| 84 | +// protected void onBindItem(AdapterPlayRecommendationBinding binding, VoicePlayerBean item, RecyclerView.ViewHolder holder) { | ||
| 85 | +// binding.setAlbum(item); | ||
| 86 | +// binding.textView2.setText(item.getTitle()); | ||
| 87 | +// if (item.isSameObject(PlayerManager.getInstance().getCurrentPlayingMusic()) && FloatWindow.get()!= null && !FloatWindow.get().getColseed()){ | ||
| 88 | +// binding.lottieplaytag.setAnimation("playlistrecommendationgif.json"); | ||
| 89 | +// binding.lottieplaytag.setRepeatCount(LottieDrawable.INFINITE); | ||
| 90 | +// if(topause){ | ||
| 91 | +// if(PlayerManager.getInstance().isPlaying()){ | ||
| 92 | +// binding.lottieplaytag.playAnimation(); | ||
| 93 | +// }else{ | ||
| 94 | +// binding.lottieplaytag.pauseAnimation(); | ||
| 95 | +// } | ||
| 96 | +// }else{ | ||
| 97 | +// binding.lottieplaytag.playAnimation(); | ||
| 98 | +// } | ||
| 99 | +// | ||
| 100 | +// binding.ivPlayStatus.setVisibility(View.GONE); | ||
| 101 | +// | ||
| 102 | +// binding.lottieplaytag.setVisibility(View.VISIBLE); | ||
| 103 | +// binding.textView2.setTextColor(ContextCompat.getColor( binding.getRoot().getContext(), R.color.res_color_common_C1)); | ||
| 104 | +// binding.textView2.setTypeface(Typeface.DEFAULT_BOLD); | ||
| 105 | +// }else { | ||
| 106 | +// binding.ivPlayStatus.setVisibility(View.VISIBLE); | ||
| 107 | +// binding.lottieplaytag.setVisibility(View.GONE); | ||
| 108 | +// binding.ivPlayStatus.setImageResource(R.mipmap.icon_play_stop); | ||
| 109 | +// binding.textView2.setTextColor(ContextCompat.getColor( binding.getRoot().getContext(), R.color.res_color_common_C1)); | ||
| 110 | +// binding.textView2.setTypeface(Typeface.DEFAULT); | ||
| 111 | +// } | ||
| 112 | +// } | ||
| 113 | + public void setTopause(boolean topause) { | ||
| 76 | this.topause = topause; | 114 | this.topause = topause; |
| 77 | } | 115 | } |
| 78 | 116 |
| @@ -14,19 +14,9 @@ | @@ -14,19 +14,9 @@ | ||
| 14 | ~ limitations under the License. | 14 | ~ limitations under the License. |
| 15 | --> | 15 | --> |
| 16 | 16 | ||
| 17 | -<layout xmlns:android="http://schemas.android.com/apk/res/android" | 17 | +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| 18 | xmlns:app="http://schemas.android.com/apk/res-auto" | 18 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 19 | - xmlns:tools="http://schemas.android.com/tools"> | ||
| 20 | - | ||
| 21 | - <data> | ||
| 22 | - | ||
| 23 | - <variable | ||
| 24 | - name="album" | ||
| 25 | - type="com.wd.foundation.bean.music.bean.VoicePlayerBean" /> | ||
| 26 | - | ||
| 27 | - </data> | ||
| 28 | - | ||
| 29 | - <androidx.constraintlayout.widget.ConstraintLayout | 19 | + xmlns:tools="http://schemas.android.com/tools" |
| 30 | android:id="@+id/root_view" | 20 | android:id="@+id/root_view" |
| 31 | android:layout_width="match_parent" | 21 | android:layout_width="match_parent" |
| 32 | android:layout_height="@dimen/rmrb_dp50" | 22 | android:layout_height="@dimen/rmrb_dp50" |
| @@ -36,44 +26,40 @@ | @@ -36,44 +26,40 @@ | ||
| 36 | android:id="@+id/textView2" | 26 | android:id="@+id/textView2" |
| 37 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
| 38 | android:layout_height="wrap_content" | 28 | android:layout_height="wrap_content" |
| 39 | - tools:text="jhghjggj" | 29 | + android:layout_marginStart="@dimen/rmrb_dp52" |
| 30 | + android:layout_marginEnd="@dimen/rmrb_dp16" | ||
| 31 | + android:ellipsize="end" | ||
| 32 | + android:maxLines="1" | ||
| 40 | android:textColor="#212228" | 33 | android:textColor="#212228" |
| 41 | android:textSize="@dimen/rmrb_dp17" | 34 | android:textSize="@dimen/rmrb_dp17" |
| 42 | app:layout_constraintBottom_toBottomOf="parent" | 35 | app:layout_constraintBottom_toBottomOf="parent" |
| 43 | app:layout_constraintLeft_toLeftOf="parent" | 36 | app:layout_constraintLeft_toLeftOf="parent" |
| 44 | app:layout_constraintStart_toEndOf="@+id/iv_play_status" | 37 | app:layout_constraintStart_toEndOf="@+id/iv_play_status" |
| 45 | app:layout_constraintTop_toTopOf="parent" | 38 | app:layout_constraintTop_toTopOf="parent" |
| 46 | - android:layout_marginStart="@dimen/rmrb_dp52" | ||
| 47 | - android:layout_marginEnd="@dimen/rmrb_dp16" | ||
| 48 | - android:maxLines="1" | ||
| 49 | - android:ellipsize="end" | ||
| 50 | - /> | 39 | + tools:text="jhghjggj" /> |
| 51 | 40 | ||
| 52 | <androidx.appcompat.widget.AppCompatImageView | 41 | <androidx.appcompat.widget.AppCompatImageView |
| 53 | android:id="@+id/iv_play_status" | 42 | android:id="@+id/iv_play_status" |
| 54 | android:layout_width="@dimen/rmrb_dp24" | 43 | android:layout_width="@dimen/rmrb_dp24" |
| 55 | android:layout_height="@dimen/rmrb_dp24" | 44 | android:layout_height="@dimen/rmrb_dp24" |
| 56 | - app:layout_constraintTop_toTopOf="parent" | ||
| 57 | - app:layout_constraintBottom_toBottomOf="parent" | ||
| 58 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 59 | android:layout_marginStart="@dimen/rmrb_dp16" | 45 | android:layout_marginStart="@dimen/rmrb_dp16" |
| 60 | - android:src="@mipmap/icon_play_stop" | ||
| 61 | android:scaleType="fitXY" | 46 | android:scaleType="fitXY" |
| 62 | - /> | 47 | + android:src="@mipmap/icon_play_stop" |
| 48 | + app:layout_constraintBottom_toBottomOf="parent" | ||
| 49 | + app:layout_constraintLeft_toLeftOf="parent" | ||
| 50 | + app:layout_constraintTop_toTopOf="parent" /> | ||
| 63 | <!--playlistrecommendationgif.json --> | 51 | <!--playlistrecommendationgif.json --> |
| 64 | <com.airbnb.lottie.LottieAnimationView | 52 | <com.airbnb.lottie.LottieAnimationView |
| 65 | android:id="@+id/lottieplaytag" | 53 | android:id="@+id/lottieplaytag" |
| 66 | android:layout_width="@dimen/rmrb_dp24" | 54 | android:layout_width="@dimen/rmrb_dp24" |
| 67 | android:layout_height="@dimen/rmrb_dp24" | 55 | android:layout_height="@dimen/rmrb_dp24" |
| 68 | android:layout_marginStart="@dimen/rmrb_dp16" | 56 | android:layout_marginStart="@dimen/rmrb_dp16" |
| 69 | - app:lottie_autoPlay="false" | ||
| 70 | - app:lottie_loop="false" | ||
| 71 | android:visibility="gone" | 57 | android:visibility="gone" |
| 72 | - app:layout_constraintTop_toTopOf="parent" | ||
| 73 | app:layout_constraintBottom_toBottomOf="parent" | 58 | app:layout_constraintBottom_toBottomOf="parent" |
| 74 | app:layout_constraintLeft_toLeftOf="parent" | 59 | app:layout_constraintLeft_toLeftOf="parent" |
| 75 | - /> | 60 | + app:layout_constraintTop_toTopOf="parent" |
| 61 | + app:lottie_autoPlay="false" | ||
| 62 | + app:lottie_loop="false" /> | ||
| 76 | 63 | ||
| 77 | 64 | ||
| 78 | - </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 79 | -</layout> | ||
| 65 | +</androidx.constraintlayout.widget.ConstraintLayout> |
| 1 | -<?xml version="1.0" encoding="utf-8"?><!-- | ||
| 2 | - ~ Copyright 2018-present KunMinX | ||
| 3 | - ~ | ||
| 4 | - ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | - ~ you may not use this file except in compliance with the License. | ||
| 6 | - ~ You may obtain a copy of the License at | ||
| 7 | - ~ | ||
| 8 | - ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | - ~ | ||
| 10 | - ~ Unless required by applicable law or agreed to in writing, software | ||
| 11 | - ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | - ~ See the License for the specific language governing permissions and | ||
| 14 | - ~ limitations under the License. | ||
| 15 | - --> | ||
| 16 | - | ||
| 17 | -<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 18 | - xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
| 19 | - | ||
| 20 | - <data> | ||
| 21 | - | ||
| 22 | - <variable | ||
| 23 | - name="vm" | ||
| 24 | - type="com.wd.musicplayer.ui.page.DrawerFragment.DrawerViewModel" /> | ||
| 25 | - | ||
| 26 | - <variable | ||
| 27 | - name="click" | ||
| 28 | - type="com.wd.musicplayer.ui.page.DrawerFragment.ClickProxy" /> | ||
| 29 | - | ||
| 30 | - <variable | ||
| 31 | - name="adapter" | ||
| 32 | - type="androidx.recyclerview.widget.RecyclerView.Adapter" /> | ||
| 33 | - </data> | ||
| 34 | - | ||
| 35 | - <androidx.constraintlayout.widget.ConstraintLayout | ||
| 36 | - android:layout_width="match_parent" | ||
| 37 | - android:layout_height="match_parent" | ||
| 38 | - android:background="@color/res_color_common_C8"> | ||
| 39 | - | ||
| 40 | - <androidx.appcompat.widget.AppCompatImageView | ||
| 41 | - android:id="@+id/iv_logo" | ||
| 42 | - android:layout_width="100dp" | ||
| 43 | - android:layout_height="100dp" | ||
| 44 | - android:layout_marginTop="40dp" | ||
| 45 | - android:onClick="@{()->click.logoClick()}" | ||
| 46 | - android:src="@drawable/ic_launcher" | ||
| 47 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 48 | - app:layout_constraintRight_toRightOf="parent" | ||
| 49 | - app:layout_constraintTop_toTopOf="parent" /> | ||
| 50 | - | ||
| 51 | - <TextView | ||
| 52 | - android:id="@+id/tv_app" | ||
| 53 | - android:layout_width="wrap_content" | ||
| 54 | - android:layout_height="wrap_content" | ||
| 55 | - android:layout_marginTop="16dp" | ||
| 56 | - android:background="?attr/selectableItemBackground" | ||
| 57 | - android:onClick="@{()->click.logoClick()}" | ||
| 58 | - android:text="@string/app_name" | ||
| 59 | - android:textColor="@color/black" | ||
| 60 | - android:textSize="20sp" | ||
| 61 | - android:textStyle="bold" | ||
| 62 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 63 | - app:layout_constraintRight_toRightOf="parent" | ||
| 64 | - app:layout_constraintTop_toBottomOf="@+id/iv_logo" /> | ||
| 65 | - | ||
| 66 | - <TextView | ||
| 67 | - android:id="@+id/tv_summary" | ||
| 68 | - android:layout_width="wrap_content" | ||
| 69 | - android:layout_height="wrap_content" | ||
| 70 | - android:layout_marginTop="16dp" | ||
| 71 | - android:background="?attr/selectableItemBackground" | ||
| 72 | - android:onClick="@{()->click.logoClick()}" | ||
| 73 | - android:text="@string/app_summary" | ||
| 74 | - android:textColor="@color/light_gray" | ||
| 75 | - android:textSize="12sp" | ||
| 76 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 77 | - app:layout_constraintRight_toRightOf="parent" | ||
| 78 | - app:layout_constraintTop_toBottomOf="@+id/tv_app" /> | ||
| 79 | - | ||
| 80 | - <androidx.recyclerview.widget.RecyclerView | ||
| 81 | - android:id="@+id/rv" | ||
| 82 | - adapter="@{adapter}" | ||
| 83 | - submitList="@{vm.list}" | ||
| 84 | - android:layout_width="0dp" | ||
| 85 | - android:layout_height="0dp" | ||
| 86 | - android:layout_marginTop="24dp" | ||
| 87 | - app:layoutManager="com.kunminx.binding_recyclerview.layout_manager.WrapContentLinearLayoutManager" | ||
| 88 | - app:layout_constraintBottom_toTopOf="@+id/tv_copyright" | ||
| 89 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 90 | - app:layout_constraintRight_toRightOf="parent" | ||
| 91 | - app:layout_constraintTop_toBottomOf="@+id/tv_summary" /> | ||
| 92 | - | ||
| 93 | - <TextView | ||
| 94 | - android:id="@+id/tv_copyright" | ||
| 95 | - android:layout_width="0dp" | ||
| 96 | - android:layout_height="48dp" | ||
| 97 | - android:background="?attr/selectableItemBackground" | ||
| 98 | - android:gravity="center" | ||
| 99 | - android:onClick="@{()->click.logoClick()}" | ||
| 100 | - android:text="@string/Copyright" | ||
| 101 | - android:textColor="@color/light_gray" | ||
| 102 | - android:textSize="12sp" | ||
| 103 | - app:layout_constraintBottom_toBottomOf="parent" | ||
| 104 | - app:layout_constraintLeft_toLeftOf="parent" | ||
| 105 | - app:layout_constraintRight_toRightOf="parent" | ||
| 106 | - app:layout_constraintTop_toBottomOf="@+id/rv" /> | ||
| 107 | - | ||
| 108 | - </androidx.constraintlayout.widget.ConstraintLayout> | ||
| 109 | -</layout> |
| @@ -20,6 +20,8 @@ | @@ -20,6 +20,8 @@ | ||
| 20 | <string name="recently">最近播放</string> | 20 | <string name="recently">最近播放</string> |
| 21 | <string name="best_practice"> </string> | 21 | <string name="best_practice"> </string> |
| 22 | 22 | ||
| 23 | + <!--音频没有播放内容--> | ||
| 24 | + <string name="audio_no_content">暂无可播放内容</string> | ||
| 23 | 25 | ||
| 24 | <string name="app_summary"> </string> | 26 | <string name="app_summary"> </string> |
| 25 | <string name="project_title"> </string> | 27 | <string name="project_title"> </string> |
-
Please register or login to post a comment