CompentLogicUtil.java 114 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791
package com.wd.capability.layout.uitls;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Layout;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.StaticLayout;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.RequiresApi;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;

import com.airbnb.lottie.LottieAnimationView;
import com.airbnb.lottie.LottieDrawable;
import com.view.text.config.TagConfig;
import com.view.text.config.Type;
import com.view.text.view.TagTextView;
import com.wd.capability.layout.R;
import com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager;
import com.wd.capability.layout.constant.PageNameConstants;
import com.wd.capability.layout.constant.WorksPublishStatusType;
import com.wd.capability.layout.listener.BatchCallback;
import com.wd.foundation.wdkit.constant.Constants;
import com.wd.foundation.wdkit.constant.IntentConstants;
import com.wd.foundation.wdkit.statusbar.StatusBarCompat;
import com.wd.capability.layout.ui.assist.bean.NewSlideShows;
import com.wd.foundation.wdkitcore.tools.HostUtil;
import com.wd.foundation.bean.convenience.AskItemBean;
import com.wd.foundation.bean.custom.act.BaseActivityBean;
import com.wd.foundation.bean.custom.comp.CompBean;
import com.wd.foundation.bean.custom.comp.TopicInfoBean;
import com.wd.foundation.bean.custom.content.CommentItem;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.bean.custom.content.ContentTypeConstant;
import com.wd.foundation.bean.custom.content.PeopleMasterBean;
import com.wd.foundation.bean.livedate.EventMessage;
import com.wd.foundation.bean.mail.LiveInfo;
import com.wd.foundation.bean.mail.ShareInfo;
import com.wd.foundation.bean.mail.SlideShows;
import com.wd.foundation.bean.mail.VideoInfo;
import com.wd.foundation.bean.response.InteractResponseDataBean;
import com.wd.foundation.bean.response.MasterFollowsStatusBean;
import com.wd.foundation.bean.response.PhotoBean;
import com.wd.foundation.wdkit.utils.DeviceUtil;
import com.wd.foundation.wdkit.utils.FilletUtil;
import com.wd.common.imageglide.ImageUtils;
import com.wd.foundation.wdkit.utils.NumberStrUtils;
import com.wd.foundation.wdkit.utils.TimeUtil;
import com.wd.foundation.wdkit.utils.ToastNightUtil;
import com.wd.foundation.wdkit.utils.UiUtils;
import com.wd.foundation.wdkit.view.CircleImageView;
import com.wd.foundation.wdkit.view.RoundImageView;
import com.wd.foundation.wdkitcore.tools.AppContext;
import com.wd.foundation.wdkitcore.tools.ArrayUtils;
import com.wd.foundation.wdkitcore.tools.ResUtils;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import com.wd.foundation.wdkit.utils.SpUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;

/**
 * 组件和稿件业务处理辅助工具类
 *
 * @version 1.0.0
 * @description:
 * @author: liyubing
 * @date :2023/3/7 9:40
 */
public class CompentLogicUtil {

    // 人民号稿件唯一标记集合
    private static final ArrayList<String> rmStyle;

    // 特殊稿件和组件 标记集合,用来处理 粗线和细线
    private static final List<String> lineStyleList;

    //问政系列组件卡
    private static final List<String> wzCompbinationStyleList;

    //需要上一个组件底部线条变粗,加了一个粗线,上面一个就不要了底部线了,两个相邻相似卡只加一条粗线
    private static final List<String> bottomStyleList;

    /**
     * 信息流上专题主动请求保持的pageId+topicId
     */
    public static final List<String> topicRequestIds;

    static {
        rmStyle = new ArrayList<>();
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_TWELVE + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_FOURTEEN + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_FIFTEEN + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_SIXTEEN + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_EIGHTEEN + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_NINETEEN + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_TWENTY + "");
        rmStyle.add(ContentTypeConstant.MANUSCRIPT_STYLE_TWENTY_ONE + "");

        lineStyleList = new ArrayList<>();
        lineStyleList.add(String.valueOf(ContentTypeConstant.MANUSCRIPT_STYLE_NINE));//时间链卡
        lineStyleList.add(String.valueOf(ContentTypeConstant.MANUSCRIPT_STYLE_TEN));//大专题卡
        lineStyleList.add("Zh_Single_Column-09");//兴趣询问卡
        lineStyleList.add("Zh_Single_Row-06");//热门评论卡
        lineStyleList.add("Zh_Single_Row-04");//地方精选卡 25
        // lineStyleList.add(String.valueOf(ContentTypeConstant.MANUSCRIPT_STYLE_TWENTY_THREE));//问政问答卡/问政问题卡
        lineStyleList.add(String.valueOf(ContentTypeConstant.MANUSCRIPT_STYLE_TWENTY_FOURE));//推荐频道问政卡
        lineStyleList.add(String.valueOf(ContentTypeConstant.MANUSCRIPT_STYLE_TWENTY_FIVE));//突发事件卡
        //时间标题
        lineStyleList.add("CompLabel01");
        // 点击展开更多相似卡
        lineStyleList.add("CompBeSimilarMore");
        // 人民热榜卡
        lineStyleList.add("Zh_Single_Column-12");
        //粗线组件
        lineStyleList.add(ContentTypeConstant.CompSubjectLine02);

        wzCompbinationStyleList = new ArrayList<>();
        wzCompbinationStyleList.add("Zh_Single_Column-10");//新增服务组合卡
        wzCompbinationStyleList.add("Zh_Single_Column-11");//新增问政组合卡

        bottomStyleList = new ArrayList<>();
        //粗线组件
        bottomStyleList.add(ContentTypeConstant.CompSubjectLine02);
        //缓存已经请求过的信息流上专题卡数据
        topicRequestIds = new ArrayList<>();
    }

    public static void cleanTopicRequestIds(){
        if (null != topicRequestIds){
            topicRequestIds.clear();
        }
    }

    /**
     * 分享内容
     *
     * @param contentBean
     */
    public static void shareContent(ContentBean contentBean, Context context, CompBean compBean, boolean isMore) {

        ShareInfo shareInfo = contentBean.getShareInfo();
        if (shareInfo == null) {
            ToastNightUtil.showShort("无ShareInfo");
            return;
        }
        // 点击埋点
//        TrackContentBean trackContentBean = new TrackContentBean();
//        trackContentBean.contentBeantoBean(contentBean, compBean);
//        trackContentBean.shareAction();


//        ShareBean bean = new ShareBean();
//        bean.setShowLike(-1);
//        MyShareUtils.setShareData(bean, contentBean);
//
//        //图文分享  参数bean:实体类  参数2:回调,参数3:去掉指定分享平台
//        new MoreDialogTools(context, isMore).showDialog(bean, new ShareResultCallBack() {
//            @Override
//            public void onComplete(String platform, String msg) {
//                if (StringUtils.isEqual(MoreEnum.ADDCOLLECTLABEL + "", platform)) {
//                    //埋点:添加收藏标签
//                    CommonTrack.getInstance().addFavoriteCategoryEventTrack(trackContentBean,
//                            msg);
//                }
//            }
//
//            @Override
//            public void onError(String platform, String msg) {
//
//                ToastNightUtil.showShort(msg);
//            }
//
//            @Override
//            public void onCancel(String platform, String msg) {
//
//            }
//
//            @Override
//            public void onShareClick(String platform, String status) {
//                //收藏埋点
//                if (platform.equals(ShareTypeConstants.COLLECT)) {
//                }
//                //分享埋点
//                else {
//                    trackContentBean.setShare_type(platform);
//                    CommonTrack.getInstance().shareClickTrack(trackContentBean);
//                }
//            }
//
//            @Override
//            public void onCommonClick(String platform, String status) {
//
//            }
//
//
//        });
    }

    /**
     * TopicInfo分享 专题
     *
     * @param topicInfoBean
     * @param context
     */
    public static void shareTopicInfoBean(TopicInfoBean topicInfoBean, Context context) {

        if (topicInfoBean == null) {
            return;
        }
        // 点击埋点
//        TrackContentBean trackContentBean = new TrackContentBean();
//        topicInfoBean.setTitleName(topicInfoBean.getTitle());
//        trackContentBean.topicInfoBeanBeantoBean(topicInfoBean);
//        trackContentBean.shareAction();

//        ShareBean bean = new ShareBean();
//        bean.setContentId(topicInfoBean.getTopicId());
//        bean.setContentType(ContentTypeConstant.URL_TYPE_FIVE + "");
//        bean.setTitle(topicInfoBean.getShareTitle());
//        bean.setDescription(topicInfoBean.getShareSummary());
//        bean.setImageUrl(topicInfoBean.getShareCoverUrl());
//        bean.setSharePosterCoverUrl(topicInfoBean.getSharePosterCoverUrl());
//        //显示CMS配置的海报
//        bean.setSharePosterStyle(topicInfoBean.getSharePosterStyle());
//        bean.setShareUrl(topicInfoBean.getShareUrl());//链接地址
//        bean.setTargetRelId(topicInfoBean.getRelId());
//        bean.setTargetRelType(topicInfoBean.getRelType());
//        bean.setShowReport(false);
//        bean.setShowLike(-1);
//        bean.setShareOpen("1");
//        bean.setSharePosterOpen(topicInfoBean.getPosterFlag() + "");
//        bean.setBackgroundColor(topicInfoBean.getBackgroundColor());
//
//        setTopicBeanToShareBean(bean, topicInfoBean);
//
//        //  bean.setShowCollect(0);
//        bean.setShowPoster(topicInfoBean.getPosterFlag() > 0 ? 1 : -1);
//
//        //图文分享  参数bean:实体类  参数2:回调,参数3:去掉指定分享平台
//        new MoreDialogTools(context, true).showDialog(bean, new ShareResultCallBack() {
//            @Override
//            public void onComplete(String platform, String msg) {
//                if (StringUtils.isEqual(MoreEnum.ADDCOLLECTLABEL + "", platform)) {
//                    //埋点:添加收藏标签
//                    CommonTrack.getInstance().addFavoriteCategoryEventTrack(trackContentBean,
//                            msg);
//                }
//            }
//
//            @Override
//            public void onError(String platform, String msg) {
//
////                ToastNightUtil.showShort(msg);
//            }
//
//            @Override
//            public void onCancel(String platform, String msg) {
//
//            }
//
//            @Override
//            public void onShareClick(String platform, String status) {
//                //收藏埋点
//                if (platform.equals(ShareTypeConstants.COLLECT)) {
//                    //用户未登录,不做处理
////                    if ("-1".equals(collectStatus)) {
////                        return;
////                    }
////                    //collectStatus   0:收藏  1:取消
////                    trackContentBean.setBhv_value("collect");
////                    CommonTrack.getInstance().collectClickTrack(trackContentBean, collectStatus);
//                }
//                //分享埋点
//                else {
//                    trackContentBean.setShare_type(platform);
//
//                    CommonTrack.getInstance().shareClickTrack(trackContentBean);
//                }
//            }
//
//            @Override
//            public void onCommonClick(String platform, String status) {
//
//            }
//
//
//        });
    }

    /**
     * H5专题海报分享
     *
     * @param shareBean
     * @param topicInfoBean
     */
//    public static void setTopicBeanToShareBean(ShareBean shareBean, TopicInfoBean topicInfoBean) {
//        /**
//         * 21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链
//         */
//        shareBean.setTopicType(topicInfoBean.getTopicType());
//        if (25 == topicInfoBean.getTopicType()) {
//            //早晚报
//            shareBean.setShowPosterType(PosterTypeEnum.DAILY_NEWSPAPERS);
//            shareBean.setTopicPattern(topicInfoBean.getTopicPattern());
//            shareBean.setPublishTime(topicInfoBean.getTopicDate());
//            //如果是有头版
//            TopicFrontLinkBean frontLinkObject = topicInfoBean.getFrontLinkObject();
//            if (frontLinkObject != null) {
//                shareBean.setFrontDaily(true);
//                //海报封面
//                shareBean.setSharePosterCoverUrl(frontLinkObject.getCoverUrl());
//                //显示CMS配置的海报
//                shareBean.setSharePosterStyle(frontLinkObject.getSharePosterStyle());
//                shareBean.setPosterTitle(frontLinkObject.getTitle());
//                shareBean.setPosterSummary(frontLinkObject.getSummary());
//            } else {
//                shareBean.setFrontDaily(false);
//                List<ContentBean> shareContentList = topicInfoBean.getShareContentList();
//                List<SharePosterItemBean> sharePosterItemBeans = new ArrayList<>();
//                if (ArrayUtils.isNotEmpty(shareContentList)) {
//                    for (ContentBean contentBean : shareContentList) {
//                        if (contentBean != null) {
//                            SharePosterItemBean sharePosterItemBean = new SharePosterItemBean();
//                            sharePosterItemBean.setTitle(contentBean.getNewsTitle());
//                            sharePosterItemBean.setImageUrl(contentBean.getCoverUrl());
//                            sharePosterItemBeans.add(sharePosterItemBean);
//                        }
//                    }
//                }
//                shareBean.setSharePosterItemList(sharePosterItemBeans);
//            }
//        } else {
//            //文章/直播/话题专题
//            shareBean.setShowPosterType(PosterTypeEnum.COMMON_H5_TOPICS);
//            //海报的头图
//            shareBean.setSharePosterCoverUrl(topicInfoBean.getBackgroundImgUrl());
//            //显示CMS配置的海报
//            shareBean.setSharePosterStyle(topicInfoBean.getSharePosterStyle());
//            shareBean.setFrontDaily(false);
//            //这个专题分享海报需要
//            shareBean.setPosterTitle(topicInfoBean.getTitle());
//            shareBean.setPosterSummary(topicInfoBean.getSummary());
//            List<ContentBean> shareContentList = topicInfoBean.getShareContentList();
//            List<SharePosterItemBean> sharePosterItemBeans = new ArrayList<>();
//            if (ArrayUtils.isNotEmpty(shareContentList)) {
//                for (ContentBean contentBean : shareContentList) {
//                    if (contentBean != null) {
//                        SharePosterItemBean sharePosterItemBean = new SharePosterItemBean();
//                        sharePosterItemBean.setTitle(contentBean.getNewsTitle());
//                        sharePosterItemBean.setImageUrl(contentBean.getCoverUrl());
//                        sharePosterItemBean.setTimeNode(contentBean.getPublishTime());
//                        sharePosterItemBean.setTimeBlurred(contentBean.timeBlurred);
//                        sharePosterItemBeans.add(sharePosterItemBean);
//                    }
//                }
//            }
//            shareBean.setSharePosterItemList(sharePosterItemBeans);
//        }
//    }

//    private boolean useCommonTopicPoster(int topicType){
//        if (21 == topicType || 23 == topicType || 24 == topicType){
//            return true;
//        }
//        return false;
//    }


    /**
     * 处理常标签
     *
     * @param photoBean
     * @param longImageTag
     */
    public static void handleLongImageTag(PhotoBean photoBean, View longImageTag) {

        /**
         * 设置 单图增加裁切规则( 1 横长图w>2h 2 竖长图: h>2w)
         * 1.竖长图 宽度为横屏的1/2,宽高比小于1:2显示长图
         * 2.横长图 宽高比大于2:1,按照2:1显示,超出裁剪,超出显示长图标签
         */
        if (photoBean != null) {

            String imageUrl = photoBean.getPicPath();

            if (imageUrl.contains(".gif")) {
                longImageTag.setVisibility(View.INVISIBLE);
            } else {

                longImageTag.setVisibility(View.VISIBLE);
                View flicon = longImageTag.findViewById(R.id.flicon);
                ImageView ivIcon = longImageTag.findViewById(R.id.ivIcon);
                TextView ivIconMsg = longImageTag.findViewById(R.id.ivIconMsg);
                ivIconMsg.setTypeface(null);
                ivIconMsg.setShadowLayer(ResUtils.getDimension(R.dimen.rmrb_dp1), 0F, ResUtils.getDimension(R.dimen.rmrb_dp1), Color.parseColor("#4D000000"));

                //先隐藏,否则出现标签重叠bug
                LottieAnimationView lottieplaytag = longImageTag.findViewById(R.id.lottieplaytag);
                lottieplaytag.setVisibility(View.GONE);

                flicon.setVisibility(View.VISIBLE);
                ivIconMsg.setVisibility(View.VISIBLE);
                //长图标签
                ivIconMsg.setText(R.string.comp_tag_long_image);
                ivIcon.setImageResource(R.mipmap.long_img_tag_icon);

                int rInt = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp4);
                ivIconMsg.setPadding(0, 0, rInt, 0);

                int width = Integer.parseInt(photoBean.getWidth());
                int height = Integer.parseInt(photoBean.getHeight());
                if (height >= width) {
                    if (width < 0.5 * height) {
                        longImageTag.setVisibility(View.VISIBLE);
                    } else {
                        longImageTag.setVisibility(View.INVISIBLE);
                    }
                } else {
                    //横长图
                    if (width > 2 * height) {
                        longImageTag.setVisibility(View.VISIBLE);
                    } else {
                        longImageTag.setVisibility(View.INVISIBLE);
                    }
                }
            }

        } else {
            longImageTag.setVisibility(View.INVISIBLE);
        }
    }

    /**
     * 处理 图片/视频/直播 tag view
     *
     * @param tagView
     * @param contentBean
     */
    public static void handleTagViewLogic(View tagView, ContentBean contentBean) {
        if (contentBean == null) {
            return;
        }
        if (TextUtils.isEmpty(contentBean.getObjectType())) {
            return;
        }
        String fromPage = contentBean.getFromPage();
        tagView.setVisibility(View.VISIBLE);
        View flicon = tagView.findViewById(R.id.flicon);
        ImageView ivIcon = tagView.findViewById(R.id.ivIcon);
        ivIcon.setVisibility(View.VISIBLE);
        TextView ivIconMsg = tagView.findViewById(R.id.ivIconMsg);
        flicon.setVisibility(View.VISIBLE);
        ivIconMsg.setVisibility(View.VISIBLE);
        int rInt = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp4);
        ivIconMsg.setPadding(0, 0, rInt, 0);
        ivIconMsg.setTypeface(null);
        ivIconMsg.setShadowLayer(ResUtils.getDimension(R.dimen.rmrb_dp1), 0F, ResUtils.getDimension(R.dimen.rmrb_dp1), Color.parseColor("#4D000000"));
        ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);

        LinearLayout llViewTag = tagView.findViewById(R.id.viewTag);
        llViewTag.setBackgroundColor(Color.TRANSPARENT);
        //先隐藏,否则出现标签重叠bug
        LottieAnimationView lottieplaytag = tagView.findViewById(R.id.lottieplaytag);
        lottieplaytag.setVisibility(View.GONE);


        // 直播观看人数
        ImageView vLiveline = tagView.findViewById(R.id.vLiveline);
        TextView tvRenNum = tagView.findViewById(R.id.tvRenNum);
        vLiveline.setVisibility(View.GONE);
        tvRenNum.setVisibility(View.GONE);
        ivIconMsg.setShadowLayer(ResUtils.getDimension(R.dimen.rmrb_dp1), 0F, ResUtils.getDimension(R.dimen.rmrb_dp1), Color.parseColor("#4D000000"));
        tvRenNum.setShadowLayer(ResUtils.getDimension(R.dimen.rmrb_dp1), 0F, ResUtils.getDimension(R.dimen.rmrb_dp1), Color.parseColor("#4D000000"));

        int type = Integer.parseInt(contentBean.getObjectType());
        if (ContentTypeConstant.URL_TYPE_TWO == type && contentBean.getLiveInfo() != null) {
            int contentStatus = contentBean.getContentStatus();
            if(contentStatus > 1 && contentStatus < 9){
                //有状态,在已知状态枚举内,但不是已发布,不设置
                tagView.setVisibility(View.GONE);
                return;
            }
            // 直播
            LiveInfo liveInfo = contentBean.getLiveInfo();
            String liveState = liveInfo.getLiveState();
            if (Constants.LIVE_WAIT.equals(liveState)) {
                // 预约
                ivIcon.setImageResource(R.mipmap.rmrb_activity_tag_waiting_new);
                ivIconMsg.setText(R.string.play_preview);

            } else if (Constants.LIVE_RUNNING.equals(liveState)) {
                ivIcon.setVisibility(View.GONE);
                ivIconMsg.setText(R.string.play_live);
                lottieplaytag.setAnimation("loveinggif.json");
                lottieplaytag.setRepeatCount(LottieDrawable.INFINITE);
                lottieplaytag.playAnimation();
                lottieplaytag.setVisibility(View.VISIBLE);
                if (PageNameConstants.PageMySubLiveList.equals(fromPage)) {
                    tagView.setVisibility(View.INVISIBLE);
                }

                // 直播观看人数
                if (contentBean.showLivePeopleNum && contentBean.getLiveInfo().infoBean != null) {

                    if ("0".equals(liveInfo.infoBean.pv) || TextUtils.isEmpty(liveInfo.infoBean.pv)) {

                    } else {
                        ivIconMsg.setPadding(0, 0, 0, 0);
                        vLiveline.setVisibility(View.VISIBLE);
                        tvRenNum.setVisibility(View.VISIBLE);
                        String liveRenNum = NumberStrUtils.Companion.getINSTANCE().handlerNumber(liveInfo.infoBean.pv) + "人参加";
                        tvRenNum.setText(liveRenNum);
                    }

                }


            } else if (Constants.LIVE_END.equals(liveState)) {

                if (!TextUtils.isEmpty(contentBean.getLinkUrl()) || !TextUtils.isEmpty(liveInfo.getVideoUri())) {
                    // 回看
                    ivIcon.setVisibility(View.VISIBLE);
                    ivIcon.setImageResource(R.mipmap.rmrb_video_tag);
                    ivIconMsg.setText(R.string.play_review);

                } else {
                    ivIcon.setVisibility(View.GONE);
                    ivIconMsg.setText(R.string.play_live_end);
                }

                // 直播观看人数
                if (contentBean.showLivePeopleNum && contentBean.getLiveInfo().infoBean != null) {
                    if ("0".equals(liveInfo.infoBean.pv) || TextUtils.isEmpty(liveInfo.infoBean.pv)) {

                    } else {
                        ivIconMsg.setPadding(0, 0, 0, 0);
                        vLiveline.setVisibility(View.VISIBLE);
                        tvRenNum.setVisibility(View.VISIBLE);
                        String liveRenNum = NumberStrUtils.Companion.getINSTANCE().handlerNumber(liveInfo.infoBean.pv) + "人参加";
                        tvRenNum.setText(liveRenNum);
                    }

                }

                if (PageNameConstants.PageMySubLiveList.equals(fromPage)) {
                    tagView.setVisibility(View.GONE);
                }
            } else {
                tagView.setVisibility(View.GONE);
            }

        } else if (ContentTypeConstant.URL_TYPE_FIFTEEN == type || ContentTypeConstant.URL_TYPE_ONE == type) {
            ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
            VideoInfo videoInfo = contentBean.getVideoInfo();
            // 视频
            ivIcon.setImageResource(R.mipmap.rmrb_video_tag);
            ivIconMsg.setTypeface(Typeface.createFromAsset(ivIconMsg.getContext().getAssets(), "ttf/BebasNeue.ttf"));
            if (videoInfo == null) {
                ivIconMsg.setText("00:00");
            } else {
                if (!TextUtils.isEmpty(videoInfo.videoDuration)) {
                    ivIconMsg.setText(TimeFormater.formatMs(Integer.parseInt(videoInfo.videoDuration) * 1000));
                } else {
                    ivIconMsg.setText("00:00");
                }

            }

        } else if ((ContentTypeConstant.URL_TYPE_NINE == type || ContentTypeConstant.URL_TYPE_FOURTEEN == type) && !TextUtils.isEmpty(contentBean.getPhotoNum())) {
            ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
            // 图集
            ivIconMsg.setTypeface(Typeface.createFromAsset(ivIconMsg.getContext().getAssets(), "ttf/BebasNeue.ttf"));
            ivIcon.setImageResource(R.mipmap.rmrb_image_tag);
            ivIconMsg.setText(contentBean.getPhotoNum());

        } else if (ContentTypeConstant.URL_TYPE_THIRTEEN == type && contentBean.getVoiceInfo() != null) {
            ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
            // 音频
            ivIconMsg.setTypeface(Typeface.createFromAsset(ivIconMsg.getContext().getAssets(), "ttf/BebasNeue.ttf"));
            ivIcon.setImageResource(R.mipmap.rmrb_audio_tag);
            ivIconMsg.setText(TimeFormater.formatMs(contentBean.getVoiceInfo().getVoiceDuration() * 1000));
        } else if (ContentTypeConstant.URL_TYPE_FOUR == type) {

            if (contentBean.getCompAdvBean() != null) {
                tagView.setVisibility(View.GONE);
                VideoInfo videoInfo = contentBean.getVideoInfo();
                if (videoInfo != null) {
                    ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
                    // 视频
                    ivIcon.setImageResource(R.mipmap.rmrb_video_tag);
                    ivIconMsg.setTypeface(Typeface.createFromAsset(ivIconMsg.getContext().getAssets(), "ttf/BebasNeue.ttf"));
                    if (videoInfo == null) {
                        ivIconMsg.setText("00:00");
                    } else {
                        if (!TextUtils.isEmpty(videoInfo.videoDuration)) {
                            ivIconMsg.setText(TimeFormater.formatMs(Integer.parseInt(videoInfo.videoDuration) * 1000));
                        } else {
                            ivIconMsg.setText("00:00");
                        }

                    }
                }
            }

        } else if (ContentTypeConstant.URL_TYPE_THREE == type) {
            llViewTag.setBackgroundResource(R.drawable.shape_corner_000000_30_2);
            //活动
            int activityStatus = -1;
            if (contentBean.itemActivity != null) {
                activityStatus = contentBean.itemActivity.checkActivityStatus(HostUtil.serverTime);
            }
            if (activityStatus == 0) {
                // 未开始
                flicon.setVisibility(View.VISIBLE);
                ivIconMsg.setVisibility(View.VISIBLE);
                ivIconMsg.setText(R.string.comp_activity_waiting);
                ivIcon.setImageResource(R.mipmap.rmrb_activity_tag_waiting_new);
            } else if (activityStatus == 2) {
                // 已结束
                flicon.setVisibility(View.GONE);
                ivIconMsg.setVisibility(View.VISIBLE);
                ivIconMsg.setText(R.string.comp_activity_end);
                int lr = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp4);
                int tb = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp1);
                ivIconMsg.setPadding(lr, tb, lr, tb);

            } else if (activityStatus == 1) {
                // 进行中
                flicon.setVisibility(View.VISIBLE);
                ivIconMsg.setVisibility(View.VISIBLE);
                ivIconMsg.setText(R.string.comp_activity_running);
                ivIcon.setImageResource(R.mipmap.rmrb_activity_tag_running);
            } else {
                tagView.setVisibility(View.GONE);
            }

        } else {
            tagView.setVisibility(View.GONE);

        }

    }

    /**
     * 处理 活动 tag view
     *
     * @param tagView
     * @param contentBean
     */
    public static void handleActivityTagViewLogic(View tagView, ContentBean contentBean) {
        if (contentBean == null) {
            return;
        }
        if (TextUtils.isEmpty(contentBean.getObjectType())) {
            return;
        }
        tagView.setVisibility(View.VISIBLE);
        View flicon = tagView.findViewById(R.id.flicon);
        ImageView ivIcon1 = tagView.findViewById(R.id.ivIcon1);
        ivIcon1.setVisibility(View.VISIBLE);
        ImageView ivIcon2 = tagView.findViewById(R.id.ivIcon2);
        ivIcon2.setVisibility(View.VISIBLE);
        TextView ivIconMsg = tagView.findViewById(R.id.ivIconMsg);
        flicon.setVisibility(View.VISIBLE);
        ivIconMsg.setVisibility(View.VISIBLE);
        int rInt = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp4);
        ivIconMsg.setTypeface(null);
        ivIconMsg.setShadowLayer(ResUtils.getDimension(R.dimen.rmrb_dp1), 0F, ResUtils.getDimension(R.dimen.rmrb_dp1), Color.parseColor("#4D000000"));
        ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
        LinearLayout llViewTag = tagView.findViewById(R.id.viewTag);
        llViewTag.setBackgroundColor(Color.TRANSPARENT);
        int type = Integer.parseInt(contentBean.getObjectType());
        if (ContentTypeConstant.URL_TYPE_THREE == type) {
            llViewTag.setBackgroundResource(R.drawable.shape_corner_000000_30_2);
            //活动
            int activityStatus = -1;
            if (contentBean.itemActivity != null) {
                activityStatus = contentBean.itemActivity.checkActivityStatus(HostUtil.serverTime);
            }
            if (activityStatus == 0) {
                // 未开始
                llViewTag.setPadding(0, 0, rInt, 0);
                flicon.setVisibility(View.VISIBLE);
                ivIcon1.setVisibility(View.GONE);
                ivIcon2.setVisibility(View.VISIBLE);
                ivIconMsg.setVisibility(View.VISIBLE);
                ivIconMsg.setText(R.string.comp_activity_waiting);
                ivIcon2.setImageResource(R.mipmap.rmrb_activity_tag_waiting_new);
            } else if (activityStatus == 2) {
                // 已结束
                llViewTag.setPadding(rInt, 0, rInt, 0);
                flicon.setVisibility(View.GONE);
                ivIconMsg.setVisibility(View.VISIBLE);
                ivIconMsg.setText(R.string.comp_activity_end);
            } else if (activityStatus == 1) {
                // 进行中
                llViewTag.setPadding(0, 0, rInt, 0);
                flicon.setVisibility(View.VISIBLE);
                ivIcon1.setVisibility(View.VISIBLE);
                ivIcon2.setVisibility(View.GONE);
                ivIconMsg.setVisibility(View.VISIBLE);
                ivIconMsg.setText(R.string.comp_activity_running);
                ivIcon1.setImageResource(R.mipmap.rmrb_activity_tag_running);
            } else {
                tagView.setVisibility(View.GONE);
            }

        } else {
            tagView.setVisibility(View.GONE);

        }

    }

    /**
     * 处理 banner  只有直播展示 tag view
     *
     * @param tagView
     * @param contentBean
     */
    public static void handleBannerTagViewLogic(View tagView, ContentBean contentBean) {
        if (contentBean == null) {
            return;
        }

        if (TextUtils.isEmpty(contentBean.getObjectType())) {
            return;
        }
        String fromPage = contentBean.getFromPage();
        tagView.setVisibility(View.VISIBLE);
        View flicon = tagView.findViewById(R.id.flicon);
        ImageView ivIcon = tagView.findViewById(R.id.ivIcon);
        TextView ivIconMsg = tagView.findViewById(R.id.ivIconMsg);
        flicon.setVisibility(View.VISIBLE);
        ivIconMsg.setVisibility(View.VISIBLE);
        int rInt = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp4);
        ivIconMsg.setPadding(0, 0, rInt, 0);
        ivIconMsg.setTypeface(null);

        LinearLayout llViewTag = tagView.findViewById(R.id.viewTag);
        //先隐藏,否则出现标签重叠bug
        LottieAnimationView lottieplaytag = tagView.findViewById(R.id.lottieplaytag);
        lottieplaytag.setVisibility(View.GONE);

        ImageView vLiveline = tagView.findViewById(R.id.vLiveline);
        TextView tvRenNum = tagView.findViewById(R.id.tvRenNum);
        vLiveline.setVisibility(View.GONE);
        tvRenNum.setVisibility(View.GONE);

        if (contentBean.getCompAdvBean() != null) {
            flicon.setVisibility(View.GONE);
            int lr = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp4);
            int tb = (int) ivIconMsg.getResources().getDimension(R.dimen.rmrb_dp1);
            ivIconMsg.setPadding(lr, tb, lr, tb);
            ivIconMsg.setText(R.string.comp_adv);
            ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);

            llViewTag.setBackgroundResource(R.drawable.shape_corner_black_2);
            ivIconMsg.setShadowLayer(0F, 0F, 0F, Color.parseColor("#4D000000"));

        } else {
            llViewTag.setBackgroundColor(Color.TRANSPARENT);
            ivIconMsg.setShadowLayer(ResUtils.getDimension(R.dimen.rmrb_dp1), 0F, ResUtils.getDimension(R.dimen.rmrb_dp1), Color.parseColor("#4D000000"));
            ivIconMsg.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
            int type = Integer.parseInt(contentBean.getObjectType());
            if (ContentTypeConstant.URL_TYPE_TWO == type && contentBean.getLiveInfo() != null) {
                // 直播
                LiveInfo liveInfo = contentBean.getLiveInfo();
                String liveState = liveInfo.getLiveState();
                if (Constants.LIVE_WAIT.equals(liveState)) {
                    // 预约
                    ivIcon.setVisibility(View.VISIBLE);
                    ivIcon.setImageResource(R.mipmap.rmrb_activity_tag_waiting_new);
                    ivIconMsg.setText(R.string.play_preview);
                    lottieplaytag.setVisibility(View.GONE);
                } else if (Constants.LIVE_RUNNING.equals(liveState)) {
                    // ivIcon.setImageResource(R.mipmap.rmrb_live_broadcast_tag);
                    ivIconMsg.setText(R.string.play_live);
                    lottieplaytag.setAnimation("loveinggif.json");
                    lottieplaytag.setRepeatCount(LottieDrawable.INFINITE);
                    lottieplaytag.playAnimation();
                    lottieplaytag.setVisibility(View.VISIBLE);
                    if (PageNameConstants.PageMySubLiveList.equals(fromPage)) {
                        tagView.setVisibility(View.INVISIBLE);
                    }
                    ivIcon.setVisibility(View.GONE);
                } else if (Constants.LIVE_END.equals(liveState)) {
                    if (!TextUtils.isEmpty(liveInfo.getVideoUri())) {

                        ivIcon.setVisibility(View.VISIBLE);
                        ivIcon.setImageResource(R.mipmap.rmrb_video_tag);
                        ivIconMsg.setText(R.string.play_review);
                        lottieplaytag.setVisibility(View.GONE);
                    } else {
                        flicon.setVisibility(View.GONE);
                        ivIconMsg.setText(R.string.play_live_end);
                    }
                    if (PageNameConstants.PageMySubLiveList.equals(fromPage)) {
                        tagView.setVisibility(View.GONE);
                    }
                } else {
                    tagView.setVisibility(View.GONE);
                }

            } else {
                tagView.setVisibility(View.GONE);
            }
        }

    }

    /**
     * textView依据业务类型的状态修改展示文字
     *
     * @param textView
     * @param content
     */
    public static void contentObjectTextMsg(TextView textView, ContentBean content) {
        if (content == null) {
            return;
        }
        int type = Integer.parseInt(content.getObjectType());
        if (ContentTypeConstant.URL_TYPE_THREE == type) {
            if (content.itemActivity == null) {
                return;
            }
            BaseActivityBean activityBean = content.itemActivity;
            //活动,0:未开始;2:已结束;1:进行中
            int activityStatus = activityBean.checkActivityStatus(HostUtil.serverTime);
            if (activityStatus == 0) {
                // 未开始
                String title = StringUtils.isBlank(activityBean.getShowTitleNo()) ?
                        ResUtils.getString(R.string.comp_activity_join) : activityBean.getShowTitleNo();
                textView.setText(title);
            }else if (activityStatus == 1) {
                // 进行中
                String title = StringUtils.isBlank(activityBean.getShowTitleIng()) ?
                        ResUtils.getString(R.string.comp_activity_join) : activityBean.getShowTitleIng();
                textView.setText(title);
            } else {
                // 已结束
                String title = StringUtils.isBlank(activityBean.getShowTitleEd()) ?
                        ResUtils.getString(R.string.comp_activity_join) : activityBean.getShowTitleEd();
                textView.setText(title);
            }
        }

    }

    /**
     * 组件内容的标签,给内容打 新、热标签
     *
     * @param tagWord 人民号主题卡标签词;0:无,1:热,2:新
     * @param tvTag
     */
    public static void compeContentTag(int tagWord, ImageView tvTag) {

        if (tagWord == 1) {

            tvTag.setVisibility(View.VISIBLE);
            tvTag.setImageResource(R.mipmap.icon_content_compe_hot);
        } else if (tagWord == 2) {
            tvTag.setVisibility(View.VISIBLE);
            tvTag.setImageResource(R.mipmap.icon_content_compe_news);
        } else {
            tvTag.setVisibility(View.INVISIBLE);
        }

    }

    /**
     * 单独处理内容日期
     *
     * @param tvData
     * @param contentBean
     */
    public static void handerContentData(TextView tvData, ContentBean contentBean) {

        // 获取日期信息
        String dataStr = null;
        if (!TextUtils.isEmpty(contentBean.getPublishTime())) {
            dataStr = contentBean.getPublishTime();
            // 加工日期信息
            if (!TextUtils.isEmpty(dataStr)) {
                if (!dataStr.contains(":")) {
                    dataStr = TimeUtil.converTime(dataStr);
                } else {
                    dataStr = TimeUtil.converTimeForm(dataStr);
                }
                // 频道页面 超过当天两天的日期,不显示
                /*if (dataStr != null && dataStr.contains("-") && !contentBean.showPublishData) {
                    dataStr = "";
                }*/

                if (TextUtils.isEmpty(dataStr)) {
                    tvData.setVisibility(View.GONE);
                } else {
                    tvData.setVisibility(View.VISIBLE);
                    tvData.setText(dataStr);
                }

            } else {
                tvData.setText("");
                tvData.setVisibility(View.GONE);
            }
        } else {
            //产品要求问政问答卡显示到秒
            if (contentBean.askInfo != null) {
                dataStr = contentBean.askInfo.firstPublishTime;
            }
            // 加工日期信息
            if (!TextUtils.isEmpty(dataStr)) {
                if (dataStr != null && !dataStr.contains(":")) {
                    dataStr = TimeUtil.converTime(dataStr);
                } else {
                    dataStr = TimeUtil.converTimeForm(dataStr);
                }

                // 频道页面 超过当天两天的日期,不显示
                /*if (dataStr != null && dataStr.contains("-") && !contentBean.showPublishData) {
                    dataStr = "";
                }*/
                if (TextUtils.isEmpty(dataStr)) {
                    tvData.setVisibility(View.GONE);
                } else {
                    tvData.setVisibility(View.VISIBLE);
                }
                tvData.setText(dataStr);
            } else {
                tvData.setText("");
                tvData.setVisibility(View.GONE);
            }
        }

    }

    /**
     * 处理稿件信息 频道信息和发布日期 view
     *
     * @param view
     * @param content
     */
    public static void handlerFromDataInfor(View view, ContentBean content) {
        view.setTag(content.getObjectId());
        view.setVisibility(View.VISIBLE);
        TagTextView tvOne = view.findViewById(R.id.tvOne);
        FrameLayout textFrame = view.findViewById(R.id.text_frame);
        //日期
        String threeStr = "";
        //评论
        String twoStr = "";
        //先设置下,以防出现崩溃
        tvOne.setText(" ");
        //日期
        if (!TextUtils.isEmpty(content.getPublishTime())) {
            if (!content.getPublishTime().contains(":")) {
                threeStr = TimeUtil.converTime(content.getPublishTime());
            } else {
                threeStr = TimeUtil.converTimeForm(content.getPublishTime());
            }
            // 频道页面 超过当天两天的日期,不显示
            if (threeStr.contains("-") && !content.showPublishData) {
                threeStr = "";
            }
        }

        // 直播业务信息不展示评论
        if (String.valueOf(ContentTypeConstant.URL_TYPE_TWO).equals(content.getObjectType())) {
            content.setCommentNum(null);
        }
        // 评论处理
        if (!TextUtils.isEmpty(content.getCommentNum()) && !"0".equals(content.getCommentNum())) {
            String commentTxtMsg = NumberStrUtils.Companion.getINSTANCE().handlerNumber(content.getCommentNum());
            String commentTxt = ResUtils.getString(R.string.comp_bottom_commnet_num);
            twoStr = String.format(commentTxt, commentTxtMsg);
        }

        String source = content.getSource();
        if (content.isRmhData() && content.getRmhInfo() != null) {
            source = content.getRmhInfo().getRmhName();
        }
        if (!TextUtils.isEmpty(source)) {
            if (!TextUtils.isEmpty(threeStr)){
                setSpan(tvOne, source,threeStr + "  " + twoStr);
            }else {
                setSpan(tvOne, source, twoStr);
            }
        } else {
            if (!TextUtils.isEmpty(threeStr)){
                tvOne.setText(threeStr + "  " + twoStr);
            }else {
                tvOne.setText(twoStr);
            }

        }

        //根据是否个人作品,发布状态
        if (isSelfHomePage(content)) {
            //是否展示标签
            boolean haveTag = setPublishStatusTag(tvOne, content);
            String timeAndComment;
            if (StringUtils.isNotBlank(threeStr)){
                timeAndComment = threeStr + "  " + twoStr;
            }else {
                timeAndComment = twoStr;
            }
            if (haveTag) {
                if (!TextUtils.isEmpty(tvOne.getText().toString())){
                    setSpanGreyTime(tvOne,tvOne.getText().toString(),timeAndComment);
                }else{
                    tvOne.setText(timeAndComment);
                }
            } else {
                tvOne.setText(tvOne.getText().toString() + timeAndComment);
                //没有标签,重置文本为灰色
                tvOne.setTextColor(ContextCompat.getColor(tvOne.getContext(), R.color.res_color_common_C4));
            }
            content.workContentOnline = !haveTag;
        }
        // 评论、来源、日期、标签都是空
        if (TextUtils.isEmpty(source) && TextUtils.isEmpty(content.getCorner()) && TextUtils.isEmpty(threeStr)) {
            // 是直播不需要显示评论
            if (String.valueOf(ContentTypeConstant.URL_TYPE_TWO).equals(content.getObjectType())) {
                view.setVisibility(View.GONE);
            }else {
                //其他业务 判断评论也没有才隐藏
                if (TextUtils.isEmpty(twoStr)){
                    view.setVisibility(View.GONE);
                }
            }
        }
        //来源
        String finalSource = source;
        //评论数
        String finalTwoStr = twoStr;
        //日期
        String finalThreeStr = threeStr;
        //要先设置不然评论批查后才能看到,导致标签会出现的很慢
        CharSequence text = tvOne.getText();
        if (null != text){
            addTextViewTag(content, text.toString(), tvOne);
        }
        textFrame.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                textFrame.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                int width = view.getWidth();
                float width2 = measureTextLength(tvOne);
                //文本宽度计算要加上标签宽度,这个measureTextLength不会加上图片宽度
                if (!TextUtils.isEmpty(content.getCorner())) {
                    width2 = width2 + UiUtils.dp2px(24 + 6);
                }
                //文本宽度计算要加上增加的图片宽度
                if (!TextUtils.isEmpty(finalThreeStr)) {
                    width2 = width2 + UiUtils.dp2px(12);
                }
                //最长的宽度
                if (width2 > width) {
                    //超长了,留下来源和评论,来源和评论之间也要带 点
                    setSpan(tvOne, finalSource, finalTwoStr);
                    float width3 = measureTextLength(tvOne);

                    //文本宽度计算要加上标签宽度,这个measureTextLength不会加上图片宽度
                    if (!TextUtils.isEmpty(content.getCorner())) {
                        width3 = width3 + UiUtils.dp2px(24 + 6);
                    }
                    //文本宽度计算要加上增加的图片宽度--带 点
                    if (!TextUtils.isEmpty(finalTwoStr)) {
                        width3 = width3 + UiUtils.dp2px(12);
                    }

                    if (width3 > width) {
                        //来源和评论也超出了,只要标签和评论
                        tvOne.setText(finalSource);
                    }

                    CharSequence text = tvOne.getText();
                    if (null != text){
                        addTextViewTag(content, text.toString(), tvOne);
                    }
                }
            }
        });

    }

    public static void addTextViewTag(ContentBean content,String source,TagTextView tvOne){
        //根据是否有标签字段判断
        if (!TextUtils.isEmpty(content.getCorner())) {
            if (TextUtils.isEmpty(source)) {
                tvOne.setText(" ");
            }else {
                CharSequence text = tvOne.getText();
                if (null == text || StringUtils.isBlank(text.toString())){
                    tvOne.setText(source);
                }
            }
            // 默认样式
            TagConfig tv1Config = new TagConfig(Type.TEXT);
            tv1Config.setText(content.getCorner());
            tv1Config.setTextSize(UiUtils.dp2pxF(12f));
            tv1Config.setTextColor(ContextCompat.getColor(tvOne.getContext(), R.color.res_color_common_C11));
            tv1Config.setBackgroundColor(ContextCompat.getColor(tvOne.getContext(), R.color.res_color_common_C8));
//            //设置圆角
//           tv1Config.setRadius(AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
//            //设置内边距
            tv1Config.setLeftPadding(0);
            tv1Config.setRightPadding(0);
            tv1Config.setTopPadding(0);
            tv1Config.setBottomPadding(0);
            //设置外边距
            tv1Config.setMarginRight((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp6));
            try{
                tvOne.addTag(tv1Config);
            }catch (Exception e){
                e.printStackTrace();
                //java.lang.NullPointerException: 请优先设置TextView的text
                tvOne.setText(source);
            }
        }
    }

    /**
     * 测量文本长度
     * @param textView
     * @return
     */
    public static float measureTextLength(TextView textView){
        String text = textView.getText().toString();
        Paint paint = textView.getPaint();
        float textWidth = paint.measureText(text);
        return textWidth;
    }

    /**
     * 设置点
     * @param textView
     * @param source
     * @param threeStr
     */
    public static void setSpan(TextView textView,String source,String threeStr){
        SpannableStringBuilder builder = new SpannableStringBuilder();
        builder.append(source+" ");
        if (StringUtils.isNotBlank(threeStr)){
            Drawable drawable = textView.getContext().getResources().getDrawable(R.mipmap.rmrb_bottom_drop);
            drawable.setBounds(0, 0, UiUtils.dp2px(12), UiUtils.dp2px(12));
            builder.setSpan(new ImageSpan(drawable,DynamicDrawableSpan.ALIGN_CENTER), builder.length()-1, builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            builder.append(threeStr);
        }
        textView.setText(builder);
    }

    /**
     * 设置点(带有标记的 时间保持灰色显示  比如 未通过 · 时间,因考虑到还有其他调用,所以复写一个方法)
     * @param textView
     * @param source
     * @param threeStr
     */
    public static void setSpanGreyTime(TextView textView,String source,String threeStr){
        SpannableStringBuilder builder = new SpannableStringBuilder();
        builder.append(source+" ");
        if (StringUtils.isNotBlank(threeStr)){
            Drawable drawable = textView.getContext().getResources().getDrawable(R.mipmap.rmrb_bottom_drop);
            drawable.setBounds(0, 0, UiUtils.dp2px(12), UiUtils.dp2px(12));
            builder.setSpan(new ImageSpan(drawable,DynamicDrawableSpan.ALIGN_CENTER), builder.length()-1, builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            int start = builder.length() ;
            builder.append(threeStr);
            builder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C4)),start,builder.length(),Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        }
        textView.setText(builder);
    }

    /**
     * 是否展示标签,以及标签的颜色内容
     * 新增号主页稿件发布状态
     *
     * @param textView
     * @param bean
     * @param tagFlag  true:表示H5不用展示
     */
    public static void showLabel(TagTextView textView, ContentBean bean, boolean tagFlag) {
        if (setWorksTopTag(textView, bean)) {
            return;
        }
        if (null == textView){
            return;
        }
        String tag = loadTitleTag(bean, tagFlag);
        if (!TextUtils.isEmpty(bean.getNewTags())) {
            tag = bean.getNewTags();
        }
        if (!TextUtils.isEmpty(tag)) {
            // 默认样式
            TagConfig tv1Config = new TagConfig(Type.TEXT);
            tv1Config.setText(tag);
            tv1Config.setTextSize(UiUtils.dp2pxF(setTextTagSize()));
            tv1Config.setTextColor(ContextCompat.getColor(textView.getContext(), bean.isSupportThemeColor ? R.color.res_color_common_C8 : R.color.white));
            // tv1Config.setBackgroundColor(ContextCompat.getColor(textView.getContext(),R.color.res_color_common_C11));
            //tv1Config.setGradientOrientation();
            tv1Config.setStartGradientBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_general_FF2B00));
            tv1Config.setEndGradientBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_general_FE6A00));
            //设置圆角
            tv1Config.setRadius(AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            //设置内边距
            tv1Config.setLeftPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
            tv1Config.setRightPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
            tv1Config.setTopPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            tv1Config.setBottomPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            //设置外边距
            tv1Config.setMarginRight((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
            textView.addTag(tv1Config);
        }
    }

    /**
     * 设置标签大小
     *
     * @return
     */
    public static float setTextTagSize() {
        // 标准
        float tagSize = 11;
        String type = SpUtils.getSettingTextSize();
        //标准
        if ("1".equals(type)) {
            // 小
            tagSize = 10;
        } else if ("3".equals(type)) {
            //大
            tagSize = 12;
        } else if ("4".equals(type)) {
            //特大
            tagSize = 14;
        }

        return tagSize;
    }

    /**
     * 是否自己的页面
     *
     * @param bean
     * @return
     */
    public static boolean isSelfHomePage(ContentBean bean) {
        if (bean == null) {
            return false;
        }
        String fromPage = bean.getFromPage();
        if (StringUtils.isBlank(fromPage)) {
            return false;
        }
        if (PageNameConstants.MAIN_PERSONAL_HOME_PAGE.equals(fromPage)) {
            return true;
        }
        return false;
    }

    /**
     * 设置号主作品列表作品置顶标签
     *
     * @param textView
     * @param bean
     * @return
     */
    private static boolean setWorksTopTag(TagTextView textView, ContentBean bean) {
        if (textView == null || bean == null) {
            return false;
        }
        String fromPage = bean.getFromPage();
        if (StringUtils.isBlank(fromPage)) {
            return false;
        }

        if (PageNameConstants.MAIN_PERSONAL_HOME_PAGE.equals(fromPage) ||
                PageNameConstants.CUSTOMER_PERSONAL_HOME_PAGE.equals(fromPage)) {
            TagConfig tv1Config = new TagConfig(Type.TEXT);
            //置顶不判断状态
//            int contentStatus = bean.getContentStatus();
            //已发布
//            if (contentStatus == WorksPublishStatusType.HAVE_PUBLISHED) {
                if (bean.isMyWorksIsTop()) {
                    tv1Config.setText(AppContext.getContext().getString(R.string.topping_text));
                    tv1Config.setTextSize(UiUtils.dp2pxF(setTextTagSize()));
                    tv1Config.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C8_keep));
                    tv1Config.setStartGradientBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_general_FF2B00));
                    tv1Config.setEndGradientBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_general_FE6A00));
                    //设置圆角
                    tv1Config.setRadius(AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
                    //设置内边距
                    tv1Config.setLeftPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
                    tv1Config.setRightPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
                    tv1Config.setTopPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
                    tv1Config.setBottomPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
                    //设置外边距
                    tv1Config.setMarginRight((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
                    textView.addTag(tv1Config);
                }
                return true;
//            }
        }
        return false;
    }

    /**
     * 发布状态
     * 1:已发布 2:审核中 3:未通过 4:已撤回 5:草稿 6待发布 7 已下线(只能操作删除,应对管理端的强制下线操作)8 发布中
     */
    private static boolean setPublishStatusTag(TextView textView, ContentBean bean) {
        if (textView == null || bean == null) {
            return false;
        }
        textView.setVisibility(View.VISIBLE);
        int contentStatus = bean.getContentStatus();
        // 2024/5/7更新 1:已发布 2:发布中(审核中) 3:发布中(审核中) 4:待发布 5:未通过 6:未通过 7:已撤回 8:已下线(只能操作删除,应对管理端的强制下线操作)
        if (contentStatus == WorksPublishStatusType.IN_REVIEW_1 || contentStatus == WorksPublishStatusType.IN_REVIEW_2) {
            textView.setText(R.string.examine_text);
            textView.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C18));
            return true;
        } else if (contentStatus == WorksPublishStatusType.NO_PASS_1 || contentStatus == WorksPublishStatusType.NO_PASS_2) {
            textView.setText(R.string.publish_refuse_text);
            textView.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C11));
            return true;
        } else if (contentStatus == WorksPublishStatusType.RETRACT) {
            textView.setText(R.string.withdraw_text);
            textView.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C4));
            return true;
        }
//        else if (contentStatus == 5) {
//            textView.setText(R.string.draft_text);
//            textView.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C2));
//            return true;
//        }
        else if (contentStatus == WorksPublishStatusType.TOBE_PUBLISH) {
            textView.setText(R.string.release_wait_text);
            textView.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C16));
            return true;
        } else if (contentStatus == WorksPublishStatusType.OFFLINE) {
            textView.setText(R.string.offline_text);
            textView.setTextColor(ContextCompat.getColor(textView.getContext(), R.color.res_color_common_C4));
            return true;
        } else {
            textView.setText("");
            return false;
        }
    }

    /**
     * 处理问政消息状态
     *
     * @param askItemBean
     * @param llstate
     * @param ivlabel
     * @param tvlabel
     */

    public static void handlerWenZhenMessageStatus(AskItemBean askItemBean, LinearLayout llstate, ImageView ivlabel, TextView tvlabel) {

        if (askItemBean.stateInfo == 1) {
            llstate.setVisibility(View.VISIBLE);
            ivlabel.setImageResource(R.mipmap.icon_politics_question);
            FilletUtil.setRoundBg(tvlabel, ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C16), tvlabel.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            tvlabel.setText(tvlabel.getContext().getString(R.string.comp_message_status_pendingprocessing));
            tvlabel.setTextColor(ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C8_keep));
        }
        //待回复
        else if (askItemBean.stateInfo == 2) {
            llstate.setVisibility(View.VISIBLE);
            ivlabel.setImageResource(R.mipmap.icon_politics_question);
            FilletUtil.setRoundBg(tvlabel, ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C16), tvlabel.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            tvlabel.setText(tvlabel.getContext().getString(R.string.comp_message_status_toreplied));
            tvlabel.setTextColor(ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C8_keep));
        }
        //办理中
        else if (askItemBean.stateInfo == 3) {
            llstate.setVisibility(View.VISIBLE);
            ivlabel.setImageResource(R.mipmap.icon_politics_processing);
            FilletUtil.setRoundBg(tvlabel, ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C18), tvlabel.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            tvlabel.setText(tvlabel.getContext().getString(R.string.comp_message_status_processing));
            tvlabel.setTextColor(ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C8_keep));
        }
        //已回复
        else if (askItemBean.stateInfo == 4) {
            llstate.setVisibility(View.VISIBLE);
            ivlabel.setImageResource(R.mipmap.icon_politics_answer);
            FilletUtil.setRoundBg(tvlabel, ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C11), tvlabel.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            tvlabel.setText(tvlabel.getContext().getString(R.string.comp_message_status_replied));
            tvlabel.setTextColor(ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C8_keep));
        }
        //未展示
        else if (askItemBean.stateInfo == 5 && askItemBean.localMyWord) {
            llstate.setVisibility(View.VISIBLE);
            ivlabel.setImageResource(R.mipmap.icon_politics_question);
            FilletUtil.setRoundBg(tvlabel, ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C6), tvlabel.getContext().getResources().getDimension(R.dimen.rmrb_dp2));
            tvlabel.setText(tvlabel.getContext().getString(R.string.comp_message_status_notshown));
            tvlabel.setTextColor(ContextCompat.getColor(tvlabel.getContext(), R.color.res_color_common_C2));
        } else {
            //隐藏
            llstate.setVisibility(View.GONE);
        }


    }

    /**
     * 设置
     *
     * @param mTagTextView
     * @param tagConfig
     * @param text
     * @param textColor
     * @param backgroundColor
     */
    private static void setTagTextViewConfig(TagTextView mTagTextView, TagConfig tagConfig, int text, int textColor, int backgroundColor) {
        tagConfig.setTextSize(AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp12));
        tagConfig.setText(AppContext.getContext().getString(text));
        tagConfig.setTextColor(ContextCompat.getColor(mTagTextView.getContext(), textColor));
//        tagConfig.setBackgroundColor(ContextCompat.getColor(mTagTextView.getContext(), backgroundColor));
        //设置圆角
//        tagConfig.setRadius(AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp3));
        //设置内边距
        tagConfig.setLeftPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
        tagConfig.setRightPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
        tagConfig.setTopPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp1));
        tagConfig.setBottomPadding((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp1));
        //设置外边距
        tagConfig.setMarginRight((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
        mTagTextView.addTag(tagConfig);
    }

    /**
     * 本地标题标签
     *
     * @param bean
     * @return
     */
    private static String loadTitleTag(ContentBean bean, boolean tagFlag) {

        String newTag = null;
        if (TextUtils.isEmpty(bean.getObjectType())) {
            return newTag;
        }
        int type = Integer.parseInt(bean.getObjectType());
        if (ContentTypeConstant.URL_TYPE_FIVE == type) {
            newTag = ResUtils.getString(R.string.comp_local_subject_tag);
            try {
                //话题专题改成调查两个字
                String objectLevel = bean.getObjectLevel();
                int topicType = Integer.parseInt(objectLevel);
                if(ContentTypeConstant.SUBJECT_TOPICTYPE_24 == topicType){
                    newTag = ResUtils.getString(R.string.comp_local_investigation_tag);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
            //21:文章专题,23:直播专题,24:话题专题,26时间轴专题 请求接口缓存 给H5使用
            requestH5TopicCache(bean);
        } else if (ContentTypeConstant.URL_TYPE_SIX == type || ContentTypeConstant.URL_TYPE_TEN == type) {
            // 头图卡、轮播卡不需要显示h5
            if (tagFlag) {

            } else {
                newTag = ResUtils.getString(R.string.comp_local_h5_tag);
            }

        }

        return newTag;
    }

    /**
     * 21:文章专题,23:直播专题,24:话题专题,26时间轴专题 请求接口缓存 给H5使用
     */
    public static void requestH5TopicCache(ContentBean contentBean){
        if (contentBean == null){
            return;
        }
        try {
            //专题类型
            String objectLevel = contentBean.getObjectLevel();
            int topicType = Integer.parseInt(objectLevel);
            //专题ID
            String objectId = contentBean.getObjectId();
            if(ContentTypeConstant.SUBJECT_TOPICTYPE_21 == topicType
                    || ContentTypeConstant.SUBJECT_TOPICTYPE_23 == topicType
                    || ContentTypeConstant.SUBJECT_TOPICTYPE_24 == topicType
                    || ContentTypeConstant.SUBJECT_TOPICTYPE_26 == topicType){
                //校验本次启动专题的缓存信息流显示时候主动请求过的缓存 是否已经有了,不重复请求
                boolean needRequest = true;
                if (null != topicRequestIds){
                    for (String saveId : topicRequestIds) {
                        String curId = contentBean.getPageId() + objectId;
                        if (StringUtils.isNotBlank(saveId) && saveId.equals(curId)){
                            needRequest = false;
                            break;
                        }
                    }
                }
                if (!needRequest){
                    //已经请求过,不需要请求了
                    return;
                }
                //专题预请求,随机延迟10~20秒调用
//                ThreadPoolUtils.postToMainDelay(new Runnable() {
//                    @Override
//                    public void run() {
//                        if (null != topicRequestIds){
//                            topicRequestIds.add(contentBean.getPageId()+objectId);
//                        }
//                        CommonNetUtils.getInstance().getPageInfoForH5Subject(contentBean.getPageId(),objectId);
//                    }
//                }, RandomUtil.getRandomDelaySeconds(10*1000, 20*1000));

            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 是人民号稿件
     *
     * @param compStyle
     * @return
     */
    public static boolean isPeopleCompByStyle(String compStyle) {
        return rmStyle.contains(compStyle);
    }


    /**
     * 是人民号稿件
     *
     * @param content
     * @param compStyle
     * @return
     */
    public static boolean isRmhCompInfo(ContentBean content, String compStyle) {

        PeopleMasterBean bean = content.getRmhInfo();
        if (bean == null) {
            return false;
        }

        if (!rmStyle.contains(compStyle)) {
            return false;
        }

        return true;

    }


    /**
     * 展示人民号布局
     *
     * @param rlItemParent 稿件父布局
     * @param fromView     日期来源
     * @param topView      顶部布局
     * @param bottomView   底部布局
     * @param content
     * @param compStyle    展示稿件style
     * @param position     稿件的索引值
     * @param isChannel    是否在频道信息流页面上
     */
    public static void showTopBottomView(RelativeLayout rlItemParent, View fromView, View topView,
                                         View bottomView, CheckBox cbSelect, ContentBean content,
                                         String compStyle, int position, boolean isChannel) {

        // 检测出非人民号
        if (!isRmhCompInfo(content, compStyle)) {
            int paddingTop = (int) ResUtils.getDimension(R.dimen.rmrb_dp14);
            if (position == 0 && isChannel) {
                paddingTop = (int) ResUtils.getDimension(R.dimen.rmrb_dp10);
            }
            int paddingLR = (int) ResUtils.getDimension(R.dimen.rmrb_dp10);
            rlItemParent.setPadding(paddingLR, paddingTop, paddingLR, 0);
            topView.setVisibility(View.GONE);
            bottomView.setVisibility(View.GONE);
            fromView.setVisibility(View.VISIBLE);
            return;
        }

//        // 内容源的数据,不展示人民号信息
//        if (content.getRmhInfo() != null && "5".equals(content.getRmhInfo().getUserType())) {
//            int paddingTop = (int) ResUtils.getDimension(R.dimen.rmrb_dp14);
//            if (position == 0 && isChannel) {
//                paddingTop = (int) ResUtils.getDimension(R.dimen.rmrb_dp10);
//            }
//            int paddingLR = (int) ResUtils.getDimension(R.dimen.rmrb_dp10);
//            rlItemParent.setPadding(paddingLR, paddingTop, paddingLR, 0);
//            topView.setVisibility(View.GONE);
//            bottomView.setVisibility(View.GONE);
//            fromView.setVisibility(View.VISIBLE);
//            return;
//        }

        PeopleMasterBean bean = content.getRmhInfo();
        int paddingTop = (int) ResUtils.getDimension(R.dimen.rmrb_dp11_5);
        if (position == 0 && isChannel) {
            paddingTop = (int) ResUtils.getDimension(R.dimen.rmrb_dp7_5);
        }
        int paddingLR = (int) ResUtils.getDimension(R.dimen.rmrb_dp10);
        rlItemParent.setPadding(paddingLR, paddingTop, paddingLR, 0);

        fromView.setVisibility(View.GONE);
        bottomView.setVisibility(View.VISIBLE);
        topView.setVisibility(View.VISIBLE);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) topView.getLayoutParams();
        layoutParams.bottomMargin = (int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp7_5);
        topView.setLayoutParams(layoutParams);

        TagTextView shareBtn = bottomView.findViewById(R.id.share_btn);
        TagTextView commentLay = bottomView.findViewById(R.id.ttcomment_btn);
        LinearLayout praiseLay = bottomView.findViewById(R.id.praise_lay);
        if (shareBtn.getVisibility() == View.GONE && commentLay.getVisibility() == View.GONE && praiseLay.getVisibility() == View.GONE) {
            RelativeLayout.LayoutParams layoutParams1 = (RelativeLayout.LayoutParams) bottomView.getLayoutParams();
            layoutParams1.bottomMargin = 0;
            bottomView.setLayoutParams(layoutParams1);
        } else {
            RelativeLayout.LayoutParams layoutParams1 = (RelativeLayout.LayoutParams) bottomView.getLayoutParams();
            layoutParams1.bottomMargin = -(int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp14);
            bottomView.setLayoutParams(layoutParams1);
        }


        ConstraintLayout layout = topView.findViewById(R.id.people_lay);
        //荣誉头像框
        ImageView dian = topView.findViewById(R.id.img_dian);
        CircleImageView imageView = topView.findViewById(R.id.head_icon);
        TextView authorTv = topView.findViewById(R.id.author_tv);
        TextView timeTv = topView.findViewById(R.id.time_tv);
        TextView descTv = topView.findViewById(R.id.desc_tv);
        ImageView imgavatarframe = topView.findViewById(R.id.imgavatarframe);
        ImageView publishDian = topView.findViewById(R.id.img_dian_publish);
        TextView publishStatusTv = topView.findViewById(R.id.tv_publish_status);

        // +v
        RoundImageView ivvip = topView.findViewById(R.id.ivvip);
        //设置荣誉头像框
        ImageUtils.getInstance().loadImage(imgavatarframe, bean.getHonoraryIcon(), -1);
        if (TextUtils.isEmpty(bean.getAuthIcon())) {
            ivvip.setVisibility(View.GONE);
        } else {
            ivvip.setVisibility(View.VISIBLE);
            ImageUtils.getInstance().loadImageSourceByNetStatus(ivvip, bean.getAuthIcon(), 0);
        }

        ImageUtils.getInstance().loadImageSourceByNetStatus(imageView, bean.getRmhHeadUrl(),
                bean.isMaterUser() ? R.mipmap.icon_default_head_mater : R.mipmap.icon_default_head);
        authorTv.setText(bean.getRmhName());
        authorTv.getPaint().setFakeBoldText(true);


        // 人民号简介
        String desc = bean.getRmhDesc();
        if (!TextUtils.isEmpty(desc)) {
            int i = desc.indexOf("\n");
            if (i == 0) {
                desc = desc.replace("\n", "");
            }
            descTv.setText(desc);
        } else {
            descTv.setText("");
        }

        // 处理稿件的发布日期、
        String publishTime = null;
        if (!TextUtils.isEmpty(content.getPublishTime())) {
            if (!content.getPublishTime().contains(":")) {
                publishTime = TimeUtil.converTime(content.getPublishTime());
            } else {
                publishTime = TimeUtil.converTimeForm(content.getPublishTime());
            }
            // 频道页面 超过当天两天的日期,不显示
            if (publishTime.contains("-") && !content.showPublishData) {
                publishTime = "";
            }
        }

        if (!TextUtils.isEmpty(publishTime)) {
            timeTv.setText(publishTime);
        } else {
            timeTv.setText("");
        }


        layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (cbSelect != null && Constants.isEdit) {
                    boolean checked = cbSelect.isChecked();
                    cbSelect.setChecked(!checked);
                } else {
                    String fromPage = StringUtils.getStringValue(content.getFromPage());
                    //号主页作品列表头像点击不需跳转
//                    if (!PageNameConstants.MAIN_PERSONAL_HOME_PAGE.equals(fromPage) && !PageNameConstants.CUSTOMER_PERSONAL_HOME_PAGE.equals(fromPage)) {
//                        ProcessUtils.jumpToPersonalCenterActivity(
//                                bean.getBanControl(),
//                                bean.getCnMainControl(),
//                                bean.getUserId(),
//                                bean.getUserType(),
//                                bean.getRmhId());
//                    }
                }
            }

        });
        //号主页个人作品发布状态处理
        if (isSelfHomePage(content)) {
            descTv.setVisibility(View.GONE);
            dian.setVisibility(View.GONE);
            //是否展示标签
            boolean haveTag = setPublishStatusTag(publishStatusTv, content);
            if (haveTag) {
                publishDian.setVisibility(View.VISIBLE);
            } else {
                publishDian.setVisibility(View.GONE);
            }
            //审核中的作品不显示点赞分享布局,已发布的才显示
            if (WorksPublishStatusType.HAVE_PUBLISHED != content.getContentStatus()) {
                bottomView.setVisibility(View.GONE);
            }

        } else {
            if (!TextUtils.isEmpty(publishTime) && !TextUtils.isEmpty(desc)) {
                dian.setVisibility(View.VISIBLE);
            } else {
                dian.setVisibility(View.GONE);
            }
            descTv.setVisibility(View.VISIBLE);

            publishDian.setVisibility(View.GONE);
            publishStatusTv.setVisibility(View.GONE);
        }

        // 内容源的数据,不展示人民号信息头像信息和关注入口
        LinearLayout llDescParent = topView.findViewById(R.id.llDescParent);
        ConstraintLayout.LayoutParams authorTvLp = (ConstraintLayout.LayoutParams) authorTv.getLayoutParams();
        ConstraintLayout.LayoutParams llDescParentLp = (ConstraintLayout.LayoutParams) llDescParent.getLayoutParams();
        boolean isContentSource = false;
        if (content.getRmhInfo() != null && "5".equals(content.getRmhInfo().getUserType())) {
            isContentSource = true;
        }
        if (isContentSource) {
            layout.setEnabled(false);
            imageView.setVisibility(View.GONE);
            imgavatarframe.setVisibility(View.GONE);
            ivvip.setVisibility(View.GONE);
            // 是内容源数据,隐藏关注按钮
            content.setOpenFollowBt(false);
            authorTvLp.leftMargin = 0;
            authorTvLp.topToTop = ConstraintLayout.LayoutParams.UNSET;

            llDescParentLp.leftMargin = 0;
            llDescParentLp.bottomToBottom = ConstraintLayout.LayoutParams.UNSET;

        } else {
            layout.setEnabled(true);
            imageView.setVisibility(View.VISIBLE);
            imgavatarframe.setVisibility(View.VISIBLE);
            authorTvLp.topToTop = R.id.head_icon;
            authorTvLp.leftMargin = (int) ResUtils.getDimension(R.dimen.rmrb_dp8);
            llDescParentLp.leftMargin = (int) ResUtils.getDimension(R.dimen.rmrb_dp8);
            llDescParentLp.bottomToBottom = R.id.head_icon;
        }
    }


    /**
     * 单图卡人民号处理居中
     *
     * @param tagView
     * @param style
     */
    public static void setViewCenter(TagTextView tagView, String style) {
        ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) tagView.getLayoutParams();
        layoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID;
        if (isPeopleCompByStyle(style)) {
            //居中
            layoutParams.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID;
        } else {
            // 非居中
            layoutParams.bottomToBottom = ConstraintLayout.LayoutParams.UNSET;
        }
        tagView.setLayoutParams(layoutParams);
    }

    /**
     * 收集创作者,不重复
     *
     * @param dataList
     * @return
     */
    public static List<PeopleMasterBean> getCreaterSet(List<ContentBean> dataList) {
        // 接口支持每次最多传20个id
        int maxNum = 20;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
            //安卓7以下
            List<PeopleMasterBean> result = new ArrayList<>();
            Set<String> rmhIdSet = new TreeSet<>();
            for (ContentBean contentBean : dataList) {
                if (contentBean != null && contentBean.getRmhInfo() != null) {
                    PeopleMasterBean rmhInfo = contentBean.getRmhInfo();
                    if (rmhIdSet.add(rmhInfo.getRmhId())) {
                        result.add(rmhInfo);
                        if (result.size() == maxNum) {
                            break;
                        }
                    }
                }
            }
            return result;
        }else {
            return dataList.stream()
                .filter(contentBean -> contentBean != null
                        && contentBean.getRmhInfo() != null)
                .map(contentBean -> contentBean.getRmhInfo())
                .distinct()
                .limit(maxNum)
                .collect(
                        Collectors.collectingAndThen(
                                Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(PeopleMasterBean::getRmhId))), ArrayList::new
                        ));
        }
    }

    /**
     * 收集创作者,不重复
     *
     * @param dataList
     * @return
     */
    public static List<CommentItem> getCommentSet(List<ContentBean> dataList) {
        // 接口支持每次最多传20个id
        int maxNum = 20;
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
            List<CommentItem> result = new ArrayList<>();
            Set<String> commentIdSet = new TreeSet<>();
            for (ContentBean contentBean : dataList) {
                if (contentBean != null && contentBean.getRmhInfo() != null) {
                    CommentItem commentInfo = contentBean.getCommentInfo();
                    if (commentIdSet.add(commentInfo.getCommentId())) {
                        result.add(commentInfo);
                        if (result.size() == maxNum) {
                            break;
                        }
                    }
                }
            }
            return result;
        }else {
            return dataList.stream()
                .filter(contentBean -> contentBean != null
                        && contentBean.getCommentInfo() != null)
                .map(contentBean -> contentBean.getCommentInfo())
                .distinct()
                .limit(maxNum)
                .collect(
                        Collectors.collectingAndThen(
                                Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CommentItem::getCommentId))), ArrayList::new
                        ));
        }
    }

    /**
     * 更新用户关注创作者信息并更新layoutManager 试图展示
     *
     * @param mEventMessage
     * @param layoutManagers
     */

    public static void updateUserFollowInforLayout(EventMessage mEventMessage, List<ItemLayoutManager> layoutManagers) {

        String createId = mEventMessage.getStringExtra(IntentConstants.PARAM_CREATOR_ID);
        boolean followStatus = mEventMessage.getBooleanExtra(IntentConstants.IS_FOLLOW, false);
        for (ItemLayoutManager itemLayoutManager : layoutManagers) {
            // 遍历所有信息,处理关注状态
            itemLayoutManager.updateUserFollow(itemLayoutManager.getContentBean(), createId, followStatus);
        }
    }

    public static void updateUserFollowFail(EventMessage mEventMessage, List<ItemLayoutManager> layoutManagers) {

        String createId = mEventMessage.getStringExtra(IntentConstants.PARAM_CREATOR_ID);
        boolean followStatus = mEventMessage.getBooleanExtra(IntentConstants.IS_FOLLOW, false);
        for (ItemLayoutManager itemLayoutManager : layoutManagers) {
            // 遍历所有信息,处理关注状态
            itemLayoutManager.updateUserFollowFail(itemLayoutManager.getContentBean(), createId, followStatus);
        }
    }


    /**
     * 更新直播预约卡
     *
     * @param mEventMessage
     * @param layoutManagers
     */
    public static void updateCompLiveAppointStatus(EventMessage mEventMessage, List<ItemLayoutManager> layoutManagers) {

//        String liveId = mEventMessage.getStringExtra(IntentConstants.CONTENT_ID);
//        String relationId = mEventMessage.getStringExtra(IntentConstants.RELATION_ID);
//        boolean isPppointment = mEventMessage.getBooleanExtra(IntentConstants.IS_APPOINTMENT, false);
//
//        for (ItemLayoutManager itemLayoutManager : layoutManagers) {
//
//            if (itemLayoutManager instanceof CompSingleRow06) {
//                CompSingleRow06 singleRow06 = (CompSingleRow06) itemLayoutManager;
//                singleRow06.requestLiveAppointmentStatus();
//            } else if (itemLayoutManager instanceof CompBigImage02) {
//
//                CompBigImage02 compBigImage02 = (CompBigImage02) itemLayoutManager;
//                compBigImage02.updateAppointmentStatus(liveId, relationId, isPppointment);
//            }
//
//        }
    }

    /**
     * 更新直播预约卡
     *
     * @param mEventMessage
     * @param layoutManagers
     */
//    public static int getCompLiveAppointLayoutMangerPosition(EventMessage mEventMessage, List<ItemLayoutManager> layoutManagers) {
//
//        int postion = -1;
//        String liveId = mEventMessage.getStringExtra(IntentConstants.CONTENT_ID);
//        String relationId = mEventMessage.getStringExtra(IntentConstants.RELATION_ID);
//        boolean isPppointment = mEventMessage.getBooleanExtra(IntentConstants.IS_APPOINTMENT, false);
//
//        int size = layoutManagers.size();
//        for (int i = 0; i < size; i++) {
//            ItemLayoutManager itemLayoutManager = layoutManagers.get(i);
//            if (itemLayoutManager instanceof CompBigImage02) {
//
//                CompBigImage02 compBigImage02 = (CompBigImage02) itemLayoutManager;
//                boolean isLiveAppointComp = compBigImage02.updateAppointmentStatus(liveId, relationId, isPppointment);
//                if (isLiveAppointComp) {
//                    postion = i;
//                    break;
//                }
//            }
//
//        }
//        return postion;
//    }

    /**
     * 更新直播人数
     *
     * @param mEventMessage
     * @param layoutManagers
     */
    public static void updateCompLivePV(EventMessage mEventMessage, List<ItemLayoutManager> layoutManagers) {
        if(ArrayUtils.isEmpty(layoutManagers)){
            return;
        }
        String liveId = mEventMessage.getStringExtra(IntentConstants.CONTENT_ID);
        String livePV = mEventMessage.getStringExtra(IntentConstants.LIVE_PV);
        if(StringUtils.isEmpty(liveId) || StringUtils.isEmpty(livePV)){
            return;
        }
        for (ItemLayoutManager itemLayoutManager : layoutManagers) {
            itemLayoutManager.updateCompLivePV(liveId,livePV);
        }
    }

    /**
     * 更新点赞信息并更新layoutManager 试图展示
     *
     * @param mEventMessage
     * @param layoutManagers
     */

    public static void updateUserZanInforLayout(EventMessage mEventMessage, List<ItemLayoutManager> layoutManagers) {

        String contentId = mEventMessage.getStringExtra(IntentConstants.CONTENT_ID);
        String relId = mEventMessage.getStringExtra(IntentConstants.REL_ID);
        String targetId = mEventMessage.getStringExtra(IntentConstants.TARGET_ID);
        boolean isZan = mEventMessage.getBooleanExtra(IntentConstants.IS_ZAN, false);

        //Log.e("DDDDSSS","relId="+relId +"  contentId="+contentId +"  TARGET_ID="+targetId);
        for (ItemLayoutManager itemLayoutManager : layoutManagers) {
            boolean haveContentFlag = itemLayoutManager.updateContentZan(contentId, relId, targetId, isZan);
            if (haveContentFlag) {
                break;
            }

        }
    }

    /**
     * 内容信息依据发布时间排序排序
     */
    public static List<SlideShows> sortList(List<SlideShows> list) {
        try {
            if (list.size() == 0) {
                return list;
            }
            for (int i = 0; i < list.size() - 1; i++) {
                for (int j = 0; j < list.size() - 1 - i; j++) {
                    long startTime = Long.parseLong(list.get(j).getPublishTime());
                    long endTime = Long.parseLong(list.get(j + 1).getPublishTime());
                    if (startTime < endTime) {
                        Collections.swap(list, j, j + 1);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

    /**
     * 收集直播间id
     *
     * @param dataList
     * @return
     */
    public static List<String> getLiveId(List<ContentBean> dataList) {
        // 接口支持每次最多传20个id
        int maxNum = 20;
        return dataList.stream()
                .filter(contentBean -> contentBean != null
                        && String.valueOf(ContentTypeConstant.URL_TYPE_TWO).equals(contentBean.getObjectType()))
                .map(contentBean -> contentBean.getObjectId())
                .distinct()
                .limit(maxNum)
                .collect(Collectors.toList());
    }


    /**
     * 获取一键读报数据
     *
     * @param topicId
     * @param groupId
     * @param pageNum
     * @param pageSize
     */
//    public static void getOneKeyReadNewsData(String topicId, String groupId, int pageNum, int pageSize) {
//
//        CompAssistDataViewModel compAssistDataViewModel = new CompAssistDataViewModel();
//        compAssistDataViewModel.sendOneKeyReadNewsData(topicId, groupId, pageNum, pageSize, new IContentPageListener() {
//
//
//            @Override
//            public void getContentPageData(ContentPageListBean data) {
//
//            }
//
//            @Override
//            public void error(int code, String message) {
//
//            }
//        });
//    }

    /**
     * 查询直播预约状态
     *
     * @param dataBeanList 列表数据
     * @param adapter      列表adapter
     * @param startIndex   起始编号
     */
//    public static void getAppointmentStatus(List<ContentBean> dataBeanList, RecyclerView.Adapter adapter,
//                                            int startIndex, BatchCallback<List<AppointmentStatusBean>> batchCallback) {
//        if (CommonUtil.isEmpty(dataBeanList)) {
//            return;
//        }
//
//        AppointmentDataFetcher appointmentDataFetcher = new AppointmentDataFetcher(new AppointmentDataFetcher.IAppointmentListener() {
//            @Override
//            public void onGetFailed(String error) {
//                if (batchCallback != null) {
//                    batchCallback.error(error);
//                }
//
//            }
//
//            @Override
//            public void onGetAppointmentStatusSuccess(List<AppointmentStatusBean> response) {
//                if (response == null || response.isEmpty()) {
//                    return;
//                }
//                response.stream()
//                        .forEach(statusBean -> dataBeanList.stream()
//                                .filter(contentBean -> (
//                                        !TextUtils.isEmpty(contentBean.getObjectId()) &&
//                                                contentBean.getObjectId().equals(statusBean.getLiveId()) &&
//                                                contentBean.getRelId().equals(statusBean.getRelationId())
//                                ))
//                                .findFirst()
//                                .ifPresent(contentBean -> {
//                                    contentBean.setSubscribe(statusBean.subscribe);
//                                }));
//
//                if (adapter != null) {
//                    if (startIndex == 0) {
//                        adapter.notifyDataSetChanged();
//                    } else {
//                        adapter.notifyItemRangeChanged(startIndex, dataBeanList.size());
//                    }
//                }
//
//                if (batchCallback != null) {
//                    batchCallback.success(response);
//                }
//            }
//        });
//
//        String parameterStr = appointmentDataFetcher.getAppointmentStatus(dataBeanList);
//        if (batchCallback != null) {
//            batchCallback.parameter(parameterStr);
//        }
//
//    }


    /**
     * 查询内容点赞、评论状态
     *
     * @param contentBeanList
     */
    public static void sendBatchDyNumRequest(List<ContentBean> contentBeanList, BatchCallback<List<InteractResponseDataBean>> batchCallback) {

//        InteractFetcher interactFetcher = new InteractFetcher(new IInteractDataListener() {
//            @Override
//            public void onInteractDataSuccess(List<InteractResponseDataBean> dataList) {
//                for (ContentBean bean : contentBeanList) {
//                    String id = bean.getObjectId();
//                    if (TextUtils.isEmpty(id)) {
//                        continue;
//                    }
//                    for (InteractResponseDataBean dataBean : dataList) {
//                        String tempId = dataBean.getContentId();
//                        if (id.equals(tempId)) {
//                            bean.setCommentNum(dataBean.getCommentNum());
//                            bean.setLikeNum(dataBean.getLikeNum());
//                            bean.setShareNum(dataBean.getShareNum());
//                            bean.setCollectNum(dataBean.getCollectNum());
//                            break;
//                        }
//                    }
//                }
//
//                if (batchCallback != null) {
//                    batchCallback.success(dataList);
//                }
//
//            }
//
//            @Override
//            public void onInteractDataError(String errorMsg) {
//                if (batchCallback != null) {
//                    batchCallback.error(errorMsg);
//                }
//
//            }
//        });
//        String key = interactFetcher.oneInteractData(contentBeanList);
//        if (batchCallback != null) {
//            batchCallback.parameter(key);
//        }

    }


    /**
     * 批量查询评论的点赞数量
     *
     * @param contentBeanList
     */
//    public static void sendBatchCommentLikesRequest(List<ContentBean> contentBeanList, BatchCallback<List<CommentItem>> batchCallback) {
//
//        InteractFetcher interactFetcher = new InteractFetcher(new ICommonDyListener() {
//            @Override
//            public void onInteractDataSuccess(List<CommentItem> dataList) {
//                for (ContentBean bean : contentBeanList) {
//                    if (bean.getCommentInfo() != null) {
//                        String id = bean.getCommentInfo().getCommentId();
//                        if (TextUtils.isEmpty(id)) {
//                            continue;
//                        }
//                        for (CommentItem dataBean : dataList) {
//                            String tempId = dataBean.getCommentId();
//                            if (id.equals(tempId)) {
//                                bean.getCommentInfo().setLikeNum(dataBean.getLikeNum());
//                                break;
//                            }
//                        }
//                    }
//
//                }
//
//                if (batchCallback != null) {
//                    batchCallback.success(dataList);
//                }
//
//            }
//
//            @Override
//            public void onInteractDataError(String errorMsg) {
//                if (batchCallback != null) {
//                    batchCallback.error(errorMsg);
//                }
//
//            }
//        });
//        String key = interactFetcher.onBatchCommentLikes(contentBeanList);
//        if (batchCallback != null) {
//            batchCallback.parameter(key);
//        }
//
//    }

    /**
     * 批量查询用户关注状态
     *
     * @param contentBeanList
     * @param peopleMasterBeanList
     * @param batchCallback
     */
    public static void sendBatchUserFollowInfor(List<ContentBean> contentBeanList,
                                                List<PeopleMasterBean> peopleMasterBeanList,
                                                BatchCallback<List<MasterFollowsStatusBean>> batchCallback) {

//        FollowDataFetcher followDataFetcher = new FollowDataFetcher();
//
//        String key = followDataFetcher.sendBatchUserFollowInfor(peopleMasterBeanList, new FollowDataFetcher.GetBatchStatusListener() {
//            @Override
//            public void onSuccess(List<MasterFollowsStatusBean> list) {
//                if (list != null) {
//                    for (MasterFollowsStatusBean masterBean : list) {
//
//                        for (ContentBean bean : contentBeanList) {
//                            PeopleMasterBean rmhInfo = bean.getRmhInfo();
//                            if (rmhInfo != null) {
//                                if (masterBean.getCreatorId().equals(rmhInfo.getRmhId())) {
//                                    rmhInfo.followStatus = masterBean.getStatus();
//                                }
//                            }
//                        }
//                    }
//                }
//
//                if (batchCallback != null) {
//                    batchCallback.success(list);
//                }
//            }
//
//            @Override
//            public void error(String e) {
//
//                if (batchCallback != null) {
//                    batchCallback.error(e);
//                }
//            }
//        });
//        if (batchCallback != null) {
//            batchCallback.parameter(key);
//        }

    }


    /**
     * 批量查询号主信息
     *
     * @param contentBeanList
     * @param peopleMasterBeanList
     * @param batchCallback
     */
//    public static void sendBatchMasterInfoRequest(List<ContentBean> contentBeanList, List<PeopleMasterBean> peopleMasterBeanList, BatchCallback<List<PersonalInfoBean>> batchCallback) {
//
//        MasterDataFetcher followDataFetcher = new MasterDataFetcher();
//
//        String key = followDataFetcher.sendBatchMasterInfo(peopleMasterBeanList, new MasterDataFetcher.GetBatchStatusListener() {
//            @Override
//            public void onSuccess(List<PersonalInfoBean> list) {
//                if (list != null) {
//                    for (PersonalInfoBean personalInfoBean : list) {
//                        for (ContentBean bean : contentBeanList) {
//                            PeopleMasterBean rmhInfo = bean.getRmhInfo();
//                            if (rmhInfo != null) {
//                                if (personalInfoBean.getRmhId().equals(rmhInfo.getRmhId())) {
//                                    //搜索出来的 存放信息字段不一样,需要设置到常用的地方
//                                    if (StringUtils.isBlank(personalInfoBean.rmhDesc)){
//                                        //这个是父类的
//                                        personalInfoBean.rmhDesc = personalInfoBean.getRmhDesc();
//                                    }
//                                    if (StringUtils.isBlank(personalInfoBean.rmhName)){
//                                        personalInfoBean.rmhName = personalInfoBean.getRmhName();
//                                    }
//                                    if (StringUtils.isBlank(personalInfoBean.rmhHeadUrl)){
//                                        personalInfoBean.rmhHeadUrl = personalInfoBean.getRmhHeadUrl();
//                                    }
//                                    if (StringUtils.isBlank(personalInfoBean.rmhId)){
//                                        personalInfoBean.rmhId = personalInfoBean.getRmhId();
//                                    }
//                                    if (StringUtils.isBlank(personalInfoBean.cnMainControl)){
//                                        personalInfoBean.cnMainControl = personalInfoBean.getCnMainControl();
//                                    }
//                                    if (StringUtils.isBlank(personalInfoBean.cnIsAttention)){
//                                        personalInfoBean.cnIsAttention = personalInfoBean.getCnIsAttention() + "";
//                                    }
//                                    bean.setRmhInfo(personalInfoBean);
//                                }
//                            }
//                        }
//                    }
//                }
//
//                if (batchCallback != null) {
//                    batchCallback.success(list);
//                }
//            }
//
//            @Override
//            public void error(String e) {
//
//                if (batchCallback != null) {
//                    batchCallback.error(e);
//                }
//            }
//        });
//        if (batchCallback != null) {
//            batchCallback.parameter(key);
//        }
//
//    }

    /**
     * 批量查询用户等级信息
     *
     * @param batchCallback
     */
//    public static void sendUserLevelRequest(List<CommentItem> data, BatchCallback<List<LevelInfoBean>> batchCallback) {
//
//        String key = CommonNetUtils.getInstance().batchUserLevelInfor(data, new BaseObserver<List<LevelInfoBean>>() {
//            @Override
//            protected void dealSpecialCode(int code, String message) {
//                if (batchCallback != null) {
//                    batchCallback.error(message);
//                }
//            }
//
//            @Override
//            protected void onSuccess(List<LevelInfoBean> levelInfoBeans) {
//                if (levelInfoBeans != null) {
//                    for (LevelInfoBean levelInfoBean : levelInfoBeans) {
//                        String userId = levelInfoBean.getUserId();
//                        for (CommentItem bean : data) {
//                            String fromUserId = bean.getFromUserId();
//                            if (!TextUtils.isEmpty(userId) && userId.equals(fromUserId)) {
//                                bean.setLevelHead(levelInfoBean.getLevelHead());
//                                bean.levelInfoBean = levelInfoBean;
//                            }
//                        }
//
//                    }
//                }
//                if (batchCallback != null) {
//                    batchCallback.success(levelInfoBeans);
//                }
//            }
//
//            @Override
//            protected void _onError(String message) {
//                if (batchCallback != null) {
//                    batchCallback.error(message);
//                }
//            }
//        });
//        if (batchCallback != null) {
//            batchCallback.parameter(key);
//        }
//
//    }

    /**
     * 直播订阅
     *
     * @param flag
     * @param contentBean
     * @param compBean
     * @param callback
     */
//    public static void predictLive(boolean flag, ContentBean contentBean, CompBean compBean, PredictLiveCallback callback) {
//        //埋点
//        TrackContentBean trackContentBean = new TrackContentBean();
//        trackContentBean.contentBeantoBean(contentBean, compBean);
//
//        if (!contentBean.isSubscribe()) {
//            CommonTrack.getInstance().subscribeClickTrack(trackContentBean);
//        } else {
//            if (flag) {
//
//                GeneralTrack.getInstance().commonBtnClickTrack(
//                        "mySavedLivePageUnSubscribe",
//                        trackContentBean.getPage_name(),
//                        trackContentBean.getPage_id());
//            } else {
//                CommonTrack.getInstance().cancelSubscribeClickTrack(trackContentBean);
//            }
//
//        }
//
//
//        PreviewDataFetcher dataFetcher = new PreviewDataFetcher(new PreviewDataListener() {
//            @Override
//            public void onCheckLiveSubscribeStatusSuccess(boolean mResult) {
//            }
//
//            @Override
//            public void onPredictSuccess() {
//                callback.requestSuccess();
//            }
//
//            @Override
//            public void onFailed(String error) {
//                callback.onFailed(error);
//                ToastNightUtil.showShort(error);
//            }
//        });
//
//        dataFetcher.predictLive(contentBean.getObjectId(), !contentBean.isSubscribe(), contentBean.getRelId());
//    }


    /**
     * 留言状态
     *
     * @param tv
     * @param askItemBean
     */
//    public static void messageStatus(TextView tv, AskItemBean askItemBean) {
//
//        if (askItemBean == null) {
//            tv.setVisibility(View.INVISIBLE);
//        } else {
//            tv.setVisibility(View.VISIBLE);
//            int stateInfo = askItemBean.stateInfo;
//            if (stateInfo == 4) {
//                tv.setText(R.string.comp_message_status_replied);
//                tv.setTextColor(ContextCompat.getColor(tv.getContext(), R.color.res_color_common_C11));
//                tv.setBackgroundResource(R.drawable.shape_corner_message_1);
//            }
////            else if (stateInfo == 3) {
////                tv.setText(R.string.comp_message_status_processing);
////                tv.setTextColor(ContextCompat.getColor(tv.getContext(), R.color.res_color_common_C18));
////                tv.setBackgroundResource(R.drawable.shape_corner_message_2);
////            } else if (stateInfo == 2) {
////                tv.setText(R.string.comp_message_status_toreplied);
////                tv.setTextColor(ContextCompat.getColor(tv.getContext(), R.color.res_color_common_C16));
////                tv.setBackgroundResource(R.drawable.shape_corner_message_3);
////            }
//            else {
//                tv.setVisibility(View.INVISIBLE);
//            }
//        }
//
//    }

    /**
     * 分享电子报信息
     *
     * @param currentPageBean
     */
//    public static void shareElInfo(PaperPageBean currentPageBean, Context context) {
//
//        if (currentPageBean == null) {
//            return;
//        }
////        // 点击埋点
////        TrackContentBean trackContentBean = new TrackContentBean();
////        topicInfoBean.setTitleName(E_SUMMARY_DETAIL_PAGE);
////        trackContentBean.topicInfoBeanBeantoBean(topicInfoBean);
////        trackContentBean.shareAction();
////        CommonTrack.getInstance().shareClickTrack(trackContentBean);
//
//        ShareBean bean = new ShareBean();
//        bean.setTitle(currentPageBean.getPageName());
//        bean.setPublishTime(currentPageBean.getPeriodNum());
//        bean.setImageUrl(currentPageBean.getPagePic());
//        bean.setShareUrl(currentPageBean.getSharePagePic().getShareUrl());
//        bean.setSharePosterCoverUrl(currentPageBean.getSharePagePic().getSharePosterCoverUrl());
//        bean.setShowReport(false);
//        bean.setShowLike(-1);
//        bean.setShareOpen("1");
//        bean.setSharePosterOpen("1");
//        bean.setPosterShareControl("1");
//        bean.setShowPoster(-1);
//        bean.setShowPosterType(PosterTypeEnum.NEWSPAPERS);
//        //海报页面
//        UmengProcessUtils.goSharePoster(bean);
//    }

    /**
     * view 直接转成bitmap
     *
     * @param view
     * @return
     */
    public static Bitmap convertViewToBitmap(View view) {

        view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));

        view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());

        view.buildDrawingCache();

        Bitmap bitmap = view.getDrawingCache();

        return bitmap;

    }

    /**
     * 把SlideShows转成ContentBean
     *
     * @param slideShowsList
     * @return
     */
    public static List<ContentBean> slideDataToContentBean(List<SlideShows> slideShowsList) {

        List<ContentBean> contentBeanList = new ArrayList<>();

        if (slideShowsList != null && slideShowsList.size() > 0) {
            for (SlideShows slideShowsBean : slideShowsList) {
                ContentBean slideContentBean = new ContentBean();
                slideContentBean.slideShowToBean(slideShowsBean);
                contentBeanList.add(slideContentBean);
            }
        }

        return contentBeanList;
    }


    /**
     * 把ContentBean 转成 NewSlideShows
     *
     * @param contentBeanList
     * @return
     */
    public static List<NewSlideShows> contentToNewSlideShows(List<ContentBean> contentBeanList, boolean addLine) {

        List<NewSlideShows> list = new ArrayList<>();
        for (int i = 0; i < contentBeanList.size(); i++) {
            ContentBean contentBean = contentBeanList.get(i);
            NewSlideShows newSlideShows1;
            if ("Zh_Grid_Layout-03".equals(contentBean.getAppStyle())) {
                newSlideShows1 = new NewSlideShows(NewSlideShows.COMP_SINGLE_ROW_GOLDEN);
                newSlideShows1.setData(contentBean);
                list.add(newSlideShows1);
            } else {
                if ((contentBean.getFullColumnImgUrls() != null && contentBean.getFullColumnImgUrls().size() > 0)
                        || !TextUtils.isEmpty(contentBean.getCoverUrl())) {
                    newSlideShows1 = new NewSlideShows(NewSlideShows.HAVE_IMAGE);
                } else {
                    newSlideShows1 = new NewSlideShows(NewSlideShows.NO_IMAGE);
                }
                newSlideShows1.setData(contentBean);
                list.add(newSlideShows1);
                //添加分割线
                if (addLine) {
                    if (i != contentBeanList.size() - 1) {
                        list.add(new NewSlideShows(NewSlideShows.LINE_VIEW));
                    }
                }
            }


        }

        return list;

    }

    /**
     * 特殊组件对线处理
     *
     * @param compBean
     * @return true:是特殊组件;false:不是特殊组件
     */
    public static boolean isThickLineComp(CompBean compBean) {

        if (compBean != null) {

            String style = compBean.getCompStyle();
            return lineStyleList.contains(style);
        } else {
            return false;
        }

    }

    /**
     * 是否需要粗顶部线
     * 数据加一个相似卡
     * 搜索相似卡需要
     * 两个相邻相似卡只加一个
     * @return
     */
    public static boolean isCoarseTopLine(CompBean compBean){
        //nextCompBean 是否是粗线
        if (compBean != null && compBean.nextCompBean != null) {
            String style = compBean.nextCompBean.getCompStyle();
            return bottomStyleList.contains(style);
        } else {
            return false;
        }
    }

    /**
     * 是组合问政卡组件
     *
     * @param compBean
     * @return
     */
    public static boolean isCombinationWzComp(CompBean compBean) {

        if (compBean != null) {
            String style = compBean.getCompStyle();
            String type = compBean.getCompType();
            return wzCompbinationStyleList.contains(style);
        } else {
            return false;
        }
    }


    /**
     * 检测电子报图片高度 不超过最大高度
     *
     * @param imageWith
     * @param activity
     * @return
     */
    public static double checkElePaperImageHeight(double imageWith, Activity activity) {

        double maxWidth = imageWith;
        // 以宽定高
        double unproprotion = 1018d / 720d;
        // 检测设备
        double checkH = imageWith * unproprotion;

        // 屏幕的高度
        int screenHeight = DeviceUtil.getScreenHeight();
        // 电子报图上下高度
        int statusHeight = StatusBarCompat.getStatusBarHeight(activity);//导航栏高度
        // 电子报标题高度
        int titleHeight = UiUtils.dp2px(45);
        // 底部工具栏高度 + 距底
        int bottomToolH = UiUtils.dp2px(41) + UiUtils.dp2px(38);
        // 电子报图片底部文字占据的空间
        int bootomViewSpce = UiUtils.dp2px(14) * 2 + UiUtils.dp2px(16) * 2;
        // 电子报图片最大高度
        int zuidaHeight = screenHeight - statusHeight - titleHeight - bottomToolH - bootomViewSpce;

        if (checkH > zuidaHeight) {
            double proprotion = 720d / 1018d;
            maxWidth = zuidaHeight * proprotion;
        }
        return maxWidth;
    }

    /**
     * 获取文本行数
     * @param textView  控件
     * @param textViewWidth   控件的宽度  比如:全屏显示-就取手机的屏幕宽度即可。
     * @return
     */
    public static int getTextViewLines(TextView textView, int textViewWidth) {
        int width = textViewWidth - textView.getCompoundPaddingLeft() - textView.getCompoundPaddingRight();
        StaticLayout staticLayout;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            staticLayout = getStaticLayout23(textView, width);
        } else {
            staticLayout = getStaticLayout(textView, width);
        }
        int lines = staticLayout.getLineCount();
        int maxLines = textView.getMaxLines();
        if (maxLines > lines) {
            return lines;
        }
        return maxLines;
    }

    /**
     * sdk>=23
     */
    @RequiresApi(api = Build.VERSION_CODES.M)
    private static StaticLayout getStaticLayout23(TextView textView, int width) {
        StaticLayout.Builder builder = StaticLayout.Builder.obtain(textView.getText(),
                        0, textView.getText().length(), textView.getPaint(), width)
                .setAlignment(Layout.Alignment.ALIGN_NORMAL)
                .setTextDirection(TextDirectionHeuristics.FIRSTSTRONG_LTR)
                .setLineSpacing(textView.getLineSpacingExtra(), textView.getLineSpacingMultiplier())
                .setIncludePad(textView.getIncludeFontPadding())
                .setBreakStrategy(textView.getBreakStrategy())
                .setHyphenationFrequency(textView.getHyphenationFrequency())
                .setMaxLines(textView.getMaxLines() == -1 ? Integer.MAX_VALUE : textView.getMaxLines());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder.setJustificationMode(textView.getJustificationMode());
        }
        if (textView.getEllipsize() != null && textView.getKeyListener() == null) {
            builder.setEllipsize(textView.getEllipsize())
                    .setEllipsizedWidth(width);
        }
        return builder.build();
    }

    /**
     * sdk<23
     */
    private static StaticLayout getStaticLayout(TextView textView, int width) {
        return new StaticLayout(textView.getText(),
                0, textView.getText().length(),
                textView.getPaint(), width, Layout.Alignment.ALIGN_NORMAL,
                textView.getLineSpacingMultiplier(),
                textView.getLineSpacingExtra(), textView.getIncludeFontPadding(), textView.getEllipsize(),
                width);
    }

    /**
     * 留言状态
     *
     * @param tv
     * @param askItemBean
     */
    public static void messageStatus(TextView tv, AskItemBean askItemBean) {

        if (askItemBean == null) {
            tv.setVisibility(View.INVISIBLE);
        } else {
            tv.setVisibility(View.VISIBLE);
            int stateInfo = askItemBean.stateInfo;
            if (stateInfo == 4) {
                tv.setText(R.string.comp_message_status_replied);
                tv.setTextColor(ContextCompat.getColor(tv.getContext(), R.color.res_color_common_C11));
                tv.setBackgroundResource(R.drawable.shape_corner_message_1);
            }
//            else if (stateInfo == 3) {
//                tv.setText(R.string.comp_message_status_processing);
//                tv.setTextColor(ContextCompat.getColor(tv.getContext(), R.color.res_color_common_C18));
//                tv.setBackgroundResource(R.drawable.shape_corner_message_2);
//            } else if (stateInfo == 2) {
//                tv.setText(R.string.comp_message_status_toreplied);
//                tv.setTextColor(ContextCompat.getColor(tv.getContext(), R.color.res_color_common_C16));
//                tv.setBackgroundResource(R.drawable.shape_corner_message_3);
//            }
            else {
                tv.setVisibility(View.INVISIBLE);
            }
        }

    }
}